@straiffi/archon 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/client/assets/{ActivityView-CbdDNsdO.js → ActivityView-CF8punHV.js} +1 -1
  2. package/dist/client/assets/{GitHubActionsDialog-Cmb9Yebr.js → GitHubActionsDialog-Ckb99-ve.js} +1 -1
  3. package/dist/client/assets/VerificationDialog-BgEDRfgP.js +4 -0
  4. package/dist/client/assets/{architectureDiagram-3BPJPVTR-BgoQ_BIc.js → architectureDiagram-3BPJPVTR-DSq-Vw-s.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-GPEHLZMM-Xdp2x8BW.js → blockDiagram-GPEHLZMM-C_0U0auf.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-AAUBKEIU-B220zS5a.js → c4Diagram-AAUBKEIU-CEHt0Kjy.js} +1 -1
  7. package/dist/client/assets/channel-BjDfVBsO.js +1 -0
  8. package/dist/client/assets/{chunk-2J33WTMH-tYM2mjFx.js → chunk-2J33WTMH-C0Kxxq-6.js} +1 -1
  9. package/dist/client/assets/{chunk-3OPIFGDE-CTITOUvV.js → chunk-3OPIFGDE-QvjUuKmV.js} +1 -1
  10. package/dist/client/assets/{chunk-5ZQYHXKU-D45jJDNN.js → chunk-5ZQYHXKU-Csrpz86K.js} +1 -1
  11. package/dist/client/assets/{chunk-727SXJPM-X90EdJX4.js → chunk-727SXJPM-B3vZVGMR.js} +1 -1
  12. package/dist/client/assets/{chunk-AQP2D5EJ-PEoVUnQP.js → chunk-AQP2D5EJ-Cs9__8di.js} +1 -1
  13. package/dist/client/assets/{chunk-CSCIHK7Q-CLWG2R5F.js → chunk-CSCIHK7Q-C9X7lfBM.js} +1 -1
  14. package/dist/client/assets/{chunk-KSCS5N6A-BamDWXh_.js → chunk-KSCS5N6A-CY0NGeTu.js} +1 -1
  15. package/dist/client/assets/{chunk-L5ZTLDWV-05TaQDcG.js → chunk-L5ZTLDWV-BboXbWo7.js} +1 -1
  16. package/dist/client/assets/{chunk-LZXEDZCA-CjsbWN3c.js → chunk-LZXEDZCA-CUBnjoBD.js} +2 -2
  17. package/dist/client/assets/{chunk-ND2GUHAM-BVmPBEeD.js → chunk-ND2GUHAM-BJqpZMk2.js} +1 -1
  18. package/dist/client/assets/{chunk-NZK2D7GU-DNZ6WouC.js → chunk-NZK2D7GU-BHRnsVyz.js} +1 -1
  19. package/dist/client/assets/{chunk-O5CBEL6O-Dfonikgz.js → chunk-O5CBEL6O-Anqw_yuF.js} +1 -1
  20. package/dist/client/assets/{chunk-WU5MYG2G-CyiTxcGh.js → chunk-WU5MYG2G-BgGztexj.js} +1 -1
  21. package/dist/client/assets/classDiagram-4FO5ZUOK-DSaSDx3D.js +1 -0
  22. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BwfjAHrx.js +1 -0
  23. package/dist/client/assets/{dagre-BM42HDAG-9jv2zUKk.js → dagre-BM42HDAG-BaQbcdG0.js} +1 -1
  24. package/dist/client/assets/{diagram-2AECGRRQ-DmF0Td45.js → diagram-2AECGRRQ-Brv-rcOf.js} +1 -1
  25. package/dist/client/assets/{diagram-5GNKFQAL-DJNMQ7tI.js → diagram-5GNKFQAL-D3eStICz.js} +1 -1
  26. package/dist/client/assets/{diagram-KO2AKTUF-EfcoL9E4.js → diagram-KO2AKTUF-CrZfGF7-.js} +1 -1
  27. package/dist/client/assets/{diagram-LMA3HP47-C77Lzbhk.js → diagram-LMA3HP47-Dtk6gUIn.js} +1 -1
  28. package/dist/client/assets/{diagram-OG6HWLK6-7GPyDhpX.js → diagram-OG6HWLK6-Bmarlaaa.js} +1 -1
  29. package/dist/client/assets/{erDiagram-TEJ5UH35-B-mOpWb2.js → erDiagram-TEJ5UH35-BC_ZzN2S.js} +1 -1
  30. package/dist/client/assets/{flowDiagram-I6XJVG4X-Bbte_qNo.js → flowDiagram-I6XJVG4X-DpCPHLj5.js} +1 -1
  31. package/dist/client/assets/{ganttDiagram-6RSMTGT7-DC4ltCss.js → ganttDiagram-6RSMTGT7-CaLaeFMa.js} +1 -1
  32. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-4F87Sxzr.js → gitGraphDiagram-PVQCEYII-36phJ4N5.js} +1 -1
  33. package/dist/client/assets/{index-DCCSprul.js → index-Os2WLcbu.js} +6 -6
  34. package/dist/client/assets/{infoDiagram-5YYISTIA-CHQaSUgi.js → infoDiagram-5YYISTIA-BI5oO32P.js} +1 -1
  35. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-CuXLE_L1.js → ishikawaDiagram-YF4QCWOH-bgfzr0xn.js} +1 -1
  36. package/dist/client/assets/{journeyDiagram-JHISSGLW-Dkj3B7DF.js → journeyDiagram-JHISSGLW-DrmwNzOC.js} +1 -1
  37. package/dist/client/assets/{kanban-definition-UN3LZRKU-DAH_WodG.js → kanban-definition-UN3LZRKU-Cg5rkyMP.js} +1 -1
  38. package/dist/client/assets/{line-CxewTz3a.js → line-CFlz4TDX.js} +1 -1
  39. package/dist/client/assets/{mermaid-parser.core-W88fOlNl.js → mermaid-parser.core-C7CnvU1K.js} +1 -1
  40. package/dist/client/assets/{mermaid.core-CjJzzlTK.js → mermaid.core-Dbab-VXW.js} +3 -3
  41. package/dist/client/assets/{mindmap-definition-RKZ34NQL-BdCMvjnB.js → mindmap-definition-RKZ34NQL-DJze85_k.js} +1 -1
  42. package/dist/client/assets/{pieDiagram-4H26LBE5-HeTRmhyt.js → pieDiagram-4H26LBE5-DJAQkhKY.js} +1 -1
  43. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-CLXv5YTL.js → quadrantDiagram-W4KKPZXB-BD8d4qar.js} +1 -1
  44. package/dist/client/assets/{requirementDiagram-4Y6WPE33-DB4DS6CS.js → requirementDiagram-4Y6WPE33-C5mokQZP.js} +1 -1
  45. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BjUVvwEU.js → sankeyDiagram-5OEKKPKP-EkdPZKJO.js} +1 -1
  46. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-FH39XKuz.js → sequenceDiagram-3UESZ5HK-B-5oe-32.js} +1 -1
  47. package/dist/client/assets/{stateDiagram-AJRCARHV-U8DIBjJj.js → stateDiagram-AJRCARHV-BFHel4DJ.js} +1 -1
  48. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-iGqsY8gO.js +1 -0
  49. package/dist/client/assets/{timeline-definition-PNZ67QCA-cuO_PRfp.js → timeline-definition-PNZ67QCA-DvyAtzba.js} +1 -1
  50. package/dist/client/assets/{vennDiagram-CIIHVFJN-BR7Vk6hi.js → vennDiagram-CIIHVFJN-C9vIulQP.js} +1 -1
  51. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-C443pGVk.js → wardleyDiagram-YWT4CUSO-CQTFOoRr.js} +1 -1
  52. package/dist/client/assets/{xychartDiagram-2RQKCTM6-BtjwBwmu.js → xychartDiagram-2RQKCTM6-CyXsRLmO.js} +1 -1
  53. package/dist/client/index.html +1 -1
  54. package/package.json +1 -1
  55. package/dist/client/assets/VerificationDialog-YUi8g2ou.js +0 -4
  56. package/dist/client/assets/channel-CZ1HsfsD.js +0 -1
  57. package/dist/client/assets/classDiagram-4FO5ZUOK-D4DcLL7k.js +0 -1
  58. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Benwuous.js +0 -1
  59. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-Cw8SkdDx.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CjJzzlTK.js","assets/chunk-O5CBEL6O-Dfonikgz.js","assets/src-BRjoYtUW.js","assets/chunk-BNv3lrIs.js","assets/chunk-5ZQYHXKU-D45jJDNN.js","assets/dist-CERhmQhR.js","assets/chunk-CSCIHK7Q-CLWG2R5F.js","assets/chunk-3OPIFGDE-CTITOUvV.js","assets/chunk-L5ZTLDWV-05TaQDcG.js","assets/chunk-NZK2D7GU-DNZ6WouC.js","assets/rough.esm-BoTisKeL.js","assets/chunk-BSJP7CBP-DJ57XcV5.js","assets/chunk-KSCS5N6A-BamDWXh_.js","assets/line-CxewTz3a.js","assets/path-sMK4d_s9.js","assets/array-BNor45A1.js","assets/chunk-LZXEDZCA-CjsbWN3c.js","assets/chunk-WU5MYG2G-CyiTxcGh.js","assets/chunk-XPW4576I-DObFPxjB.js","assets/VerificationDialog-YUi8g2ou.js","assets/GitHubActionsDialog-Cmb9Yebr.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-Dbab-VXW.js","assets/chunk-O5CBEL6O-Anqw_yuF.js","assets/src-BRjoYtUW.js","assets/chunk-BNv3lrIs.js","assets/chunk-5ZQYHXKU-Csrpz86K.js","assets/dist-CERhmQhR.js","assets/chunk-CSCIHK7Q-C9X7lfBM.js","assets/chunk-3OPIFGDE-QvjUuKmV.js","assets/chunk-L5ZTLDWV-BboXbWo7.js","assets/chunk-NZK2D7GU-BHRnsVyz.js","assets/rough.esm-BoTisKeL.js","assets/chunk-BSJP7CBP-DJ57XcV5.js","assets/chunk-KSCS5N6A-CY0NGeTu.js","assets/line-CFlz4TDX.js","assets/path-sMK4d_s9.js","assets/array-BNor45A1.js","assets/chunk-LZXEDZCA-CUBnjoBD.js","assets/chunk-WU5MYG2G-BgGztexj.js","assets/chunk-XPW4576I-DObFPxjB.js","assets/VerificationDialog-BgEDRfgP.js","assets/GitHubActionsDialog-Ckb99-ve.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=[],B=-1;function V(e){return{current:e}}function H(e){0>B||(e.current=z[B],z[B]=null,B--)}function U(e,t){B++,z[B]=e.current,e.current=t}var W=V(null),G=V(null),K=V(null),ee=V(null);function te(e,t){switch(U(K,t),U(G,e),U(W,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}}H(W),U(W,e)}function ne(){H(W),H(G),H(K)}function re(e){e.memoizedState!==null&&U(ee,e);var t=W.current,n=Gd(t,e.type);t!==n&&(U(G,e),U(W,n))}function ie(e){G.current===e&&(H(W),H(G)),ee.current===e&&(H(ee),tp._currentValue=R)}var ae,oe;function se(e){if(ae===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||``,oe=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ae+e+oe}var ce=!1;function le(e,t){if(!e||ce)return``;ce=!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,7 +51,7 @@ 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},cs=`DialogDescriptionWarning`,ls=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${os(cs).contentName}}.`;return p.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},us=Fo,ds=Vo,fs=Uo,ps=qo,ms=Qo,hs=es,gs=ns;function _s(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 vs(e){let[t,n]=p.useState(void 0);return $r(()=>{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 ys=[`top`,`right`,`bottom`,`left`],bs=Math.min,xs=Math.max,Ss=Math.round,Cs=Math.floor,ws=e=>({x:e,y:e}),Ts={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Es(e,t,n){return xs(e,bs(t,n))}function Ds(e,t){return typeof e==`function`?e(t):e}function Os(e){return e.split(`-`)[0]}function ks(e){return e.split(`-`)[1]}function As(e){return e===`x`?`y`:`x`}function js(e){return e===`y`?`height`:`width`}function Ms(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ns(e){return As(Ms(e))}function Ps(e,t,n){n===void 0&&(n=!1);let r=ks(e),i=Ns(e),a=js(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Us(o)),[o,Us(o)]}function Fs(e){let t=Us(e);return[Is(e),t,Is(t)]}function Is(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ls=[`left`,`right`],Rs=[`right`,`left`],zs=[`top`,`bottom`],Bs=[`bottom`,`top`];function Vs(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Rs:Ls:t?Ls:Rs;case`left`:case`right`:return t?zs:Bs;default:return[]}}function Hs(e,t,n,r){let i=ks(e),a=Vs(Os(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Is)))),a}function Us(e){let t=Os(e);return Ts[t]+e.slice(t.length)}function Ws(e){return{top:0,right:0,bottom:0,left:0,...e}}function Gs(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ws(e)}function Ks(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 qs(e,t,n){let{reference:r,floating:i}=e,a=Ms(t),o=Ns(t),s=js(o),c=Os(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(ks(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 Js(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}=Ds(t,e),p=Gs(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ks(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=Ks(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 Ys=50,Xs=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Js},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=qs(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<Ys&&(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}=qs(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Zs=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}=Ds(e,t)||{};if(l==null)return{};let d=Gs(u),f={x:n,y:r},p=Ns(i),m=js(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=Es(O,A,k),M=!c.arrow&&ks(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}}}),Qs=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}=Ds(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Os(r),_=Ms(o),v=Os(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Us(o)]:Fs(o)),x=p!==`none`;!d&&x&&b.push(...Hs(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=Ps(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`&&_!==Ms(t))||T.every(e=>Ms(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=Ms(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 $s(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ec(e){return ys.some(t=>e[t]>=0)}var tc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Ds(e,t);switch(i){case`referenceHidden`:{let e=$s(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ec(e)}}}case`escaped`:{let e=$s(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ec(e)}}}default:return{}}}}},nc=new Set([`left`,`top`]);async function rc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Os(n),s=ks(n),c=Ms(n)===`y`,l=nc.has(o)?-1:1,u=a&&c?-1:1,d=Ds(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 ic=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 rc(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}}}}},ac=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}=Ds(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ms(Os(i)),p=As(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=Es(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=Es(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}}}}}},oc=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}=Ds(e,t),u={x:n,y:r},d=Ms(i),f=As(d),p=u[f],m=u[d],h=Ds(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=nc.has(Os(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}}}},sc=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}=Ds(e,t),u=await o.detectOverflow(t,l),d=Os(i),f=ks(i),p=Ms(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=xs(u.left,0),t=xs(u.right,0),n=xs(u.top,0),r=xs(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:xs(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:xs(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 cc(){return typeof window<`u`}function lc(e){return fc(e)?(e.nodeName||``).toLowerCase():`#document`}function uc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dc(e){return((fc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fc(e){return cc()?e instanceof Node||e instanceof uc(e).Node:!1}function pc(e){return cc()?e instanceof Element||e instanceof uc(e).Element:!1}function mc(e){return cc()?e instanceof HTMLElement||e instanceof uc(e).HTMLElement:!1}function hc(e){return!cc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof uc(e).ShadowRoot}function gc(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Dc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _c(e){return/^(table|td|th)$/.test(lc(e))}function vc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yc=/transform|translate|scale|rotate|perspective|filter/,bc=/paint|layout|strict|content/,xc=e=>!!e&&e!==`none`,Sc;function Cc(e){let t=pc(e)?Dc(e):e;return xc(t.transform)||xc(t.translate)||xc(t.scale)||xc(t.rotate)||xc(t.perspective)||!Tc()&&(xc(t.backdropFilter)||xc(t.filter))||yc.test(t.willChange||``)||bc.test(t.contain||``)}function wc(e){let t=kc(e);for(;mc(t)&&!Ec(t);){if(Cc(t))return t;if(vc(t))return null;t=kc(t)}return null}function Tc(){return Sc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sc}function Ec(e){return/^(html|body|#document)$/.test(lc(e))}function Dc(e){return uc(e).getComputedStyle(e)}function Oc(e){return pc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kc(e){if(lc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hc(e)&&e.host||dc(e);return hc(t)?t.host:t}function Ac(e){let t=kc(e);return Ec(t)?e.ownerDocument?e.ownerDocument.body:e.body:mc(t)&&gc(t)?t:Ac(t)}function jc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ac(e),i=r===e.ownerDocument?.body,a=uc(r);if(i){let e=Mc(a);return t.concat(a,a.visualViewport||[],gc(r)?r:[],e&&n?jc(e):[])}else return t.concat(r,jc(r,[],n))}function Mc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Nc(e){let t=Dc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=mc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ss(n)!==a||Ss(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Pc(e){return pc(e)?e:e.contextElement}function Fc(e){let t=Pc(e);if(!mc(t))return ws(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Nc(t),o=(a?Ss(n.width):n.width)/r,s=(a?Ss(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ic=ws(0);function Lc(e){let t=uc(e);return!Tc()||!t.visualViewport?Ic:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==uc(e)?!1:t}function zc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Pc(e),o=ws(1);t&&(r?pc(r)&&(o=Fc(r)):o=Fc(e));let s=Rc(a,n,r)?Lc(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=uc(a),t=r&&pc(r)?uc(r):r,n=e,i=Mc(n);for(;i&&r&&t!==n;){let e=Fc(i),t=i.getBoundingClientRect(),r=Dc(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=uc(i),i=Mc(n)}}return Ks({width:u,height:d,x:c,y:l})}function Bc(e,t){let n=Oc(e).scrollLeft;return t?t.left+n:zc(dc(e)).left+n}function Vc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Bc(e,n),y:n.top+t.scrollTop}}function Hc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=dc(r),s=t?vc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ws(1),u=ws(0),d=mc(r);if((d||!d&&!a)&&((lc(r)!==`body`||gc(o))&&(c=Oc(r)),d)){let e=zc(r);l=Fc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Vc(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 Uc(e){return Array.from(e.getClientRects())}function Wc(e){let t=dc(e),n=Oc(e),r=e.ownerDocument.body,i=xs(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=xs(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Bc(e),s=-n.scrollTop;return Dc(r).direction===`rtl`&&(o+=xs(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Gc=25;function Kc(e,t){let n=uc(e),r=dc(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Tc();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Bc(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<=Gc&&(a-=o)}else l<=Gc&&(a+=l);return{width:a,height:o,x:s,y:c}}function qc(e,t){let n=zc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=mc(e)?Fc(e):ws(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Jc(e,t,n){let r;if(t===`viewport`)r=Kc(e,n);else if(t===`document`)r=Wc(dc(e));else if(pc(t))r=qc(t,n);else{let n=Lc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ks(r)}function Yc(e,t){let n=kc(e);return n===t||!pc(n)||Ec(n)?!1:Dc(n).position===`fixed`||Yc(n,t)}function Xc(e,t){let n=t.get(e);if(n)return n;let r=jc(e,[],!1).filter(e=>pc(e)&&lc(e)!==`body`),i=null,a=Dc(e).position===`fixed`,o=a?kc(e):e;for(;pc(o)&&!Ec(o);){let t=Dc(o),n=Cc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||gc(o)&&!n&&Yc(e,o))?r=r.filter(e=>e!==o):i=t,o=kc(o)}return t.set(e,r),r}function Zc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vc(t)?[]:Xc(t,this._c):[].concat(n),r],o=Jc(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=Jc(t,a[e],i);s=xs(n.top,s),c=bs(n.right,c),l=bs(n.bottom,l),u=xs(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Qc(e){let{width:t,height:n}=Nc(e);return{width:t,height:n}}function $c(e,t,n){let r=mc(t),i=dc(t),a=n===`fixed`,o=zc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ws(0);function l(){c.x=Bc(i)}if(r||!r&&!a)if((lc(t)!==`body`||gc(i))&&(s=Oc(t)),r){let e=zc(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?Vc(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 el(e){return Dc(e).position===`static`}function tl(e,t){if(!mc(e)||Dc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return dc(e)===n&&(n=n.ownerDocument.body),n}function nl(e,t){let n=uc(e);if(vc(e))return n;if(!mc(e)){let t=kc(e);for(;t&&!Ec(t);){if(pc(t)&&!el(t))return t;t=kc(t)}return n}let r=tl(e,t);for(;r&&_c(r)&&el(r);)r=tl(r,t);return r&&Ec(r)&&el(r)&&!Cc(r)?n:r||wc(e)||n}var rl=async function(e){let t=this.getOffsetParent||nl,n=this.getDimensions,r=await n(e.floating);return{reference:$c(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function il(e){return Dc(e).direction===`rtl`}var al={convertOffsetParentRelativeRectToViewportRelativeRect:Hc,getDocumentElement:dc,getClippingRect:Zc,getOffsetParent:nl,getElementRects:rl,getClientRects:Uc,getDimensions:Qc,getScale:Fc,isElement:pc,isRTL:il};function ol(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sl(e,t){let n=null,r,i=dc(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=Cs(d),h=Cs(i.clientWidth-(u+f)),g=Cs(i.clientHeight-(d+p)),_=Cs(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:xs(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&&!ol(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 cl(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=Pc(e),u=i||a?[...l?jc(l):[],...t?jc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?sl(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?zc(e):null;c&&g();function g(){let t=zc(e);h&&!ol(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 ll=ic,ul=ac,dl=Qs,fl=sc,pl=tc,ml=Zs,hl=oc,gl=(e,t,n)=>{let r=new Map,i={platform:al,...n},a={...i.platform,_c:r};return Xs(e,t,{...i,platform:a})},_l=typeof document<`u`?p.useLayoutEffect:function(){};function vl(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(!vl(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)&&!vl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function yl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bl(e,t){let n=yl(e);return Math.round(t*n)/n}function xl(e){let t=p.useRef(e);return _l(()=>{t.current=e}),t}function Sl(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);vl(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=xl(c),k=xl(i),A=xl(l),j=p.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),gl(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!vl(E.current,t)&&(E.current=t,m.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);_l(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=p.useRef(!1);_l(()=>(M.current=!0,()=>{M.current=!1}),[]),_l(()=>{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)`,...yl(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 Cl=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?{}:ml({element:r.current,padding:i}).fn(n):r?ml({element:r,padding:i}).fn(n):{}}}},wl=(e,t)=>{let n=ll(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tl=(e,t)=>{let n=ul(e);return{name:n.name,fn:n.fn,options:[e,t]}},El=(e,t)=>({fn:hl(e).fn,options:[e,t]}),Dl=(e,t)=>{let n=dl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ol=(e,t)=>{let n=fl(e);return{name:n.name,fn:n.fn,options:[e,t]}},kl=(e,t)=>{let n=pl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Al=(e,t)=>{let n=Cl(e);return{name:n.name,fn:n.fn,options:[e,t]}},jl=`Arrow`,Ml=p.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,X.jsx)(Hr.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`})})});Ml.displayName=jl;var Nl=Ml,Pl=`Popper`,[Fl,Il]=Yr(Pl),[Ll,Rl]=Fl(Pl),zl=e=>{let{__scopePopper:t,children:n}=e,[r,i]=p.useState(null);return(0,X.jsx)(Ll,{scope:t,anchor:r,onAnchorChange:i,children:n})};zl.displayName=Pl;var Bl=`PopperAnchor`,Vl=p.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Rl(Bl,n),o=p.useRef(null),s=Nr(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)(Hr.div,{...i,ref:s})});Vl.displayName=Bl;var Hl=`PopperContent`,[Ul,Wl]=Fl(Hl),Gl=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,_=Rl(Hl,n),[v,y]=p.useState(null),b=Nr(t,e=>y(e)),[x,S]=p.useState(null),C=vs(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(Yl),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Sl({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>cl(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[wl({mainAxis:i+T,alignmentAxis:o}),c&&Tl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?El():void 0,...A}),c&&Dl({...A}),Ol({...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&&Al({element:x,padding:s}),Xl({arrowWidth:w,arrowHeight:T}),f&&kl({strategy:`referenceHidden`,...A})]}),[I,L]=Zl(N),R=ki(h);$r(()=>{P&&R?.()},[P,R]);let z=F.arrow?.x,B=F.arrow?.y,V=F.arrow?.centerOffset!==0,[H,U]=p.useState();return $r(()=>{v&&U(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:H,"--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)(Ul,{scope:n,placedSide:I,onArrowChange:S,arrowX:z,arrowY:B,shouldHideArrow:V,children:(0,X.jsx)(Hr.div,{"data-side":I,"data-align":L,...g,ref:b,style:{...g.style,animation:P?void 0:`none`}})})})});Gl.displayName=Hl;var Kl=`PopperArrow`,ql={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Jl=p.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Wl(Kl,n),a=ql[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)(Nl,{...r,ref:t,style:{...r.style,display:`block`}})})});Jl.displayName=Kl;function Yl(e){return e!==null}var Xl=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]=Zl(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 Zl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Ql=zl,$l=Vl,eu=Gl,tu=Jl,nu=`rovingFocusGroup.onEntryFocus`,ru={bubbles:!1,cancelable:!0},iu=`RovingFocusGroup`,[au,ou,su]=Zr(iu),[cu,lu]=Yr(iu,[su]),[uu,du]=cu(iu),fu=p.forwardRef((e,t)=>(0,X.jsx)(au.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(au.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(pu,{...e,ref:t})})}));fu.displayName=iu;var pu=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=Nr(t,f),h=Oi(a),[g,_]=ti({prop:o,defaultProp:s??null,onChange:c,caller:iu}),[v,y]=p.useState(!1),b=ki(l),x=ou(n),S=p.useRef(!1),[C,w]=p.useState(0);return p.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(nu,b),()=>e.removeEventListener(nu,b)},[b]),(0,X.jsx)(uu,{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)(Hr.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:`none`,...e.style},onMouseDown:Qr(e.onMouseDown,()=>{S.current=!0}),onFocus:Qr(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(nu,ru);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);yu([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:Qr(e.onBlur,()=>y(!1))})})}),mu=`RovingFocusGroupItem`,hu=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=di(),l=a||c,u=du(mu,n),d=u.currentTabStopId===l,f=ou(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u;return p.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,X.jsx)(au.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,X.jsx)(Hr.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Qr(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Qr(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Qr(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=vu(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(()=>yu(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});hu.displayName=mu;var gu={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function _u(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function vu(e,t,n){let r=_u(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return gu[r]}function yu(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 xu=fu,Su=hu,Cu=[`Enter`,` `],wu=[`ArrowDown`,`PageUp`,`Home`],Tu=[`ArrowUp`,`PageDown`,`End`],Eu=[...wu,...Tu],Du={ltr:[...Cu,`ArrowRight`],rtl:[...Cu,`ArrowLeft`]},Ou={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},ku=`Menu`,[Au,ju,Mu]=Zr(ku),[Nu,Pu]=Yr(ku,[Mu,Il,lu]),Fu=Il(),Iu=lu(),[Lu,Ru]=Nu(ku),[zu,Bu]=Nu(ku),Vu=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Fu(t),[c,l]=p.useState(null),u=p.useRef(!1),d=ki(a),f=Oi(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)(Ql,{...s,children:(0,X.jsx)(Lu,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,X.jsx)(zu,{scope:t,onClose:p.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Vu.displayName=ku;var Hu=`MenuAnchor`,Uu=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Fu(n);return(0,X.jsx)($l,{...i,...r,ref:t})});Uu.displayName=Hu;var Wu=`MenuPortal`,[Gu,Ku]=Nu(Wu,{forceMount:void 0}),qu=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Ru(Wu,t);return(0,X.jsx)(Gu,{scope:t,forceMount:n,children:(0,X.jsx)(ai,{present:n||a.open,children:(0,X.jsx)(sa,{asChild:!0,container:i,children:r})})})};qu.displayName=Wu;var Ju=`MenuContent`,[Yu,Xu]=Nu(Ju),Zu=p.forwardRef((e,t)=>{let n=Ku(Ju,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Ru(Ju,e.__scopeMenu),o=Bu(Ju,e.__scopeMenu);return(0,X.jsx)(Au.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(ai,{present:r||a.open,children:(0,X.jsx)(Au.Slot,{scope:e.__scopeMenu,children:o.modal?(0,X.jsx)(Qu,{...i,ref:t}):(0,X.jsx)($u,{...i,ref:t})})})})}),Qu=p.forwardRef((e,t)=>{let n=Ru(Ju,e.__scopeMenu),r=p.useRef(null),i=Nr(t,r);return p.useEffect(()=>{let e=r.current;if(e)return ko(e)},[]),(0,X.jsx)(td,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Qr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),$u=p.forwardRef((e,t)=>{let n=Ru(Ju,e.__scopeMenu);return(0,X.jsx)(td,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ed=Pr(`MenuContent.ScrollLock`),td=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,_=Ru(Ju,n),v=Bu(Ju,n),y=Fu(n),b=Iu(n),x=ju(n),[S,C]=p.useState(null),w=p.useRef(null),T=Nr(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:ed,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=zd(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),[]),la();let F=p.useCallback(e=>A.current===k.current?.side&&Vd(e,k.current?.area),[]);return(0,X.jsx)(Yu,{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)(Ji,{asChild:!0,trapped:i,onMountAutoFocus:Qr(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,X.jsx)(Li,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:m,children:(0,X.jsx)(xu,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:Qr(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,X.jsx)(eu,{role:`menu`,"aria-orientation":`vertical`,"data-state":Pd(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:Qr(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||!Eu.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Tu.includes(e.key)&&a.reverse(),Ld(a)}),onBlur:Qr(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:Qr(e.onPointerMove,Hd(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)}))})})})})})})});Zu.displayName=Ju;var nd=`MenuGroup`,rd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(Hr.div,{role:`group`,...r,ref:t})});rd.displayName=nd;var id=`MenuLabel`,ad=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(Hr.div,{...r,ref:t})});ad.displayName=id;var od=`MenuItem`,sd=`menu.itemSelect`,cd=p.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=p.useRef(null),o=Bu(od,e.__scopeMenu),s=Xu(od,e.__scopeMenu),c=Nr(t,a),l=p.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(sd,{bubbles:!0,cancelable:!0});e.addEventListener(sd,e=>r?.(e),{once:!0}),Ur(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,X.jsx)(ld,{...i,ref:c,disabled:n,onClick:Qr(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Qr(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Qr(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Cu.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});cd.displayName=od;var ld=p.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Xu(od,n),s=Iu(n),c=p.useRef(null),l=Nr(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)(Au.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,X.jsx)(Su,{asChild:!0,...s,focusable:!r,children:(0,X.jsx)(Hr.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Qr(e.onPointerMove,Hd(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Qr(e.onPointerLeave,Hd(e=>o.onItemLeave(e))),onFocus:Qr(e.onFocus,()=>d(!0)),onBlur:Qr(e.onBlur,()=>d(!1))})})})}),ud=`MenuCheckboxItem`,dd=p.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,X.jsx)(yd,{scope:e.__scopeMenu,checked:n,children:(0,X.jsx)(cd,{role:`menuitemcheckbox`,"aria-checked":Fd(n)?`mixed`:n,...i,ref:t,"data-state":Id(n),onSelect:Qr(i.onSelect,()=>r?.(Fd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dd.displayName=ud;var fd=`MenuRadioGroup`,[pd,md]=Nu(fd,{value:void 0,onValueChange:()=>{}}),hd=p.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=ki(r);return(0,X.jsx)(pd,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,X.jsx)(rd,{...i,ref:t})})});hd.displayName=fd;var gd=`MenuRadioItem`,_d=p.forwardRef((e,t)=>{let{value:n,...r}=e,i=md(gd,e.__scopeMenu),a=n===i.value;return(0,X.jsx)(yd,{scope:e.__scopeMenu,checked:a,children:(0,X.jsx)(cd,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Id(a),onSelect:Qr(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});_d.displayName=gd;var vd=`MenuItemIndicator`,[yd,bd]=Nu(vd,{checked:!1}),xd=p.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=bd(vd,n);return(0,X.jsx)(ai,{present:r||Fd(a.checked)||a.checked===!0,children:(0,X.jsx)(Hr.span,{...i,ref:t,"data-state":Id(a.checked)})})});xd.displayName=vd;var Sd=`MenuSeparator`,Cd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(Hr.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Cd.displayName=Sd;var wd=`MenuArrow`,Td=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Fu(n);return(0,X.jsx)(tu,{...i,...r,ref:t})});Td.displayName=wd;var Ed=`MenuSub`,[Dd,Od]=Nu(Ed),kd=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Ru(Ed,t),o=Fu(t),[s,c]=p.useState(null),[l,u]=p.useState(null),d=ki(i);return p.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,X.jsx)(Ql,{...o,children:(0,X.jsx)(Lu,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,X.jsx)(Dd,{scope:t,contentId:di(),triggerId:di(),trigger:s,onTriggerChange:c,children:n})})})};kd.displayName=Ed;var Ad=`MenuSubTrigger`,jd=p.forwardRef((e,t)=>{let n=Ru(Ad,e.__scopeMenu),r=Bu(Ad,e.__scopeMenu),i=Od(Ad,e.__scopeMenu),a=Xu(Ad,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)(Uu,{asChild:!0,...l,children:(0,X.jsx)(ld,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Pd(n.open),...e,ref:Mr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Qr(e.onPointerMove,Hd(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:Qr(e.onPointerLeave,Hd(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:Qr(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Du[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});jd.displayName=Ad;var Md=`MenuSubContent`,Nd=p.forwardRef((e,t)=>{let n=Ku(Ju,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Ru(Ju,e.__scopeMenu),o=Bu(Ju,e.__scopeMenu),s=Od(Md,e.__scopeMenu),c=p.useRef(null),l=Nr(t,c);return(0,X.jsx)(Au.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(ai,{present:r||a.open,children:(0,X.jsx)(Au.Slot,{scope:e.__scopeMenu,children:(0,X.jsx)(td,{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:Qr(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Qr(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:Qr(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ou[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Nd.displayName=Md;function Pd(e){return e?`open`:`closed`}function Fd(e){return e===`indeterminate`}function Id(e){return Fd(e)?`indeterminate`:e?`checked`:`unchecked`}function Ld(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Rd(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function zd(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=Rd(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 Bd(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 Vd(e,t){return t?Bd({x:e.clientX,y:e.clientY},t):!1}function Hd(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Ud=Vu,Wd=Uu,Gd=qu,Kd=Zu,qd=rd,Jd=ad,Yd=cd,Xd=dd,Zd=hd,Qd=_d,$d=xd,ef=Cd,tf=Td,nf=jd,rf=Nd,af=`DropdownMenu`,[of,sf]=Yr(af,[Pu]),cf=Pu(),[lf,uf]=of(af),df=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=cf(t),l=p.useRef(null),[u,d]=ti({prop:i,defaultProp:a??!1,onChange:o,caller:af});return(0,X.jsx)(lf,{scope:t,triggerId:di(),triggerRef:l,contentId:di(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,X.jsx)(Ud,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};df.displayName=af;var ff=`DropdownMenuTrigger`,pf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=uf(ff,n),o=cf(n);return(0,X.jsx)(Wd,{asChild:!0,...o,children:(0,X.jsx)(Hr.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:Mr(t,a.triggerRef),onPointerDown:Qr(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Qr(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});pf.displayName=ff;var mf=`DropdownMenuPortal`,hf=e=>{let{__scopeDropdownMenu:t,...n}=e,r=cf(t);return(0,X.jsx)(Gd,{...r,...n})};hf.displayName=mf;var gf=`DropdownMenuContent`,_f=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uf(gf,n),a=cf(n),o=p.useRef(!1);return(0,X.jsx)(Kd,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Qr(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Qr(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)`}})});_f.displayName=gf;var vf=`DropdownMenuGroup`,yf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(qd,{...i,...r,ref:t})});yf.displayName=vf;var bf=`DropdownMenuLabel`,xf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Jd,{...i,...r,ref:t})});xf.displayName=bf;var Sf=`DropdownMenuItem`,Cf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Yd,{...i,...r,ref:t})});Cf.displayName=Sf;var wf=`DropdownMenuCheckboxItem`,Tf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Xd,{...i,...r,ref:t})});Tf.displayName=wf;var Ef=`DropdownMenuRadioGroup`,Df=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Zd,{...i,...r,ref:t})});Df.displayName=Ef;var Of=`DropdownMenuRadioItem`,kf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Qd,{...i,...r,ref:t})});kf.displayName=Of;var Af=`DropdownMenuItemIndicator`,jf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)($d,{...i,...r,ref:t})});jf.displayName=Af;var Mf=`DropdownMenuSeparator`,Nf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(ef,{...i,...r,ref:t})});Nf.displayName=Mf;var Pf=`DropdownMenuArrow`,Ff=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(tf,{...i,...r,ref:t})});Ff.displayName=Pf;var If=`DropdownMenuSubTrigger`,Lf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(nf,{...i,...r,ref:t})});Lf.displayName=If;var Rf=`DropdownMenuSubContent`,zf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(rf,{...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)`}})});zf.displayName=Rf;var Bf=df,Vf=pf,Hf=hf,Uf=_f,Wf=Cf,Gf=`Label`,Kf=p.forwardRef((e,t)=>(0,X.jsx)(Hr.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Kf.displayName=Gf;var qf=Kf,Jf=`Popover`,[Yf,Xf]=Yr(Jf,[Il]),Zf=Il(),[Qf,$f]=Yf(Jf),ep=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Zf(t),c=p.useRef(null),[l,u]=p.useState(!1),[d,f]=ti({prop:r,defaultProp:i??!1,onChange:a,caller:Jf});return(0,X.jsx)(Ql,{...s,children:(0,X.jsx)(Qf,{scope:t,contentId:di(),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})})};ep.displayName=Jf;var tp=`PopoverAnchor`,np=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$f(tp,n),a=Zf(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return p.useEffect(()=>(o(),()=>s()),[o,s]),(0,X.jsx)($l,{...a,...r,ref:t})});np.displayName=tp;var rp=`PopoverTrigger`,ip=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$f(rp,n),a=Zf(n),o=Nr(t,i.triggerRef),s=(0,X.jsx)(Hr.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":yp(i.open),...r,ref:o,onClick:Qr(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,X.jsx)($l,{asChild:!0,...a,children:s})});ip.displayName=rp;var ap=`PopoverPortal`,[op,sp]=Yf(ap,{forceMount:void 0}),cp=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=$f(ap,t);return(0,X.jsx)(op,{scope:t,forceMount:n,children:(0,X.jsx)(ai,{present:n||a.open,children:(0,X.jsx)(sa,{asChild:!0,container:i,children:r})})})};cp.displayName=ap;var lp=`PopoverContent`,up=p.forwardRef((e,t)=>{let n=sp(lp,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=$f(lp,e.__scopePopover);return(0,X.jsx)(ai,{present:r||a.open,children:a.modal?(0,X.jsx)(fp,{...i,ref:t}):(0,X.jsx)(pp,{...i,ref:t})})});up.displayName=lp;var dp=Pr(`PopoverContent.RemoveScroll`),fp=p.forwardRef((e,t)=>{let n=$f(lp,e.__scopePopover),r=p.useRef(null),i=Nr(t,r),a=p.useRef(!1);return p.useEffect(()=>{let e=r.current;if(e)return ko(e)},[]),(0,X.jsx)(bo,{as:dp,allowPinchZoom:!0,children:(0,X.jsx)(mp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qr(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Qr(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:Qr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),pp=p.forwardRef((e,t)=>{let n=$f(lp,e.__scopePopover),r=p.useRef(!1),i=p.useRef(!1);return(0,X.jsx)(mp,{...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()}})}),mp=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=$f(lp,n),p=Zf(n);return la(),(0,X.jsx)(Ji,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,X.jsx)(Li,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,X.jsx)(eu,{"data-state":yp(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)`}})})})}),hp=`PopoverClose`,gp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$f(hp,n);return(0,X.jsx)(Hr.button,{type:`button`,...r,ref:t,onClick:Qr(e.onClick,()=>i.onOpenChange(!1))})});gp.displayName=hp;var _p=`PopoverArrow`,vp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Zf(n);return(0,X.jsx)(tu,{...i,...r,ref:t})});vp.displayName=_p;function yp(e){return e?`open`:`closed`}var bp=ep,xp=ip,Sp=cp,Cp=up,wp=`Switch`,[Tp,Ep]=Yr(wp),[Dp,Op]=Tp(wp),kp=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=Nr(t,e=>m(e)),g=p.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=ti({prop:i,defaultProp:a??!1,onChange:l,caller:wp});return(0,X.jsxs)(Dp,{scope:n,checked:v,disabled:s,children:[(0,X.jsx)(Hr.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Pp(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:h,onClick:Qr(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,X.jsx)(Np,{control:f,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});kp.displayName=wp;var Ap=`SwitchThumb`,jp=p.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Op(Ap,n);return(0,X.jsx)(Hr.span,{"data-state":Pp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});jp.displayName=Ap;var Mp=`SwitchBubbleInput`,Np=p.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=p.useRef(null),s=Nr(o,a),c=_s(n),l=vs(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}})});Np.displayName=Mp;function Pp(e){return e?`checked`:`unchecked`}var Fp=kp,Ip=jp,Lp=`Tabs`,[Rp,zp]=Yr(Lp,[lu]),Bp=lu(),[Vp,Hp]=Rp(Lp),Up=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Oi(s),[d,f]=ti({prop:r,onChange:i,defaultProp:a??``,caller:Lp});return(0,X.jsx)(Vp,{scope:n,baseId:di(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,X.jsx)(Hr.div,{dir:u,"data-orientation":o,...l,ref:t})})});Up.displayName=Lp;var Wp=`TabsList`,Gp=p.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Hp(Wp,n),o=Bp(n);return(0,X.jsx)(xu,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,X.jsx)(Hr.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Gp.displayName=Wp;var Kp=`TabsTrigger`,qp=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Hp(Kp,n),s=Bp(n),c=Xp(o.baseId,r),l=Zp(o.baseId,r),u=r===o.value;return(0,X.jsx)(Su,{asChild:!0,...s,focusable:!i,active:u,children:(0,X.jsx)(Hr.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:Qr(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Qr(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Qr(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});qp.displayName=Kp;var Jp=`TabsContent`,Yp=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Hp(Jp,n),c=Xp(s.baseId,r),l=Zp(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)(ai,{present:i||u,children:({present:n})=>(0,X.jsx)(Hr.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})})});Yp.displayName=Jp;function Xp(e,t){return`${e}-trigger-${t}`}function Zp(e,t){return`${e}-content-${t}`}var Qp=Up,$p=Gp,eee=qp,em=Yp,tm=`Toggle`,nm=p.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=ti({prop:n,onChange:i,defaultProp:r??!1,caller:tm});return(0,X.jsx)(Hr.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:Qr(e.onClick,()=>{e.disabled||s(!o)})})});nm.displayName=tm;var rm=`ToggleGroup`,[im,tee]=Yr(rm,[lu]),am=lu(),om=p.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,X.jsx)(lm,{...r,ref:t});if(n===`multiple`)return(0,X.jsx)(nee,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${rm}\``)});om.displayName=rm;var[sm,cm]=im(rm),lm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=ti({prop:n,defaultProp:r??``,onChange:i,caller:rm});return(0,X.jsx)(sm,{scope:e.__scopeToggleGroup,type:`single`,value:p.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:p.useCallback(()=>s(``),[s]),children:(0,X.jsx)(um,{...a,ref:t})})}),nee=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=ti({prop:n,defaultProp:r??[],onChange:i,caller:rm}),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)(sm,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,X.jsx)(um,{...a,ref:t})})});om.displayName=rm;var[ree,iee]=im(rm),um=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=am(n),u=Oi(o),d={role:`group`,dir:u,...c};return(0,X.jsx)(ree,{scope:n,rovingFocus:i,disabled:r,children:i?(0,X.jsx)(xu,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,X.jsx)(Hr.div,{...d,ref:t})}):(0,X.jsx)(Hr.div,{...d,ref:t})})}),dm=`ToggleGroupItem`,fm=p.forwardRef((e,t)=>{let n=cm(dm,e.__scopeToggleGroup),r=iee(dm,e.__scopeToggleGroup),i=am(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)(Su,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,X.jsx)(pm,{...s,ref:t})}):(0,X.jsx)(pm,{...s,ref:t})});fm.displayName=dm;var pm=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=cm(dm,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,X.jsx)(nm,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),mm=om,hm=fm,[gm,aee]=Yr(`Tooltip`,[Il]),_m=Il(),vm=`TooltipProvider`,oee=700,ym=`tooltip.open`,[see,bm]=gm(vm),xm=e=>{let{__scopeTooltip:t,delayDuration:n=oee,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)(see,{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})};xm.displayName=vm;var Sm=`Tooltip`,[Cm,wm]=gm(Sm),Tm=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=bm(Sm,e.__scopeTooltip),l=_m(t),[u,d]=p.useState(null),f=di(),m=p.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=p.useRef(!1),[v,y]=ti({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),a?.(e)},caller:Sm}),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)(Ql,{...l,children:(0,X.jsx)(Cm,{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})})};Tm.displayName=Sm;var Em=`TooltipTrigger`,Dm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=wm(Em,n),a=bm(Em,n),o=_m(n),s=Nr(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)($l,{asChild:!0,...o,children:(0,X.jsx)(Hr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Qr(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Qr(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Qr(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Qr(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Qr(e.onBlur,i.onClose),onClick:Qr(e.onClick,i.onClose)})})});Dm.displayName=Em;var Om=`TooltipPortal`,[km,Am]=gm(Om,{forceMount:void 0}),jm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=wm(Om,t);return(0,X.jsx)(km,{scope:t,forceMount:n,children:(0,X.jsx)(ai,{present:n||a.open,children:(0,X.jsx)(sa,{asChild:!0,container:i,children:r})})})};jm.displayName=Om;var Mm=`TooltipContent`,Nm=p.forwardRef((e,t)=>{let n=Am(Mm,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=wm(Mm,e.__scopeTooltip);return(0,X.jsx)(ai,{present:r||o.open,children:o.disableHoverableContent?(0,X.jsx)(Rm,{side:i,...a,ref:t}):(0,X.jsx)(Pm,{side:i,...a,ref:t})})}),Pm=p.forwardRef((e,t)=>{let n=wm(Mm,e.__scopeTooltip),r=bm(Mm,e.__scopeTooltip),i=p.useRef(null),a=Nr(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=lee(r,cee(r,n.getBoundingClientRect())),a=uee(t.getBoundingClientRect());s(fee([...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=!dee(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,X.jsx)(Rm,{...e,ref:a})}),[Fm,Im]=gm(Sm,{isInside:!1}),Lm=Rr(`TooltipContent`),Rm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=wm(Mm,n),l=_m(n),{onClose:u}=c;return p.useEffect(()=>(document.addEventListener(ym,u),()=>document.removeEventListener(ym,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)(Li,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,X.jsxs)(eu,{"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)(Lm,{children:r}),(0,X.jsx)(Fm,{scope:n,isInside:!0,children:(0,X.jsx)(qr,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Nm.displayName=Mm;var zm=`TooltipArrow`,Bm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=_m(n);return Im(zm,n).isInside?null:(0,X.jsx)(tu,{...i,...r,ref:t})});Bm.displayName=zm;function cee(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 lee(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 uee(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 dee(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 fee(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)),pee(t)}function pee(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 mee=xm,hee=Tm,gee=Dm,_ee=jm,vee=Nm,yee=Bm,bee=(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},xee=(e,t)=>({classGroupId:e,validator:t}),Vm=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Hm=`-`,Um=[],See=`arbitrary..`,Cee=e=>{let t=Tee(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return wee(e);let n=e.split(Hm);return Wm(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?bee(i,t):t:i||Um}return n[e]||Um}}},Wm=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Wm(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Hm):e.slice(t).join(Hm),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},wee=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?See+r:void 0})(),Tee=e=>{let{theme:t,classGroups:n}=e;return Eee(n,t)},Eee=(e,t)=>{let n=Vm();for(let r in e){let i=e[r];Gm(i,n,r,t)}return n},Gm=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Km(i,t,n,r)}},Km=(e,t,n,r)=>{if(typeof e==`string`){qm(e,t,n);return}if(typeof e==`function`){Jm(e,t,n,r);return}Ym(e,t,n,r)},qm=(e,t,n)=>{let r=e===``?t:Xm(t,e);r.classGroupId=n},Jm=(e,t,n,r)=>{if(Zm(e)){Gm(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(xee(n,e))},Ym=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Gm(o,Xm(t,a),n,r)}},Xm=(e,t)=>{let n=e,r=t.split(Hm),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Vm(),n.nextPart.set(t,i)),n=i}return n},Zm=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Qm=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)}}},$m=`!`,eh=`:`,th=[],nh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),rh=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===eh){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($m)?(c=s.slice(0,-1),l=!0):s.startsWith($m)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return nh(t,l,c,u)};if(t){let e=t+eh,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):nh(th,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ih=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}},ah=e=>({cache:Qm(e.cacheSize),parseClassName:rh(e),sortModifiers:ih(e),...Cee(e)}),oh=/\s+/,sh=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(oh),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+$m: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},ch=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=lh(n))&&(i&&(i+=` `),i+=r);return i},lh=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=lh(e[r]))&&(n&&(n+=` `),n+=t);return n},uh=(e,...t)=>{let n,r,i,a,o=o=>(n=ah(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=sh(e,n);return i(e,a),a};return a=o,(...e)=>a(ch(...e))},dh=[],fh=e=>{let t=t=>t[e]||dh;return t.isThemeGetter=!0,t},ph=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,mh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,hh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_h=/\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$/,vh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xh=e=>hh.test(e),Sh=e=>!!e&&!Number.isNaN(Number(e)),Ch=e=>!!e&&Number.isInteger(Number(e)),wh=e=>e.endsWith(`%`)&&Sh(e.slice(0,-1)),Th=e=>gh.test(e),Eh=()=>!0,Dh=e=>_h.test(e)&&!vh.test(e),Oh=()=>!1,kh=e=>yh.test(e),Ah=e=>bh.test(e),jh=e=>!Nh(e)&&!Rh(e),Mh=e=>Hh(e,Kh,Oh),Nh=e=>ph.test(e),Ph=e=>Hh(e,qh,Dh),Fh=e=>Hh(e,Pee,Sh),Dee=e=>Hh(e,Yh,Eh),Oee=e=>Hh(e,Jh,Oh),Ih=e=>Hh(e,Wh,Oh),kee=e=>Hh(e,Gh,Ah),Lh=e=>Hh(e,Xh,kh),Rh=e=>mh.test(e),zh=e=>Uh(e,qh),Aee=e=>Uh(e,Jh),Bh=e=>Uh(e,Wh),jee=e=>Uh(e,Kh),Mee=e=>Uh(e,Gh),Vh=e=>Uh(e,Xh,!0),Nee=e=>Uh(e,Yh,!0),Hh=(e,t,n)=>{let r=ph.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Uh=(e,t,n=!1)=>{let r=mh.exec(e);return r?r[1]?t(r[1]):n:!1},Wh=e=>e===`position`||e===`percentage`,Gh=e=>e===`image`||e===`url`,Kh=e=>e===`length`||e===`size`||e===`bg-size`,qh=e=>e===`length`,Pee=e=>e===`number`,Jh=e=>e===`family-name`,Yh=e=>e===`number`||e===`weight`,Xh=e=>e===`shadow`,Fee=uh(()=>{let e=fh(`color`),t=fh(`font`),n=fh(`text`),r=fh(`font-weight`),i=fh(`tracking`),a=fh(`leading`),o=fh(`breakpoint`),s=fh(`container`),c=fh(`spacing`),l=fh(`radius`),u=fh(`shadow`),d=fh(`inset-shadow`),f=fh(`text-shadow`),p=fh(`drop-shadow`),m=fh(`blur`),h=fh(`perspective`),g=fh(`aspect`),_=fh(`ease`),v=fh(`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(),Rh,Nh],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Rh,Nh,c],T=()=>[xh,`full`,`auto`,...w()],E=()=>[Ch,`none`,`subgrid`,Rh,Nh],D=()=>[`auto`,{span:[`full`,Ch,Rh,Nh]},Ch,Rh,Nh],O=()=>[Ch,`auto`,Rh,Nh],k=()=>[`auto`,`min`,`max`,`fr`,Rh,Nh],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=()=>[xh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[xh,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[xh,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Rh,Nh],L=()=>[...b(),Bh,Ih,{position:[Rh,Nh]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,jee,Mh,{size:[Rh,Nh]}],B=()=>[wh,zh,Ph],V=()=>[``,`none`,`full`,l,Rh,Nh],H=()=>[``,Sh,zh,Ph],U=()=>[`solid`,`dashed`,`dotted`,`double`],W=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],G=()=>[Sh,wh,Bh,Ih],K=()=>[``,`none`,m,Rh,Nh],ee=()=>[`none`,Sh,Rh,Nh],te=()=>[`none`,Sh,Rh,Nh],ne=()=>[Sh,Rh,Nh],re=()=>[xh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Th],breakpoint:[Th],color:[Eh],container:[Th],"drop-shadow":[Th],ease:[`in`,`out`,`in-out`],font:[jh],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Th],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Th],shadow:[Th],spacing:[`px`,Sh],text:[Th],"text-shadow":[Th],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,xh,Nh,Rh,g]}],container:[`container`],columns:[{columns:[Sh,Nh,Rh,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:[Ch,`auto`,Rh,Nh]}],basis:[{basis:[xh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Sh,xh,`auto`,`initial`,`none`,Nh]}],grow:[{grow:[``,Sh,Rh,Nh]}],shrink:[{shrink:[``,Sh,Rh,Nh]}],order:[{order:[Ch,`first`,`last`,`none`,Rh,Nh]}],"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,zh,Ph]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Nee,Dee]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,wh,Nh]}],"font-family":[{font:[Aee,Oee,t]}],"font-features":[{"font-features":[Nh]}],"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,Rh,Nh]}],"line-clamp":[{"line-clamp":[Sh,`none`,Rh,Fh]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Rh,Nh]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Rh,Nh]}],"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:[...U(),`wavy`]}],"text-decoration-thickness":[{decoration:[Sh,`from-font`,`auto`,Rh,Ph]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Sh,`auto`,Rh,Nh]}],"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`,Rh,Nh]}],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`,Rh,Nh]}],"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`]},Ch,Rh,Nh],radial:[``,Rh,Nh],conic:[Ch,Rh,Nh]},Mee,kee]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":H()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...U(),`hidden`,`none`]}],"divide-style":[{divide:[...U(),`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:[...U(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Sh,Rh,Nh]}],"outline-w":[{outline:[``,Sh,zh,Ph]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Vh,Lh]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Vh,Lh]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:H()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Sh,Ph]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Vh,Lh]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Sh,Rh,Nh]}],"mix-blend":[{"mix-blend":[...W(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":W()}],"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":[Sh]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"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":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"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":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"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":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"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":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"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":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"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":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Rh,Nh]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"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":[Sh]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"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`,Rh,Nh]}],filter:[{filter:[``,`none`,Rh,Nh]}],blur:[{blur:K()}],brightness:[{brightness:[Sh,Rh,Nh]}],contrast:[{contrast:[Sh,Rh,Nh]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Vh,Lh]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Sh,Rh,Nh]}],"hue-rotate":[{"hue-rotate":[Sh,Rh,Nh]}],invert:[{invert:[``,Sh,Rh,Nh]}],saturate:[{saturate:[Sh,Rh,Nh]}],sepia:[{sepia:[``,Sh,Rh,Nh]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Rh,Nh]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[Sh,Rh,Nh]}],"backdrop-contrast":[{"backdrop-contrast":[Sh,Rh,Nh]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Sh,Rh,Nh]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Sh,Rh,Nh]}],"backdrop-invert":[{"backdrop-invert":[``,Sh,Rh,Nh]}],"backdrop-opacity":[{"backdrop-opacity":[Sh,Rh,Nh]}],"backdrop-saturate":[{"backdrop-saturate":[Sh,Rh,Nh]}],"backdrop-sepia":[{"backdrop-sepia":[``,Sh,Rh,Nh]}],"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`,Rh,Nh]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Sh,`initial`,Rh,Nh]}],ease:[{ease:[`linear`,`initial`,_,Rh,Nh]}],delay:[{delay:[Sh,Rh,Nh]}],animate:[{animate:[`none`,v,Rh,Nh]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Rh,Nh]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":[`scale-3d`],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[Rh,Nh,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"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`,Rh,Nh]}],"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`,Rh,Nh]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Sh,zh,Ph,Fh]}],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)=>Fee(Dr(e)),Iee=Ar(`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?Fr:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Z(Iee({variant:t,size:n,className:e})),...i}),Zh=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Lee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ree=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Qh=e=>{let t=Ree(e);return t.charAt(0).toUpperCase()+t.slice(1)},$h={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`},zee=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Bee=(0,p.createContext)({}),Vee=()=>(0,p.useContext)(Bee),Hee=(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=``}=Vee()??{},h=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,p.createElement)(`svg`,{ref:c,...$h,width:t??l??$h.width,height:t??l??$h.height,stroke:e??f,strokeWidth:h,className:Zh(`lucide`,m,i),...!a&&!zee(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),eg=(e,t)=>{let n=(0,p.forwardRef)(({className:n,...r},i)=>(0,p.createElement)(Hee,{ref:i,iconNode:t,className:Zh(`lucide-${Lee(Qh(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Qh(e),n},tg=eg(`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`}]]),Uee=eg(`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`}]]),Wee=eg(`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`}]]),Gee=eg(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Kee=eg(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ng=eg(`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`}]]),rg=eg(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ig=eg(`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`}]]),ag=eg(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),og=eg(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),sg=eg(`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`}]]),cg=eg(`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`}]]),lg=eg(`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`}]]),ug=eg(`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`}]]),dg=eg(`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`}]]),fg=eg(`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`}]]),pg=eg(`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`}]]),mg=eg(`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`}]]),hg=eg(`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`}]]),gg=eg(`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`}]]),_g=eg(`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`}]]),vg=eg(`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`}]]),yg=eg(`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`}]]),bg=eg(`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`}]]),xg=eg(`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`}]]),Sg=eg(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Cg=eg(`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`}]]),wg=eg(`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`}]]),Tg=eg(`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`}]]),Eg=eg(`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`}]]),Dg=eg(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Og=eg(`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`}]]),kg=eg(`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`}]]),Ag=eg(`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`}]]),jg=eg(`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`}]]),Mg=eg(`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`}]]),Ng=eg(`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`}]]),Pg=eg(`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`}]]),Fg=eg(`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`}]]),Ig=eg(`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`}]]),Lg=eg(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Rg=eg(`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`}]]),zg=eg(`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`}]]),Bg=eg(`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`}]]),Vg=eg(`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`}]]),Hg=eg(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ug=eg(`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`}]]),Wg=eg(`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`}]]),Gg=eg(`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`}]]),Kg=eg(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),qg=eg(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Jg=eg(`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`}]]),Yg=eg(`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`}]]),Xg=eg(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Zg=1,Qg=.9,$g=.8,e_=.17,t_=.1,n_=.999,r_=.9999,i_=.99,a_=/[\\\/_+.#"@\[\(\{&]/,o_=/[\\\/_+.#"@\[\(\{&]/g,s_=/[\s-]/,c_=/[\s-]/g;function l_(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Zg:i_;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=l_(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Zg:a_.test(e.charAt(l-1))?(d*=$g,p=e.slice(i,l-1).match(o_),p&&i>0&&(d*=n_**+p.length)):s_.test(e.charAt(l-1))?(d*=Qg,m=e.slice(i,l-1).match(c_),m&&i>0&&(d*=n_**+m.length)):(d*=e_,i>0&&(d*=n_**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=r_)),(d<t_&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=l_(e,t,n,r,l+1,a+2,o),f*t_>d&&(d=f*t_)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function u_(e){return e.toLowerCase().replace(c_,` `)}function d_(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,l_(e,t,u_(e),u_(t),0,0,{})}var f_=`[cmdk-group=""]`,p_=`[cmdk-group-items=""]`,m_=`[cmdk-group-heading=""]`,h_=`[cmdk-item=""]`,g_=`${h_}:not([aria-disabled="true"])`,__=`cmdk-item-select`,v_=`data-value`,y_=(e,t,n)=>d_(e,t,n),b_=p.createContext(void 0),x_=()=>p.useContext(b_),S_=p.createContext(void 0),C_=()=>p.useContext(S_),w_=p.createContext(void 0),T_=p.forwardRef((e,t)=>{let n=z_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=z_(()=>new Set),i=z_(()=>new Map),a=z_(()=>new Map),o=z_(()=>new Set),s=L_(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=di(),b=di(),x=di(),S=p.useRef(null),C=H_();R_(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),R_(()=>{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??y_;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(p_);t?t.appendChild(e.parentElement===t?e:e.closest(`${p_} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${p_} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${f_}[${v_}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(v_);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(f_)?.querySelector(m_))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${h_}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(g_)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(v_))}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(v_))}function F(e){let t=j()?.closest(f_),n;for(;t&&!n;)t=e>0?F_(t,f_):I_(t,f_),n=t?.querySelector(g_);n?w.setState(`value`,n.getAttribute(v_)):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(Hr.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(__);t.dispatchEvent(e)}}}}},p.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:G_},c),W_(e,e=>p.createElement(S_.Provider,{value:w},p.createElement(b_.Provider,{value:T},e))))}),E_=p.forwardRef((e,t)=>{let n=di(),r=p.useRef(null),i=p.useContext(w_),a=x_(),o=L_(e),s=o.current?.forceMount??i?.forceMount;R_(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=V_(n,r,[e.value,e.children,r],e.keywords),l=C_(),u=B_(e=>e.value&&e.value===c.current),d=B_(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(__,f),()=>t.removeEventListener(__,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(Hr.div,{ref:Mr(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)}),D_=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=di(),s=p.useRef(null),c=p.useRef(null),l=di(),u=x_(),d=B_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);R_(()=>u.group(o),[]),V_(o,s,[e.value,e.heading,c]);let f=p.useMemo(()=>({id:o,forceMount:i}),[i]);return p.createElement(Hr.div,{ref:Mr(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),W_(e,e=>p.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},p.createElement(w_.Provider,{value:f},e))))}),O_=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=p.useRef(null),a=B_(e=>!e.search);return!n&&!a?null:p.createElement(Hr.div,{ref:Mr(i,t),...r,"cmdk-separator":``,role:`separator`})}),k_=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=C_(),o=B_(e=>e.search),s=B_(e=>e.selectedItemId),c=x_();return p.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),p.createElement(Hr.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)}})}),A_=p.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=p.useRef(null),o=p.useRef(null),s=B_(e=>e.selectedItemId),c=x_();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(Hr.div,{ref:Mr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},W_(e,e=>p.createElement(`div`,{ref:Mr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),j_=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return p.createElement(us,{open:n,onOpenChange:r},p.createElement(ds,{container:o},p.createElement(fs,{"cmdk-overlay":``,className:i}),p.createElement(ps,{"aria-label":e.label,"cmdk-dialog":``,className:a},p.createElement(T_,{ref:t,...s}))))}),M_=p.forwardRef((e,t)=>B_(e=>e.filtered.count===0)?p.createElement(Hr.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),N_=p.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return p.createElement(Hr.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},W_(e,e=>p.createElement(`div`,{"aria-hidden":!0},e)))}),P_=Object.assign(T_,{List:A_,Item:E_,Input:k_,Group:D_,Separator:O_,Dialog:j_,Empty:M_,Loading:N_});function F_(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function I_(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function L_(e){let t=p.useRef(e);return R_(()=>{t.current=e}),t}var R_=typeof window>`u`?p.useEffect:p.useLayoutEffect;function z_(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function B_(e){let t=C_(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function V_(e,t,n,r=[]){let i=p.useRef(),a=x_();return R_(()=>{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(v_,s),i.current=s}),i}var H_=()=>{let[e,t]=p.useState(),n=z_(()=>new Map);return R_(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function U_(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function W_({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(U_(t),{ref:t.ref},n(t.props.children)):n(t)}var G_={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},K_=e=>(0,X.jsx)(us,{"data-slot":`dialog`,...e}),q_=e=>(0,X.jsx)(ds,{"data-slot":`dialog-portal`,...e}),J_=e=>(0,X.jsx)(gs,{"data-slot":`dialog-close`,...e}),Y_=({className:e,...t})=>(0,X.jsx)(fs,{"data-slot":`dialog-overlay`,className:Z(`fixed inset-0 isolate z-50 bg-black/70 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t}),X_=({className:e,children:t,showCloseButton:n=!0,overlayClassName:r,...i})=>(0,X.jsxs)(q_,{children:[(0,X.jsx)(Y_,{className:r}),(0,X.jsxs)(ps,{"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)(gs,{"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)(Xg,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]}),Z_=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`dialog-header`,className:Z(`flex flex-col gap-1.5`,e),...t}),Q_=({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)(gs,{asChild:!0,children:(0,X.jsx)(Q,{variant:`outline`,children:`Close`})})]}),$_=({className:e,...t})=>(0,X.jsx)(ms,{"data-slot":`dialog-title`,className:Z(`font-heading text-base leading-none font-medium`,e),...t}),ev=({className:e,...t})=>(0,X.jsx)(hs,{"data-slot":`dialog-description`,className:Z(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t}),tv=(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})),nv=(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}));nv.displayName=`Textarea`;function rv({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 iv=Ar(`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 av({className:e,align:t=`inline-start`,...n}){return(0,X.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Z(iv({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var ov=Ar(`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 sv({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(ov({size:r}),e),...i})}function cv({className:e,...t}){return(0,X.jsx)(tv,{"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 lv({className:e,...t}){return(0,X.jsx)(P_,{"data-slot":`command`,className:Z(`flex size-full flex-col overflow-hidden rounded-4xl bg-popover p-1 text-popover-foreground`,e),...t})}function uv({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,X.jsxs)(rv,{className:`h-9 bg-input/50`,children:[(0,X.jsx)(P_.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)(av,{children:(0,X.jsx)(Hg,{className:`size-4 shrink-0 opacity-50`})})]})})}function dv({className:e,...t}){return(0,X.jsx)(P_.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 fv({className:e,...t}){return(0,X.jsx)(P_.Empty,{"data-slot":`command-empty`,className:Z(`py-6 text-center text-sm`,e),...t})}function pv({className:e,...t}){return(0,X.jsx)(P_.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 mv({className:e,children:t,...n}){return(0,X.jsxs)(P_.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)(ag,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function hv({className:e,...t}){return(0,X.jsx)(qf,{"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 gv=e=>(0,X.jsx)(bp,{"data-slot":`popover`,...e}),_v=e=>(0,X.jsx)(xp,{"data-slot":`popover-trigger`,...e}),vv=({className:e,align:t=`center`,sideOffset:n=4,...r})=>(0,X.jsx)(Sp,{children:(0,X.jsx)(Cp,{"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})}),yv=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`popover-header`,className:Z(`flex flex-col gap-1 text-sm`,e),...t}),bv=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`popover-title`,className:Z(`font-heading text-base font-medium`,e),...t}),qee=/[\s\-_/.:]+/,Jee=/\d(?:[._:-]*\d)+/g,xv=e=>e.toLowerCase().trim().split(qee).filter(Boolean),Yee=(e,t)=>t===e?300:t.startsWith(e)?200:e.length>=3&&t.includes(e)?100:0,Xee=e=>(e.toLowerCase().match(Jee)??[]).map(e=>e.replace(/\D/g,``)).filter(e=>e.length>=2),Zee=e=>/^\d+$/.test(e),Qee=(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},Sv=(e,t)=>{let n=xv(e);if(n.length===0)return 1;let r=t.flatMap(e=>xv(e??``)),i=[...new Set(t.flatMap(e=>Xee(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=Yee(e,n);r>t&&(t=r)}if(t===0&&Zee(e)&&(t=Qee(e,i)),t===0)return 0;a+=t}return a},Cv=({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)(hv,{className:Z(`text-xs font-medium text-muted-foreground`,s),htmlFor:r,children:e}),(0,X.jsxs)(gv,{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)(og,{className:`h-4 w-4 text-muted-foreground`})]})})}),(0,X.jsx)(vv,{side:g?`top`:`bottom`,align:`start`,className:Z(`w-[var(--radix-popover-trigger-width)] p-0`,c),children:(0,X.jsxs)(lv,{filter:(e,t,n)=>Sv(t,[e,...n??[]]),children:[y&&(0,X.jsx)(uv,{placeholder:`Filter...`}),(0,X.jsxs)(dv,{className:`max-h-72`,children:[(0,X.jsx)(fv,{children:`No matches`}),i.map((e,t)=>e.options.length===0?null:(0,X.jsx)(pv,{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)(mv,{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}`))]})]})})]})]})},wv=({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)(Cv,{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})=>{let u=(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]),d=e||`Use default model`;return t?(0,X.jsx)(`div`,{className:Z(c),children:(0,X.jsx)(wv,{label:a,triggerLabel:d,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:`Use default model`}]},...u.map(e=>({label:e.provider,options:e.models}))]})}):null},Ev=({variant:e,selectedModel:t,showVariantSelector:n,onVariantChange:r,selectId:i,label:a=`Variant`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l})=>{if(!n||!t)return null;let u=e||`Use model default`;return(0,X.jsx)(`div`,{className:Z(c),children:(0,X.jsx)(wv,{label:a,triggerLabel:u,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:`Use model default`}]},{label:`Available levels`,options:t.variants.map(e=>({value:e,label:e}))}]})})},Dv=({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 d=n.find(t=>t.id===e)??null,f=n.length>0,p=d!==null&&d.variants.length>0;return(0,X.jsxs)(`div`,{className:Z(`rounded-2xl border border-border/70 bg-background/25 p-4`,c),children:[u&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:`Helper model`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Used for auto-config and other lightweight project tasks. Leave empty to use the selected tool's default model.`})]}),r?(0,X.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,u?`mt-4`:``),children:`Loading OpenCode models...`}):f?(0,X.jsxs)(`div`,{className:Z(u?`mt-4`:``,`gap-3`,l?`flex flex-col`:`flex flex-wrap`),children:[(0,X.jsx)(Tv,{model:e,showModelSelector:f,availableModels:n,onModelChange:i,selectId:o,className:l?`min-w-0`:`min-w-[10rem] flex-[1.35_1_10rem]`}),p&&(0,X.jsx)(Ev,{variant:t,selectedModel:d,showVariantSelector:p,onVariantChange:a,selectId:s,className:l?`min-w-0`:`min-w-[7rem] flex-[0.7_1_7rem]`})]}):(0,X.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,u?`mt-4`:``),children:`OpenCode model discovery is unavailable right now. Leave this empty to use the selected tool's default model.`})]})},$ee=({delayDuration:e=0,...t})=>(0,X.jsx)(mee,{"data-slot":`tooltip-provider`,delayDuration:e,...t}),ete=e=>(0,X.jsx)(hee,{"data-slot":`tooltip`,...e}),tte=e=>(0,X.jsx)(gee,{"data-slot":`tooltip-trigger`,...e}),nte=({className:e,sideOffset:t=8,children:n,...r})=>(0,X.jsx)(_ee,{children:(0,X.jsxs)(vee,{"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)(yee,{className:`fill-popover`})]})}),Ov=({content:e,children:t,align:n,side:r,sideOffset:i,disabled:a=!1,contentClassName:o,delayDuration:s=0})=>(0,X.jsx)($ee,{delayDuration:s,disableHoverableContent:!0,children:(0,X.jsxs)(ete,{children:[(0,X.jsx)(tte,{asChild:!0,children:t}),a?null:(0,X.jsx)(nte,{className:o,align:n,side:r,sideOffset:i??8,children:e})]})}),kv=({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)(Ov,{content:t.inactiveTooltip,children:a},t.value)})}),rte=({activeTool:e,onChange:t})=>(0,X.jsx)(kv,{value:e,items:[{value:`opencode`,label:`OpenCode`},{value:`claude`,label:`Claude`}],onChange:t}),ite=({activeTool:e,availableHelperModels:t,helperModel:n,helperVariant:r,isHelperModelsLoaded:i,isToolLoaded:a,onCreateProject:o,onHelperModelChange:s,onHelperVariantChange:c,onToolChange:l})=>{let{t:u}=He(`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:u(`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:u(`emptyState.description`)}),a?(0,X.jsx)(`div`,{className:`w-fit`,children:(0,X.jsx)(rte,{activeTool:e,onChange:l})}):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u(`emptyState.loadingToolPreference`)}),(0,X.jsx)(Dv,{helperModel:n,helperVariant:r,availableModels:t,isLoadingModels:!i,onHelperModelChange:s,onHelperVariantChange:c,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:o,variant:`success`,size:`lg`,children:u(`emptyState.createFirstProject`)})})]})})},Av=({className:e})=>(0,X.jsx)(og,{"aria-hidden":`true`,className:e}),jv=({className:e})=>(0,X.jsx)(Lg,{"aria-hidden":`true`,className:e}),ate=({className:e})=>(0,X.jsx)(Ug,{"aria-hidden":`true`,className:e}),ote=({activeProjectId:e,onCreateProject:t,projects:n,onEditProject:r,onProjectChange:i})=>{let{t:a}=He(`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)(gv,{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)(Av,{className:`h-4 w-4`})})]})})}),(0,X.jsxs)(vv,{side:c?`top`:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:[(0,X.jsxs)(lv,{filter:(e,t,n)=>Sv(t,[e,...n??[]]),children:[f&&(0,X.jsx)(uv,{placeholder:a(`identity.filterPlaceholder`)}),(0,X.jsxs)(dv,{className:`max-h-72`,children:[(0,X.jsx)(fv,{children:a(`identity.emptySearch`)}),(0,X.jsx)(pv,{children:n.map(t=>(0,X.jsx)(mv,{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)(jv,{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)(ate,{className:`h-4 w-4`})})]})};function ste({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:Z(`animate-pulse rounded-2xl bg-muted`,e),...t})}var Mv=({className:e=``})=>(0,X.jsx)(ste,{"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)}),Nv=({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)(Mv,{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]})]})},Pv=({className:e})=>(0,X.jsx)(Eg,{"aria-hidden":`true`,className:e}),Fv=({className:e})=>(0,X.jsx)(_g,{"aria-hidden":`true`,className:e}),Iv=({className:e})=>(0,X.jsx)(bg,{"aria-hidden":`true`,className:e}),Lv=({className:e})=>(0,X.jsx)(tg,{"aria-hidden":`true`,className:e}),Rv=({className:e})=>(0,X.jsx)(Dg,{"aria-hidden":`true`,className:e}),zv=({className:e})=>(0,X.jsx)(Ig,{"aria-hidden":`true`,className:e}),Bv=({className:e})=>(0,X.jsx)(bg,{"aria-hidden":`true`,className:e}),Vv=({className:e})=>(0,X.jsx)(Kg,{"aria-hidden":`true`,className:e}),Hv=({className:e})=>(0,X.jsx)(qg,{"aria-hidden":`true`,className:e});function cte(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 lte=e=>{switch(e){case`success`:return fte;case`info`:return mte;case`warning`:return pte;case`error`:return hte;default:return null}},ute=Array(12).fill(0),dte=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},ute.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),fte=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`})),pte=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`})),mte=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`})),hte=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`})),gte=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`})),_te=()=>{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},Uv=1,Wv=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:Uv++,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(yte(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||Uv++;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}},vte=(e,t)=>{let n=t?.id||Uv++;return Wv.addToast({title:e,...t,id:n}),n},yte=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,$=Object.assign(vte,{success:Wv.success,info:Wv.info,warning:Wv.warning,error:Wv.error,custom:Wv.custom,message:Wv.message,promise:Wv.promise,dismiss:Wv.dismiss,loading:Wv.loading},{getHistory:()=>Wv.toasts,getToasts:()=>Wv.getActiveToasts()});cte(`[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 Gv(e){return e.label!==void 0}var bte=3,xte=`24px`,Ste=`16px`,Kv=4e3,Cte=356,wte=14,Tte=45,Ete=200;function qv(...e){return e.filter(Boolean).join(` `)}function Dte(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Ote=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,B]=p.useState(!1),[V,H]=p.useState(0),[U,W]=p.useState(0),G=p.useRef(n.duration||b||Kv),K=p.useRef(null),ee=p.useRef(null),te=c===0,ne=c+1<=o,re=n.type,ie=n.dismissible!==!1,ae=n.className||``,oe=n.descriptionClassName||``,se=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ce=p.useMemo(()=>n.closeButton??m,[n.closeButton,m]),le=p.useMemo(()=>n.duration||b||Kv,[n.duration,b]),ue=p.useRef(0),de=p.useRef(0),fe=p.useRef(0),pe=p.useRef(null),[me,he]=x.split(`-`),ge=p.useMemo(()=>s.reduce((e,t,n)=>n>=se?e:e+t.height,0),[s,se]),_e=_te(),ve=n.invert||t,ye=re===`loading`;de.current=p.useMemo(()=>se*S+ge,[se,ge]),p.useEffect(()=>{G.current=le},[le]),p.useEffect(()=>{M(!0)},[]),p.useEffect(()=>{let e=ee.current;if(e){let t=e.getBoundingClientRect().height;return W(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=ee.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,W(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 be=p.useCallback(()=>{P(!0),H(de.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Ete)},[n,d,a,de]);p.useEffect(()=>{if(n.promise&&re===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||_e?(()=>{if(fe.current<ue.current){let e=new Date().getTime()-ue.current;G.current-=e}fe.current=new Date().getTime()})():G.current!==1/0&&(ue.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),be()},G.current)),()=>clearTimeout(e)},[u,i,n,re,_e,be]),p.useEffect(()=>{n.delete&&(be(),n.onDismiss==null||n.onDismiss.call(n,n))},[be,n.delete]);function xe(){return T?.loading?p.createElement(`div`,{className:qv(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":re===`loading`},T.loading):p.createElement(dte,{className:qv(w?.loader,n?.classNames?.loader),visible:re===`loading`})}let Se=n.icon||T?.[re]||lte(re);return p.createElement(`li`,{tabIndex:0,ref:ee,className:qv(v,ae,w?.toast,n?.classNames?.toast,w?.default,w?.[re],n?.classNames?.[re]),"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":ne,"data-y-position":me,"data-x-position":he,"data-index":c,"data-front":te,"data-swiping":F,"data-dismissible":ie,"data-type":re,"data-invert":ve,"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?V:de.current}px`,"--initial-height":C?`auto`:`${U}px`,...h,...n.style},onDragEnd:()=>{I(!1),O(null),pe.current=null},onPointerDown:e=>{e.button!==2&&(ye||!ie||(K.current=new Date,H(de.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),pe.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!ie)return;pe.current=null;let e=Number(ee.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ee.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-K.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Tte||a>.11){H(de.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),be(),R(!0);return}else{var o,s;(o=ee.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ee.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}B(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!pe.current||!ie||window.getSelection()?.toString().length>0)return;let i=t.clientY-pe.current.y,a=t.clientX-pe.current.x,o=e.swipeDirections??Dte(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)&&B(!0),(n=ee.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ee.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ce&&!n.jsx&&re!==`loading`?p.createElement(`button`,{"aria-label":E,"data-disabled":ye,"data-close-button":!0,onClick:ye||!ie?()=>{}:()=>{be(),n.onDismiss==null||n.onDismiss.call(n,n)},className:qv(w?.closeButton,n?.classNames?.closeButton)},T?.close??gte):null,(re||n.icon||n.promise)&&n.icon!==null&&(T?.[re]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:qv(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||xe():null,n.type===`loading`?null:Se):null,p.createElement(`div`,{"data-content":``,className:qv(w?.content,n?.classNames?.content)},p.createElement(`div`,{"data-title":``,className:qv(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:qv(y,oe,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),p.isValidElement(n.cancel)?n.cancel:n.cancel&&Gv(n.cancel)?p.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{Gv(n.cancel)&&ie&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),be())},className:qv(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,p.isValidElement(n.action)?n.action:n.action&&Gv(n.action)?p.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||_,onClick:e=>{Gv(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&be())},className:qv(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Jv(){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 kte(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Ste:xte;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 Ate=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:_=bte,toastOptions:v,dir:y=Jv(),gap:b=wte,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||Wv.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return p.useEffect(()=>Wv.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`?Jv():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":`${Cte}px`,"--gap":`${b}px`,...g,...kte(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(Ote,{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}))}),Yv=({className:e})=>(0,X.jsx)(yg,{"aria-hidden":`true`,className:e}),jte=(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},Xv=12,Zv=e=>({x:e.left+e.width/2,y:e.top+e.height/2}),Qv=e=>`${e.blocker_ticket_id}:${e.dependent_ticket_id}`,$v=(e,t)=>e.filter(e=>e.blocker_ticket_id!==t&&e.dependent_ticket_id!==t),ey=(e,t)=>{let n=e.filter(e=>Qv(e)!==Qv(t));return n.push(t),n.sort((e,t)=>Qv(e).localeCompare(Qv(t))),n},ty=(e,t,n)=>e.filter(e=>!(e.blocker_ticket_id===t&&e.dependent_ticket_id===n)),ny=(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},ry=(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`}:ny(e,t,n)?{valid:!1,reason:`cycle`}:{valid:!0},iy=e=>e===`self`?`A ticket cannot depend on itself.`:e===`duplicate`?`This dependency already exists.`:`This dependency would create a cycle.`,ay=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,oy=e=>!e||e.has_worktree===!1?!1:e.run_setup_status===`ready`?!0:ay(e),sy=e=>{if(!(!e||e.has_worktree===!1)){if(e.run_setup_status===`preparing`)return`Setting up worktree...`;if(!oy(e))return`Run unlocks after setup finishes.`}},cy=(e,t,n)=>n.filter(t=>t.dependent_ticket_id===e.id).map(e=>t.get(e.blocker_ticket_id)).filter(e=>!!e&&!ay(e)),ly=(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},uy=(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&&jte(r,o)<0){e.splice(a,0,t),i=!0;break}}i||e.push(t)},dy=(e,t,n)=>{if(!t.get(e))return[];let r=ly(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&&uy(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&&uy(c,n,t)}}}return l.map(e=>t.get(e)).filter(e=>!!e)},fy=(e,t,n)=>{let r=dy(e.id,t,n),i=r.filter(e=>!ay(e)),a=r.length>1,o=cy(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}},py=(e,t)=>{let n=Zv(e),r=Zv(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-Xv},end:{x:r.x,y:t.top+Xv}}:{start:{x:n.x,y:e.top+Xv},end:{x:r.x,y:s-Xv}}:r.x>=n.x?{start:{x:i-Xv,y:n.y},end:{x:t.left+Xv,y:r.y}}:{start:{x:e.left+Xv,y:n.y},end:{x:a-Xv,y:r.y}}},my=(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)}},hy={plan:0,build:1,review:2},gy={plan:`build`,build:`review`},_y=e=>gy[e]??null,vy=e=>e===`plan`?`plan`:e===`build`||e===`review`||e===`done`?`build`:`default`,yy=e=>e.worktree_bundle_id??e.id,by=(e,t)=>{if(!e)return null;let n=t.find(t=>t.id===e.ticket_id);return n?yy(n):e.ticket_id},xy=({bundleId:e,activeRunContextKey:t,isProjectRootRunActive:n})=>n?!0:t!==null&&t!==e,Sy=(e,t,n,r)=>n||t!==null&&t!==yy(e)?r:sy(e),Cy=(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,wy=(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)))},Ty=e=>e.state===`build`||e.state===`review`&&e.review_follow_up_active===!0,Ey=e=>e.state===`review`&&e.review_follow_up_active!==!0,Dy=e=>e.parked_at!==null,Oy=e=>Dy(e)?`done`:e.state,ky=e=>e.is_stale===!0,Ay=e=>e?e.files_changed===0&&e.additions===0&&e.deletions===0:!1,jy=(e,t)=>!t||e===`plan`?!1:!(e===`done`&&Ay(t)),My=e=>Dy(e)||e.agent_status===`running`?!1:e.state===`build`?e.agent_status===`done`:e.state===`review`,Ny=(e,t)=>Dy(e)&&e.state===t,Py=e=>e.tickets.length>0&&e.tickets.every(e=>By(e,`trash`)),Fy=e=>e.tickets.length>0&&e.tickets.every(e=>By(e,`done`)),Iy=e=>e.column===`done`&&e.tickets.length>0&&e.tickets.every(e=>e.state!==`plan`),Ly=(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}:{},Ry=(e,t)=>e===`plan`&&t===`build`?`build`:e===`build`&&t===`review`?`review`:e===`review`&&t===`build`?`undoReview`:null,zy=(e,t,n)=>t===`review`&&n===`build`?{}:Ly(e,n),By=(e,t)=>e.agent_status===`running`?!1:t===`done`?My(e):!(t!==`trash`&&hy[t]<=hy[e.state]||t===`review`&&(e.state!==`build`||e.agent_status!==`done`&&e.agent_status!==`stopped`)),Vy=e=>{let t=_y(e.state);return!t||By(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},Hy=[...[`plan`,`build`,`review`],`done`],Uy=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}),Wy=(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},Gy=e=>e.kind===`project_root`?!0:e.has_prepared_worktree!==!1,Ky=e=>e.filter(e=>e.kind!==`project_root`&&Gy(e)),qy=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,Jy=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,Yy=e=>e.has_worktree??!!(e.bundle?.branch??e.branch),Xy=(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=Jy(e),a=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId&&e.session_id)??null:qy(e),o=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId)??null:null;return n??r??i??a??o??e.find(e=>Yy(e))??e.find(e=>e.state!==`plan`)??e[0]??null},Zy=(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=Wy(t[0],r);return i?[{kind:`bundle`,group:{id:`${i.id}:${n}`,bundle:i,column:n,tickets:Uy(t)}}]:t.map(e=>({kind:`ticket`,ticket:e}))})},Qy=e=>`bundle-group:${e.id}`,$y=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(Oy(n));continue}t.set(n.worktree_bundle_id,new Set([Oy(n)]))}let n=new Set;for(let[e,r]of t)r.size>=2&&n.add(e);return n},eb=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 Hy.includes(i)?{bundleId:r,column:i}:null},tb=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()},nb=(e,t)=>{let n=tb(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},rb=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?e.name??``:e.branch??``;let t=tb(e.name||e.branch||``);return e.branch?nb(t,e.branch):t},ib=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?`Project root`:`Project root (${e.branch})`;let t=rb(e),n=e.branch??``,r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return t===``||n===``?t||n:r===i?t:`${t} (${n})`},ab=(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`,ob=({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}=He(`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)(()=>Ky(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?ib(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)(()=>ab(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`,B=!g||!z||!!m?.rebase_disabled_reason||h!==null||C;(0,p.useEffect)(()=>{y&&S(t?.branch??``)},[t?.branch,y]);let V=e=>{b(e),u?.(e)},H=()=>{c&&V(!1)},U=async e=>{w(!0);try{await d(e)&&H()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.bundleSwitch`))}finally{w(!1)}},W=async(e,t)=>{w(!0);try{await f(e,t)&&H()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.repoRootSwitch`))}finally{w(!1)}},G=async()=>{if(g){w(!0);try{await g(),V(!1)}catch(e){$.error(e instanceof Error?e.message:v(`projectFooter.rebaseFallbackError`))}finally{w(!1)}}};return(0,X.jsxs)(gv,{open:y,onOpenChange:V,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)(Mv,{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)(Yv,{className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate font-medium`,children:A})]})})}),(0,X.jsx)(vv,{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)(hv,{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)(lv,{className:`rounded-xl border border-border/70 bg-background/40 p-0`,label:v(`projectTargetSelector.searchAriaLabel`),shouldFilter:!0,children:[(0,X.jsx)(uv,{placeholder:v(`projectTargetSelector.searchPlaceholder`),"aria-label":v(`projectTargetSelector.searchAriaLabel`)}),(0,X.jsxs)(dv,{className:`max-h-56 p-1`,"data-testid":`project-target-options`,children:[(0,X.jsx)(fv,{children:v(N?`projectTargetSelector.loadingTargets`:`projectTargetSelector.noSearchResults`)}),(0,X.jsxs)(mv,{value:`${v(`projectTargetSelector.repoRoot`)} ${k??``}`,"data-checked":E,disabled:N||C,"aria-label":`${j}. ${E?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{W(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=rb(t),r=ib(t),i=e.active_target_kind===`bundle`&&e.active_target_bundle_id===t.id;return(0,X.jsxs)(mv,{value:r,"data-checked":i,disabled:N||C,"aria-label":`${r}. ${i?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{U(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)(Rv,{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:()=>{V(!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)(hv,{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:()=>{W(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)(hv,{htmlFor:`project-target-branch-input`,className:`text-xs text-muted-foreground`,children:v(`projectTargetSelector.switchOrCreateBranch`)}),(0,X.jsx)(tv,{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:()=>{W(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)(hv,{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:B,title:m?.rebase_disabled_reason??void 0,onClick:()=>{G()},children:[(0,X.jsx)(`span`,{children:R}),h===`rebase`&&(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`})]})]})]})})]})},sb=(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,cb=({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}=He(`common`),j=r?.operation_state??`idle`,M=!!(e&&r&&r.behind>0&&j===`idle`),N=(()=>{let e=sb(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`,B=A(j===`merge`?`projectFooter.abortMerge`:`projectFooter.abortRebase`),V=!!e,H=!!(e&&n?.diffStats?.is_dirty),U=A(l?`workspaceControls.hideTerminalAriaLabel`:`workspaceControls.openTerminalAriaLabel`),W=e?.active_target_kind??`repo_root`,G=e?.active_target_bundle_id??null,K=W!==`bundle`||f.some(e=>e.id===G&&e.has_prepared_worktree===!0),ee=e!==null&&t?.kind===`project`&&t.project_id===e.id&&(t.target_kind??`repo_root`)===W&&((t.target_kind??`repo_root`)!==`bundle`||t.target_bundle_id===G),te=e!==null&&!ee&&(!i||!c),ne=!e||!ee&&(!s||t!==null||te),re=A(ee?`projectFooter.stop`:`projectFooter.run`),ie=(()=>{if(!e)return A(`projectFooter.selectProjectFirst`);if(!ee){if(!s)return A(`projectFooter.addRunConfig`);if(te)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)(ob,{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)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Vv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:I?A(`projectFooter.aborting`):B})]}),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)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Bv,{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:[H&&n?.diffStats&&(0,X.jsx)(Nv,{stats:n.diffStats,showFiles:!0,className:`text-xs`}),V&&(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)(Iv,{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)(Fv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.files`)})]})]}),(d||u)&&K&&(0,X.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.verification`),onClick:y,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(Pv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.verification`)})]}),(0,X.jsxs)(Q,{type:`button`,"aria-label":U,"aria-pressed":l,onClick:w,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(Hv,{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)(Lv,{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:ne,title:ie,onClick:C,variant:ee?`destructive`:`secondary`,className:[`gap-2`,ee?``:`bg-sky-700 text-sky-100 hover:bg-sky-600 hover:text-white`,ne?`bg-slate-700 text-slate-400 hover:bg-slate-700 hover:text-slate-400`:``].join(` `),children:[ee&&(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`}),ee?(0,X.jsx)(Vv,{className:`h-4 w-4`}):(0,X.jsx)(zv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:re})]})]})]})})},lb=e=>(0,X.jsx)(Bf,{"data-slot":`dropdown-menu`,...e}),ub=e=>(0,X.jsx)(Vf,{"data-slot":`dropdown-menu-trigger`,...e}),db=({className:e,align:t=`end`,sideOffset:n=6,...r})=>(0,X.jsx)(Hf,{children:(0,X.jsx)(Uf,{"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})}),fb=({className:e,inset:t=!1,...n})=>(0,X.jsx)(Wf,{"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}),pb=({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,mb=({className:e})=>(0,X.jsx)(Yg,{"aria-hidden":`true`,className:e}),hb=({className:e})=>(0,X.jsx)(Rg,{"aria-hidden":`true`,className:e}),gb=class extends Error{constructor(e){super(e),this.name=`UpgradeInProgressError`}},_b=async e=>{let t=await fetch(qe(`/tools/upgrade`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tool:e})});if(t.status===409)throw new gb(await Xe(t,`upgrade already running`));if(!t.ok)throw new Ge(await Xe(t,`Upgrade failed.`),t.status);return await t.json()},vb=({onUpgrade:e})=>{let{t}=He(`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 _b(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 gb){$.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)(fb,{disabled:i,onSelect:t=>{t.preventDefault(),a(e)},children:[i?(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(hb,{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`))]})}},yb=({onUpgrade:e})=>{let{t}=He(`common`),{renderUpgradeMenuItems:n}=vb({onUpgrade:e});return(0,X.jsxs)(lb,{children:[(0,X.jsx)(ub,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,"aria-label":t(`toolsMenu.triggerAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`rounded-xl border border-border/70`,children:(0,X.jsx)(mb,{className:`h-4 w-4`})})}),(0,X.jsx)(db,{align:`end`,className:`w-52`,children:n()})]})},bb=({className:e})=>(0,X.jsx)(ig,{"aria-hidden":`true`,className:e}),xb=({className:e})=>(0,X.jsx)(ag,{"aria-hidden":`true`,className:e}),Sb=({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`})}),Cb=({className:e})=>(0,X.jsx)(mg,{"aria-hidden":`true`,className:e}),wb={"X-Archon-Desktop-Action":`mobile-access`},Tb=e=>Y(qe(`/mobile-access/status`),{signal:e}),Eb=e=>Y(qe(`/mobile-access/enable`),{method:`POST`,headers:wb,body:e}),Db=()=>Y(qe(`/mobile-access/disable`),{method:`POST`,headers:wb}),Ob=e=>Y(qe(`/mobile-access/regenerate-pairing`),{method:`POST`,headers:wb,body:{preferred_project_id:e??null}}),kb=e=>Y(qe(`/mobile-access/sessions/${encodeURIComponent(e)}/revoke`),{method:`POST`,headers:wb}),Ab=new Set,jb=null,Mb=null,Nb=()=>{for(let e of Ab)e(jb)},Pb=()=>{Mb!==null&&(window.clearTimeout(Mb),Mb=null)},Fb=e=>{if(typeof window>`u`||(Pb(),e?.state!==`awaiting_pairing`||!e.pairing))return;let t=new Date(e.pairing.expires_at).getTime();if(Number.isNaN(t))return;let n=()=>{jb?.state!==`awaiting_pairing`||jb.pairing?.expires_at!==e.pairing?.expires_at||Ib({...jb,state:`expired`,pairing:null})},r=t-Date.now();if(r<=0){n();return}Mb=window.setTimeout(n,r)},Ib=e=>{jb=e,Fb(e),Nb()},Lb=async e=>{let t=await Tb(e);return Ib(t),t},Rb=()=>{let[e,t]=(0,p.useState)(jb);return(0,p.useEffect)(()=>(Ab.add(t),()=>{Ab.delete(t)}),[]),e},zb=e=>{(0,p.useEffect)(()=>{if(!e)return;let t=null,n=()=>{t?.abort(),t=new AbortController;let e=t;Lb(e.signal).catch(e=>{Ye(e)}).finally(()=>{t===e&&(t=null)})};n();let r=e=>{Ib(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])},Bb=`(min-width: 1440px)`,Vb=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches,Hb=e=>{let[t,n]=(0,p.useState)(()=>Vb(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},Ub=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`,Wb=(e,t)=>{if(!e||e.state===`disabled`){let n=t(`projectHeader.runtime.mobileDisabled`);return{buttonClassName:Ub(e),indicatorState:`inactive`,isActive:!1,statusLabel:n,tooltip:n}}if(e.state===`awaiting_pairing`){let n=t(`projectHeader.runtime.mobileReadyToPair`);return{buttonClassName:Ub(e),indicatorState:`running`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`connected`){let n=t(`projectHeader.runtime.mobileConnected`);return{buttonClassName:Ub(e),indicatorState:`finished`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`expired`){let n=t(`projectHeader.runtime.mobilePairingExpired`);return{buttonClassName:Ub(e),indicatorState:`interrupted`,isActive:!0,statusLabel:n,tooltip:n}}return{buttonClassName:Ub(e),indicatorState:`error`,isActive:!0,statusLabel:t(`projectHeader.runtime.mobileUnavailable`),tooltip:e.error??t(`projectHeader.runtime.mobileUnavailable`)}},Gb=(e,t)=>t(e===`opencode`?`projectHeader.agent.openCode`:`projectHeader.agent.claude`),Kb=({activeTool:e,onToolChange:t})=>{let{t:n}=He(`common`);return(0,X.jsx)(`div`,{role:`group`,"aria-label":n(`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:[`opencode`,`claude`].map(r=>{let i=e===r;return(0,X.jsx)(Q,{type:`button`,variant:i?`secondary`:`ghost`,size:`xs`,className:i?`rounded-lg px-2.5 text-xs text-foreground`:`rounded-lg px-2.5 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>t(r),children:Gb(r,n)},r)})})},qb=({activeTool:e,onToolChange:t})=>{let{t:n}=He(`common`);return(0,X.jsxs)(lb,{children:[(0,X.jsx)(ub,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":n(`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)(bb,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{children:Gb(e,n)}),(0,X.jsx)(Av,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,X.jsx)(db,{align:`end`,className:`w-44`,children:[`opencode`,`claude`].map(r=>{let i=e===r;return(0,X.jsxs)(fb,{onSelect:()=>t(r),children:[(0,X.jsx)(bb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:Gb(r,n)}),i&&(0,X.jsx)(xb,{className:`h-4 w-4 text-muted-foreground`})]},r)})})]})},Jb=({hasActiveGitHubRuns:e=!1,onOpenGitHubActions:t})=>{let{t:n}=He(`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)(Sb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:n(`workspaceControls.githubActions`)})]}),e&&(0,X.jsx)(pb,{state:`running`,className:`absolute -top-0.5 -right-0.5`})]}):null},Yb=({onOpenActivity:e})=>{let{t}=He(`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)(Cb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:t(`projectHeader.runtime.activityLabel`)})]}):null},Xb=({mobileAccessStatus:e,onMobileAccessOpen:t})=>{let{t:n}=He(`common`);if(!t)return null;let r=Wb(e,n);return(0,X.jsx)(Ov,{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)(pb,{state:r.indicatorState,className:`mt-0`}),(0,X.jsx)(`span`,{children:n(`projectHeader.runtime.mobileLabel`)})]})})},Zb=({hasActiveGitHubRuns:e=!1,mobileAccessStatus:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i})=>{let{t:a}=He(`common`),{hasRunningUpgrade:o,renderUpgradeMenuItems:s}=vb({}),c=Wb(t,a),l=a(`projectHeader.runtime.triggerLabel`),u=null;return i&&e?u=`running`:n&&c.isActive?(l=c.statusLabel,u=c.indicatorState):o&&(l=a(`projectHeader.runtime.toolUpdateRunning`),u=`running`),(0,X.jsxs)(lb,{children:[(0,X.jsx)(ub,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":a(`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)(mb,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{children:l}),u&&(0,X.jsx)(pb,{state:u,className:`absolute -top-0.5 -right-0.5`})]})}),(0,X.jsxs)(db,{align:`end`,className:`w-60`,children:[r&&(0,X.jsxs)(fb,{onSelect:r,children:[(0,X.jsx)(Cb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:a(`projectHeader.runtime.openActivity`)})]}),i&&(0,X.jsxs)(fb,{onSelect:i,children:[(0,X.jsx)(Sb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:a(`projectHeader.runtime.openGitHubActions`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a(e?`projectHeader.runtime.githubStatusRunning`:`projectHeader.runtime.githubStatusIdle`)})]}),n&&(0,X.jsxs)(fb,{onSelect:n,children:[(0,X.jsx)(pb,{state:c.indicatorState,className:`mt-0`}),(0,X.jsx)(`span`,{className:`flex-1`,children:a(`projectHeader.runtime.openMobileAccess`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c.statusLabel})]}),s()]})]})},Qb=({activeTool:e,hasActiveGitHubRuns:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onToolChange:a})=>{let o=Rb(),s=Hb(Bb);return(0,X.jsxs)(`div`,{className:`flex w-full min-w-0 items-center justify-end gap-2`,children:[s?(0,X.jsx)(Kb,{activeTool:e,onToolChange:a}):(0,X.jsx)(qb,{activeTool:e,onToolChange:a}),s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Jb,{hasActiveGitHubRuns:t,onOpenGitHubActions:i}),(0,X.jsx)(Yb,{onOpenActivity:r}),(0,X.jsx)(Xb,{mobileAccessStatus:o,onMobileAccessOpen:n}),(0,X.jsx)(yb,{})]}):(0,X.jsx)(Zb,{hasActiveGitHubRuns:t,mobileAccessStatus:o,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i})]})},$b=`border-sky-500/30 bg-sky-500/15 text-sky-100`,ex=`[--normal-bg:var(--info-bg)] [--normal-border:var(--info-border)] [--normal-text:var(--info-text)]`,tx=()=>(0,X.jsx)(Ate,{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:$b,loading:ex}}}),nx=300,rx=(e,t={})=>{let n=t.dedupeMs??nx,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)}},ix=6e4,ax=(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 ft(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()},ix),u=rx(()=>{o()});return()=>{n.abort(),window.clearInterval(c),u()}},[e,t,u]),{count:n,providers:i,loading:o,error:c,refresh:m}},ox=new Set,sx=new Map,cx=(e,t)=>{sx.set(e,t),ox.forEach(n=>n(e,t))},lx=e=>sx.has(e),ux=e=>{let[t,n]=(0,p.useState)(()=>e?sx.get(e)??[]:[]);return(0,p.useEffect)(()=>{if(!e){n([]);return}n(sx.get(e)??[]);let t=(t,r)=>{t===e&&n(r)};return ox.add(t),()=>{ox.delete(t)}},[e]),t},dx=Object.create(null);dx.open=`0`,dx.close=`1`,dx.ping=`2`,dx.pong=`3`,dx.message=`4`,dx.upgrade=`5`,dx.noop=`6`;var fx=Object.create(null);Object.keys(dx).forEach(e=>{fx[dx[e]]=e});var px={type:`error`,data:`parser error`},mx=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,hx=typeof ArrayBuffer==`function`,gx=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,_x=({type:e,data:t},n,r)=>mx&&t instanceof Blob?n?r(t):vx(t,r):hx&&(t instanceof ArrayBuffer||gx(t))?n?r(t):vx(new Blob([t]),r):r(dx[e]+(t||``)),vx=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function yx(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var bx;function xx(e,t){if(mx&&e.data instanceof Blob)return e.data.arrayBuffer().then(yx).then(t);if(hx&&(e.data instanceof ArrayBuffer||gx(e.data)))return t(yx(e.data));_x(e,!1,e=>{bx||=new TextEncoder,t(bx.encode(e))})}var Sx=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Cx=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Cx[Sx.charCodeAt(e)]=e;var wx=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=Cx[e.charCodeAt(r)],o=Cx[e.charCodeAt(r+1)],s=Cx[e.charCodeAt(r+2)],c=Cx[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},Tx=typeof ArrayBuffer==`function`,Ex=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:Ox(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Dx(e.substring(1),t)}:fx[n]?e.length>1?{type:fx[n],data:e.substring(1)}:{type:fx[n]}:px},Dx=(e,t)=>Tx?Ox(wx(e),t):{base64:!0,data:e},Ox=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},kx=``,Ax=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{_x(e,!1,e=>{r[a]=e,++i===n&&t(r.join(kx))})})},jx=(e,t)=>{let n=e.split(kx),r=[];for(let e=0;e<n.length;e++){let i=Ex(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Mx(){return new TransformStream({transform(e,t){xx(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 Nx;function Px(e){return e.reduce((e,t)=>e+t.length,0)}function Fx(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 Ix(e,t){Nx||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Px(n)<1)break;let e=Fx(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Px(n)<2)break;let e=Fx(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Px(n)<8)break;let e=Fx(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(px);break}i=a*2**32+t.getUint32(4),r=3}else{if(Px(n)<i)break;let e=Fx(n,i);s.enqueue(Ex(a?e:Nx.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(px);break}}}})}function Lx(e){if(e)return Rx(e)}function Rx(e){for(var t in Lx.prototype)e[t]=Lx.prototype[t];return e}Lx.prototype.on=Lx.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},Lx.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Lx.prototype.off=Lx.prototype.removeListener=Lx.prototype.removeAllListeners=Lx.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},Lx.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},Lx.prototype.emitReserved=Lx.prototype.emit,Lx.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},Lx.prototype.hasListeners=function(e){return!!this.listeners(e).length};var zx=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Bx=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),Vx=`arraybuffer`;function Hx(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Ux=Bx.setTimeout,Wx=Bx.clearTimeout;function Gx(e,t){t.useNativeTimers?(e.setTimeoutFn=Ux.bind(Bx),e.clearTimeoutFn=Wx.bind(Bx)):(e.setTimeoutFn=Bx.setTimeout.bind(Bx),e.clearTimeoutFn=Bx.clearTimeout.bind(Bx))}var Kx=1.33;function qx(e){return typeof e==`string`?Jx(e):Math.ceil((e.byteLength||e.size)*Kx)}function Jx(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 Yx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Xx(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function Zx(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 Qx=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},$x=class extends Lx{constructor(e){super(),this.writable=!1,Gx(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 Qx(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=Ex(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=Xx(e);return t.length?`?`+t:``}},eS=class extends $x{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){jx(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,Ax(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]=Yx()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},tS=!1;try{tS=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var nS=tS;function rS(){}var iS=class extends eS{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}},aS=class e extends Lx{constructor(e,t,n){super(),this.createRequest=e,Gx(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=Hx(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=rS,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(aS.requestsCount=0,aS.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,oS);else if(typeof addEventListener==`function`){let e=`onpagehide`in Bx?`pagehide`:`unload`;addEventListener(e,oS,!1)}}function oS(){for(let e in aS.requests)aS.requests.hasOwnProperty(e)&&aS.requests[e].abort()}var sS=(function(){let e=lS({xdomain:!1});return e&&e.responseType!==null})(),cS=class extends iS{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=sS&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new aS(lS,this.uri(),e)}};function lS(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||nS))return new XMLHttpRequest}catch{}if(!t)try{return new Bx[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var uS=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,dS=class extends $x{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=uS?{}:Hx(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;_x(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&zx(()=>{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]=Yx()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},fS=Bx.WebSocket||Bx.MozWebSocket,pS={websocket:class extends dS{createSocket(e,t,n){return uS?new fS(e,t,n):t?new fS(e,t):new fS(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends $x{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=Ix(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Mx();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&&zx(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:cS},mS=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,hS=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function gS(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=mS.exec(e||``),a={},o=14;for(;o--;)a[hS[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=_S(a,a.path),a.queryKey=vS(a,a.query),a}function _S(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 vS(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var yS=typeof addEventListener==`function`&&typeof removeEventListener==`function`,bS=[];yS&&addEventListener(`offline`,()=>{bS.forEach(e=>e())},!1);var xS=class e extends Lx{constructor(e,t){if(super(),this.binaryType=Vx,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=gS(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=gS(t.host).host);Gx(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=Zx(this.opts.query)),yS&&(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`})},bS.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+=qx(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,zx(()=>{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(),yS&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=bS.indexOf(this._offlineEventListener);e!==-1&&bS.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};xS.protocol=4;var SS=class extends xS{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;xS.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;xS.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}},CS=class extends SS{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=>pS[e]).filter(e=>!!e)),super(e,n)}};CS.protocol;function wS(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=gS(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 TS=typeof ArrayBuffer==`function`,ES=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,DS=Object.prototype.toString,OS=typeof Blob==`function`||typeof Blob<`u`&&DS.call(Blob)===`[object BlobConstructor]`,kS=typeof File==`function`||typeof File<`u`&&DS.call(File)===`[object FileConstructor]`;function AS(e){return TS&&(e instanceof ArrayBuffer||ES(e))||OS&&e instanceof Blob||kS&&e instanceof File}function jS(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(jS(e[t]))return!0;return!1}if(AS(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return jS(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&jS(e[t]))return!0;return!1}function MS(e){let t=[],n=e.data,r=e;return r.data=NS(n,t),r.attachments=t.length,{packet:r,buffers:t}}function NS(e,t){if(!e)return e;if(AS(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]=NS(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]=NS(e[r],t));return n}return e}function PS(e,t){return e.data=FS(e.data,t),delete e.attachments,e}function FS(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]=FS(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=FS(e[n],t));return e}var IS=r({Decoder:()=>BS,Encoder:()=>zS,PacketType:()=>RS,isPacketValid:()=>qS,protocol:()=>5}),LS=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],RS;(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`})(RS||={});var zS=class{constructor(e){this.replacer=e}encode(e){return(e.type===RS.EVENT||e.type===RS.ACK)&&jS(e)?this.encodeAsBinary({type:e.type===RS.EVENT?RS.BINARY_EVENT:RS.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===RS.BINARY_EVENT||e.type===RS.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=MS(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},BS=class e extends Lx{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===RS.BINARY_EVENT;n||t.type===RS.BINARY_ACK?(t.type=n?RS.EVENT:RS.ACK,this.reconstructor=new VS(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(AS(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(RS[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===RS.BINARY_EVENT||r.type===RS.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(!US(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 RS.CONNECT:return GS(t);case RS.DISCONNECT:return t===void 0;case RS.CONNECT_ERROR:return typeof t==`string`||GS(t);case RS.EVENT:case RS.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&LS.indexOf(t[0])===-1);case RS.ACK:case RS.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},VS=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=PS(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function HS(e){return typeof e==`string`}var US=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function WS(e){return e===void 0||US(e)}function GS(e){return Object.prototype.toString.call(e)===`[object Object]`}function KS(e,t){switch(e){case RS.CONNECT:return t===void 0||GS(t);case RS.DISCONNECT:return t===void 0;case RS.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&LS.indexOf(t[0])===-1);case RS.ACK:return Array.isArray(t);case RS.CONNECT_ERROR:return typeof t==`string`||GS(t);default:return!1}}function qS(e){return HS(e.nsp)&&WS(e.id)&&KS(e.type,e.data)}function JS(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var YS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),XS=class extends Lx{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=[JS(e,`open`,this.onopen.bind(this)),JS(e,`packet`,this.onpacket.bind(this)),JS(e,`error`,this.onerror.bind(this)),JS(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(YS.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:RS.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:RS.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 RS.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 RS.EVENT:case RS.BINARY_EVENT:this.onevent(e);break;case RS.ACK:case RS.BINARY_ACK:this.onack(e);break;case RS.DISCONNECT:this.ondisconnect();break;case RS.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:RS.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:RS.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 ZS(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}ZS.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},ZS.prototype.reset=function(){this.attempts=0},ZS.prototype.setMin=function(e){this.ms=e},ZS.prototype.setMax=function(e){this.max=e},ZS.prototype.setJitter=function(e){this.jitter=e};var QS=class extends Lx{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,Gx(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 ZS({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||IS;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 CS(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=JS(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=JS(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(JS(e,`ping`,this.onping.bind(this)),JS(e,`data`,this.ondata.bind(this)),JS(e,`error`,this.onerror.bind(this)),JS(e,`close`,this.onclose.bind(this)),JS(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){zx(()=>{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 XS(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)}},$S={};function eC(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=wS(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=$S[i]&&a in $S[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new QS(r,t):($S[i]||($S[i]=new QS(r,t)),c=$S[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(eC,{Manager:QS,Socket:XS,io:eC,connect:eC});var tC=((e=We)=>eC(e))(),nC=({className:e})=>(0,X.jsx)(xg,{"aria-hidden":`true`,className:e}),rC=({className:e})=>(0,X.jsx)(fg,{"aria-hidden":`true`,className:e}),iC=({className:e})=>(0,X.jsx)(Vg,{"aria-hidden":`true`,className:e}),aC=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},oC=({draft:e,onCreateTicket:t,onStartSpec:n})=>{let{t:r}=He(`common`),i=e.external_source.provider,a=r(i===`jira`?`assignedIssuesInbox.providerJira`:`assignedIssuesInbox.providerGithub`),o=r(i===`jira`?`assignedIssuesInbox.viewJira`:`assignedIssuesInbox.viewGithub`),s=aC(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)(iC,{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)(rC,{className:`h-3 w-3`}),o]})]})]})},sC=({projectId:e,onStartSpecFromDraft:t,onCreateTicketFromDraft:n})=>{let{t:r}=He(`common`),i=(ux(e)??[]).some(e=>e.status===`connected`),{count:a,refresh:o}=ax(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 pt(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 tC.on(`ticket:created`,t),()=>{tC.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)(gv,{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)(nC,{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)(vv,{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)(oC,{draft:e,onCreateTicket:v,onStartSpec:y},`${e.external_source.provider}:${e.external_source.external_key}`))})})]})]})},cC=({className:e})=>(0,X.jsx)(Xg,{"aria-hidden":`true`,className:e}),lC=[],uC=!1,dC=()=>{if(!(typeof window>`u`)){if(lC.length===0){uC&&=(window.removeEventListener(`keydown`,fC),!1);return}uC||=(window.addEventListener(`keydown`,fC),!0)}},fC=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=lC[lC.length-1];t&&t.onClose()},pC=(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 lC.push(e),dC(),()=>{let t=lC.findIndex(t=>t.id===e.id);t!==-1&&lC.splice(t,1),dC()}},[n])},mC=(...e)=>e.filter(Boolean).join(` `),hC=({children:e,onClose:t,overlayClassName:n,panelClassName:r,closeButtonClassName:i,closeButtonLabel:a=`Close modal`,renderContent:o})=>{pC(t);let s=(0,X.jsx)(Q,{type:`button`,"aria-label":a,variant:`ghost`,size:`icon-sm`,onClick:t,className:mC(`cursor-pointer text-muted-foreground hover:text-foreground`,i),children:(0,X.jsx)(cC,{className:`h-4 w-4`})});return(0,X.jsx)(`div`,{className:mC(`fixed inset-0 z-50 flex items-center justify-center`,n),children:(0,X.jsx)(`div`,{className:mC(`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]})})})},gC=({title:e,description:t,confirmLabel:n,cancelLabel:r,confirmVariant:i=`default`,onConfirm:a,onCancel:o})=>(0,X.jsxs)(hC,{onClose:o,overlayClassName:`bg-black/60`,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})]})]}),Mte=({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`})]})}),Nte=`common`,_C={en:{common:{appName:`Archon`,postBuildChecks:{blockedReason:`Wait for post-Build Checks to finish before sending another prompt.`,progress:`{{completed}} of {{total}} complete`,status:{queued:`Checks queued`,running:`Checks running`,waiting:`Checks waiting`,completed:`Checks passed`,failed:`Checks failed`,cancelled:`Checks stopped`,interrupted:`Checks interrupted`}},workspaceTabs:{ariaLabel:`Project workspace`,board:`Board`,chat:`Chat`,spec:`Spec`,memory:`Memory`},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`},kind:{test:`Tests`,check_batch:`Check batch`,check_attempt:`Check attempt`,check_repair:`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`,unknown:`Run`},status:{queued:`Queued`,running:`Running`,waiting:`Waiting`,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}}`,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.`,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`},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`,sourceUnavailable:`Source unavailable`,created:`Created`,started:`Started`,completed:`Completed`,failureReason:`Failure reason`,loading:`Loading run details...`,testEvidence:`Test evidence`,checkBatchEvidence:`Check batch`,checkAttemptEvidence:`Check attempt`,checkRepairEvidence:`Repair provenance`,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`,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`,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`}},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`,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`,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...`,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`,openQuestionsLabel:`Open Questions checkpoint`,openQuestionsDescription:`Pause before Review when Build has unresolved implementation questions.`,openQuestionsAriaLabel:`Open Questions checkpoint override`,enabled:`Enabled`,disabled:`Disabled`},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.`,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.`}}},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.`,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.`,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.`,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`,stopping:`Stopping...`,stop:`Stop`,collapseAriaLabel:`Collapse preview`,collapseTooltip:`Collapse`,expandAriaLabel:`Expand preview`,expandTooltip:`Expand`,closeAriaLabel:`Close preview`,closeTooltip:`Close`}},mobileApp:{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`},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...`,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.`,modeError:`Unable to update the spec mode 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`,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}}`},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.`,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`}},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.`,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.`},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...`,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`,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}}`,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 Relation Graph`,proposedTickets:`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`,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.`,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`,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`}},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`},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.`,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.`},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.`,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.`},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`,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}}`,projectPolicy:`Required policy: project policy`},gateTitle:`Automated delivery gate`,gatePassed:`Passed`,gateBlocked:`Blocked`,gateStale:`No longer current`,gateUnverifiable:`Unable to verify`,gatePolicy:`Policy {{fingerprint}}`,gateBoundary:`Boundary: {{boundary}}`,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...`,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.`},attempts:`Check attempts`,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`,command:`Command`,directory:`Directory`,targetRoot:`Target root`,outcome:`Outcome`,currencyLabel:`Currency`,output:`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...`,summary_one:`{{count}} structured diagnostic from {{parser}}`,summary_other:`{{count}} structured diagnostics from {{parser}}`,selectLegend:`Select diagnostics to repair`,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.`,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. Parser and count metadata remain available; repair is disabled.`,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 the owning ticket`,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`},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`},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.`},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:{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`},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.`,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.`,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`}},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`},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`},states:{loading:`Loading diff...`,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`,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`,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.`},services:{title:`Services`,description:`Add long-running commands that Archon should start automatically inside each worktree.`},checks:{title:`Checks`,description:`Configure commands and choose which checks must pass before delivery or also run before automatic Review.`},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.`,previewServiceRequired:`Choose a named service before enabling preview.`},actions:{cancel:`Cancel`,createProject:`Create project`,createProjectBusy:`Creating...`,saveChanges:`Save changes`,saveChangesBusy:`Saving...`}},advanced:{summary:{none:`None`,configured:`Configured`,toolDefault:`Tool default`,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 OpenCode model for auto-config and other lightweight project tasks.`},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:`Applies only to ticket worktree bundles, not the project root.`,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},cs=`DialogDescriptionWarning`,ls=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${os(cs).contentName}}.`;return p.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},us=Fo,ds=Vo,fs=Uo,ps=qo,ms=Qo,hs=es,gs=ns;function _s(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 vs(e){let[t,n]=p.useState(void 0);return $r(()=>{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 ys=[`top`,`right`,`bottom`,`left`],bs=Math.min,xs=Math.max,Ss=Math.round,Cs=Math.floor,ws=e=>({x:e,y:e}),Ts={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Es(e,t,n){return xs(e,bs(t,n))}function Ds(e,t){return typeof e==`function`?e(t):e}function Os(e){return e.split(`-`)[0]}function ks(e){return e.split(`-`)[1]}function As(e){return e===`x`?`y`:`x`}function js(e){return e===`y`?`height`:`width`}function Ms(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ns(e){return As(Ms(e))}function Ps(e,t,n){n===void 0&&(n=!1);let r=ks(e),i=Ns(e),a=js(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Us(o)),[o,Us(o)]}function Fs(e){let t=Us(e);return[Is(e),t,Is(t)]}function Is(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ls=[`left`,`right`],Rs=[`right`,`left`],zs=[`top`,`bottom`],Bs=[`bottom`,`top`];function Vs(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Rs:Ls:t?Ls:Rs;case`left`:case`right`:return t?zs:Bs;default:return[]}}function Hs(e,t,n,r){let i=ks(e),a=Vs(Os(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Is)))),a}function Us(e){let t=Os(e);return Ts[t]+e.slice(t.length)}function Ws(e){return{top:0,right:0,bottom:0,left:0,...e}}function Gs(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ws(e)}function Ks(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 qs(e,t,n){let{reference:r,floating:i}=e,a=Ms(t),o=Ns(t),s=js(o),c=Os(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(ks(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 Js(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}=Ds(t,e),p=Gs(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ks(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=Ks(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 Ys=50,Xs=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Js},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=qs(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<Ys&&(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}=qs(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Zs=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}=Ds(e,t)||{};if(l==null)return{};let d=Gs(u),f={x:n,y:r},p=Ns(i),m=js(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=Es(O,A,k),M=!c.arrow&&ks(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}}}),Qs=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}=Ds(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Os(r),_=Ms(o),v=Os(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Us(o)]:Fs(o)),x=p!==`none`;!d&&x&&b.push(...Hs(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=Ps(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`&&_!==Ms(t))||T.every(e=>Ms(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=Ms(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 $s(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ec(e){return ys.some(t=>e[t]>=0)}var tc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Ds(e,t);switch(i){case`referenceHidden`:{let e=$s(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ec(e)}}}case`escaped`:{let e=$s(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ec(e)}}}default:return{}}}}},nc=new Set([`left`,`top`]);async function rc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Os(n),s=ks(n),c=Ms(n)===`y`,l=nc.has(o)?-1:1,u=a&&c?-1:1,d=Ds(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 ic=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 rc(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}}}}},ac=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}=Ds(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ms(Os(i)),p=As(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=Es(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=Es(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}}}}}},oc=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}=Ds(e,t),u={x:n,y:r},d=Ms(i),f=As(d),p=u[f],m=u[d],h=Ds(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=nc.has(Os(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}}}},sc=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}=Ds(e,t),u=await o.detectOverflow(t,l),d=Os(i),f=ks(i),p=Ms(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=xs(u.left,0),t=xs(u.right,0),n=xs(u.top,0),r=xs(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:xs(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:xs(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 cc(){return typeof window<`u`}function lc(e){return fc(e)?(e.nodeName||``).toLowerCase():`#document`}function uc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dc(e){return((fc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fc(e){return cc()?e instanceof Node||e instanceof uc(e).Node:!1}function pc(e){return cc()?e instanceof Element||e instanceof uc(e).Element:!1}function mc(e){return cc()?e instanceof HTMLElement||e instanceof uc(e).HTMLElement:!1}function hc(e){return!cc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof uc(e).ShadowRoot}function gc(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Dc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _c(e){return/^(table|td|th)$/.test(lc(e))}function vc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yc=/transform|translate|scale|rotate|perspective|filter/,bc=/paint|layout|strict|content/,xc=e=>!!e&&e!==`none`,Sc;function Cc(e){let t=pc(e)?Dc(e):e;return xc(t.transform)||xc(t.translate)||xc(t.scale)||xc(t.rotate)||xc(t.perspective)||!Tc()&&(xc(t.backdropFilter)||xc(t.filter))||yc.test(t.willChange||``)||bc.test(t.contain||``)}function wc(e){let t=kc(e);for(;mc(t)&&!Ec(t);){if(Cc(t))return t;if(vc(t))return null;t=kc(t)}return null}function Tc(){return Sc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sc}function Ec(e){return/^(html|body|#document)$/.test(lc(e))}function Dc(e){return uc(e).getComputedStyle(e)}function Oc(e){return pc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kc(e){if(lc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hc(e)&&e.host||dc(e);return hc(t)?t.host:t}function Ac(e){let t=kc(e);return Ec(t)?e.ownerDocument?e.ownerDocument.body:e.body:mc(t)&&gc(t)?t:Ac(t)}function jc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ac(e),i=r===e.ownerDocument?.body,a=uc(r);if(i){let e=Mc(a);return t.concat(a,a.visualViewport||[],gc(r)?r:[],e&&n?jc(e):[])}else return t.concat(r,jc(r,[],n))}function Mc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Nc(e){let t=Dc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=mc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ss(n)!==a||Ss(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Pc(e){return pc(e)?e:e.contextElement}function Fc(e){let t=Pc(e);if(!mc(t))return ws(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Nc(t),o=(a?Ss(n.width):n.width)/r,s=(a?Ss(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ic=ws(0);function Lc(e){let t=uc(e);return!Tc()||!t.visualViewport?Ic:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==uc(e)?!1:t}function zc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Pc(e),o=ws(1);t&&(r?pc(r)&&(o=Fc(r)):o=Fc(e));let s=Rc(a,n,r)?Lc(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=uc(a),t=r&&pc(r)?uc(r):r,n=e,i=Mc(n);for(;i&&r&&t!==n;){let e=Fc(i),t=i.getBoundingClientRect(),r=Dc(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=uc(i),i=Mc(n)}}return Ks({width:u,height:d,x:c,y:l})}function Bc(e,t){let n=Oc(e).scrollLeft;return t?t.left+n:zc(dc(e)).left+n}function Vc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Bc(e,n),y:n.top+t.scrollTop}}function Hc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=dc(r),s=t?vc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ws(1),u=ws(0),d=mc(r);if((d||!d&&!a)&&((lc(r)!==`body`||gc(o))&&(c=Oc(r)),d)){let e=zc(r);l=Fc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Vc(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 Uc(e){return Array.from(e.getClientRects())}function Wc(e){let t=dc(e),n=Oc(e),r=e.ownerDocument.body,i=xs(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=xs(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Bc(e),s=-n.scrollTop;return Dc(r).direction===`rtl`&&(o+=xs(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Gc=25;function Kc(e,t){let n=uc(e),r=dc(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Tc();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Bc(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<=Gc&&(a-=o)}else l<=Gc&&(a+=l);return{width:a,height:o,x:s,y:c}}function qc(e,t){let n=zc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=mc(e)?Fc(e):ws(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Jc(e,t,n){let r;if(t===`viewport`)r=Kc(e,n);else if(t===`document`)r=Wc(dc(e));else if(pc(t))r=qc(t,n);else{let n=Lc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ks(r)}function Yc(e,t){let n=kc(e);return n===t||!pc(n)||Ec(n)?!1:Dc(n).position===`fixed`||Yc(n,t)}function Xc(e,t){let n=t.get(e);if(n)return n;let r=jc(e,[],!1).filter(e=>pc(e)&&lc(e)!==`body`),i=null,a=Dc(e).position===`fixed`,o=a?kc(e):e;for(;pc(o)&&!Ec(o);){let t=Dc(o),n=Cc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||gc(o)&&!n&&Yc(e,o))?r=r.filter(e=>e!==o):i=t,o=kc(o)}return t.set(e,r),r}function Zc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vc(t)?[]:Xc(t,this._c):[].concat(n),r],o=Jc(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=Jc(t,a[e],i);s=xs(n.top,s),c=bs(n.right,c),l=bs(n.bottom,l),u=xs(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Qc(e){let{width:t,height:n}=Nc(e);return{width:t,height:n}}function $c(e,t,n){let r=mc(t),i=dc(t),a=n===`fixed`,o=zc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ws(0);function l(){c.x=Bc(i)}if(r||!r&&!a)if((lc(t)!==`body`||gc(i))&&(s=Oc(t)),r){let e=zc(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?Vc(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 el(e){return Dc(e).position===`static`}function tl(e,t){if(!mc(e)||Dc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return dc(e)===n&&(n=n.ownerDocument.body),n}function nl(e,t){let n=uc(e);if(vc(e))return n;if(!mc(e)){let t=kc(e);for(;t&&!Ec(t);){if(pc(t)&&!el(t))return t;t=kc(t)}return n}let r=tl(e,t);for(;r&&_c(r)&&el(r);)r=tl(r,t);return r&&Ec(r)&&el(r)&&!Cc(r)?n:r||wc(e)||n}var rl=async function(e){let t=this.getOffsetParent||nl,n=this.getDimensions,r=await n(e.floating);return{reference:$c(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function il(e){return Dc(e).direction===`rtl`}var al={convertOffsetParentRelativeRectToViewportRelativeRect:Hc,getDocumentElement:dc,getClippingRect:Zc,getOffsetParent:nl,getElementRects:rl,getClientRects:Uc,getDimensions:Qc,getScale:Fc,isElement:pc,isRTL:il};function ol(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sl(e,t){let n=null,r,i=dc(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=Cs(d),h=Cs(i.clientWidth-(u+f)),g=Cs(i.clientHeight-(d+p)),_=Cs(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:xs(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&&!ol(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 cl(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=Pc(e),u=i||a?[...l?jc(l):[],...t?jc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?sl(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?zc(e):null;c&&g();function g(){let t=zc(e);h&&!ol(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 ll=ic,ul=ac,dl=Qs,fl=sc,pl=tc,ml=Zs,hl=oc,gl=(e,t,n)=>{let r=new Map,i={platform:al,...n},a={...i.platform,_c:r};return Xs(e,t,{...i,platform:a})},_l=typeof document<`u`?p.useLayoutEffect:function(){};function vl(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(!vl(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)&&!vl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function yl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bl(e,t){let n=yl(e);return Math.round(t*n)/n}function xl(e){let t=p.useRef(e);return _l(()=>{t.current=e}),t}function Sl(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);vl(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=xl(c),k=xl(i),A=xl(l),j=p.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),gl(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!vl(E.current,t)&&(E.current=t,m.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);_l(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=p.useRef(!1);_l(()=>(M.current=!0,()=>{M.current=!1}),[]),_l(()=>{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)`,...yl(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 Cl=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?{}:ml({element:r.current,padding:i}).fn(n):r?ml({element:r,padding:i}).fn(n):{}}}},wl=(e,t)=>{let n=ll(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tl=(e,t)=>{let n=ul(e);return{name:n.name,fn:n.fn,options:[e,t]}},El=(e,t)=>({fn:hl(e).fn,options:[e,t]}),Dl=(e,t)=>{let n=dl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ol=(e,t)=>{let n=fl(e);return{name:n.name,fn:n.fn,options:[e,t]}},kl=(e,t)=>{let n=pl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Al=(e,t)=>{let n=Cl(e);return{name:n.name,fn:n.fn,options:[e,t]}},jl=`Arrow`,Ml=p.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,X.jsx)(Hr.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`})})});Ml.displayName=jl;var Nl=Ml,Pl=`Popper`,[Fl,Il]=Yr(Pl),[Ll,Rl]=Fl(Pl),zl=e=>{let{__scopePopper:t,children:n}=e,[r,i]=p.useState(null);return(0,X.jsx)(Ll,{scope:t,anchor:r,onAnchorChange:i,children:n})};zl.displayName=Pl;var Bl=`PopperAnchor`,Vl=p.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Rl(Bl,n),o=p.useRef(null),s=Nr(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)(Hr.div,{...i,ref:s})});Vl.displayName=Bl;var Hl=`PopperContent`,[Ul,Wl]=Fl(Hl),Gl=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,_=Rl(Hl,n),[v,y]=p.useState(null),b=Nr(t,e=>y(e)),[x,S]=p.useState(null),C=vs(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(Yl),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Sl({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>cl(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[wl({mainAxis:i+T,alignmentAxis:o}),c&&Tl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?El():void 0,...A}),c&&Dl({...A}),Ol({...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&&Al({element:x,padding:s}),Xl({arrowWidth:w,arrowHeight:T}),f&&kl({strategy:`referenceHidden`,...A})]}),[I,L]=Zl(N),R=ki(h);$r(()=>{P&&R?.()},[P,R]);let z=F.arrow?.x,B=F.arrow?.y,V=F.arrow?.centerOffset!==0,[H,U]=p.useState();return $r(()=>{v&&U(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:H,"--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)(Ul,{scope:n,placedSide:I,onArrowChange:S,arrowX:z,arrowY:B,shouldHideArrow:V,children:(0,X.jsx)(Hr.div,{"data-side":I,"data-align":L,...g,ref:b,style:{...g.style,animation:P?void 0:`none`}})})})});Gl.displayName=Hl;var Kl=`PopperArrow`,ql={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Jl=p.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Wl(Kl,n),a=ql[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)(Nl,{...r,ref:t,style:{...r.style,display:`block`}})})});Jl.displayName=Kl;function Yl(e){return e!==null}var Xl=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]=Zl(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 Zl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Ql=zl,$l=Vl,eu=Gl,tu=Jl,nu=`rovingFocusGroup.onEntryFocus`,ru={bubbles:!1,cancelable:!0},iu=`RovingFocusGroup`,[au,ou,su]=Zr(iu),[cu,lu]=Yr(iu,[su]),[uu,du]=cu(iu),fu=p.forwardRef((e,t)=>(0,X.jsx)(au.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(au.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(pu,{...e,ref:t})})}));fu.displayName=iu;var pu=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=Nr(t,f),h=Oi(a),[g,_]=ti({prop:o,defaultProp:s??null,onChange:c,caller:iu}),[v,y]=p.useState(!1),b=ki(l),x=ou(n),S=p.useRef(!1),[C,w]=p.useState(0);return p.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(nu,b),()=>e.removeEventListener(nu,b)},[b]),(0,X.jsx)(uu,{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)(Hr.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:`none`,...e.style},onMouseDown:Qr(e.onMouseDown,()=>{S.current=!0}),onFocus:Qr(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(nu,ru);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);yu([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:Qr(e.onBlur,()=>y(!1))})})}),mu=`RovingFocusGroupItem`,hu=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=di(),l=a||c,u=du(mu,n),d=u.currentTabStopId===l,f=ou(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u;return p.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,X.jsx)(au.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,X.jsx)(Hr.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Qr(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Qr(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Qr(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=vu(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(()=>yu(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});hu.displayName=mu;var gu={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function _u(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function vu(e,t,n){let r=_u(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return gu[r]}function yu(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 xu=fu,Su=hu,Cu=[`Enter`,` `],wu=[`ArrowDown`,`PageUp`,`Home`],Tu=[`ArrowUp`,`PageDown`,`End`],Eu=[...wu,...Tu],Du={ltr:[...Cu,`ArrowRight`],rtl:[...Cu,`ArrowLeft`]},Ou={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},ku=`Menu`,[Au,ju,Mu]=Zr(ku),[Nu,Pu]=Yr(ku,[Mu,Il,lu]),Fu=Il(),Iu=lu(),[Lu,Ru]=Nu(ku),[zu,Bu]=Nu(ku),Vu=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Fu(t),[c,l]=p.useState(null),u=p.useRef(!1),d=ki(a),f=Oi(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)(Ql,{...s,children:(0,X.jsx)(Lu,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,X.jsx)(zu,{scope:t,onClose:p.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Vu.displayName=ku;var Hu=`MenuAnchor`,Uu=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Fu(n);return(0,X.jsx)($l,{...i,...r,ref:t})});Uu.displayName=Hu;var Wu=`MenuPortal`,[Gu,Ku]=Nu(Wu,{forceMount:void 0}),qu=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Ru(Wu,t);return(0,X.jsx)(Gu,{scope:t,forceMount:n,children:(0,X.jsx)(ai,{present:n||a.open,children:(0,X.jsx)(sa,{asChild:!0,container:i,children:r})})})};qu.displayName=Wu;var Ju=`MenuContent`,[Yu,Xu]=Nu(Ju),Zu=p.forwardRef((e,t)=>{let n=Ku(Ju,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Ru(Ju,e.__scopeMenu),o=Bu(Ju,e.__scopeMenu);return(0,X.jsx)(Au.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(ai,{present:r||a.open,children:(0,X.jsx)(Au.Slot,{scope:e.__scopeMenu,children:o.modal?(0,X.jsx)(Qu,{...i,ref:t}):(0,X.jsx)($u,{...i,ref:t})})})})}),Qu=p.forwardRef((e,t)=>{let n=Ru(Ju,e.__scopeMenu),r=p.useRef(null),i=Nr(t,r);return p.useEffect(()=>{let e=r.current;if(e)return ko(e)},[]),(0,X.jsx)(td,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Qr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),$u=p.forwardRef((e,t)=>{let n=Ru(Ju,e.__scopeMenu);return(0,X.jsx)(td,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ed=Pr(`MenuContent.ScrollLock`),td=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,_=Ru(Ju,n),v=Bu(Ju,n),y=Fu(n),b=Iu(n),x=ju(n),[S,C]=p.useState(null),w=p.useRef(null),T=Nr(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:ed,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=zd(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),[]),la();let F=p.useCallback(e=>A.current===k.current?.side&&Vd(e,k.current?.area),[]);return(0,X.jsx)(Yu,{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)(Ji,{asChild:!0,trapped:i,onMountAutoFocus:Qr(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,X.jsx)(Li,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:m,children:(0,X.jsx)(xu,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:Qr(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,X.jsx)(eu,{role:`menu`,"aria-orientation":`vertical`,"data-state":Pd(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:Qr(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||!Eu.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Tu.includes(e.key)&&a.reverse(),Ld(a)}),onBlur:Qr(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:Qr(e.onPointerMove,Hd(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)}))})})})})})})});Zu.displayName=Ju;var nd=`MenuGroup`,rd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(Hr.div,{role:`group`,...r,ref:t})});rd.displayName=nd;var id=`MenuLabel`,ad=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(Hr.div,{...r,ref:t})});ad.displayName=id;var od=`MenuItem`,sd=`menu.itemSelect`,cd=p.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=p.useRef(null),o=Bu(od,e.__scopeMenu),s=Xu(od,e.__scopeMenu),c=Nr(t,a),l=p.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(sd,{bubbles:!0,cancelable:!0});e.addEventListener(sd,e=>r?.(e),{once:!0}),Ur(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,X.jsx)(ld,{...i,ref:c,disabled:n,onClick:Qr(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Qr(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Qr(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Cu.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});cd.displayName=od;var ld=p.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Xu(od,n),s=Iu(n),c=p.useRef(null),l=Nr(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)(Au.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,X.jsx)(Su,{asChild:!0,...s,focusable:!r,children:(0,X.jsx)(Hr.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Qr(e.onPointerMove,Hd(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Qr(e.onPointerLeave,Hd(e=>o.onItemLeave(e))),onFocus:Qr(e.onFocus,()=>d(!0)),onBlur:Qr(e.onBlur,()=>d(!1))})})})}),ud=`MenuCheckboxItem`,dd=p.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,X.jsx)(yd,{scope:e.__scopeMenu,checked:n,children:(0,X.jsx)(cd,{role:`menuitemcheckbox`,"aria-checked":Fd(n)?`mixed`:n,...i,ref:t,"data-state":Id(n),onSelect:Qr(i.onSelect,()=>r?.(Fd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dd.displayName=ud;var fd=`MenuRadioGroup`,[pd,md]=Nu(fd,{value:void 0,onValueChange:()=>{}}),hd=p.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=ki(r);return(0,X.jsx)(pd,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,X.jsx)(rd,{...i,ref:t})})});hd.displayName=fd;var gd=`MenuRadioItem`,_d=p.forwardRef((e,t)=>{let{value:n,...r}=e,i=md(gd,e.__scopeMenu),a=n===i.value;return(0,X.jsx)(yd,{scope:e.__scopeMenu,checked:a,children:(0,X.jsx)(cd,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Id(a),onSelect:Qr(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});_d.displayName=gd;var vd=`MenuItemIndicator`,[yd,bd]=Nu(vd,{checked:!1}),xd=p.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=bd(vd,n);return(0,X.jsx)(ai,{present:r||Fd(a.checked)||a.checked===!0,children:(0,X.jsx)(Hr.span,{...i,ref:t,"data-state":Id(a.checked)})})});xd.displayName=vd;var Sd=`MenuSeparator`,Cd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(Hr.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Cd.displayName=Sd;var wd=`MenuArrow`,Td=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Fu(n);return(0,X.jsx)(tu,{...i,...r,ref:t})});Td.displayName=wd;var Ed=`MenuSub`,[Dd,Od]=Nu(Ed),kd=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Ru(Ed,t),o=Fu(t),[s,c]=p.useState(null),[l,u]=p.useState(null),d=ki(i);return p.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,X.jsx)(Ql,{...o,children:(0,X.jsx)(Lu,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,X.jsx)(Dd,{scope:t,contentId:di(),triggerId:di(),trigger:s,onTriggerChange:c,children:n})})})};kd.displayName=Ed;var Ad=`MenuSubTrigger`,jd=p.forwardRef((e,t)=>{let n=Ru(Ad,e.__scopeMenu),r=Bu(Ad,e.__scopeMenu),i=Od(Ad,e.__scopeMenu),a=Xu(Ad,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)(Uu,{asChild:!0,...l,children:(0,X.jsx)(ld,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Pd(n.open),...e,ref:Mr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Qr(e.onPointerMove,Hd(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:Qr(e.onPointerLeave,Hd(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:Qr(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Du[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});jd.displayName=Ad;var Md=`MenuSubContent`,Nd=p.forwardRef((e,t)=>{let n=Ku(Ju,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Ru(Ju,e.__scopeMenu),o=Bu(Ju,e.__scopeMenu),s=Od(Md,e.__scopeMenu),c=p.useRef(null),l=Nr(t,c);return(0,X.jsx)(Au.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(ai,{present:r||a.open,children:(0,X.jsx)(Au.Slot,{scope:e.__scopeMenu,children:(0,X.jsx)(td,{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:Qr(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Qr(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:Qr(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ou[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Nd.displayName=Md;function Pd(e){return e?`open`:`closed`}function Fd(e){return e===`indeterminate`}function Id(e){return Fd(e)?`indeterminate`:e?`checked`:`unchecked`}function Ld(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Rd(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function zd(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=Rd(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 Bd(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 Vd(e,t){return t?Bd({x:e.clientX,y:e.clientY},t):!1}function Hd(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Ud=Vu,Wd=Uu,Gd=qu,Kd=Zu,qd=rd,Jd=ad,Yd=cd,Xd=dd,Zd=hd,Qd=_d,$d=xd,ef=Cd,tf=Td,nf=jd,rf=Nd,af=`DropdownMenu`,[of,sf]=Yr(af,[Pu]),cf=Pu(),[lf,uf]=of(af),df=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=cf(t),l=p.useRef(null),[u,d]=ti({prop:i,defaultProp:a??!1,onChange:o,caller:af});return(0,X.jsx)(lf,{scope:t,triggerId:di(),triggerRef:l,contentId:di(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,X.jsx)(Ud,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};df.displayName=af;var ff=`DropdownMenuTrigger`,pf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=uf(ff,n),o=cf(n);return(0,X.jsx)(Wd,{asChild:!0,...o,children:(0,X.jsx)(Hr.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:Mr(t,a.triggerRef),onPointerDown:Qr(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Qr(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});pf.displayName=ff;var mf=`DropdownMenuPortal`,hf=e=>{let{__scopeDropdownMenu:t,...n}=e,r=cf(t);return(0,X.jsx)(Gd,{...r,...n})};hf.displayName=mf;var gf=`DropdownMenuContent`,_f=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uf(gf,n),a=cf(n),o=p.useRef(!1);return(0,X.jsx)(Kd,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Qr(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Qr(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)`}})});_f.displayName=gf;var vf=`DropdownMenuGroup`,yf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(qd,{...i,...r,ref:t})});yf.displayName=vf;var bf=`DropdownMenuLabel`,xf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Jd,{...i,...r,ref:t})});xf.displayName=bf;var Sf=`DropdownMenuItem`,Cf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Yd,{...i,...r,ref:t})});Cf.displayName=Sf;var wf=`DropdownMenuCheckboxItem`,Tf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Xd,{...i,...r,ref:t})});Tf.displayName=wf;var Ef=`DropdownMenuRadioGroup`,Df=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Zd,{...i,...r,ref:t})});Df.displayName=Ef;var Of=`DropdownMenuRadioItem`,kf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(Qd,{...i,...r,ref:t})});kf.displayName=Of;var Af=`DropdownMenuItemIndicator`,jf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)($d,{...i,...r,ref:t})});jf.displayName=Af;var Mf=`DropdownMenuSeparator`,Nf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(ef,{...i,...r,ref:t})});Nf.displayName=Mf;var Pf=`DropdownMenuArrow`,Ff=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(tf,{...i,...r,ref:t})});Ff.displayName=Pf;var If=`DropdownMenuSubTrigger`,Lf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(nf,{...i,...r,ref:t})});Lf.displayName=If;var Rf=`DropdownMenuSubContent`,zf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cf(n);return(0,X.jsx)(rf,{...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)`}})});zf.displayName=Rf;var Bf=df,Vf=pf,Hf=hf,Uf=_f,Wf=Cf,Gf=`Label`,Kf=p.forwardRef((e,t)=>(0,X.jsx)(Hr.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Kf.displayName=Gf;var qf=Kf,Jf=`Popover`,[Yf,Xf]=Yr(Jf,[Il]),Zf=Il(),[Qf,$f]=Yf(Jf),ep=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Zf(t),c=p.useRef(null),[l,u]=p.useState(!1),[d,f]=ti({prop:r,defaultProp:i??!1,onChange:a,caller:Jf});return(0,X.jsx)(Ql,{...s,children:(0,X.jsx)(Qf,{scope:t,contentId:di(),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})})};ep.displayName=Jf;var tp=`PopoverAnchor`,np=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$f(tp,n),a=Zf(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return p.useEffect(()=>(o(),()=>s()),[o,s]),(0,X.jsx)($l,{...a,...r,ref:t})});np.displayName=tp;var rp=`PopoverTrigger`,ip=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$f(rp,n),a=Zf(n),o=Nr(t,i.triggerRef),s=(0,X.jsx)(Hr.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":yp(i.open),...r,ref:o,onClick:Qr(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,X.jsx)($l,{asChild:!0,...a,children:s})});ip.displayName=rp;var ap=`PopoverPortal`,[op,sp]=Yf(ap,{forceMount:void 0}),cp=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=$f(ap,t);return(0,X.jsx)(op,{scope:t,forceMount:n,children:(0,X.jsx)(ai,{present:n||a.open,children:(0,X.jsx)(sa,{asChild:!0,container:i,children:r})})})};cp.displayName=ap;var lp=`PopoverContent`,up=p.forwardRef((e,t)=>{let n=sp(lp,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=$f(lp,e.__scopePopover);return(0,X.jsx)(ai,{present:r||a.open,children:a.modal?(0,X.jsx)(fp,{...i,ref:t}):(0,X.jsx)(pp,{...i,ref:t})})});up.displayName=lp;var dp=Pr(`PopoverContent.RemoveScroll`),fp=p.forwardRef((e,t)=>{let n=$f(lp,e.__scopePopover),r=p.useRef(null),i=Nr(t,r),a=p.useRef(!1);return p.useEffect(()=>{let e=r.current;if(e)return ko(e)},[]),(0,X.jsx)(bo,{as:dp,allowPinchZoom:!0,children:(0,X.jsx)(mp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qr(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Qr(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:Qr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),pp=p.forwardRef((e,t)=>{let n=$f(lp,e.__scopePopover),r=p.useRef(!1),i=p.useRef(!1);return(0,X.jsx)(mp,{...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()}})}),mp=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=$f(lp,n),p=Zf(n);return la(),(0,X.jsx)(Ji,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,X.jsx)(Li,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,X.jsx)(eu,{"data-state":yp(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)`}})})})}),hp=`PopoverClose`,gp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$f(hp,n);return(0,X.jsx)(Hr.button,{type:`button`,...r,ref:t,onClick:Qr(e.onClick,()=>i.onOpenChange(!1))})});gp.displayName=hp;var _p=`PopoverArrow`,vp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Zf(n);return(0,X.jsx)(tu,{...i,...r,ref:t})});vp.displayName=_p;function yp(e){return e?`open`:`closed`}var bp=ep,xp=ip,Sp=cp,Cp=up,wp=`Switch`,[Tp,Ep]=Yr(wp),[Dp,Op]=Tp(wp),kp=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=Nr(t,e=>m(e)),g=p.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=ti({prop:i,defaultProp:a??!1,onChange:l,caller:wp});return(0,X.jsxs)(Dp,{scope:n,checked:v,disabled:s,children:[(0,X.jsx)(Hr.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Pp(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:h,onClick:Qr(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,X.jsx)(Np,{control:f,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});kp.displayName=wp;var Ap=`SwitchThumb`,jp=p.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Op(Ap,n);return(0,X.jsx)(Hr.span,{"data-state":Pp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});jp.displayName=Ap;var Mp=`SwitchBubbleInput`,Np=p.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=p.useRef(null),s=Nr(o,a),c=_s(n),l=vs(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}})});Np.displayName=Mp;function Pp(e){return e?`checked`:`unchecked`}var Fp=kp,Ip=jp,Lp=`Tabs`,[Rp,zp]=Yr(Lp,[lu]),Bp=lu(),[Vp,Hp]=Rp(Lp),Up=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Oi(s),[d,f]=ti({prop:r,onChange:i,defaultProp:a??``,caller:Lp});return(0,X.jsx)(Vp,{scope:n,baseId:di(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,X.jsx)(Hr.div,{dir:u,"data-orientation":o,...l,ref:t})})});Up.displayName=Lp;var Wp=`TabsList`,Gp=p.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Hp(Wp,n),o=Bp(n);return(0,X.jsx)(xu,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,X.jsx)(Hr.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Gp.displayName=Wp;var Kp=`TabsTrigger`,qp=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Hp(Kp,n),s=Bp(n),c=Xp(o.baseId,r),l=Zp(o.baseId,r),u=r===o.value;return(0,X.jsx)(Su,{asChild:!0,...s,focusable:!i,active:u,children:(0,X.jsx)(Hr.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:Qr(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Qr(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Qr(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});qp.displayName=Kp;var Jp=`TabsContent`,Yp=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Hp(Jp,n),c=Xp(s.baseId,r),l=Zp(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)(ai,{present:i||u,children:({present:n})=>(0,X.jsx)(Hr.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})})});Yp.displayName=Jp;function Xp(e,t){return`${e}-trigger-${t}`}function Zp(e,t){return`${e}-content-${t}`}var Qp=Up,$p=Gp,eee=qp,em=Yp,tm=`Toggle`,nm=p.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=ti({prop:n,onChange:i,defaultProp:r??!1,caller:tm});return(0,X.jsx)(Hr.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:Qr(e.onClick,()=>{e.disabled||s(!o)})})});nm.displayName=tm;var rm=`ToggleGroup`,[im,tee]=Yr(rm,[lu]),am=lu(),om=p.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,X.jsx)(lm,{...r,ref:t});if(n===`multiple`)return(0,X.jsx)(nee,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${rm}\``)});om.displayName=rm;var[sm,cm]=im(rm),lm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=ti({prop:n,defaultProp:r??``,onChange:i,caller:rm});return(0,X.jsx)(sm,{scope:e.__scopeToggleGroup,type:`single`,value:p.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:p.useCallback(()=>s(``),[s]),children:(0,X.jsx)(um,{...a,ref:t})})}),nee=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=ti({prop:n,defaultProp:r??[],onChange:i,caller:rm}),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)(sm,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,X.jsx)(um,{...a,ref:t})})});om.displayName=rm;var[ree,iee]=im(rm),um=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=am(n),u=Oi(o),d={role:`group`,dir:u,...c};return(0,X.jsx)(ree,{scope:n,rovingFocus:i,disabled:r,children:i?(0,X.jsx)(xu,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,X.jsx)(Hr.div,{...d,ref:t})}):(0,X.jsx)(Hr.div,{...d,ref:t})})}),dm=`ToggleGroupItem`,fm=p.forwardRef((e,t)=>{let n=cm(dm,e.__scopeToggleGroup),r=iee(dm,e.__scopeToggleGroup),i=am(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)(Su,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,X.jsx)(pm,{...s,ref:t})}):(0,X.jsx)(pm,{...s,ref:t})});fm.displayName=dm;var pm=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=cm(dm,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,X.jsx)(nm,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),mm=om,hm=fm,[gm,aee]=Yr(`Tooltip`,[Il]),_m=Il(),vm=`TooltipProvider`,oee=700,ym=`tooltip.open`,[see,bm]=gm(vm),xm=e=>{let{__scopeTooltip:t,delayDuration:n=oee,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)(see,{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})};xm.displayName=vm;var Sm=`Tooltip`,[Cm,wm]=gm(Sm),Tm=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=bm(Sm,e.__scopeTooltip),l=_m(t),[u,d]=p.useState(null),f=di(),m=p.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=p.useRef(!1),[v,y]=ti({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),a?.(e)},caller:Sm}),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)(Ql,{...l,children:(0,X.jsx)(Cm,{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})})};Tm.displayName=Sm;var Em=`TooltipTrigger`,Dm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=wm(Em,n),a=bm(Em,n),o=_m(n),s=Nr(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)($l,{asChild:!0,...o,children:(0,X.jsx)(Hr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Qr(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Qr(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Qr(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Qr(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Qr(e.onBlur,i.onClose),onClick:Qr(e.onClick,i.onClose)})})});Dm.displayName=Em;var Om=`TooltipPortal`,[km,Am]=gm(Om,{forceMount:void 0}),jm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=wm(Om,t);return(0,X.jsx)(km,{scope:t,forceMount:n,children:(0,X.jsx)(ai,{present:n||a.open,children:(0,X.jsx)(sa,{asChild:!0,container:i,children:r})})})};jm.displayName=Om;var Mm=`TooltipContent`,Nm=p.forwardRef((e,t)=>{let n=Am(Mm,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=wm(Mm,e.__scopeTooltip);return(0,X.jsx)(ai,{present:r||o.open,children:o.disableHoverableContent?(0,X.jsx)(Rm,{side:i,...a,ref:t}):(0,X.jsx)(Pm,{side:i,...a,ref:t})})}),Pm=p.forwardRef((e,t)=>{let n=wm(Mm,e.__scopeTooltip),r=bm(Mm,e.__scopeTooltip),i=p.useRef(null),a=Nr(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=lee(r,cee(r,n.getBoundingClientRect())),a=uee(t.getBoundingClientRect());s(fee([...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=!dee(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,X.jsx)(Rm,{...e,ref:a})}),[Fm,Im]=gm(Sm,{isInside:!1}),Lm=Rr(`TooltipContent`),Rm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=wm(Mm,n),l=_m(n),{onClose:u}=c;return p.useEffect(()=>(document.addEventListener(ym,u),()=>document.removeEventListener(ym,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)(Li,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,X.jsxs)(eu,{"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)(Lm,{children:r}),(0,X.jsx)(Fm,{scope:n,isInside:!0,children:(0,X.jsx)(qr,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Nm.displayName=Mm;var zm=`TooltipArrow`,Bm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=_m(n);return Im(zm,n).isInside?null:(0,X.jsx)(tu,{...i,...r,ref:t})});Bm.displayName=zm;function cee(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 lee(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 uee(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 dee(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 fee(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)),pee(t)}function pee(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 mee=xm,hee=Tm,gee=Dm,_ee=jm,vee=Nm,yee=Bm,bee=(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},xee=(e,t)=>({classGroupId:e,validator:t}),Vm=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Hm=`-`,Um=[],See=`arbitrary..`,Cee=e=>{let t=Tee(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return wee(e);let n=e.split(Hm);return Wm(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?bee(i,t):t:i||Um}return n[e]||Um}}},Wm=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Wm(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Hm):e.slice(t).join(Hm),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},wee=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?See+r:void 0})(),Tee=e=>{let{theme:t,classGroups:n}=e;return Eee(n,t)},Eee=(e,t)=>{let n=Vm();for(let r in e){let i=e[r];Gm(i,n,r,t)}return n},Gm=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Km(i,t,n,r)}},Km=(e,t,n,r)=>{if(typeof e==`string`){qm(e,t,n);return}if(typeof e==`function`){Jm(e,t,n,r);return}Ym(e,t,n,r)},qm=(e,t,n)=>{let r=e===``?t:Xm(t,e);r.classGroupId=n},Jm=(e,t,n,r)=>{if(Zm(e)){Gm(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(xee(n,e))},Ym=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Gm(o,Xm(t,a),n,r)}},Xm=(e,t)=>{let n=e,r=t.split(Hm),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Vm(),n.nextPart.set(t,i)),n=i}return n},Zm=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Qm=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)}}},$m=`!`,eh=`:`,th=[],nh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),rh=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===eh){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($m)?(c=s.slice(0,-1),l=!0):s.startsWith($m)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return nh(t,l,c,u)};if(t){let e=t+eh,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):nh(th,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ih=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}},ah=e=>({cache:Qm(e.cacheSize),parseClassName:rh(e),sortModifiers:ih(e),...Cee(e)}),oh=/\s+/,sh=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(oh),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+$m: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},ch=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=lh(n))&&(i&&(i+=` `),i+=r);return i},lh=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=lh(e[r]))&&(n&&(n+=` `),n+=t);return n},uh=(e,...t)=>{let n,r,i,a,o=o=>(n=ah(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=sh(e,n);return i(e,a),a};return a=o,(...e)=>a(ch(...e))},dh=[],fh=e=>{let t=t=>t[e]||dh;return t.isThemeGetter=!0,t},ph=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,mh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,hh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_h=/\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$/,vh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xh=e=>hh.test(e),Sh=e=>!!e&&!Number.isNaN(Number(e)),Ch=e=>!!e&&Number.isInteger(Number(e)),wh=e=>e.endsWith(`%`)&&Sh(e.slice(0,-1)),Th=e=>gh.test(e),Eh=()=>!0,Dh=e=>_h.test(e)&&!vh.test(e),Oh=()=>!1,kh=e=>yh.test(e),Ah=e=>bh.test(e),jh=e=>!Nh(e)&&!Rh(e),Mh=e=>Hh(e,Kh,Oh),Nh=e=>ph.test(e),Ph=e=>Hh(e,qh,Dh),Fh=e=>Hh(e,Pee,Sh),Dee=e=>Hh(e,Yh,Eh),Oee=e=>Hh(e,Jh,Oh),Ih=e=>Hh(e,Wh,Oh),kee=e=>Hh(e,Gh,Ah),Lh=e=>Hh(e,Xh,kh),Rh=e=>mh.test(e),zh=e=>Uh(e,qh),Aee=e=>Uh(e,Jh),Bh=e=>Uh(e,Wh),jee=e=>Uh(e,Kh),Mee=e=>Uh(e,Gh),Vh=e=>Uh(e,Xh,!0),Nee=e=>Uh(e,Yh,!0),Hh=(e,t,n)=>{let r=ph.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Uh=(e,t,n=!1)=>{let r=mh.exec(e);return r?r[1]?t(r[1]):n:!1},Wh=e=>e===`position`||e===`percentage`,Gh=e=>e===`image`||e===`url`,Kh=e=>e===`length`||e===`size`||e===`bg-size`,qh=e=>e===`length`,Pee=e=>e===`number`,Jh=e=>e===`family-name`,Yh=e=>e===`number`||e===`weight`,Xh=e=>e===`shadow`,Fee=uh(()=>{let e=fh(`color`),t=fh(`font`),n=fh(`text`),r=fh(`font-weight`),i=fh(`tracking`),a=fh(`leading`),o=fh(`breakpoint`),s=fh(`container`),c=fh(`spacing`),l=fh(`radius`),u=fh(`shadow`),d=fh(`inset-shadow`),f=fh(`text-shadow`),p=fh(`drop-shadow`),m=fh(`blur`),h=fh(`perspective`),g=fh(`aspect`),_=fh(`ease`),v=fh(`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(),Rh,Nh],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Rh,Nh,c],T=()=>[xh,`full`,`auto`,...w()],E=()=>[Ch,`none`,`subgrid`,Rh,Nh],D=()=>[`auto`,{span:[`full`,Ch,Rh,Nh]},Ch,Rh,Nh],O=()=>[Ch,`auto`,Rh,Nh],k=()=>[`auto`,`min`,`max`,`fr`,Rh,Nh],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=()=>[xh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[xh,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[xh,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Rh,Nh],L=()=>[...b(),Bh,Ih,{position:[Rh,Nh]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,jee,Mh,{size:[Rh,Nh]}],B=()=>[wh,zh,Ph],V=()=>[``,`none`,`full`,l,Rh,Nh],H=()=>[``,Sh,zh,Ph],U=()=>[`solid`,`dashed`,`dotted`,`double`],W=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],G=()=>[Sh,wh,Bh,Ih],K=()=>[``,`none`,m,Rh,Nh],ee=()=>[`none`,Sh,Rh,Nh],te=()=>[`none`,Sh,Rh,Nh],ne=()=>[Sh,Rh,Nh],re=()=>[xh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Th],breakpoint:[Th],color:[Eh],container:[Th],"drop-shadow":[Th],ease:[`in`,`out`,`in-out`],font:[jh],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Th],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Th],shadow:[Th],spacing:[`px`,Sh],text:[Th],"text-shadow":[Th],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,xh,Nh,Rh,g]}],container:[`container`],columns:[{columns:[Sh,Nh,Rh,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:[Ch,`auto`,Rh,Nh]}],basis:[{basis:[xh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Sh,xh,`auto`,`initial`,`none`,Nh]}],grow:[{grow:[``,Sh,Rh,Nh]}],shrink:[{shrink:[``,Sh,Rh,Nh]}],order:[{order:[Ch,`first`,`last`,`none`,Rh,Nh]}],"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,zh,Ph]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Nee,Dee]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,wh,Nh]}],"font-family":[{font:[Aee,Oee,t]}],"font-features":[{"font-features":[Nh]}],"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,Rh,Nh]}],"line-clamp":[{"line-clamp":[Sh,`none`,Rh,Fh]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Rh,Nh]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Rh,Nh]}],"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:[...U(),`wavy`]}],"text-decoration-thickness":[{decoration:[Sh,`from-font`,`auto`,Rh,Ph]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Sh,`auto`,Rh,Nh]}],"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`,Rh,Nh]}],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`,Rh,Nh]}],"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`]},Ch,Rh,Nh],radial:[``,Rh,Nh],conic:[Ch,Rh,Nh]},Mee,kee]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":H()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...U(),`hidden`,`none`]}],"divide-style":[{divide:[...U(),`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:[...U(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Sh,Rh,Nh]}],"outline-w":[{outline:[``,Sh,zh,Ph]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Vh,Lh]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Vh,Lh]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:H()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Sh,Ph]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Vh,Lh]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Sh,Rh,Nh]}],"mix-blend":[{"mix-blend":[...W(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":W()}],"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":[Sh]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"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":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"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":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"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":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"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":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"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":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"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":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Rh,Nh]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"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":[Sh]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"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`,Rh,Nh]}],filter:[{filter:[``,`none`,Rh,Nh]}],blur:[{blur:K()}],brightness:[{brightness:[Sh,Rh,Nh]}],contrast:[{contrast:[Sh,Rh,Nh]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Vh,Lh]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Sh,Rh,Nh]}],"hue-rotate":[{"hue-rotate":[Sh,Rh,Nh]}],invert:[{invert:[``,Sh,Rh,Nh]}],saturate:[{saturate:[Sh,Rh,Nh]}],sepia:[{sepia:[``,Sh,Rh,Nh]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Rh,Nh]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[Sh,Rh,Nh]}],"backdrop-contrast":[{"backdrop-contrast":[Sh,Rh,Nh]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Sh,Rh,Nh]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Sh,Rh,Nh]}],"backdrop-invert":[{"backdrop-invert":[``,Sh,Rh,Nh]}],"backdrop-opacity":[{"backdrop-opacity":[Sh,Rh,Nh]}],"backdrop-saturate":[{"backdrop-saturate":[Sh,Rh,Nh]}],"backdrop-sepia":[{"backdrop-sepia":[``,Sh,Rh,Nh]}],"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`,Rh,Nh]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Sh,`initial`,Rh,Nh]}],ease:[{ease:[`linear`,`initial`,_,Rh,Nh]}],delay:[{delay:[Sh,Rh,Nh]}],animate:[{animate:[`none`,v,Rh,Nh]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Rh,Nh]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":[`scale-3d`],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[Rh,Nh,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"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`,Rh,Nh]}],"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`,Rh,Nh]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Sh,zh,Ph,Fh]}],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)=>Fee(Dr(e)),Iee=Ar(`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?Fr:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Z(Iee({variant:t,size:n,className:e})),...i}),Zh=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Lee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ree=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Qh=e=>{let t=Ree(e);return t.charAt(0).toUpperCase()+t.slice(1)},$h={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`},zee=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Bee=(0,p.createContext)({}),Vee=()=>(0,p.useContext)(Bee),Hee=(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=``}=Vee()??{},h=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,p.createElement)(`svg`,{ref:c,...$h,width:t??l??$h.width,height:t??l??$h.height,stroke:e??f,strokeWidth:h,className:Zh(`lucide`,m,i),...!a&&!zee(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),eg=(e,t)=>{let n=(0,p.forwardRef)(({className:n,...r},i)=>(0,p.createElement)(Hee,{ref:i,iconNode:t,className:Zh(`lucide-${Lee(Qh(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Qh(e),n},tg=eg(`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`}]]),Uee=eg(`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`}]]),Wee=eg(`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`}]]),Gee=eg(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Kee=eg(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ng=eg(`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`}]]),rg=eg(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ig=eg(`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`}]]),ag=eg(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),og=eg(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),sg=eg(`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`}]]),cg=eg(`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`}]]),lg=eg(`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`}]]),ug=eg(`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`}]]),dg=eg(`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`}]]),fg=eg(`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`}]]),pg=eg(`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`}]]),mg=eg(`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`}]]),hg=eg(`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`}]]),gg=eg(`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`}]]),_g=eg(`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`}]]),vg=eg(`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`}]]),yg=eg(`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`}]]),bg=eg(`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`}]]),xg=eg(`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`}]]),Sg=eg(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Cg=eg(`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`}]]),wg=eg(`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`}]]),Tg=eg(`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`}]]),Eg=eg(`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`}]]),Dg=eg(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Og=eg(`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`}]]),kg=eg(`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`}]]),Ag=eg(`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`}]]),jg=eg(`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`}]]),Mg=eg(`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`}]]),Ng=eg(`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`}]]),Pg=eg(`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`}]]),Fg=eg(`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`}]]),Ig=eg(`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`}]]),Lg=eg(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Rg=eg(`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`}]]),zg=eg(`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`}]]),Bg=eg(`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`}]]),Vg=eg(`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`}]]),Hg=eg(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ug=eg(`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`}]]),Wg=eg(`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`}]]),Gg=eg(`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`}]]),Kg=eg(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),qg=eg(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Jg=eg(`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`}]]),Yg=eg(`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`}]]),Xg=eg(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Zg=1,Qg=.9,$g=.8,e_=.17,t_=.1,n_=.999,r_=.9999,i_=.99,a_=/[\\\/_+.#"@\[\(\{&]/,o_=/[\\\/_+.#"@\[\(\{&]/g,s_=/[\s-]/,c_=/[\s-]/g;function l_(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Zg:i_;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=l_(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Zg:a_.test(e.charAt(l-1))?(d*=$g,p=e.slice(i,l-1).match(o_),p&&i>0&&(d*=n_**+p.length)):s_.test(e.charAt(l-1))?(d*=Qg,m=e.slice(i,l-1).match(c_),m&&i>0&&(d*=n_**+m.length)):(d*=e_,i>0&&(d*=n_**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=r_)),(d<t_&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=l_(e,t,n,r,l+1,a+2,o),f*t_>d&&(d=f*t_)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function u_(e){return e.toLowerCase().replace(c_,` `)}function d_(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,l_(e,t,u_(e),u_(t),0,0,{})}var f_=`[cmdk-group=""]`,p_=`[cmdk-group-items=""]`,m_=`[cmdk-group-heading=""]`,h_=`[cmdk-item=""]`,g_=`${h_}:not([aria-disabled="true"])`,__=`cmdk-item-select`,v_=`data-value`,y_=(e,t,n)=>d_(e,t,n),b_=p.createContext(void 0),x_=()=>p.useContext(b_),S_=p.createContext(void 0),C_=()=>p.useContext(S_),w_=p.createContext(void 0),T_=p.forwardRef((e,t)=>{let n=z_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=z_(()=>new Set),i=z_(()=>new Map),a=z_(()=>new Map),o=z_(()=>new Set),s=L_(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=di(),b=di(),x=di(),S=p.useRef(null),C=H_();R_(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),R_(()=>{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??y_;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(p_);t?t.appendChild(e.parentElement===t?e:e.closest(`${p_} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${p_} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${f_}[${v_}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(v_);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(f_)?.querySelector(m_))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${h_}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(g_)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(v_))}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(v_))}function F(e){let t=j()?.closest(f_),n;for(;t&&!n;)t=e>0?F_(t,f_):I_(t,f_),n=t?.querySelector(g_);n?w.setState(`value`,n.getAttribute(v_)):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(Hr.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(__);t.dispatchEvent(e)}}}}},p.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:G_},c),W_(e,e=>p.createElement(S_.Provider,{value:w},p.createElement(b_.Provider,{value:T},e))))}),E_=p.forwardRef((e,t)=>{let n=di(),r=p.useRef(null),i=p.useContext(w_),a=x_(),o=L_(e),s=o.current?.forceMount??i?.forceMount;R_(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=V_(n,r,[e.value,e.children,r],e.keywords),l=C_(),u=B_(e=>e.value&&e.value===c.current),d=B_(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(__,f),()=>t.removeEventListener(__,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(Hr.div,{ref:Mr(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)}),D_=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=di(),s=p.useRef(null),c=p.useRef(null),l=di(),u=x_(),d=B_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);R_(()=>u.group(o),[]),V_(o,s,[e.value,e.heading,c]);let f=p.useMemo(()=>({id:o,forceMount:i}),[i]);return p.createElement(Hr.div,{ref:Mr(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),W_(e,e=>p.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},p.createElement(w_.Provider,{value:f},e))))}),O_=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=p.useRef(null),a=B_(e=>!e.search);return!n&&!a?null:p.createElement(Hr.div,{ref:Mr(i,t),...r,"cmdk-separator":``,role:`separator`})}),k_=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=C_(),o=B_(e=>e.search),s=B_(e=>e.selectedItemId),c=x_();return p.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),p.createElement(Hr.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)}})}),A_=p.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=p.useRef(null),o=p.useRef(null),s=B_(e=>e.selectedItemId),c=x_();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(Hr.div,{ref:Mr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},W_(e,e=>p.createElement(`div`,{ref:Mr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),j_=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return p.createElement(us,{open:n,onOpenChange:r},p.createElement(ds,{container:o},p.createElement(fs,{"cmdk-overlay":``,className:i}),p.createElement(ps,{"aria-label":e.label,"cmdk-dialog":``,className:a},p.createElement(T_,{ref:t,...s}))))}),M_=p.forwardRef((e,t)=>B_(e=>e.filtered.count===0)?p.createElement(Hr.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),N_=p.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return p.createElement(Hr.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},W_(e,e=>p.createElement(`div`,{"aria-hidden":!0},e)))}),P_=Object.assign(T_,{List:A_,Item:E_,Input:k_,Group:D_,Separator:O_,Dialog:j_,Empty:M_,Loading:N_});function F_(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function I_(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function L_(e){let t=p.useRef(e);return R_(()=>{t.current=e}),t}var R_=typeof window>`u`?p.useEffect:p.useLayoutEffect;function z_(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function B_(e){let t=C_(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function V_(e,t,n,r=[]){let i=p.useRef(),a=x_();return R_(()=>{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(v_,s),i.current=s}),i}var H_=()=>{let[e,t]=p.useState(),n=z_(()=>new Map);return R_(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function U_(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function W_({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(U_(t),{ref:t.ref},n(t.props.children)):n(t)}var G_={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},K_=e=>(0,X.jsx)(us,{"data-slot":`dialog`,...e}),q_=e=>(0,X.jsx)(ds,{"data-slot":`dialog-portal`,...e}),J_=e=>(0,X.jsx)(gs,{"data-slot":`dialog-close`,...e}),Y_=({className:e,...t})=>(0,X.jsx)(fs,{"data-slot":`dialog-overlay`,className:Z(`fixed inset-0 isolate z-50 bg-black/70 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t}),X_=({className:e,children:t,showCloseButton:n=!0,overlayClassName:r,...i})=>(0,X.jsxs)(q_,{children:[(0,X.jsx)(Y_,{className:r}),(0,X.jsxs)(ps,{"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)(gs,{"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)(Xg,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]}),Z_=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`dialog-header`,className:Z(`flex flex-col gap-1.5`,e),...t}),Q_=({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)(gs,{asChild:!0,children:(0,X.jsx)(Q,{variant:`outline`,children:`Close`})})]}),$_=({className:e,...t})=>(0,X.jsx)(ms,{"data-slot":`dialog-title`,className:Z(`font-heading text-base leading-none font-medium`,e),...t}),ev=({className:e,...t})=>(0,X.jsx)(hs,{"data-slot":`dialog-description`,className:Z(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t}),tv=(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})),nv=(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}));nv.displayName=`Textarea`;function rv({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 iv=Ar(`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 av({className:e,align:t=`inline-start`,...n}){return(0,X.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Z(iv({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var ov=Ar(`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 sv({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(ov({size:r}),e),...i})}function cv({className:e,...t}){return(0,X.jsx)(tv,{"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 lv({className:e,...t}){return(0,X.jsx)(P_,{"data-slot":`command`,className:Z(`flex size-full flex-col overflow-hidden rounded-4xl bg-popover p-1 text-popover-foreground`,e),...t})}function uv({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,X.jsxs)(rv,{className:`h-9 bg-input/50`,children:[(0,X.jsx)(P_.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)(av,{children:(0,X.jsx)(Hg,{className:`size-4 shrink-0 opacity-50`})})]})})}function dv({className:e,...t}){return(0,X.jsx)(P_.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 fv({className:e,...t}){return(0,X.jsx)(P_.Empty,{"data-slot":`command-empty`,className:Z(`py-6 text-center text-sm`,e),...t})}function pv({className:e,...t}){return(0,X.jsx)(P_.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 mv({className:e,children:t,...n}){return(0,X.jsxs)(P_.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)(ag,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function hv({className:e,...t}){return(0,X.jsx)(qf,{"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 gv=e=>(0,X.jsx)(bp,{"data-slot":`popover`,...e}),_v=e=>(0,X.jsx)(xp,{"data-slot":`popover-trigger`,...e}),vv=({className:e,align:t=`center`,sideOffset:n=4,...r})=>(0,X.jsx)(Sp,{children:(0,X.jsx)(Cp,{"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})}),yv=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`popover-header`,className:Z(`flex flex-col gap-1 text-sm`,e),...t}),bv=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`popover-title`,className:Z(`font-heading text-base font-medium`,e),...t}),qee=/[\s\-_/.:]+/,Jee=/\d(?:[._:-]*\d)+/g,xv=e=>e.toLowerCase().trim().split(qee).filter(Boolean),Yee=(e,t)=>t===e?300:t.startsWith(e)?200:e.length>=3&&t.includes(e)?100:0,Xee=e=>(e.toLowerCase().match(Jee)??[]).map(e=>e.replace(/\D/g,``)).filter(e=>e.length>=2),Zee=e=>/^\d+$/.test(e),Qee=(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},Sv=(e,t)=>{let n=xv(e);if(n.length===0)return 1;let r=t.flatMap(e=>xv(e??``)),i=[...new Set(t.flatMap(e=>Xee(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=Yee(e,n);r>t&&(t=r)}if(t===0&&Zee(e)&&(t=Qee(e,i)),t===0)return 0;a+=t}return a},Cv=({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)(hv,{className:Z(`text-xs font-medium text-muted-foreground`,s),htmlFor:r,children:e}),(0,X.jsxs)(gv,{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)(og,{className:`h-4 w-4 text-muted-foreground`})]})})}),(0,X.jsx)(vv,{side:g?`top`:`bottom`,align:`start`,className:Z(`w-[var(--radix-popover-trigger-width)] p-0`,c),children:(0,X.jsxs)(lv,{filter:(e,t,n)=>Sv(t,[e,...n??[]]),children:[y&&(0,X.jsx)(uv,{placeholder:`Filter...`}),(0,X.jsxs)(dv,{className:`max-h-72`,children:[(0,X.jsx)(fv,{children:`No matches`}),i.map((e,t)=>e.options.length===0?null:(0,X.jsx)(pv,{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)(mv,{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}`))]})]})})]})]})},wv=({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)(Cv,{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})=>{let u=(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]),d=e||`Use default model`;return t?(0,X.jsx)(`div`,{className:Z(c),children:(0,X.jsx)(wv,{label:a,triggerLabel:d,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:`Use default model`}]},...u.map(e=>({label:e.provider,options:e.models}))]})}):null},Ev=({variant:e,selectedModel:t,showVariantSelector:n,onVariantChange:r,selectId:i,label:a=`Variant`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l})=>{if(!n||!t)return null;let u=e||`Use model default`;return(0,X.jsx)(`div`,{className:Z(c),children:(0,X.jsx)(wv,{label:a,triggerLabel:u,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:`Use model default`}]},{label:`Available levels`,options:t.variants.map(e=>({value:e,label:e}))}]})})},Dv=({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 d=n.find(t=>t.id===e)??null,f=n.length>0,p=d!==null&&d.variants.length>0;return(0,X.jsxs)(`div`,{className:Z(`rounded-2xl border border-border/70 bg-background/25 p-4`,c),children:[u&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:`Helper model`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Used for auto-config and other lightweight project tasks. Leave empty to use the selected tool's default model.`})]}),r?(0,X.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,u?`mt-4`:``),children:`Loading OpenCode models...`}):f?(0,X.jsxs)(`div`,{className:Z(u?`mt-4`:``,`gap-3`,l?`flex flex-col`:`flex flex-wrap`),children:[(0,X.jsx)(Tv,{model:e,showModelSelector:f,availableModels:n,onModelChange:i,selectId:o,className:l?`min-w-0`:`min-w-[10rem] flex-[1.35_1_10rem]`}),p&&(0,X.jsx)(Ev,{variant:t,selectedModel:d,showVariantSelector:p,onVariantChange:a,selectId:s,className:l?`min-w-0`:`min-w-[7rem] flex-[0.7_1_7rem]`})]}):(0,X.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,u?`mt-4`:``),children:`OpenCode model discovery is unavailable right now. Leave this empty to use the selected tool's default model.`})]})},$ee=({delayDuration:e=0,...t})=>(0,X.jsx)(mee,{"data-slot":`tooltip-provider`,delayDuration:e,...t}),ete=e=>(0,X.jsx)(hee,{"data-slot":`tooltip`,...e}),tte=e=>(0,X.jsx)(gee,{"data-slot":`tooltip-trigger`,...e}),nte=({className:e,sideOffset:t=8,children:n,...r})=>(0,X.jsx)(_ee,{children:(0,X.jsxs)(vee,{"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)(yee,{className:`fill-popover`})]})}),Ov=({content:e,children:t,align:n,side:r,sideOffset:i,disabled:a=!1,contentClassName:o,delayDuration:s=0})=>(0,X.jsx)($ee,{delayDuration:s,disableHoverableContent:!0,children:(0,X.jsxs)(ete,{children:[(0,X.jsx)(tte,{asChild:!0,children:t}),a?null:(0,X.jsx)(nte,{className:o,align:n,side:r,sideOffset:i??8,children:e})]})}),kv=({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)(Ov,{content:t.inactiveTooltip,children:a},t.value)})}),rte=({activeTool:e,onChange:t})=>(0,X.jsx)(kv,{value:e,items:[{value:`opencode`,label:`OpenCode`},{value:`claude`,label:`Claude`}],onChange:t}),ite=({activeTool:e,availableHelperModels:t,helperModel:n,helperVariant:r,isHelperModelsLoaded:i,isToolLoaded:a,onCreateProject:o,onHelperModelChange:s,onHelperVariantChange:c,onToolChange:l})=>{let{t:u}=He(`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:u(`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:u(`emptyState.description`)}),a?(0,X.jsx)(`div`,{className:`w-fit`,children:(0,X.jsx)(rte,{activeTool:e,onChange:l})}):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u(`emptyState.loadingToolPreference`)}),(0,X.jsx)(Dv,{helperModel:n,helperVariant:r,availableModels:t,isLoadingModels:!i,onHelperModelChange:s,onHelperVariantChange:c,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:o,variant:`success`,size:`lg`,children:u(`emptyState.createFirstProject`)})})]})})},Av=({className:e})=>(0,X.jsx)(og,{"aria-hidden":`true`,className:e}),jv=({className:e})=>(0,X.jsx)(Lg,{"aria-hidden":`true`,className:e}),ate=({className:e})=>(0,X.jsx)(Ug,{"aria-hidden":`true`,className:e}),ote=({activeProjectId:e,onCreateProject:t,projects:n,onEditProject:r,onProjectChange:i})=>{let{t:a}=He(`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)(gv,{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)(Av,{className:`h-4 w-4`})})]})})}),(0,X.jsxs)(vv,{side:c?`top`:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:[(0,X.jsxs)(lv,{filter:(e,t,n)=>Sv(t,[e,...n??[]]),children:[f&&(0,X.jsx)(uv,{placeholder:a(`identity.filterPlaceholder`)}),(0,X.jsxs)(dv,{className:`max-h-72`,children:[(0,X.jsx)(fv,{children:a(`identity.emptySearch`)}),(0,X.jsx)(pv,{children:n.map(t=>(0,X.jsx)(mv,{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)(jv,{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)(ate,{className:`h-4 w-4`})})]})};function ste({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:Z(`animate-pulse rounded-2xl bg-muted`,e),...t})}var Mv=({className:e=``})=>(0,X.jsx)(ste,{"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)}),Nv=({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)(Mv,{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]})]})},Pv=({className:e})=>(0,X.jsx)(Eg,{"aria-hidden":`true`,className:e}),Fv=({className:e})=>(0,X.jsx)(_g,{"aria-hidden":`true`,className:e}),Iv=({className:e})=>(0,X.jsx)(bg,{"aria-hidden":`true`,className:e}),Lv=({className:e})=>(0,X.jsx)(tg,{"aria-hidden":`true`,className:e}),Rv=({className:e})=>(0,X.jsx)(Dg,{"aria-hidden":`true`,className:e}),zv=({className:e})=>(0,X.jsx)(Ig,{"aria-hidden":`true`,className:e}),Bv=({className:e})=>(0,X.jsx)(bg,{"aria-hidden":`true`,className:e}),Vv=({className:e})=>(0,X.jsx)(Kg,{"aria-hidden":`true`,className:e}),Hv=({className:e})=>(0,X.jsx)(qg,{"aria-hidden":`true`,className:e});function cte(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 lte=e=>{switch(e){case`success`:return fte;case`info`:return mte;case`warning`:return pte;case`error`:return hte;default:return null}},ute=Array(12).fill(0),dte=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},ute.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),fte=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`})),pte=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`})),mte=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`})),hte=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`})),gte=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`})),_te=()=>{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},Uv=1,Wv=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:Uv++,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(yte(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||Uv++;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}},vte=(e,t)=>{let n=t?.id||Uv++;return Wv.addToast({title:e,...t,id:n}),n},yte=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,$=Object.assign(vte,{success:Wv.success,info:Wv.info,warning:Wv.warning,error:Wv.error,custom:Wv.custom,message:Wv.message,promise:Wv.promise,dismiss:Wv.dismiss,loading:Wv.loading},{getHistory:()=>Wv.toasts,getToasts:()=>Wv.getActiveToasts()});cte(`[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 Gv(e){return e.label!==void 0}var bte=3,xte=`24px`,Ste=`16px`,Kv=4e3,Cte=356,wte=14,Tte=45,Ete=200;function qv(...e){return e.filter(Boolean).join(` `)}function Dte(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Ote=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,B]=p.useState(!1),[V,H]=p.useState(0),[U,W]=p.useState(0),G=p.useRef(n.duration||b||Kv),K=p.useRef(null),ee=p.useRef(null),te=c===0,ne=c+1<=o,re=n.type,ie=n.dismissible!==!1,ae=n.className||``,oe=n.descriptionClassName||``,se=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ce=p.useMemo(()=>n.closeButton??m,[n.closeButton,m]),le=p.useMemo(()=>n.duration||b||Kv,[n.duration,b]),ue=p.useRef(0),de=p.useRef(0),fe=p.useRef(0),pe=p.useRef(null),[me,he]=x.split(`-`),ge=p.useMemo(()=>s.reduce((e,t,n)=>n>=se?e:e+t.height,0),[s,se]),_e=_te(),ve=n.invert||t,ye=re===`loading`;de.current=p.useMemo(()=>se*S+ge,[se,ge]),p.useEffect(()=>{G.current=le},[le]),p.useEffect(()=>{M(!0)},[]),p.useEffect(()=>{let e=ee.current;if(e){let t=e.getBoundingClientRect().height;return W(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=ee.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,W(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 be=p.useCallback(()=>{P(!0),H(de.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Ete)},[n,d,a,de]);p.useEffect(()=>{if(n.promise&&re===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||_e?(()=>{if(fe.current<ue.current){let e=new Date().getTime()-ue.current;G.current-=e}fe.current=new Date().getTime()})():G.current!==1/0&&(ue.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),be()},G.current)),()=>clearTimeout(e)},[u,i,n,re,_e,be]),p.useEffect(()=>{n.delete&&(be(),n.onDismiss==null||n.onDismiss.call(n,n))},[be,n.delete]);function xe(){return T?.loading?p.createElement(`div`,{className:qv(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":re===`loading`},T.loading):p.createElement(dte,{className:qv(w?.loader,n?.classNames?.loader),visible:re===`loading`})}let Se=n.icon||T?.[re]||lte(re);return p.createElement(`li`,{tabIndex:0,ref:ee,className:qv(v,ae,w?.toast,n?.classNames?.toast,w?.default,w?.[re],n?.classNames?.[re]),"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":ne,"data-y-position":me,"data-x-position":he,"data-index":c,"data-front":te,"data-swiping":F,"data-dismissible":ie,"data-type":re,"data-invert":ve,"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?V:de.current}px`,"--initial-height":C?`auto`:`${U}px`,...h,...n.style},onDragEnd:()=>{I(!1),O(null),pe.current=null},onPointerDown:e=>{e.button!==2&&(ye||!ie||(K.current=new Date,H(de.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),pe.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!ie)return;pe.current=null;let e=Number(ee.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ee.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-K.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Tte||a>.11){H(de.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),be(),R(!0);return}else{var o,s;(o=ee.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ee.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}B(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!pe.current||!ie||window.getSelection()?.toString().length>0)return;let i=t.clientY-pe.current.y,a=t.clientX-pe.current.x,o=e.swipeDirections??Dte(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)&&B(!0),(n=ee.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ee.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ce&&!n.jsx&&re!==`loading`?p.createElement(`button`,{"aria-label":E,"data-disabled":ye,"data-close-button":!0,onClick:ye||!ie?()=>{}:()=>{be(),n.onDismiss==null||n.onDismiss.call(n,n)},className:qv(w?.closeButton,n?.classNames?.closeButton)},T?.close??gte):null,(re||n.icon||n.promise)&&n.icon!==null&&(T?.[re]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:qv(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||xe():null,n.type===`loading`?null:Se):null,p.createElement(`div`,{"data-content":``,className:qv(w?.content,n?.classNames?.content)},p.createElement(`div`,{"data-title":``,className:qv(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:qv(y,oe,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),p.isValidElement(n.cancel)?n.cancel:n.cancel&&Gv(n.cancel)?p.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{Gv(n.cancel)&&ie&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),be())},className:qv(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,p.isValidElement(n.action)?n.action:n.action&&Gv(n.action)?p.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||_,onClick:e=>{Gv(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&be())},className:qv(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Jv(){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 kte(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Ste:xte;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 Ate=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:_=bte,toastOptions:v,dir:y=Jv(),gap:b=wte,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||Wv.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return p.useEffect(()=>Wv.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`?Jv():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":`${Cte}px`,"--gap":`${b}px`,...g,...kte(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(Ote,{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}))}),Yv=({className:e})=>(0,X.jsx)(yg,{"aria-hidden":`true`,className:e}),jte=(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},Xv=12,Zv=e=>({x:e.left+e.width/2,y:e.top+e.height/2}),Qv=e=>`${e.blocker_ticket_id}:${e.dependent_ticket_id}`,$v=(e,t)=>e.filter(e=>e.blocker_ticket_id!==t&&e.dependent_ticket_id!==t),ey=(e,t)=>{let n=e.filter(e=>Qv(e)!==Qv(t));return n.push(t),n.sort((e,t)=>Qv(e).localeCompare(Qv(t))),n},ty=(e,t,n)=>e.filter(e=>!(e.blocker_ticket_id===t&&e.dependent_ticket_id===n)),ny=(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},ry=(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`}:ny(e,t,n)?{valid:!1,reason:`cycle`}:{valid:!0},iy=e=>e===`self`?`A ticket cannot depend on itself.`:e===`duplicate`?`This dependency already exists.`:`This dependency would create a cycle.`,ay=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,oy=e=>!e||e.has_worktree===!1?!1:e.run_setup_status===`ready`?!0:ay(e),sy=e=>{if(!(!e||e.has_worktree===!1)){if(e.run_setup_status===`preparing`)return`Setting up worktree...`;if(!oy(e))return`Run unlocks after setup finishes.`}},cy=(e,t,n)=>n.filter(t=>t.dependent_ticket_id===e.id).map(e=>t.get(e.blocker_ticket_id)).filter(e=>!!e&&!ay(e)),ly=(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},uy=(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&&jte(r,o)<0){e.splice(a,0,t),i=!0;break}}i||e.push(t)},dy=(e,t,n)=>{if(!t.get(e))return[];let r=ly(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&&uy(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&&uy(c,n,t)}}}return l.map(e=>t.get(e)).filter(e=>!!e)},fy=(e,t,n)=>{let r=dy(e.id,t,n),i=r.filter(e=>!ay(e)),a=r.length>1,o=cy(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}},py=(e,t)=>{let n=Zv(e),r=Zv(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-Xv},end:{x:r.x,y:t.top+Xv}}:{start:{x:n.x,y:e.top+Xv},end:{x:r.x,y:s-Xv}}:r.x>=n.x?{start:{x:i-Xv,y:n.y},end:{x:t.left+Xv,y:r.y}}:{start:{x:e.left+Xv,y:n.y},end:{x:a-Xv,y:r.y}}},my=(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)}},hy={plan:0,build:1,review:2},gy={plan:`build`,build:`review`},_y=e=>gy[e]??null,vy=e=>e===`plan`?`plan`:e===`build`||e===`review`||e===`done`?`build`:`default`,yy=e=>e.worktree_bundle_id??e.id,by=(e,t)=>{if(!e)return null;let n=t.find(t=>t.id===e.ticket_id);return n?yy(n):e.ticket_id},xy=({bundleId:e,activeRunContextKey:t,isProjectRootRunActive:n})=>n?!0:t!==null&&t!==e,Sy=(e,t,n,r)=>n||t!==null&&t!==yy(e)?r:sy(e),Cy=(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,wy=(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)))},Ty=e=>e.state===`build`||e.state===`review`&&e.review_follow_up_active===!0,Ey=e=>e.state===`review`&&e.review_follow_up_active!==!0,Dy=e=>e.parked_at!==null,Oy=e=>Dy(e)?`done`:e.state,ky=e=>e.is_stale===!0,Ay=e=>e?e.files_changed===0&&e.additions===0&&e.deletions===0:!1,jy=(e,t)=>!t||e===`plan`?!1:!(e===`done`&&Ay(t)),My=e=>Dy(e)||e.agent_status===`running`?!1:e.state===`build`?e.agent_status===`done`:e.state===`review`,Ny=(e,t)=>Dy(e)&&e.state===t,Py=e=>e.tickets.length>0&&e.tickets.every(e=>By(e,`trash`)),Fy=e=>e.tickets.length>0&&e.tickets.every(e=>By(e,`done`)),Iy=e=>e.column===`done`&&e.tickets.length>0&&e.tickets.every(e=>e.state!==`plan`),Ly=(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}:{},Ry=(e,t)=>e===`plan`&&t===`build`?`build`:e===`build`&&t===`review`?`review`:e===`review`&&t===`build`?`undoReview`:null,zy=(e,t,n)=>t===`review`&&n===`build`?{}:Ly(e,n),By=(e,t)=>e.agent_status===`running`?!1:t===`done`?My(e):!(t!==`trash`&&hy[t]<=hy[e.state]||t===`review`&&(e.state!==`build`||e.agent_status!==`done`&&e.agent_status!==`stopped`)),Vy=e=>{let t=_y(e.state);return!t||By(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},Hy=[...[`plan`,`build`,`review`],`done`],Uy=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}),Wy=(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},Gy=e=>e.kind===`project_root`?!0:e.has_prepared_worktree!==!1,Ky=e=>e.filter(e=>e.kind!==`project_root`&&Gy(e)),qy=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,Jy=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,Yy=e=>e.has_worktree??!!(e.bundle?.branch??e.branch),Xy=(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=Jy(e),a=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId&&e.session_id)??null:qy(e),o=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId)??null:null;return n??r??i??a??o??e.find(e=>Yy(e))??e.find(e=>e.state!==`plan`)??e[0]??null},Zy=(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=Wy(t[0],r);return i?[{kind:`bundle`,group:{id:`${i.id}:${n}`,bundle:i,column:n,tickets:Uy(t)}}]:t.map(e=>({kind:`ticket`,ticket:e}))})},Qy=e=>`bundle-group:${e.id}`,$y=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(Oy(n));continue}t.set(n.worktree_bundle_id,new Set([Oy(n)]))}let n=new Set;for(let[e,r]of t)r.size>=2&&n.add(e);return n},eb=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 Hy.includes(i)?{bundleId:r,column:i}:null},tb=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()},nb=(e,t)=>{let n=tb(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},rb=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?e.name??``:e.branch??``;let t=tb(e.name||e.branch||``);return e.branch?nb(t,e.branch):t},ib=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?`Project root`:`Project root (${e.branch})`;let t=rb(e),n=e.branch??``,r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return t===``||n===``?t||n:r===i?t:`${t} (${n})`},ab=(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`,ob=({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}=He(`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)(()=>Ky(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?ib(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)(()=>ab(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`,B=!g||!z||!!m?.rebase_disabled_reason||h!==null||C;(0,p.useEffect)(()=>{y&&S(t?.branch??``)},[t?.branch,y]);let V=e=>{b(e),u?.(e)},H=()=>{c&&V(!1)},U=async e=>{w(!0);try{await d(e)&&H()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.bundleSwitch`))}finally{w(!1)}},W=async(e,t)=>{w(!0);try{await f(e,t)&&H()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.repoRootSwitch`))}finally{w(!1)}},G=async()=>{if(g){w(!0);try{await g(),V(!1)}catch(e){$.error(e instanceof Error?e.message:v(`projectFooter.rebaseFallbackError`))}finally{w(!1)}}};return(0,X.jsxs)(gv,{open:y,onOpenChange:V,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)(Mv,{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)(Yv,{className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate font-medium`,children:A})]})})}),(0,X.jsx)(vv,{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)(hv,{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)(lv,{className:`rounded-xl border border-border/70 bg-background/40 p-0`,label:v(`projectTargetSelector.searchAriaLabel`),shouldFilter:!0,children:[(0,X.jsx)(uv,{placeholder:v(`projectTargetSelector.searchPlaceholder`),"aria-label":v(`projectTargetSelector.searchAriaLabel`)}),(0,X.jsxs)(dv,{className:`max-h-56 p-1`,"data-testid":`project-target-options`,children:[(0,X.jsx)(fv,{children:v(N?`projectTargetSelector.loadingTargets`:`projectTargetSelector.noSearchResults`)}),(0,X.jsxs)(mv,{value:`${v(`projectTargetSelector.repoRoot`)} ${k??``}`,"data-checked":E,disabled:N||C,"aria-label":`${j}. ${E?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{W(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=rb(t),r=ib(t),i=e.active_target_kind===`bundle`&&e.active_target_bundle_id===t.id;return(0,X.jsxs)(mv,{value:r,"data-checked":i,disabled:N||C,"aria-label":`${r}. ${i?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{U(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)(Rv,{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:()=>{V(!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)(hv,{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:()=>{W(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)(hv,{htmlFor:`project-target-branch-input`,className:`text-xs text-muted-foreground`,children:v(`projectTargetSelector.switchOrCreateBranch`)}),(0,X.jsx)(tv,{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:()=>{W(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)(hv,{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:B,title:m?.rebase_disabled_reason??void 0,onClick:()=>{G()},children:[(0,X.jsx)(`span`,{children:R}),h===`rebase`&&(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`})]})]})]})})]})},sb=(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,cb=({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}=He(`common`),j=r?.operation_state??`idle`,M=!!(e&&r&&r.behind>0&&j===`idle`),N=(()=>{let e=sb(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`,B=A(j===`merge`?`projectFooter.abortMerge`:`projectFooter.abortRebase`),V=!!e,H=!!(e&&n?.diffStats?.is_dirty),U=A(l?`workspaceControls.hideTerminalAriaLabel`:`workspaceControls.openTerminalAriaLabel`),W=e?.active_target_kind??`repo_root`,G=e?.active_target_bundle_id??null,K=W!==`bundle`||f.some(e=>e.id===G&&e.has_prepared_worktree===!0),ee=e!==null&&t?.kind===`project`&&t.project_id===e.id&&(t.target_kind??`repo_root`)===W&&((t.target_kind??`repo_root`)!==`bundle`||t.target_bundle_id===G),te=e!==null&&!ee&&(!i||!c),ne=!e||!ee&&(!s||t!==null||te),re=A(ee?`projectFooter.stop`:`projectFooter.run`),ie=(()=>{if(!e)return A(`projectFooter.selectProjectFirst`);if(!ee){if(!s)return A(`projectFooter.addRunConfig`);if(te)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)(ob,{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)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Vv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:I?A(`projectFooter.aborting`):B})]}),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)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Bv,{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:[H&&n?.diffStats&&(0,X.jsx)(Nv,{stats:n.diffStats,showFiles:!0,className:`text-xs`}),V&&(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)(Iv,{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)(Fv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.files`)})]})]}),(d||u)&&K&&(0,X.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.verification`),onClick:y,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(Pv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.verification`)})]}),(0,X.jsxs)(Q,{type:`button`,"aria-label":U,"aria-pressed":l,onClick:w,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(Hv,{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)(Lv,{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:ne,title:ie,onClick:C,variant:ee?`destructive`:`secondary`,className:[`gap-2`,ee?``:`bg-sky-700 text-sky-100 hover:bg-sky-600 hover:text-white`,ne?`bg-slate-700 text-slate-400 hover:bg-slate-700 hover:text-slate-400`:``].join(` `),children:[ee&&(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`}),ee?(0,X.jsx)(Vv,{className:`h-4 w-4`}):(0,X.jsx)(zv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:re})]})]})]})})},lb=e=>(0,X.jsx)(Bf,{"data-slot":`dropdown-menu`,...e}),ub=e=>(0,X.jsx)(Vf,{"data-slot":`dropdown-menu-trigger`,...e}),db=({className:e,align:t=`end`,sideOffset:n=6,...r})=>(0,X.jsx)(Hf,{children:(0,X.jsx)(Uf,{"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})}),fb=({className:e,inset:t=!1,...n})=>(0,X.jsx)(Wf,{"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}),pb=({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,mb=({className:e})=>(0,X.jsx)(Yg,{"aria-hidden":`true`,className:e}),hb=({className:e})=>(0,X.jsx)(Rg,{"aria-hidden":`true`,className:e}),gb=class extends Error{constructor(e){super(e),this.name=`UpgradeInProgressError`}},_b=async e=>{let t=await fetch(qe(`/tools/upgrade`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tool:e})});if(t.status===409)throw new gb(await Xe(t,`upgrade already running`));if(!t.ok)throw new Ge(await Xe(t,`Upgrade failed.`),t.status);return await t.json()},vb=({onUpgrade:e})=>{let{t}=He(`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 _b(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 gb){$.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)(fb,{disabled:i,onSelect:t=>{t.preventDefault(),a(e)},children:[i?(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(hb,{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`))]})}},yb=({onUpgrade:e})=>{let{t}=He(`common`),{renderUpgradeMenuItems:n}=vb({onUpgrade:e});return(0,X.jsxs)(lb,{children:[(0,X.jsx)(ub,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,"aria-label":t(`toolsMenu.triggerAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`rounded-xl border border-border/70`,children:(0,X.jsx)(mb,{className:`h-4 w-4`})})}),(0,X.jsx)(db,{align:`end`,className:`w-52`,children:n()})]})},bb=({className:e})=>(0,X.jsx)(ig,{"aria-hidden":`true`,className:e}),xb=({className:e})=>(0,X.jsx)(ag,{"aria-hidden":`true`,className:e}),Sb=({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`})}),Cb=({className:e})=>(0,X.jsx)(mg,{"aria-hidden":`true`,className:e}),wb={"X-Archon-Desktop-Action":`mobile-access`},Tb=e=>Y(qe(`/mobile-access/status`),{signal:e}),Eb=e=>Y(qe(`/mobile-access/enable`),{method:`POST`,headers:wb,body:e}),Db=()=>Y(qe(`/mobile-access/disable`),{method:`POST`,headers:wb}),Ob=e=>Y(qe(`/mobile-access/regenerate-pairing`),{method:`POST`,headers:wb,body:{preferred_project_id:e??null}}),kb=e=>Y(qe(`/mobile-access/sessions/${encodeURIComponent(e)}/revoke`),{method:`POST`,headers:wb}),Ab=new Set,jb=null,Mb=null,Nb=()=>{for(let e of Ab)e(jb)},Pb=()=>{Mb!==null&&(window.clearTimeout(Mb),Mb=null)},Fb=e=>{if(typeof window>`u`||(Pb(),e?.state!==`awaiting_pairing`||!e.pairing))return;let t=new Date(e.pairing.expires_at).getTime();if(Number.isNaN(t))return;let n=()=>{jb?.state!==`awaiting_pairing`||jb.pairing?.expires_at!==e.pairing?.expires_at||Ib({...jb,state:`expired`,pairing:null})},r=t-Date.now();if(r<=0){n();return}Mb=window.setTimeout(n,r)},Ib=e=>{jb=e,Fb(e),Nb()},Lb=async e=>{let t=await Tb(e);return Ib(t),t},Rb=()=>{let[e,t]=(0,p.useState)(jb);return(0,p.useEffect)(()=>(Ab.add(t),()=>{Ab.delete(t)}),[]),e},zb=e=>{(0,p.useEffect)(()=>{if(!e)return;let t=null,n=()=>{t?.abort(),t=new AbortController;let e=t;Lb(e.signal).catch(e=>{Ye(e)}).finally(()=>{t===e&&(t=null)})};n();let r=e=>{Ib(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])},Bb=`(min-width: 1440px)`,Vb=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches,Hb=e=>{let[t,n]=(0,p.useState)(()=>Vb(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},Ub=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`,Wb=(e,t)=>{if(!e||e.state===`disabled`){let n=t(`projectHeader.runtime.mobileDisabled`);return{buttonClassName:Ub(e),indicatorState:`inactive`,isActive:!1,statusLabel:n,tooltip:n}}if(e.state===`awaiting_pairing`){let n=t(`projectHeader.runtime.mobileReadyToPair`);return{buttonClassName:Ub(e),indicatorState:`running`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`connected`){let n=t(`projectHeader.runtime.mobileConnected`);return{buttonClassName:Ub(e),indicatorState:`finished`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`expired`){let n=t(`projectHeader.runtime.mobilePairingExpired`);return{buttonClassName:Ub(e),indicatorState:`interrupted`,isActive:!0,statusLabel:n,tooltip:n}}return{buttonClassName:Ub(e),indicatorState:`error`,isActive:!0,statusLabel:t(`projectHeader.runtime.mobileUnavailable`),tooltip:e.error??t(`projectHeader.runtime.mobileUnavailable`)}},Gb=(e,t)=>t(e===`opencode`?`projectHeader.agent.openCode`:`projectHeader.agent.claude`),Kb=({activeTool:e,onToolChange:t})=>{let{t:n}=He(`common`);return(0,X.jsx)(`div`,{role:`group`,"aria-label":n(`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:[`opencode`,`claude`].map(r=>{let i=e===r;return(0,X.jsx)(Q,{type:`button`,variant:i?`secondary`:`ghost`,size:`xs`,className:i?`rounded-lg px-2.5 text-xs text-foreground`:`rounded-lg px-2.5 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>t(r),children:Gb(r,n)},r)})})},qb=({activeTool:e,onToolChange:t})=>{let{t:n}=He(`common`);return(0,X.jsxs)(lb,{children:[(0,X.jsx)(ub,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":n(`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)(bb,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{children:Gb(e,n)}),(0,X.jsx)(Av,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,X.jsx)(db,{align:`end`,className:`w-44`,children:[`opencode`,`claude`].map(r=>{let i=e===r;return(0,X.jsxs)(fb,{onSelect:()=>t(r),children:[(0,X.jsx)(bb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:Gb(r,n)}),i&&(0,X.jsx)(xb,{className:`h-4 w-4 text-muted-foreground`})]},r)})})]})},Jb=({hasActiveGitHubRuns:e=!1,onOpenGitHubActions:t})=>{let{t:n}=He(`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)(Sb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:n(`workspaceControls.githubActions`)})]}),e&&(0,X.jsx)(pb,{state:`running`,className:`absolute -top-0.5 -right-0.5`})]}):null},Yb=({onOpenActivity:e})=>{let{t}=He(`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)(Cb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:t(`projectHeader.runtime.activityLabel`)})]}):null},Xb=({mobileAccessStatus:e,onMobileAccessOpen:t})=>{let{t:n}=He(`common`);if(!t)return null;let r=Wb(e,n);return(0,X.jsx)(Ov,{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)(pb,{state:r.indicatorState,className:`mt-0`}),(0,X.jsx)(`span`,{children:n(`projectHeader.runtime.mobileLabel`)})]})})},Zb=({hasActiveGitHubRuns:e=!1,mobileAccessStatus:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i})=>{let{t:a}=He(`common`),{hasRunningUpgrade:o,renderUpgradeMenuItems:s}=vb({}),c=Wb(t,a),l=a(`projectHeader.runtime.triggerLabel`),u=null;return i&&e?u=`running`:n&&c.isActive?(l=c.statusLabel,u=c.indicatorState):o&&(l=a(`projectHeader.runtime.toolUpdateRunning`),u=`running`),(0,X.jsxs)(lb,{children:[(0,X.jsx)(ub,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":a(`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)(mb,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{children:l}),u&&(0,X.jsx)(pb,{state:u,className:`absolute -top-0.5 -right-0.5`})]})}),(0,X.jsxs)(db,{align:`end`,className:`w-60`,children:[r&&(0,X.jsxs)(fb,{onSelect:r,children:[(0,X.jsx)(Cb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:a(`projectHeader.runtime.openActivity`)})]}),i&&(0,X.jsxs)(fb,{onSelect:i,children:[(0,X.jsx)(Sb,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:a(`projectHeader.runtime.openGitHubActions`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a(e?`projectHeader.runtime.githubStatusRunning`:`projectHeader.runtime.githubStatusIdle`)})]}),n&&(0,X.jsxs)(fb,{onSelect:n,children:[(0,X.jsx)(pb,{state:c.indicatorState,className:`mt-0`}),(0,X.jsx)(`span`,{className:`flex-1`,children:a(`projectHeader.runtime.openMobileAccess`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c.statusLabel})]}),s()]})]})},Qb=({activeTool:e,hasActiveGitHubRuns:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onToolChange:a})=>{let o=Rb(),s=Hb(Bb);return(0,X.jsxs)(`div`,{className:`flex w-full min-w-0 items-center justify-end gap-2`,children:[s?(0,X.jsx)(Kb,{activeTool:e,onToolChange:a}):(0,X.jsx)(qb,{activeTool:e,onToolChange:a}),s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Jb,{hasActiveGitHubRuns:t,onOpenGitHubActions:i}),(0,X.jsx)(Yb,{onOpenActivity:r}),(0,X.jsx)(Xb,{mobileAccessStatus:o,onMobileAccessOpen:n}),(0,X.jsx)(yb,{})]}):(0,X.jsx)(Zb,{hasActiveGitHubRuns:t,mobileAccessStatus:o,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i})]})},$b=`border-sky-500/30 bg-sky-500/15 text-sky-100`,ex=`[--normal-bg:var(--info-bg)] [--normal-border:var(--info-border)] [--normal-text:var(--info-text)]`,tx=()=>(0,X.jsx)(Ate,{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:$b,loading:ex}}}),nx=300,rx=(e,t={})=>{let n=t.dedupeMs??nx,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)}},ix=6e4,ax=(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 ft(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()},ix),u=rx(()=>{o()});return()=>{n.abort(),window.clearInterval(c),u()}},[e,t,u]),{count:n,providers:i,loading:o,error:c,refresh:m}},ox=new Set,sx=new Map,cx=(e,t)=>{sx.set(e,t),ox.forEach(n=>n(e,t))},lx=e=>sx.has(e),ux=e=>{let[t,n]=(0,p.useState)(()=>e?sx.get(e)??[]:[]);return(0,p.useEffect)(()=>{if(!e){n([]);return}n(sx.get(e)??[]);let t=(t,r)=>{t===e&&n(r)};return ox.add(t),()=>{ox.delete(t)}},[e]),t},dx=Object.create(null);dx.open=`0`,dx.close=`1`,dx.ping=`2`,dx.pong=`3`,dx.message=`4`,dx.upgrade=`5`,dx.noop=`6`;var fx=Object.create(null);Object.keys(dx).forEach(e=>{fx[dx[e]]=e});var px={type:`error`,data:`parser error`},mx=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,hx=typeof ArrayBuffer==`function`,gx=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,_x=({type:e,data:t},n,r)=>mx&&t instanceof Blob?n?r(t):vx(t,r):hx&&(t instanceof ArrayBuffer||gx(t))?n?r(t):vx(new Blob([t]),r):r(dx[e]+(t||``)),vx=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function yx(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var bx;function xx(e,t){if(mx&&e.data instanceof Blob)return e.data.arrayBuffer().then(yx).then(t);if(hx&&(e.data instanceof ArrayBuffer||gx(e.data)))return t(yx(e.data));_x(e,!1,e=>{bx||=new TextEncoder,t(bx.encode(e))})}var Sx=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Cx=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Cx[Sx.charCodeAt(e)]=e;var wx=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=Cx[e.charCodeAt(r)],o=Cx[e.charCodeAt(r+1)],s=Cx[e.charCodeAt(r+2)],c=Cx[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},Tx=typeof ArrayBuffer==`function`,Ex=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:Ox(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Dx(e.substring(1),t)}:fx[n]?e.length>1?{type:fx[n],data:e.substring(1)}:{type:fx[n]}:px},Dx=(e,t)=>Tx?Ox(wx(e),t):{base64:!0,data:e},Ox=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},kx=``,Ax=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{_x(e,!1,e=>{r[a]=e,++i===n&&t(r.join(kx))})})},jx=(e,t)=>{let n=e.split(kx),r=[];for(let e=0;e<n.length;e++){let i=Ex(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Mx(){return new TransformStream({transform(e,t){xx(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 Nx;function Px(e){return e.reduce((e,t)=>e+t.length,0)}function Fx(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 Ix(e,t){Nx||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Px(n)<1)break;let e=Fx(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Px(n)<2)break;let e=Fx(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Px(n)<8)break;let e=Fx(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(px);break}i=a*2**32+t.getUint32(4),r=3}else{if(Px(n)<i)break;let e=Fx(n,i);s.enqueue(Ex(a?e:Nx.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(px);break}}}})}function Lx(e){if(e)return Rx(e)}function Rx(e){for(var t in Lx.prototype)e[t]=Lx.prototype[t];return e}Lx.prototype.on=Lx.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},Lx.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Lx.prototype.off=Lx.prototype.removeListener=Lx.prototype.removeAllListeners=Lx.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},Lx.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},Lx.prototype.emitReserved=Lx.prototype.emit,Lx.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},Lx.prototype.hasListeners=function(e){return!!this.listeners(e).length};var zx=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Bx=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),Vx=`arraybuffer`;function Hx(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Ux=Bx.setTimeout,Wx=Bx.clearTimeout;function Gx(e,t){t.useNativeTimers?(e.setTimeoutFn=Ux.bind(Bx),e.clearTimeoutFn=Wx.bind(Bx)):(e.setTimeoutFn=Bx.setTimeout.bind(Bx),e.clearTimeoutFn=Bx.clearTimeout.bind(Bx))}var Kx=1.33;function qx(e){return typeof e==`string`?Jx(e):Math.ceil((e.byteLength||e.size)*Kx)}function Jx(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 Yx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Xx(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function Zx(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 Qx=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},$x=class extends Lx{constructor(e){super(),this.writable=!1,Gx(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 Qx(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=Ex(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=Xx(e);return t.length?`?`+t:``}},eS=class extends $x{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){jx(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,Ax(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]=Yx()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},tS=!1;try{tS=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var nS=tS;function rS(){}var iS=class extends eS{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}},aS=class e extends Lx{constructor(e,t,n){super(),this.createRequest=e,Gx(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=Hx(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=rS,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(aS.requestsCount=0,aS.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,oS);else if(typeof addEventListener==`function`){let e=`onpagehide`in Bx?`pagehide`:`unload`;addEventListener(e,oS,!1)}}function oS(){for(let e in aS.requests)aS.requests.hasOwnProperty(e)&&aS.requests[e].abort()}var sS=(function(){let e=lS({xdomain:!1});return e&&e.responseType!==null})(),cS=class extends iS{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=sS&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new aS(lS,this.uri(),e)}};function lS(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||nS))return new XMLHttpRequest}catch{}if(!t)try{return new Bx[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var uS=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,dS=class extends $x{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=uS?{}:Hx(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;_x(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&zx(()=>{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]=Yx()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},fS=Bx.WebSocket||Bx.MozWebSocket,pS={websocket:class extends dS{createSocket(e,t,n){return uS?new fS(e,t,n):t?new fS(e,t):new fS(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends $x{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=Ix(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Mx();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&&zx(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:cS},mS=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,hS=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function gS(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=mS.exec(e||``),a={},o=14;for(;o--;)a[hS[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=_S(a,a.path),a.queryKey=vS(a,a.query),a}function _S(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 vS(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var yS=typeof addEventListener==`function`&&typeof removeEventListener==`function`,bS=[];yS&&addEventListener(`offline`,()=>{bS.forEach(e=>e())},!1);var xS=class e extends Lx{constructor(e,t){if(super(),this.binaryType=Vx,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=gS(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=gS(t.host).host);Gx(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=Zx(this.opts.query)),yS&&(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`})},bS.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+=qx(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,zx(()=>{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(),yS&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=bS.indexOf(this._offlineEventListener);e!==-1&&bS.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};xS.protocol=4;var SS=class extends xS{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;xS.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;xS.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}},CS=class extends SS{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=>pS[e]).filter(e=>!!e)),super(e,n)}};CS.protocol;function wS(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=gS(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 TS=typeof ArrayBuffer==`function`,ES=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,DS=Object.prototype.toString,OS=typeof Blob==`function`||typeof Blob<`u`&&DS.call(Blob)===`[object BlobConstructor]`,kS=typeof File==`function`||typeof File<`u`&&DS.call(File)===`[object FileConstructor]`;function AS(e){return TS&&(e instanceof ArrayBuffer||ES(e))||OS&&e instanceof Blob||kS&&e instanceof File}function jS(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(jS(e[t]))return!0;return!1}if(AS(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return jS(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&jS(e[t]))return!0;return!1}function MS(e){let t=[],n=e.data,r=e;return r.data=NS(n,t),r.attachments=t.length,{packet:r,buffers:t}}function NS(e,t){if(!e)return e;if(AS(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]=NS(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]=NS(e[r],t));return n}return e}function PS(e,t){return e.data=FS(e.data,t),delete e.attachments,e}function FS(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]=FS(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=FS(e[n],t));return e}var IS=r({Decoder:()=>BS,Encoder:()=>zS,PacketType:()=>RS,isPacketValid:()=>qS,protocol:()=>5}),LS=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],RS;(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`})(RS||={});var zS=class{constructor(e){this.replacer=e}encode(e){return(e.type===RS.EVENT||e.type===RS.ACK)&&jS(e)?this.encodeAsBinary({type:e.type===RS.EVENT?RS.BINARY_EVENT:RS.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===RS.BINARY_EVENT||e.type===RS.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=MS(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},BS=class e extends Lx{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===RS.BINARY_EVENT;n||t.type===RS.BINARY_ACK?(t.type=n?RS.EVENT:RS.ACK,this.reconstructor=new VS(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(AS(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(RS[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===RS.BINARY_EVENT||r.type===RS.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(!US(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 RS.CONNECT:return GS(t);case RS.DISCONNECT:return t===void 0;case RS.CONNECT_ERROR:return typeof t==`string`||GS(t);case RS.EVENT:case RS.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&LS.indexOf(t[0])===-1);case RS.ACK:case RS.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},VS=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=PS(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function HS(e){return typeof e==`string`}var US=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function WS(e){return e===void 0||US(e)}function GS(e){return Object.prototype.toString.call(e)===`[object Object]`}function KS(e,t){switch(e){case RS.CONNECT:return t===void 0||GS(t);case RS.DISCONNECT:return t===void 0;case RS.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&LS.indexOf(t[0])===-1);case RS.ACK:return Array.isArray(t);case RS.CONNECT_ERROR:return typeof t==`string`||GS(t);default:return!1}}function qS(e){return HS(e.nsp)&&WS(e.id)&&KS(e.type,e.data)}function JS(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var YS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),XS=class extends Lx{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=[JS(e,`open`,this.onopen.bind(this)),JS(e,`packet`,this.onpacket.bind(this)),JS(e,`error`,this.onerror.bind(this)),JS(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(YS.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:RS.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:RS.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 RS.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 RS.EVENT:case RS.BINARY_EVENT:this.onevent(e);break;case RS.ACK:case RS.BINARY_ACK:this.onack(e);break;case RS.DISCONNECT:this.ondisconnect();break;case RS.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:RS.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:RS.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 ZS(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}ZS.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},ZS.prototype.reset=function(){this.attempts=0},ZS.prototype.setMin=function(e){this.ms=e},ZS.prototype.setMax=function(e){this.max=e},ZS.prototype.setJitter=function(e){this.jitter=e};var QS=class extends Lx{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,Gx(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 ZS({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||IS;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 CS(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=JS(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=JS(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(JS(e,`ping`,this.onping.bind(this)),JS(e,`data`,this.ondata.bind(this)),JS(e,`error`,this.onerror.bind(this)),JS(e,`close`,this.onclose.bind(this)),JS(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){zx(()=>{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 XS(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)}},$S={};function eC(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=wS(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=$S[i]&&a in $S[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new QS(r,t):($S[i]||($S[i]=new QS(r,t)),c=$S[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(eC,{Manager:QS,Socket:XS,io:eC,connect:eC});var tC=((e=We)=>eC(e))(),nC=({className:e})=>(0,X.jsx)(xg,{"aria-hidden":`true`,className:e}),rC=({className:e})=>(0,X.jsx)(fg,{"aria-hidden":`true`,className:e}),iC=({className:e})=>(0,X.jsx)(Vg,{"aria-hidden":`true`,className:e}),aC=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},oC=({draft:e,onCreateTicket:t,onStartSpec:n})=>{let{t:r}=He(`common`),i=e.external_source.provider,a=r(i===`jira`?`assignedIssuesInbox.providerJira`:`assignedIssuesInbox.providerGithub`),o=r(i===`jira`?`assignedIssuesInbox.viewJira`:`assignedIssuesInbox.viewGithub`),s=aC(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)(iC,{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)(rC,{className:`h-3 w-3`}),o]})]})]})},sC=({projectId:e,onStartSpecFromDraft:t,onCreateTicketFromDraft:n})=>{let{t:r}=He(`common`),i=(ux(e)??[]).some(e=>e.status===`connected`),{count:a,refresh:o}=ax(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 pt(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 tC.on(`ticket:created`,t),()=>{tC.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)(gv,{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)(nC,{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)(vv,{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)(oC,{draft:e,onCreateTicket:v,onStartSpec:y},`${e.external_source.provider}:${e.external_source.external_key}`))})})]})]})},cC=({className:e})=>(0,X.jsx)(Xg,{"aria-hidden":`true`,className:e}),lC=[],uC=!1,dC=()=>{if(!(typeof window>`u`)){if(lC.length===0){uC&&=(window.removeEventListener(`keydown`,fC),!1);return}uC||=(window.addEventListener(`keydown`,fC),!0)}},fC=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=lC[lC.length-1];t&&t.onClose()},pC=(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 lC.push(e),dC(),()=>{let t=lC.findIndex(t=>t.id===e.id);t!==-1&&lC.splice(t,1),dC()}},[n])},mC=(...e)=>e.filter(Boolean).join(` `),hC=({children:e,onClose:t,overlayClassName:n,panelClassName:r,closeButtonClassName:i,closeButtonLabel:a=`Close modal`,renderContent:o})=>{pC(t);let s=(0,X.jsx)(Q,{type:`button`,"aria-label":a,variant:`ghost`,size:`icon-sm`,onClick:t,className:mC(`cursor-pointer text-muted-foreground hover:text-foreground`,i),children:(0,X.jsx)(cC,{className:`h-4 w-4`})});return(0,X.jsx)(`div`,{className:mC(`fixed inset-0 z-50 flex items-center justify-center`,n),children:(0,X.jsx)(`div`,{className:mC(`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]})})})},gC=({title:e,description:t,confirmLabel:n,cancelLabel:r,confirmVariant:i=`default`,onConfirm:a,onCancel:o})=>(0,X.jsxs)(hC,{onClose:o,overlayClassName:`bg-black/60`,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})]})]}),Mte=({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`})]})}),Nte=`common`,_C={en:{common:{appName:`Archon`,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`}},workspaceTabs:{ariaLabel:`Project workspace`,board:`Board`,chat:`Chat`,spec:`Spec`,memory:`Memory`},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`},kind:{test:`Tests`,check_batch:`Check batch`,check_attempt:`Check attempt`,check_repair:`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`,unknown:`Run`},status:{queued:`Queued`,running:`Running`,waiting:`Waiting`,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}}`,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.`,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`},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`,sourceUnavailable:`Source unavailable`,created:`Created`,started:`Started`,completed:`Completed`,failureReason:`Failure reason`,loading:`Loading run details...`,testEvidence:`Test evidence`,checkBatchEvidence:`Check batch`,checkAttemptEvidence:`Check attempt`,checkRepairEvidence:`Repair provenance`,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`,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`,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`}},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`,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`,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...`,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`,openQuestionsLabel:`Open Questions checkpoint`,openQuestionsDescription:`Pause before Review when Build has unresolved implementation questions.`,openQuestionsAriaLabel:`Open Questions checkpoint override`,enabled:`Enabled`,disabled:`Disabled`},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.`,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.`}}},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.`,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.`,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.`,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`,stopping:`Stopping...`,stop:`Stop`,collapseAriaLabel:`Collapse preview`,collapseTooltip:`Collapse`,expandAriaLabel:`Expand preview`,expandTooltip:`Expand`,closeAriaLabel:`Close preview`,closeTooltip:`Close`}},mobileApp:{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`},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...`,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.`,modeError:`Unable to update the spec mode 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`,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}}`},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.`,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`}},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.`,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.`},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...`,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`,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}}`,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 Relation Graph`,proposedTickets:`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`,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.`,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`,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`}},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`},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.`,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.`},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.`,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.`},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`,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}}`,projectPolicy:`Required policy: project policy`},gateTitle:`Automated delivery gate`,gatePassed:`Passed`,gateBlocked:`Blocked`,gateStale:`No longer current`,gateUnverifiable:`Unable to verify`,gatePolicy:`Policy {{fingerprint}}`,gateBoundary:`Boundary: {{boundary}}`,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...`,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.`},attempts:`Check attempts`,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`,command:`Command`,directory:`Directory`,targetRoot:`Target root`,outcome:`Outcome`,currencyLabel:`Currency`,output:`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...`,summary_one:`{{count}} structured diagnostic from {{parser}}`,summary_other:`{{count}} structured diagnostics from {{parser}}`,selectLegend:`Select diagnostics to repair`,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.`,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. Parser and count metadata remain available; repair is disabled.`,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 the owning ticket`,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`},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`},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.`},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:{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`},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.`,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.`,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`}},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`},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`},states:{loading:`Loading diff...`,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`,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`,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.`},services:{title:`Services`,description:`Add long-running commands that Archon should start automatically inside each worktree.`},checks:{title:`Checks`,description:`Configure commands and choose which checks must pass before delivery or also run before automatic Review.`},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.`,previewServiceRequired:`Choose a named service before enabling preview.`},actions:{cancel:`Cancel`,createProject:`Create project`,createProjectBusy:`Creating...`,saveChanges:`Save changes`,saveChangesBusy:`Saving...`}},advanced:{summary:{none:`None`,configured:`Configured`,toolDefault:`Tool default`,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 OpenCode model for auto-config and other lightweight project tasks.`},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:`Applies only to ticket worktree bundles, not the project root.`,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 and choose which ones govern automated delivery.`,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`}},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}}`},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`}}},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
@@ -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 uU(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=sW.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function _W(){return{exit:{taskListCheckValueChecked:yW,taskListCheckValueUnchecked:yW,paragraph:bW}}}function vW(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:xW}}}function yW(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function bW(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 xW(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=sW.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 SW(){return[OH(),QH(),rU(),cW(),_W()]}function CW(e){return{extensions:[kH(),$H(e),iU(),gW(e),vW()]}}var wW={tokenize:RW,partial:!0},TW={tokenize:zW,partial:!0},EW={tokenize:BW,partial:!0},DW={tokenize:VW,partial:!0},OW={tokenize:HW,partial:!0},kW={name:`wwwAutolink`,tokenize:IW,previous:UW},AW={name:`protocolAutolink`,tokenize:LW,previous:WW},jW={name:`emailAutolink`,tokenize:FW,previous:GW},MW={};function NW(){return{text:MW}}for(var PW=48;PW<123;)MW[PW]=jW,PW++,PW===58?PW=65:PW===91&&(PW=97);MW[43]=jW,MW[45]=jW,MW[46]=jW,MW[95]=jW,MW[72]=[jW,AW],MW[104]=[jW,AW],MW[87]=[jW,kW],MW[119]=[jW,kW];function FW(e,t,n){let r=this,i,a;return o;function o(t){return!KW(t)||!GW.call(r,r.previous)||qW(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return KW(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(OW,u,l)(t):t===45||t===95||OL(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&&DL(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function IW(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!UW.call(r,r.previous)||qW(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(wW,e.attempt(TW,e.attempt(EW,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function LW(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&WW.call(r,r.previous)&&!qW(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(DL(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||AL(t)||FL(t)||RL(t)||LL(t)?n(t):e.attempt(TW,e.attempt(EW,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function RW(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 zW(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(DW,c,s)(t):t===null||FL(t)||RL(t)||t!==45&&LL(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 BW(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(DW,t,a)(o):o===null||FL(o)||RL(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function VW(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||FL(o)||RL(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||FL(e)||RL(e)?t(e):r(e)}function a(e){return DL(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):DL(t)?(e.consume(t),o):n(t)}}function HW(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return OL(e)?n(e):t(e)}}function UW(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||FL(e)}function WW(e){return!DL(e)}function GW(e){return!(e===47||KW(e))}function KW(e){return e===43||e===45||e===46||e===95||OL(e)}function qW(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 JW={tokenize:nG,partial:!0};function YW(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:$W,continuation:{tokenize:eG},exit:tG}},text:{91:{name:`gfmFootnoteCall`,tokenize:QW},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:XW,resolveTo:ZW}}}}function XW(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=EL(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 ZW(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 QW(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||FL(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(EL(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return FL(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 $W(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||FL(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=EL(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return FL(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),VL(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function eG(e,t,n){return e.check(nR,t,e.attempt(JW,t,n))}function tG(e){e.exit(`gfmFootnoteDefinition`)}function nG(e,t,n){let r=this;return VL(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 rG(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&&yL(o,o.length,0,YL(s,e.slice(r+1,n),t)),yL(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),yL(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=JL(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=JL(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var iG=class{constructor(){this.map=[]}add(e,t,n){aG(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 aG(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 oG(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 sG(){return{flow:{null:{name:`table`,tokenize:cG,resolveAll:lG}}}}function cG(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):PL(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):IL(t)?VL(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||FL(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,IL(t)?VL(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 IL(t)?VL(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||PL(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 IL(t)?VL(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||PL(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||PL(n)?(e.exit(`tableRow`),t(n)):IL(n)?VL(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||FL(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 lG(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 iG;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(dG(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=uG(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=uG(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=uG(f,t,o,i,n,d)):(o[0]=o[1],d=uG(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&dG(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=oG(t.events,n))}return e}function uG(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},fG(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=fG(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=fG(t.events,n[2]),a=fG(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({},fG(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function dG(e,t,n,r,i){let a=[],o=fG(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 fG(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var pG={name:`tasklistCheck`,tokenize:hG};function mG(){return{text:{91:pG}}}function hG(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 FL(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 PL(r)?t(r):IL(r)?e.check({tokenize:gG},t,n)(r):n(r)}}function gG(e,t,n){return VL(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function _G(e){return SL([NW(),YW(),rG(e),sG(),mG()])}var vG={};function yG(e){let t=this,n=e||vG,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(_G(n)),a.push(SW()),o.push(CW(n))}function bG(e){SH(e,[/\r?\n|\r/g,xG])}function xG(){return{type:`break`}}function SG(){return function(e){bG(e)}}var CG=/^\[(?:X|x| )\]\s+/,wG=e=>{let t=e.split(`
146
146
  `).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0&&t.every(e=>CG.test(e))},TG=e=>wG(e)?e.split(`
147
- `).map(e=>e.trim()).filter(e=>e.length>0):[],EG=`modulepreload`,DG=function(e){return`/`+e},OG={},kG=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=DG(t,n),t in OG)return;OG[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`:EG,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)})},AG=e=>e.replace(/\\"/g,`"`),jG=({mermaid:e,className:t,onClick:n})=>{let{t:r}=He(`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}return(async()=>{try{let n=await kG(()=>import(`./mermaid.core-CjJzzlTK.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=AG(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})}})(),()=>{t=!0}},[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})},MG=e=>e.replace(/\\"/g,`"`),NG=({mermaid:e,open:t,onClose:n})=>{let{t:r}=He(`common`),[i,a]=(0,p.useState)({kind:`loading`}),o=`mermaid-preview-${(0,p.useId)().replace(/:/g,``)}`;return(0,p.useEffect)(()=>{if(!t)return;let n=!1;return a({kind:`loading`}),(async()=>{try{let t=await kG(()=>import(`./mermaid.core-CjJzzlTK.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=MG(e);if(await r.parse(i),n)return;let{svg:s}=await r.render(o,i);if(n)return;a({kind:`rendered`,svg:s})}catch{n||a({kind:`error`,rawText:e})}})(),()=>{n=!0}},[e,o,t]),(0,X.jsx)(K_,{open:t,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(X_,{showCloseButton:!1,overlayClassName:`bg-black/80 supports-backdrop-filter:backdrop-blur-md`,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)($_,{className:`sr-only`,children:r(`mermaidPreviewDialog.title`)}),(0,X.jsx)(ev,{className:`sr-only`,children:r(`mermaidPreviewDialog.description`)}),(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border/70 px-4 py-2.5 sm:px-5`,children:[(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground sm:text-base`,children:r(`mermaidPreviewDialog.title`)})}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,X.jsx)(J_,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,X.jsx)(cC,{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`,{className:`h-full w-full overflow-auto`,children:(0,X.jsx)(`div`,{className:`flex min-h-full min-w-full items-center justify-center`,dangerouslySetInnerHTML:{__html:i.svg}})})]})]})})},PG=`*, *::before, *::after { box-sizing: border-box; }
147
+ `).map(e=>e.trim()).filter(e=>e.length>0):[],EG=`modulepreload`,DG=function(e){return`/`+e},OG={},kG=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=DG(t,n),t in OG)return;OG[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`:EG,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)})},AG=e=>e.replace(/\\"/g,`"`),jG=({mermaid:e,className:t,onClick:n})=>{let{t:r}=He(`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}return(async()=>{try{let n=await kG(()=>import(`./mermaid.core-Dbab-VXW.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=AG(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})}})(),()=>{t=!0}},[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})},MG=e=>e.replace(/\\"/g,`"`),NG=({mermaid:e,open:t,onClose:n})=>{let{t:r}=He(`common`),[i,a]=(0,p.useState)({kind:`loading`}),o=`mermaid-preview-${(0,p.useId)().replace(/:/g,``)}`;return(0,p.useEffect)(()=>{if(!t)return;let n=!1;return a({kind:`loading`}),(async()=>{try{let t=await kG(()=>import(`./mermaid.core-Dbab-VXW.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=MG(e);if(await r.parse(i),n)return;let{svg:s}=await r.render(o,i);if(n)return;a({kind:`rendered`,svg:s})}catch{n||a({kind:`error`,rawText:e})}})(),()=>{n=!0}},[e,o,t]),(0,X.jsx)(K_,{open:t,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(X_,{showCloseButton:!1,overlayClassName:`bg-black/80 supports-backdrop-filter:backdrop-blur-md`,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)($_,{className:`sr-only`,children:r(`mermaidPreviewDialog.title`)}),(0,X.jsx)(ev,{className:`sr-only`,children:r(`mermaidPreviewDialog.description`)}),(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border/70 px-4 py-2.5 sm:px-5`,children:[(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground sm:text-base`,children:r(`mermaidPreviewDialog.title`)})}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,X.jsx)(J_,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,X.jsx)(cC,{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`,{className:`h-full w-full overflow-auto`,children:(0,X.jsx)(`div`,{className:`flex min-h-full min-w-full items-center justify-center`,dangerouslySetInnerHTML:{__html:i.svg}})})]})]})})},PG=`*, *::before, *::after { box-sizing: border-box; }
148
148
  html, body {
149
149
  margin: 0;
150
150
  padding: 16px;
@@ -216,7 +216,7 @@ Context:
216
216
  `);if(a.length<5)return null;let[o,s,c,l,...u]=a;return!/^\d+\. File: /.test(o)||!s.startsWith(`Line: `)||!c.startsWith(`Hunk: `)||!l.startsWith(`Changed line: `)||u.length===0||!u[0].startsWith(`Comment: `)?null:{source:`manual_comment`,filePath:o.replace(/^\d+\. File: /,``),page:null,line:s.slice(6),element:null,selectorHint:null,text:null,href:null,src:null,hunk:c.slice(6),lineContent:l.slice(14),comment:[u[0].slice(9),...u.slice(1)].join(`
217
217
  `),diffSnippet:i.slice(0,-4)}},vJ=e=>{let t=e.trimEnd().split(`
218
218
  `),n=t[0];if(!/^\d+\. Source: /.test(n))return null;let r=n.replace(/^\d+\. Source: /,``).trim().toLowerCase(),i=r===`archon review finding`?`archon_review_finding`:r===`external review comment`||r.startsWith(`github review `)?`external_review_comment`:r===`preview comment`?`preview_comment`:`manual_comment`,a=new Map,o=null,s=1;for(;s<t.length;){let e=t[s],n=hJ(t,s);if(typeof n==`number`){s=n;continue}let r=pJ(t,s);if(r){o=r.diffSnippet,s=r.nextIndex;continue}let i=mJ(t,s);if(typeof i==`number`){s=i;continue}if(e.startsWith(`Comment:`)){let n=[e.slice(8).trimStart()];for(s+=1;s<t.length;){let e=t[s];if(e===`Context:`||e===`Nearby source context:`||e.startsWith(`GitHub URL: `)||dJ.test(e))break;n.push(e),s+=1}a.set(`Comment`,gJ(n).join(`
219
- `).trimEnd());continue}let c=e.indexOf(`: `);if(c===-1){s+=1;continue}a.set(e.slice(0,c),e.slice(c+2)),s+=1}let c=a.get(`Comment`)??a.get(`What`)??``;return c?i===`preview_comment`?{source:i,filePath:null,page:a.get(`Page`)??null,line:null,element:a.get(`Element`)??null,selectorHint:a.get(`Selector hint`)??null,text:a.get(`Text`)??null,href:a.get(`Href`)??null,src:a.get(`Src`)??null,hunk:null,lineContent:null,comment:c,diffSnippet:null,severity:null,title:null,findingNumber:null}:{source:i,filePath:a.get(`File`)??`Unknown file`,page:null,line:a.get(`Line`)??`line unavailable`,element:null,selectorHint:null,text:null,href:null,src:null,hunk:a.get(`Hunk`)??null,lineContent:a.get(`Changed line`)??a.get(`Current line`)??null,comment:c,diffSnippet:o,severity:a.get(`Severity`)??null,title:a.get(`Title`)??null,findingNumber:a.has(`Finding`)&&Number(a.get(`Finding`))||null}:null},yJ=e=>{let t=e.trim(),n=t.startsWith(Zq),r=[Qq,$q,eJ,tJ,nJ,iJ,aJ,oJ,sJ,cJ,lJ].find(e=>t.startsWith(e));if(!n&&!r)return null;let i=n?Zq:r??Qq,a=t.slice(i.length).trim();if(!a)return null;let o=(n?a.split(/\n(?=\d+\. File: )/):(()=>{let e=a.replace(RegExp(`\\n${uJ.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}$`),``).replace(RegExp(`\\n${rJ.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}$`),``).trim(),t=fJ.exec(e);return!t||t.index===void 0?[]:e.slice(t.index).split(/\n(?=\d+\. Source: )/)})()).map(n?_J:vJ);if(o.some(e=>e===null))return null;let s=o.filter(e=>e!==null);return s.length===0?null:{items:s,locationCount:new Set(s.map(e=>e.filePath??e.page??`Unknown target`)).size,locationLabel:s.every(e=>e.page&&!e.filePath)?`page`:s.every(e=>e.filePath&&!e.page)?`file`:`target`}},bJ=e=>e?.status===`queued`||e?.status===`running`||e?.status===`waiting`,xJ=({summary:e})=>{let{t}=He(`common`),n=e.passed_count+e.failed_count+e.cancelled_count+e.interrupted_count,r=n+e.queued_count+e.running_count,i=bJ(e);return(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border px-3 py-2 text-xs ${i?`border-sky-500/30 bg-sky-500/10 text-sky-100`:e.status===`completed`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-100`:e.status===`failed`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-amber-500/30 bg-amber-500/10 text-amber-100`}`,role:`status`,children:[(0,X.jsx)(Pv,{className:`size-4 shrink-0`}),(0,X.jsx)(`span`,{className:`font-medium`,children:t(`postBuildChecks.status.${e.status}`)}),!i&&(0,X.jsx)(`span`,{className:`text-current/70`,children:t(`postBuildChecks.progress`,{completed:n,total:r})})]})},SJ=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.run_index===r.run_index&&e.label===r.label&&e.role===r.role&&e.agent_status===r.agent_status&&e.agent_log===r.agent_log&&e.streaming_response===r.streaming_response&&e.response_text===r.response_text&&e.updated_at===r.updated_at}),CJ=24,wJ=160,TJ=`archon.show-thinking`,EJ=new Set([`step started`,`step finished`]),DJ=/^_?todo[_-]?write_?$/i,OJ=`[[archon-apply-patch]]`,kJ=`[[/archon-apply-patch]]`,AJ=[/(^|\n)\s*<system-reminder>[\s\S]*?<\/system-reminder>\s*(?=\n|$)/g,/(^|\n)\s*<archon-[a-z0-9-]+>[\s\S]*?<\/archon-[a-z0-9-]+>\s*(?=\n|$)/g,/(^|\n)\s*<selected_skills>[\s\S]*?<\/selected_skills>\s*(?=\n|$)/g,/(^|\n)\s*<ticket>[\s\S]*?<\/ticket>\s*(?=\n|$)/g,/(^|\n)\s*<follow_up_instruction>[\s\S]*?<\/follow_up_instruction>\s*(?=\n|$)/g,/(^|\n)\s*<review_findings>[\s\S]*?<\/review_findings>\s*(?=\n|$)/g,/(^|\n)\s*<diff>[\s\S]*?<\/diff>\s*(?=\n|$)/g],jJ=/^<(?<tag>archon-[a-z0-9-]+)>$/i,MJ=/^<\/(?<tag>archon-[a-z0-9-]+)>$/i,NJ=()=>{try{return window.localStorage.getItem(TJ)===`true`}catch{return!1}},PJ=e=>{if(typeof queueMicrotask==`function`){queueMicrotask(e);return}Promise.resolve().then(e)},FJ=e=>{e.scrollTop=e.scrollHeight},IJ=e=>Math.max(0,e.scrollHeight-e.clientHeight),LJ=e=>1-(1-e)**3,RJ=()=>typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,zJ=e=>e.scrollHeight-e.clientHeight-e.scrollTop<=CJ,BJ=e=>e.replace(/\r\n/g,`
219
+ `).trimEnd());continue}let c=e.indexOf(`: `);if(c===-1){s+=1;continue}a.set(e.slice(0,c),e.slice(c+2)),s+=1}let c=a.get(`Comment`)??a.get(`What`)??``;return c?i===`preview_comment`?{source:i,filePath:null,page:a.get(`Page`)??null,line:null,element:a.get(`Element`)??null,selectorHint:a.get(`Selector hint`)??null,text:a.get(`Text`)??null,href:a.get(`Href`)??null,src:a.get(`Src`)??null,hunk:null,lineContent:null,comment:c,diffSnippet:null,severity:null,title:null,findingNumber:null}:{source:i,filePath:a.get(`File`)??`Unknown file`,page:null,line:a.get(`Line`)??`line unavailable`,element:null,selectorHint:null,text:null,href:null,src:null,hunk:a.get(`Hunk`)??null,lineContent:a.get(`Changed line`)??a.get(`Current line`)??null,comment:c,diffSnippet:o,severity:a.get(`Severity`)??null,title:a.get(`Title`)??null,findingNumber:a.has(`Finding`)&&Number(a.get(`Finding`))||null}:null},yJ=e=>{let t=e.trim(),n=t.startsWith(Zq),r=[Qq,$q,eJ,tJ,nJ,iJ,aJ,oJ,sJ,cJ,lJ].find(e=>t.startsWith(e));if(!n&&!r)return null;let i=n?Zq:r??Qq,a=t.slice(i.length).trim();if(!a)return null;let o=(n?a.split(/\n(?=\d+\. File: )/):(()=>{let e=a.replace(RegExp(`\\n${uJ.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}$`),``).replace(RegExp(`\\n${rJ.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}$`),``).trim(),t=fJ.exec(e);return!t||t.index===void 0?[]:e.slice(t.index).split(/\n(?=\d+\. Source: )/)})()).map(n?_J:vJ);if(o.some(e=>e===null))return null;let s=o.filter(e=>e!==null);return s.length===0?null:{items:s,locationCount:new Set(s.map(e=>e.filePath??e.page??`Unknown target`)).size,locationLabel:s.every(e=>e.page&&!e.filePath)?`page`:s.every(e=>e.filePath&&!e.page)?`file`:`target`}},bJ=e=>e?.status===`queued`||e?.status===`running`||e?.status===`waiting`,xJ=({summary:e})=>{let{t}=He(`common`),n=bJ(e);return(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border px-3 py-2 text-xs ${n?`border-sky-500/30 bg-sky-500/10 text-sky-100`:e.status===`completed`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-100`:e.status===`failed`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-amber-500/30 bg-amber-500/10 text-amber-100`}`,role:`status`,children:[(0,X.jsx)(Pv,{className:`size-4 shrink-0`}),(0,X.jsx)(`span`,{className:`font-medium`,children:t(`postBuildChecks.status.${e.status}`)}),!n&&(0,X.jsx)(`span`,{className:`text-current/70`,children:t(`postBuildChecks.progress`,{passed:e.passed_count,failed:e.failed_count})})]})},SJ=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.run_index===r.run_index&&e.label===r.label&&e.role===r.role&&e.agent_status===r.agent_status&&e.agent_log===r.agent_log&&e.streaming_response===r.streaming_response&&e.response_text===r.response_text&&e.updated_at===r.updated_at}),CJ=24,wJ=160,TJ=`archon.show-thinking`,EJ=new Set([`step started`,`step finished`]),DJ=/^_?todo[_-]?write_?$/i,OJ=`[[archon-apply-patch]]`,kJ=`[[/archon-apply-patch]]`,AJ=[/(^|\n)\s*<system-reminder>[\s\S]*?<\/system-reminder>\s*(?=\n|$)/g,/(^|\n)\s*<archon-[a-z0-9-]+>[\s\S]*?<\/archon-[a-z0-9-]+>\s*(?=\n|$)/g,/(^|\n)\s*<selected_skills>[\s\S]*?<\/selected_skills>\s*(?=\n|$)/g,/(^|\n)\s*<ticket>[\s\S]*?<\/ticket>\s*(?=\n|$)/g,/(^|\n)\s*<follow_up_instruction>[\s\S]*?<\/follow_up_instruction>\s*(?=\n|$)/g,/(^|\n)\s*<review_findings>[\s\S]*?<\/review_findings>\s*(?=\n|$)/g,/(^|\n)\s*<diff>[\s\S]*?<\/diff>\s*(?=\n|$)/g],jJ=/^<(?<tag>archon-[a-z0-9-]+)>$/i,MJ=/^<\/(?<tag>archon-[a-z0-9-]+)>$/i,NJ=()=>{try{return window.localStorage.getItem(TJ)===`true`}catch{return!1}},PJ=e=>{if(typeof queueMicrotask==`function`){queueMicrotask(e);return}Promise.resolve().then(e)},FJ=e=>{e.scrollTop=e.scrollHeight},IJ=e=>Math.max(0,e.scrollHeight-e.clientHeight),LJ=e=>1-(1-e)**3,RJ=()=>typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,zJ=e=>e.scrollHeight-e.clientHeight-e.scrollTop<=CJ,BJ=e=>e.replace(/\r\n/g,`
220
220
  `).trim(),VJ=e=>AJ.reduce((e,t)=>e.replace(t,`$1`),e),HJ=e=>{let t=e.trim();return t?t.startsWith(`{`)||t.startsWith(`[`)||t.startsWith(`"`)||t.startsWith(`- `)||/^\d+\.\s/.test(t):!0},UJ=e=>{let t=e.split(`
221
221
  `),n=[],r=null;for(let e of t){let t=e.trim();if(r===null){let i=t.match(jJ);if(i?.groups?.tag){r=i.groups.tag.toLowerCase();continue}n.push(e);continue}if(t.match(MJ)?.groups?.tag?.toLowerCase()===r){r=null;continue}HJ(t)||(r=null,n.push(e))}return n.join(`
222
222
  `)},WJ=e=>{let t=e.trim();if(!t.startsWith(`{`)||!t.endsWith(`}`))return!1;try{let e=JSON.parse(t);return Object.keys(e).length===1&&Array.isArray(e.open_questions)}catch{return!1}},GJ=e=>{let t=BJ(UJ(VJ(e??``)));return t?t.split(`
@@ -270,5 +270,5 @@ ${s.join(`
270
270
  `),[e.content,e.line_count]),u=zG(e.path),d=!!(u&&(e.content.length>1e5||l.some(e=>e.length>1e4))),f=!!(u&&!d),m=(0,p.useMemo)(()=>!f||!u?null:l.map(e=>qK(e,u)),[u,l,f]),h=(0,p.useMemo)(()=>{let e=new Map;return t.forEach(t=>e.set(t.lineNumber,[...e.get(t.lineNumber)??[],t])),e},[t]),g=m6({count:l.length,getScrollElement:()=>i.current,estimateSize:()=>24,overscan:15,initialRect:{width:900,height:600},initialOffset:0});return(0,p.useEffect)(()=>{o(null),c(``)},[e.content,e.content_signature,e.path]),(0,p.useEffect)(()=>{n||(o(null),c(``))},[n]),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[d&&(0,X.jsx)(`div`,{className:`shrink-0 border-b border-amber-400/20 bg-amber-500/5 px-4 py-2 text-xs text-amber-200`,role:`status`,children:$6(`highlightingDisabledLargeFile`)}),(0,X.jsxs)(`div`,{ref:i,className:`archon-diff-viewer min-h-0 flex-1 overflow-auto bg-background/50`,"aria-label":$6(`ariaLabel`),children:[l.length===0&&(0,X.jsx)(`div`,{className:`p-6 text-center text-sm text-muted-foreground`,children:$6(`empty`)}),l.length>0&&(0,X.jsx)(`div`,{className:`relative min-w-max`,style:{height:g.getTotalSize()},children:g.getVirtualItems().map(e=>{let t=e.index+1,i=h.get(t)??[];return(0,X.jsxs)(`div`,{ref:g.measureElement,"data-index":e.index,"data-source-line-number":t,className:Z(`absolute left-0 top-0 min-w-full font-mono text-xs`,i.length>0&&`bg-sky-500/5`,a===t&&`bg-accent/50`),style:{transform:`translateY(${e.start}px)`},children:[(0,X.jsxs)(`div`,{className:`group/source-line flex h-6 min-w-full leading-6`,children:[(0,X.jsxs)(`div`,{className:`relative flex h-6 w-16 shrink-0 select-none items-center justify-end border-r border-border/60 px-2 font-mono text-[11px] text-muted-foreground`,children:[n&&(0,X.jsx)(Q,{type:`button`,variant:`success`,size:`icon-xs`,className:`pointer-events-none absolute left-1 size-5 rounded-md opacity-0 shadow-[0_8px_20px_rgba(16,185,129,0.22)] transition-opacity group-hover/source-line:pointer-events-auto group-hover/source-line:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"aria-label":$6(`commentOnLine`,{lineNumber:t}),onClick:()=>{o(t),c(``)},children:(0,X.jsx)(jv,{className:`size-3`})}),i.length>0&&(0,X.jsx)(`span`,{"data-source-comment-count":i.length,className:`mr-1 text-sky-300`,children:i.length}),t]}),(0,X.jsx)(`code`,{className:`block whitespace-pre px-3 text-foreground`,children:m?.[e.index]??l[e.index]??` `})]}),a===t&&(0,X.jsxs)(`form`,{className:Z(`rounded-xl border border-sky-500/20 bg-sky-500/8 p-3 shadow-sm`,`sticky left-0 my-2 ml-16 w-[min(42rem,calc(100vw-8rem))]`),"aria-label":$6(`commentOnLine`,{lineNumber:t}),onSubmit:e=>{e.preventDefault();let i=s.trim();!n||!i||(r(t,i),o(null),c(``))},children:[(0,X.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,children:[$6(`commentOnLine`,{lineNumber:t}),(0,X.jsx)(nv,{className:Z(`min-h-20 font-mono text-xs`,`mt-2`),value:s,onChange:e=>c(e.target.value),placeholder:$6(`placeholder`),autoFocus:!0})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,X.jsx)(Q,{type:`submit`,size:`xs`,disabled:!n||!s.trim(),children:$6(`add`)}),(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{o(null),c(``)},children:$6(`cancel`)})]})]})]},t)})})]})]})},Rce=({className:e})=>(0,X.jsx)(pg,{"aria-hidden":`true`,className:e}),zce=({className:e})=>(0,X.jsx)(vg,{"aria-hidden":`true`,className:e}),Bce=new Set(`astro.c.cc.cjs.cpp.cs.css.dart.ex.exs.fs.go.h.hpp.html.htm.java.js.jsx.kt.kts.lua.mjs.php.pl.py.r.rb.rs.scala.sh.sql.svelte.swift.ts.tsx.vue.zsh`.split(`.`)),Vce=new Set([`dockerfile`,`gemfile`,`justfile`,`makefile`,`procfile`,`rakefile`]),Hce=e=>{if(!e)return`document`;let t=e.split(`/`),n=t[t.length-1]?.toLowerCase()??e.toLowerCase();if(Vce.has(n))return`code`;let r=n.split(`.`),i=r.length>1?r[r.length-1]??``:``;return Bce.has(i)?`code`:`document`},Uce={added:`A`,deleted:`D`,modified:`M`,renamed:`R`,typechanged:`T`,untracked:`U`},e8=(e,t)=>vC.t(`common:workspaceFiles.${e}`,t),Wce=({entry:e,expanded:t})=>e?Hce(e.path)===`code`?(0,X.jsx)(Rce,{className:`h-4 w-4 shrink-0 text-muted-foreground`}):(0,X.jsx)(Cb,{className:`h-4 w-4 shrink-0 text-muted-foreground`}):t?(0,X.jsx)(Fv,{className:`h-4 w-4 shrink-0 text-muted-foreground`}):(0,X.jsx)(zce,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),Gce=e=>{let t={path:``,name:``,depth:-1,entry:null,children:[]},n=new Map([[``,t]]);e.forEach(e=>{let r=e.path.split(`/`).filter(Boolean),i=t;r.forEach((t,a)=>{let o=r.slice(0,a+1).join(`/`),s=a===r.length-1,c=n.get(o);c||(c={path:o,name:t,depth:a,entry:s?e:null,children:[]},i.children.push(c),s||n.set(o,c)),i=c})});let r=e=>{e.sort((e,t)=>!!e.entry==!!t.entry?e.name.localeCompare(t.name):e.entry?1:-1),e.forEach(e=>r(e.children))};return r(t.children),t.children},t8=(e,t,n)=>e.flatMap(e=>{if(e.entry){let r=!t||e.path.toLocaleLowerCase().includes(t),i=!n||e.entry.status!==null;return r&&i?[e]:[]}let r=t8(e.children,t,n);return r.length>0?[{...e,children:r}]:[]}),n8=e=>e.entry?e.entry.status!==null:e.children.some(n8),Kce=(e,t,n)=>{let r=[],i=e=>{let a=!e.entry&&(n||t.has(e.path));r.push({...e,expanded:a,hasChangedDescendant:!e.entry&&e.children.some(n8)}),a&&e.children.forEach(i)};return e.forEach(i),r},qce=({entries:e,search:t,changedOnly:n,expandedPaths:r,selectedPath:i,commentCounts:a,onExpandedPathsChange:o,onSelectPath:s})=>{let c=(0,p.useRef)(null),l=t.trim().toLocaleLowerCase(),u=(0,p.useMemo)(()=>Kce(t8(Gce(e),l,n),r,!!l),[n,e,r,l]),d=m6({count:u.length,getScrollElement:()=>c.current,estimateSize:()=>32,overscan:8,initialRect:{width:320,height:600},initialOffset:0});return u.length===0?(0,X.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:e8(l?`noSearchResults`:`noFilterResults`)}):(0,X.jsx)(`div`,{ref:c,className:`min-h-0 flex-1 overflow-auto`,"aria-label":e8(`repositoryTree`),children:(0,X.jsx)(`div`,{className:`relative w-full`,style:{height:d.getTotalSize()},children:d.getVirtualItems().map(e=>{let t=u[e.index];if(!t)return null;let n=t.entry?a.get(t.path)??0:0;return(0,X.jsx)(`div`,{className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${e.start}px)`,height:e.size},children:(0,X.jsxs)(Q,{type:`button`,variant:`ghost`,className:Z(`h-8 w-full justify-start gap-1.5 rounded-none px-2 font-mono text-xs font-normal`,i===t.path&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${8+t.depth*14}px`},"aria-expanded":t.entry?void 0:t.expanded,"aria-label":t.entry?e8(`fileLabel`,{status:t.entry.status?`${t.entry.status}: `:``,path:t.path,comments:n?e8(`commentsSuffix`,{count:n}):``}):e8(t.expanded?`expandedFolder`:`collapsedFolder`,{path:t.path}),onClick:()=>{if(t.entry){s(t.path);return}let e=new Set(r);t.expanded?e.delete(t.path):e.add(t.path),o(e)},children:[(0,X.jsx)(Wce,{entry:t.entry,expanded:t.expanded}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t.name}),t.entry?.status&&(0,X.jsx)(`span`,{className:`shrink-0 font-semibold text-amber-300`,children:Uce[t.entry.status]}),!t.entry&&t.hasChangedDescendant&&(0,X.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-amber-300`}),n>0&&(0,X.jsx)(`span`,{className:`shrink-0 text-sky-300`,children:n})]})},t.path)})})})},Jce=`archon.workspace-review.source-comments`,r8=(e,t)=>`${Jce}:${e}:${t.kind}:${t.bundle_id??``}:${t.ticket_id??``}`,Yce=(e,t)=>{if(!e)return[];try{return JSON.parse(e).filter(e=>e.kind===`source`&&e.target.kind===t.kind&&e.target.bundle_id===t.bundle_id&&e.target.ticket_id===t.ticket_id)}catch{return[]}},i8=async(e,t)=>{let n=new Map;for(let r of t){let t=`${r.target.kind}:${r.target.bundle_id??``}:${r.target.ticket_id??``}:${r.filePath}`;if(!n.has(t)){let i=new AbortController;n.set(t,Q6(e,r.target,r.filePath,i.signal,!0).then(e=>e.content_signature).catch(()=>null))}}return await Promise.all(t.map(async e=>{let t=`${e.target.kind}:${e.target.bundle_id??``}:${e.target.ticket_id??``}:${e.filePath}`,r=await n.get(t);return{...e,stale:r===null||r!==e.contentSignature}}))},Xce=12,a8=(e,t)=>vC.t(`common:workspaceFiles.${e}`,t),o8=e=>a8(`unsupported.${e}`),Zce=e=>{if(!e.data||typeof e.data!=`object`||!(`reason`in e.data))return null;let t=e.data;return typeof t.reason==`string`?t:null},Qce=(e,t)=>{let n=e.split(`
271
271
  `),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(`
272
272
  `)},$ce=e=>e?.status?[vC.t(`common:chatChangesPanel.fileStatus.${e.status}`),e.staged&&vC.t(`common:chatChangesPanel.fileStatus.staged`),e.unstaged&&vC.t(`common:chatChangesPanel.fileStatus.unstaged`),e.conflicted&&vC.t(`common:chatChangesPanel.fileStatus.conflicted`)].filter(Boolean).join(`, `):a8(`tracked`),ele=({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)({kind:`empty`}),O=(0,p.useRef)(new Map),k=(0,p.useRef)(null),A=(0,p.useRef)(null),j=(0,p.useRef)(o),M=(0,p.useRef)(i),N=(0,p.useRef)(null),P=(0,p.useRef)(null),F=(0,p.useRef)(null),I=(0,p.useRef)(0),L=(0,p.useRef)(0),R=(0,p.useRef)(0),z=(0,p.useRef)(null),B=(0,p.useRef)(!1),V=(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]);k.current=u,A.current=w,j.current=o,M.current=i;let H=(0,p.useCallback)(e=>{M.current=e,a(e)},[a]),U=e?r8(e,t):null;(0,p.useEffect)(()=>{if(!e||!U||N.current===U||(N.current=U,M.current.length>0))return;let n=Yce(localStorage.getItem(U),t);n.length>0&&(H(n),i8(e,n).then(e=>{let t=new Map(e.map(e=>[e.id,e.stale])),n=M.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)&&H(r)}))},[H,e,U,t]),(0,p.useEffect)(()=>{if(U){if(i.length===0){localStorage.removeItem(U);return}localStorage.setItem(U,JSON.stringify(i))}},[i,U]);let W=(0,p.useCallback)(async(n,r=!1)=>{if(!e)return;P.current?.abort(),L.current+=1;let i=L.current;if((k.current?.entries.find(e=>e.path===n)??null)?.status===`deleted`){D({kind:`unsupported`,path:n,reason:`deleted`,message:o8(`deleted`)});return}let a=O.current.get(n);if(a&&!r){D({kind:`content`,content:a});return}let o=new AbortController;P.current=o,D({kind:`loading`,path:n});try{let a=await Q6(e,t,n,o.signal,r);if(i!==L.current)return;for(O.current.delete(n),O.current.set(n,a);O.current.size>Xce;){let e=O.current.keys().next().value;if(typeof e!=`string`)break;O.current.delete(e)}D({kind:`content`,content:a});let s=M.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)&&H(c)}catch(e){if(i!==L.current||Ye(e))return;if(e instanceof Ge){let t=Zce(e);if(t){D({kind:`unsupported`,path:n,reason:t.reason,message:o8(t.reason)});return}}D({kind:`error`,path:n,message:e instanceof Error?e.message:a8(`contentError`)})}},[H,e,t]),G=(0,p.useCallback)(async(n=!1)=>{if(!e){m(a8(`noProject`));return}let r=new AbortController;F.current?.abort(),F.current=r,I.current+=1;let i=I.current;g(!0),m(null);try{let a=await Ice(e,t,r.signal,n);if(i!==I.current)return;let o=k.current?.workspace_signature,s=o!==void 0&&o!==a.workspace_signature;k.current=a,d(a),s&&O.current.clear();let c=A.current;if(!c){let e=a.entries.filter(e=>e.status!==`deleted`);!j.current&&e.length===1&&(A.current=e[0].path,T(e[0].path),W(e[0].path));return}if(!a.entries.some(e=>e.path===c)){P.current?.abort(),L.current+=1,A.current=null,T(null),D({kind:`empty`});return}(s||n)&&(O.current.delete(c),W(c,!0))}catch(e){i===I.current&&!Ye(e)&&m(e instanceof Error?e.message:a8(`manifestError`))}finally{i===I.current&&g(!1)}},[W,e,t]);(0,p.useEffect)(()=>{if(!n){F.current?.abort(),P.current?.abort(),I.current+=1,L.current+=1;return}G(),z.current?.focus()},[n,G]),(0,p.useEffect)(()=>()=>{F.current?.abort(),P.current?.abort(),I.current+=1,L.current+=1},[]);let K=(0,p.useCallback)(e=>{A.current=e,T(e),W(e)},[W]);(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}),K(o),s?.(o)},[u,s,o,K]),(0,p.useEffect)(()=>{V.length===1&&w===null&&K(V[0].path)},[V,w,K]),(0,p.useEffect)(()=>{n&&!B.current&&!o&&z.current?.focus(),B.current=n},[n,o]);let ee=u?.entries.find(e=>e.path===w)??null,te=(0,p.useMemo)(()=>i.filter(e=>e.filePath===w),[i,w]),ne=(0,p.useMemo)(()=>{let e=new Map;return i.forEach(t=>e.set(t.filePath,(e.get(t.filePath)??0)+1)),e},[i]),re=(0,p.useCallback)((e,n)=>{if(E.kind!==`content`)return;let r=E.content.content.split(`
273
- `);R.current+=1,H([...M.current,{kind:`source`,id:`${E.content.path}:${e}:${Date.now()}:${R.current}`,target:t,filePath:E.content.path,lineNumber:e,lineContent:r[e-1]??``,sourceContext:Qce(E.content.content,e),contentSignature:E.content.content_signature,comment:n,stale:!1}])},[H,E,t]);return(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":a8(`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:[a8(`searchFiles`),(0,X.jsx)(tv,{ref:z,type:`search`,className:`mt-1 h-8`,value:_,onChange:e=>v(e.target.value),placeholder:a8(`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)}),a8(`changedOnly`)]}),(0,X.jsx)(Ov,{content:a8(`refreshFiles`),children:(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":a8(`refreshFiles`),disabled:h,onClick:()=>{G(!0)},children:h?(0,X.jsx)(Rv,{className:`size-3.5 animate-spin`}):(0,X.jsx)(Fce,{className:`size-3.5`})})})]})]}),h&&!u&&(0,X.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:a8(`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 G(),children:a8(`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:a8(`truncated`)}),(0,X.jsx)(qce,{entries:u.entries,search:y,changedOnly:b,expandedPaths:S,selectedPath:w,commentCounts:ne,onExpandedPathsChange:C,onSelectPath:K})]})]}),(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??a8(`selectFile`)}),ee&&(0,X.jsx)(`div`,{className:`mt-0.5 text-[11px] capitalize text-muted-foreground`,children:$ce(ee)})]}),(l||w&&ee?.status&&c)&&(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:[w&&ee?.status&&c&&(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>c(w),children:a8(`viewChanges`)}),l]})]}),E.kind===`empty`&&(0,X.jsx)(`div`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:a8(`empty`)}),E.kind===`loading`&&(0,X.jsx)(`div`,{className:`m-auto text-sm text-muted-foreground`,children:a8(`loadingFile`,{path:E.path})}),E.kind===`unsupported`&&(0,X.jsxs)(`div`,{className:`m-auto max-w-md space-y-2 text-center`,children:[(0,X.jsx)(yC,{variant:`outline`,className:`capitalize`,children:E.reason.replace(/_/g,` `)}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:E.message})]}),E.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:E.message}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void W(E.path,!0),children:a8(`retry`)})]}),E.kind===`content`&&(0,X.jsx)(Lce,{file:E.content,comments:te,canComment:r,onAddComment:re})]})]})},s8=r({WorkspaceReviewModal:()=>l8}),c8=e=>vC.t(`common:workspaceReviewModal.${e}`),tle=({activeMode:e,availableModes:t,onModeChange:n})=>(0,X.jsx)(`div`,{role:`tablist`,"aria-label":c8(`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)(Fv,{className:`h-4 w-4`}):(0,X.jsx)(Iv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:c8(t)})]},t))}),l8=({target:e,initialMode:t=`changes`,enabledModes:n=[`changes`],filesView:r,bundleTargetName:i=null,onClose:a,title:o,mode:s,onModeChange:c,canToggleMode:l=!1,...u})=>{let d=n.includes(t)?n:[t,...n],[f]=(0,p.useState)(e),[m,h]=(0,p.useState)(t),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)([]),[S,C]=(0,p.useState)([]),w=(0,p.useRef)(S),[T,E]=(0,p.useState)(null);w.current=S;let D=(0,p.useCallback)(e=>{w.current=e,C(e)},[]),O=(0,p.useCallback)(()=>{w.current=[],C([])},[]),k=d.length>1,A=k&&r===void 0,[j]=(0,p.useState)(i),[M]=(0,p.useState)(()=>f.scope===`project_root`?u.targetKind===`bundle`&&u.reviewCommentsBundleId?{kind:`bundle`,bundle_id:u.reviewCommentsBundleId,ticket_id:null}:{kind:`repo_root`,bundle_id:null,ticket_id:null}:u.reviewCommentsBundleId?{kind:`bundle`,bundle_id:u.reviewCommentsBundleId,ticket_id:null}:{kind:`ticket`,bundle_id:null,ticket_id:f.ticketId}),N=M.kind===`repo_root`?vC.t(`common:workspaceFiles.repositoryRoot`):M.kind===`bundle`?vC.t(`common:workspaceFiles.bundleTarget`,{name:j||M.bundle_id}):vC.t(`common:workspaceFiles.ticketTarget`,{id:M.ticket_id}),P=M.kind===`ticket`?o:N,F=(0,p.useCallback)(async()=>{if(!u.projectId||S.length===0)return S;let e=await i8(u.projectId,S),t=new Map(e.map(e=>[e.id,e.stale])),n=w.current.map(e=>{let n=t.get(e.id);return n===void 0?e:{...e,stale:n}});return D(n),n},[u.projectId,S,D]),I=(0,p.useCallback)(()=>{u.projectId&&localStorage.removeItem(r8(u.projectId,M)),O()},[u.projectId,O,M]),L=(0,p.useCallback)(e=>{_(e),h(`changes`)},[]),R=(0,p.useCallback)(e=>{y(e),h(`files`)},[]),z=(0,p.useCallback)(e=>{_(t=>t===e?null:t)},[]),B=(0,p.useCallback)(e=>{y(t=>t===e?null:t)},[]),V=(0,p.useCallback)(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s!==void 0&&c&&(0,X.jsx)(cX,{value:s,disabled:!l||u.isUpdatingMode,onChange:c,planInactiveTooltip:(0,X.jsx)(vX,{label:vC.t(`common:ticketChangesModal.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(vX,{label:vC.t(`common:ticketChangesModal.switchToBuild`)})}),(0,X.jsx)(a6,{reviewComments:b,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})]}),[l,u.isUpdatingMode,s,c,b]);return(0,p.useEffect)(()=>{if(!c||s===void 0)return;let e=e=>{!hX(e)||!l||(e.preventDefault(),c(mX(s)))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[l,s,c]),(0,X.jsx)(hC,{onClose:a,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:c8(`closeAriaLabel`),renderContent:({closeButton:e})=>{let t=k?(0,X.jsx)(tle,{activeMode:m,availableModes:d,onModeChange:h}):null,n=k?(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t,e]}):null,i=f.scope===`ticket`?(0,X.jsx)(X6,{...u,...f,projectId:u.projectId,title:o,onClose:a,mode:s,onModeChange:c,canToggleMode:l,closeButton:k?null:e,headerControls:n,isActive:m===`changes`,onPendingReviewCommentsChange:x,onReviewControlsStateChange:E,renderReviewControls:V,showReviewControls:!k||m===`changes`,sourceReviewComments:S,onSourceReviewCommentsChange:D,onClearSourceReviewComments:O,onSourceReviewCommentsSubmitted:I,onValidateSourceReviewComments:F,requestedDiffPath:g,onRequestedDiffPathHandled:z,onViewCurrentFile:A?R:void 0}):(0,X.jsx)(X6,{...u,scope:`project_root`,projectId:u.projectId,title:o,onClose:a,mode:s,onModeChange:c,canToggleMode:l,closeButton:k?null:e,headerControls:n,isActive:m===`changes`,onPendingReviewCommentsChange:x,onReviewControlsStateChange:E,renderReviewControls:V,showReviewControls:!k||m===`changes`,sourceReviewComments:S,onSourceReviewCommentsChange:D,onClearSourceReviewComments:O,onSourceReviewCommentsSubmitted:I,onValidateSourceReviewComments:F,requestedDiffPath:g,onRequestedDiffPathHandled:z,onViewCurrentFile:A?R:void 0});return k?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[m===`files`&&(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4`,children:[(0,X.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-lg font-semibold text-foreground`,children:P}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t,e]})]}),(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:m!==`changes`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":m===`changes`,children:i}),(0,X.jsx)(`div`,{id:`workspace-review-files-panel`,role:`tabpanel`,hidden:m!==`files`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":m===`files`,children:r??(0,X.jsx)(ele,{projectId:u.projectId,target:M,isActive:m===`files`,canAddComments:u.canAddReviewComments??!1,comments:S,onCommentsChange:D,requestedPath:v,onRequestedPathHandled:B,onViewChanges:L,headerControls:m===`files`&&T?V(T):void 0})})]})]}):i}})},nle=e=>!(e instanceof Ge)||e.status!==409||typeof e.data!=`object`||e.data===null?!1:`code`in e.data&&e.data.code===`build_open_questions_changed`,rle=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))},ile=e=>e.flatMap(e=>e.questions.map(e=>`${e.id}:${e.updated_at}`)).join(`|`),ale=({details:e,onClose:t,onRefresh:n,onSubmit:r})=>{let{t:i}=He(`common`),a=(0,p.useMemo)(()=>rle(e),[e]),o=(0,p.useMemo)(()=>a.flatMap(e=>e.questions),[a]),s=(0,p.useMemo)(()=>ile(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)(K_,{open:!0,onOpenChange:e=>{!e&&!d&&t()},children:(0,X.jsx)(X_,{showCloseButton:!1,className:`max-h-[calc(100vh-2rem)] 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(nle(e)){try{await n()}catch{_(i(`buildOpenQuestionsDialog.refreshFailedError`))}h(!0),_(e=>e??i(`buildOpenQuestionsDialog.conflictError`))}else _(e instanceof Ge?e.message:i(`buildOpenQuestionsDialog.submitError`))}finally{f(!1)}}},className:`flex min-h-0 flex-col`,children:[(0,X.jsxs)(Z_,{className:`border-b border-border/70 px-5 py-4 sm:px-6`,children:[(0,X.jsx)($_,{children:i(`buildOpenQuestionsDialog.title`)}),(0,X.jsx)(ev,{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)(hv,{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)(hv,{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)(hv,{htmlFor:`answer-${e.id}`,className:`sr-only`,children:i(`buildOpenQuestionsDialog.answerLabel`,{question:e.question_text})}),(0,X.jsx)(nv,{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)(Q_,{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`,disabled:d,onClick:t,children:i(`buildOpenQuestionsDialog.cancel`)}),(0,X.jsx)(Q,{type:`submit`,disabled:!v||m||d,children:i(d?`buildOpenQuestionsDialog.submitting`:`buildOpenQuestionsDialog.submit`)})]})]})})})},u8={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`}},ole=e=>ay(e)?`ready`:`blocked`,d8=180,sle=560,f8=88,p8=12,m8=18,h8=`dependency-overlay-clip`,g8=(e,t,n)=>Math.min(Math.max(e,t),n),cle=(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(` `)}`},lle=(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}),ule=(e,t)=>{let n=g8(Math.round(e.length*7.2)+24,d8,sle),r=Math.max(d8,t-p8*2);return Math.min(n,r)},dle=(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}=py(t,o??{left:e.pointer.x,top:e.pointer.y,width:0,height:0}),d=lle(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=ule(c,d.width);return{text:c,x:o&&s?g8(f.x-p/2,p8,Math.max(p8,d.width-p-p8)):(()=>{let e=f.x+m8,t=f.x-m8-p;return e+p<=d.width-p8?e:t>=p8?t:g8(e,p8,Math.max(p8,d.width-p-p8))})(),y:g8(f.y,p8,Math.max(p8,d.height-f8-p8)),width:p}},_8=({blockerRect:e,dependentRect:t,className:n,testId:r,markerEnd:i})=>{let{start:a,end:o}=py(e,t),{path:s}=my(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})})},fle=({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=dle(e,i,n,t,r);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_8,{blockerRect:i,dependentRect:a,className:u8.preview.className,testId:`dependency-preview`,markerEnd:`url(#${u8.preview.markerId})`}),(e=>o?(0,X.jsx)(`foreignObject`,{x:o.x,y:o.y,width:o.width,height:f8,"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})}))]})},ple=({dependencies:e,cardRects:t,clipRects:n=[],preview:r,ticketsById:i,overlaySize:a})=>{let o=cle(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(u8).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:h8,children:(0,X.jsx)(`path`,{d:o,clipRule:`evenodd`})})]}),(0,X.jsxs)(`g`,{"data-testid":`dependency-overlay-content`,clipPath:o?`url(#${h8})`: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=u8[ole(n)];return!a||!o?null:(0,X.jsx)(_8,{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)(fle,{preview:r,cardRects:t,ticketsById:i,overlaySize:a})]})]})},mle=({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,onClose:_})=>{let{t:v}=He(`common`),{jiraImportState:y,importFromJira:b}=Ew(n),{gitHubImportState:x,importFromGitHub:S}=QC(n),C=[{key:`jira`,label:v(`jiraImportField.label`),placeholder:v(`jiraImportField.placeholder`),state:y,onImport:b},{key:`github`,label:v(`githubImportField.label`),placeholder:v(`githubImportField.placeholder`),state:x,onImport:S}];return(0,X.jsx)(hC,{onClose:_,overlayClassName:`bg-black/60`,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:y})=>(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:y}),(0,X.jsx)(tX,{heading:v(`newTicketModal.heading`),bundles:t,showModelSelector:a,showSkillsSelector:o,availableModels:s,availableSkills:c,projectId:n,initialModel:l,initialVariant:u,initialSkills:d,initialWorktreeBundleId:f,initialImportedDraft:p,projectBranchState:r,externalImportProviders:C,onCancel:_,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,titleInputId:`title`,descriptionInputId:`description`,bundleSelectId:`new-ticket-bundle`,modelSelectId:`new-model`,variantSelectId:`new-variant`,skillsSelectId:`new-skills`,showEmptyBundleOption:!0,planAction:i?{label:v(`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}:{}}),_()}}:void 0,primaryAction:{label:v(`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}:{}}),_()}},secondaryAction:{label:v(`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}:{}}),_()}}})]})})},hle=({className:e=``})=>{let{setNodeRef:t,isOver:n}=SF({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)(yC,{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)(OC,{className:`h-5 w-5 transition-colors ${n?`text-red-100`:`text-red-300/70`}`})})]})},gle=(e,t)=>Y(J(`/ticket-dependencies`,e),{signal:t}),_le=(e,t)=>Y(J(`/ticket-dependencies`,e),{method:`POST`,body:t,fallbackErrorMessage:`Unable to create the dependency right now.`}),vle=(e,t,n)=>Ze(J(`/ticket-dependencies/${t}/${n}`,e),{method:`DELETE`,fallbackErrorMessage:`Unable to remove the dependency right now.`}),yle=(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},ble=(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,xle=(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,Sle=({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=>ble(e,r)?e:r),C.current=n,c(e=>yle(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=>{xle(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},[]),B=(0,p.useCallback)(async t=>{if(e)try{await vle(e,t.blocker_ticket_id,t.dependent_ticket_id),r(e=>ty(e,t.blocker_ticket_id,t.dependent_ticket_id))}catch(e){$.error(e instanceof Ge?e.message:`Unable to remove the dependency right now.`,{id:`board-dependency-error`})}},[e,r]),V=(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?ry(n,t,o):null;if(D.current?.(),D.current=null,F(null),!(!o||!s)){if(!s.valid){$.error(iy(s.reason),{id:`board-dependency-error`});return}try{let n=await _le(e,{blocker_ticket_id:t,dependent_ticket_id:o});r(e=>ey(e,n))}catch(e){$.error(e instanceof Ge?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 H=(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=ry(n,r,e.id);i.set(e.id,t.valid?`valid`:`idle`)}return i},[e,n,g,j,t]),U=(0,p.useCallback)(e=>{if(!H||!g)return`idle`;let t=H.get(e)??`idle`;return e===g.hoveredTicketId&&t===`idle`?`invalid`:t},[H,g]),W=(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:W,overlaySize:d,getDependencyTargetState:U,handleDependencyStart:V,handleDeleteDependency:B}},Cle=`[data-terminal-pane="true"]`,wle=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},Tle=e=>e instanceof HTMLElement?e.closest(Cle)!==null:!1,Ele=e=>wle(e)||Tle(e),Dle=(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])},v8=new Set([`queued`,`running`]),Ole={check_batch:`checks`,check_repair:`auto_fix`,automation_review_fix:`auto_fix`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pr`},y8=e=>{if(!e.id)return null;let t=Date.parse(e.updated_at);return Number.isFinite(t)?t:null},kle=e=>{let t=e.source_reference;if(e.kind!==`automation_progression`||e.status!==`waiting`&&!v8.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=y8(e);return!n||r===null?null:{bundleId:n,id:e.id,isActive:v8.has(e.status),updatedAt:r}},Ale=e=>{let t=Ole[e.kind],n=y8(e);return!t||!v8.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}},b8=(e,t)=>e.updatedAt===t.updatedAt?e.id.localeCompare(t.id)>0:e.updatedAt>t.updatedAt,jle=e=>{let t=new Map,n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=kle(r);if(e){let n=t.get(e.bundleId);(!n||b8(e,n))&&t.set(e.bundleId,e);continue}let i=Ale(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||b8(e,n))&&a.set(t,e)}for(let[e,t]of a)i.set(e,t.status);return i},x8={runs:[],events:[],isLoading:!1,isLoadingMore:!1,hasMoreRuns:!1,hasMoreEvents:!1,error:null},S8=(0,p.createContext)({state:new Map,loadMoreProject:()=>void 0,refreshProject:()=>void 0,subscribeProject:()=>()=>void 0}),Mle=[`queued`,`waiting`,`running`],Nle=(e,t,n,r)=>Noe(e,{cursor:t,limit:200,signal:n,statuses:r}),Ple=(e,t,n)=>Poe(e,{cursor:t,limit:200,signal:n}),Fle=(e,t)=>{let n=t.created_at.localeCompare(e.created_at);return n===0?t.id.localeCompare(e.id):n},Ile=(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},C8=(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(Fle)},w8=(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(Ile)},Lle=async(e,t,n)=>{let r=null,i=[];do{let a=await e(t,r,n,Mle);i=C8(i,a.runs),r=a.next_cursor}while(r);return i},Rle=({socket:e,fetchRunsPage:t,fetchEventsPage:n,children:r})=>{let i=Aq(),a=e??i,o=t??Nle,s=n??Ple,[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)??x8;return n.set(e,{...r,isLoading:!0,isLoadingMore:!1,error:null}),n}),Promise.all([o(e,null,t.signal),Lle(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:C8(C8(n.runs,r),a.runs),events:w8(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)??x8;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)??x8;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)??x8;return i.set(e,{...a,runs:C8(a.runs,t.runs),events:w8(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)??x8;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=C8(t.runs,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??x8;return n.set(e.project_id,{...r,runs:C8(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=w8(t.events,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??x8;return n.set(e.project_id,{...r,events:w8(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)(S8.Provider,{value:x,children:r})},T8=e=>{let{loadMoreProject:t,refreshProject:n,state:r,subscribeProject:i}=(0,p.useContext)(S8);(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)??x8:x8,loadMore:o,refresh:a}},E8=e=>({...e,messages:void 0,agent_log:void 0,streaming_response:void 0}),D8=(e,t)=>e?e.state!==t.state||e.parked_at!==t.parked_at||e.worktree_bundle_id!==t.worktree_bundle_id:!0,O8=(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}},k8=(e,t)=>{let n=e=>Dy(t)?Dy(e):e.state===t.state&&!Dy(e),r=e.findIndex(e=>n(e));if(r===-1)return[...e,t];let i=[...e];return i.splice(r,0,t),i},A8=(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)]},j8=(e,t)=>{let n=e.find(e=>e.id===t.id);if(!n)return[...e,t];let r=O8(n,t);return e.map(e=>e.id===t.id?r:e)},M8=(e,t)=>{let n=O8(e.find(e=>e.id===t.id),t);return k8(N8(e,t.id),n)},zle=(e,t)=>{if(e.length===0)return[...t];let n=[...e];for(let e of t)n=D8(n.find(t=>t.id===e.id),e)?M8(n,e):j8(n,e);let r=new Set(t.map(e=>e.id));return n.filter(e=>r.has(e.id))},N8=(e,t)=>e.filter(e=>e.id!==t),P8=(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=N8(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 k8(s,o)},F8=async(e,t)=>{`Notification`in window&&Notification.permission!==`denied`&&(Notification.permission===`default`&&await Notification.requestPermission(),Notification.permission===`granted`&&new Notification(e,{body:t}))},I8=(0,p.createContext)(null),Ble=15*1e3,Vle=1e3,Hle=async e=>F8(`Ticket done`,e),L8=e=>E8(e),Ule=(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,Wle=({activeProjectId:e,refreshKey:t=0,onLoadedProjectIdChange:n,onProjectUsageChange:r,onBundlesChange:i,onBundlesLoadingChange:a,children:o})=>{let s=Aq(),[c,l]=(0,p.useState)([]),[u,d]=(0,p.useState)([]),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)(null),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(null),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),T=(0,p.useRef)(0),E=(0,p.useRef)(0),D=(0,p.useRef)(new Map),O=(0,p.useRef)(new Map),k=(0,p.useRef)([]),A=(0,p.useRef)(e),j=(0,p.useRef)(new Map),M=(0,p.useRef)(new Map),N=(0,p.useRef)(new Map),P=(0,p.useCallback)((e,t)=>{let n=M.current.get(t.id);return!n||!e||t.state===n?t:e},[]),F=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(M.current);for(let r of e)n.set(r,t);M.current=n},[]),I=(0,p.useCallback)(e=>{if(e.length===0||M.current.size===0)return;let t=new Map(M.current);for(let n of e)t.delete(n);M.current=t},[]),L=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(N.current);for(let r of e)n.set(r,t);N.current=n},[]),R=(0,p.useCallback)(e=>{if(e.length===0||N.current.size===0)return;let t=new Map(N.current);for(let n of e)t.delete(n);N.current=t},[]),z=(0,p.useCallback)((e,t)=>{if(j.current.has(t.id))return null;let n=P(e,t);return N.current.has(t.id)?{...n,parked_at:N.current.get(t.id)??null}:n},[P]),B=(0,p.useCallback)((e,t)=>{if(j.current.size===0&&M.current.size===0&&N.current.size===0)return t;let n=new Map(e.map(e=>[e.id,e]));return t.flatMap(e=>{let t=z(n.get(e.id),e);return t?[t]:[]})},[z]),V=(0,p.useCallback)(async(e,t)=>{let n=await Gt(e,t,{detail:`board`});return Array.isArray(n)?(!t?.aborted&&A.current===e&&l(e=>zle(e,B(e,n).map(L8))),n):null},[B]),H=(0,p.useCallback)(async(e,t)=>{await V(e,t)},[V]),U=(0,p.useCallback)(async(e,t)=>{let n=++E.current,r=await Kt(e,t);if(!Array.isArray(r)||t?.aborted||A.current!==e||E.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}))},[]),W=(0,p.useCallback)(e=>e.some(e=>e.is_stale===void 0),[]),G=(0,p.useCallback)(async e=>{let t=A.current;if(!t)return null;try{let n=await qt(e,t);if(A.current!==t)return null;let r=O.current.get(n.id),i=z(r,n);if(!i)return null;let a=L8(i),o=D8(r,a);return l(e=>o?M8(e,a):j8(e,a)),n}catch{return null}},[z]),K=(0,p.useCallback)(async t=>{if(!e){m([]);return}m(await mt(e,t))},[e]),ee=(0,p.useMemo)(()=>new Map(c.map(e=>[e.id,e])),[c]),te=(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:C}},[C,c]);(0,p.useEffect)(()=>{if(O.current=ee,k.current.length===0)return;let e=[],t=[];for(let n of k.current){let r=ee.get(n.blocker_ticket_id),i=ee.get(n.dependent_ticket_id);r&&i&&r.project_id===A.current&&i.project_id===A.current?e.push(n):t.push(n)}k.current=t,e.length>0&&d(t=>e.reduce((e,t)=>ey(e,t),t))},[ee]),(0,p.useEffect)(()=>{A.current=e,j.current.clear(),k.current=[],M.current.clear(),N.current.clear(),w(null),g(null),D.current.clear()},[e]),(0,p.useEffect)(()=>{n?.(y?null:_)},[_,y,n]),(0,p.useEffect)(()=>{if(i){if(!e){i(null,[]);return}if(_!==e){i(e,[]);return}i(e,f)}},[e,f,_,i]),(0,p.useEffect)(()=>{if(a){if(!e){a(null,!1);return}a(e,x===e)}},[e,x,a]),(0,p.useEffect)(()=>{let t=new AbortController,n=++T.current,r=null,i=async()=>{try{if(!e){l([]),d([]),m([]),v(null),b(null);return}l([]),d([]),m([]),v(null),b(e),S(e);let[n,i,a]=await Promise.allSettled([V(e,t.signal),gle(e,t.signal),mt(e,t.signal)]);if(t.signal.aborted)return;n.status!==`fulfilled`&&!Ye(n.reason)&&l([]),i.status===`fulfilled`?d(i.value):Ye(i.reason)||d([]),a.status===`fulfilled`?m(a.value):Ye(a.reason)||m([]),v(n.status===`fulfilled`&&i.status===`fulfilled`&&a.status===`fulfilled`?e:null),n.status===`fulfilled`&&n.value!==null&&W(n.value)&&(r=window.setTimeout(()=>{t.signal.aborted||U(e,t.signal)},Vle))}finally{!t.signal.aborted&&T.current===n&&(b(null),S(null))}},a=t=>{t.project_id===e&&(g(t),!j.current.has(t.id)&&(t.bundle&&m(e=>A8(e,t.bundle)),l(e=>M8(e,L8(t)))))},o=t=>{if(t.project_id===e&&g(t),l(n=>{if(t.project_id!==e)return N8(n,t.id);let r=n.find(e=>e.id===t.id),i=z(r,t);if(!i)return n;let a=L8(i);return D8(r,a)?M8(n,a):j8(n,a)}),t.project_id!==e){d(e=>$v(e,t.id));return}t.bundle&&m(e=>A8(e,t.bundle))},c=({id:e})=>{j.current.delete(e),N.current.delete(e),M.current.delete(e),l(t=>N8(t,e)),d(t=>$v(t,e))},u=e=>{if(!e)return;let t=O.current.get(e.blocker_ticket_id),n=O.current.get(e.dependent_ticket_id);if(!t||!n){k.current.push(e);return}t.project_id!==A.current||n.project_id!==A.current||d(t=>ey(t,e))},f=e=>{d(t=>ty(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(`ticket-dependency:created`,u),s.on(`ticket-dependency:deleted`,f),()=>{t.abort(),r!==null&&window.clearTimeout(r),s.off(`ticket:created`,a),s.off(`ticket:updated`,o),s.off(`ticket:deleted`,c),s.off(`ticket-dependency:created`,u),s.off(`ticket-dependency:deleted`,f)}},[e,U,t,W,V,z,s]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=()=>{document.visibilityState===`visible`&&Promise.allSettled([V(e,t.signal),K(t.signal)]).then(n=>{n[0]?.status===`fulfilled`&&n[0].value!==null&&W(n[0].value)&&U(e,t.signal)}).catch(()=>{})},r=window.setInterval(n,Ble),i=rx(n);return()=>{t.abort(),window.clearInterval(r),i()}},[e,K,U,W,V]),(0,p.useEffect)(()=>{if(!e||!r||_!==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,_,r,c]),(0,p.useEffect)(()=>{for(let e of c){let t=D.current.get(e.id),n=Ule(e,t);n&&w(n),t!==void 0&&t===`running`&&e.agent_status===`done`&&(e.state===`plan`||e.state===`build`||e.state===`review`)&&Hle(e.title),D.current.set(e.id,e.agent_status)}},[c]);let ne=(0,p.useCallback)(()=>{g(null)},[]),re=(0,p.useMemo)(()=>({tickets:c,setTickets:l,dependencies:u,setDependencies:d,bundles:f,setBundles:m,latestDetailedTicketUpdate:h,clearLatestDetailedTicketUpdate:ne,loadedProjectId:_,loadingProjectId:y,activeProjectIdRef:A,pendingDeletedTicketsRef:j,pendingOptimisticMovesRef:M,pendingParkedTicketsRef:N,refreshTickets:H,requestSingleTicketRefresh:G,refreshBundles:K,resolvePendingTicket:z,resolvePendingTickets:B,markPendingOptimisticMoves:F,clearPendingOptimisticMoves:I,markPendingParkedTickets:L,clearPendingParkedTickets:R,liveActivity:te}),[f,ne,I,R,u,te,_,h,y,F,L,K,H,G,z,B,c]);return(0,X.jsx)(I8.Provider,{value:re,children:o})},R8=()=>{let e=(0,p.useContext)(I8);if(!e)throw Error(`useProjectWorkspace must be used inside ProjectWorkspaceProvider`);return e},z8=(0,p.lazy)(()=>kG(()=>import(`./VerificationDialog-YUi8g2ou.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),B8=`archon.last-model-selection`,V8=`archon.last-variant-selection`,H8=`archon.last-skills-selection`,Gle=()=>{try{let e=window.localStorage.getItem(H8),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}},U8=[`plan`,`build`,`review`],W8=`done`,G8=()=>({build:!1,stopBuild:!1,resumeBuild:!1,review:!1,undoReview:!1,run:!1,stop:!1,followUp:!1,bundleRefresh:!1}),Kle=(e,t,n)=>{e?window.localStorage.setItem(B8,e):window.localStorage.removeItem(B8),t?window.localStorage.setItem(V8,t):window.localStorage.removeItem(V8),n.length>0?window.localStorage.setItem(H8,JSON.stringify(n)):window.localStorage.removeItem(H8)},K8=(e,t={})=>Xy(e,t),qle=()=>({model:window.localStorage.getItem(B8)??``,variant:window.localStorage.getItem(V8)??``,skills:Gle()}),q8=(e,t)=>{let n=N8(e,t.ticket.id),r=Math.max(0,Math.min(t.index,n.length));return n.splice(r,0,t.ticket),n},Jle=({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,initialTicketId:f=null,onInitialTicketNavigationConsumed:m,initialImportedDraft:h=null,onInitialImportedDraftConsumed:g})=>{let{t:_}=He(`common`),v=Pre(Nre(XP,{activationConstraint:{distance:5}})),{tickets:y,setTickets:b,dependencies:x,setDependencies:S,bundles:C,setBundles:w,latestDetailedTicketUpdate:T,clearLatestDetailedTicketUpdate:E,loadedProjectId:D,loadingProjectId:O,activeProjectIdRef:k,pendingDeletedTicketsRef:A,requestSingleTicketRefresh:j,refreshBundles:M,resolvePendingTicket:N,markPendingOptimisticMoves:P,clearPendingOptimisticMoves:F,markPendingParkedTickets:I,clearPendingParkedTickets:L}=R8(),{runs:R}=T8(e),z=(0,p.useMemo)(()=>{let e=jle(R);for(let t of y)t.worktree_bundle_id&&t.automation_paused_reason&&e.delete(t.worktree_bundle_id);return e},[R,y]),[B,V]=(0,p.useState)(null),[H,U]=(0,p.useState)(null),[W,G]=(0,p.useState)(null),K=(0,p.useCallback)(e=>G(e),[]),[ee,te]=(0,p.useState)(null),[ne,re]=(0,p.useState)({x:0,y:0}),[ie,ae]=(0,p.useState)(null),[oe,se]=(0,p.useState)([]),ce=OF(`opencode`),le=OF(`claude`),ue=(0,p.useMemo)(()=>({opencode:ce.models,claude:le.models}),[ce.models,le.models]),de=(0,p.useCallback)(e=>ue[e]??[],[ue]),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(null),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)(null),we=(0,p.useRef)(null),[Te,Ee]=(0,p.useState)(null),[De,Oe]=(0,p.useState)(null),[ke,Ae]=(0,p.useState)(null),[je,Me]=(0,p.useState)(null),[Ne,q]=(0,p.useState)(null),Pe=(0,p.useRef)(0),[Fe,Ie]=(0,p.useState)(null),[Le,Re]=(0,p.useState)(null),[ze,Be]=(0,p.useState)(null),[Ve,Ue]=(0,p.useState)(!1),[We,Ke]=(0,p.useState)(G8()),[qe,Je]=(0,p.useState)(0),[J,Xe]=(0,p.useState)(``),[Ze,Y]=(0,p.useState)(!1),[Qe,$e]=(0,p.useState)(!1),et=tI(i)||tI(Se?.tool)||!!ke?.tickets.some(e=>tI(eI(e,i))),tt=tI(i)&&de(i).length>0,nt=tI(eI(Se,i))&&de(eI(Se,i)).length>0,rt=!!ke?.tickets.some(e=>tI(eI(e,i)))&&(ue.opencode.length>0||ue.claude.length>0),it=(0,p.useRef)(e),at=(0,p.useRef)(null),ot=(0,p.useRef)(null),[st,ct]=(0,p.useState)(null),lt=y.find(e=>e.is_running)??null,ut=lt?yy(lt):null,dt=r?.context_key??null,ft=r?.kind===`ticket`?by(r,y)??ut:ut,pt=r?.kind===`project`,mt=ft??st,gt=(0,p.useCallback)(e=>xy({bundleId:e,activeRunContextKey:mt,isProjectRootRunActive:pt}),[mt,pt]),_t=B!==null&&By(B,`trash`)||H!==null&&Py(H),bt=O===e,xt=(0,p.useMemo)(()=>t?cw(t):[],[t]),St=(0,p.useMemo)(()=>dw(xt),[xt]),Dt=(0,p.useMemo)(()=>t?lw(t):[],[t]),Ot=(0,p.useMemo)(()=>t?uw(t):[],[t]),kt=St.length>0,It=(0,p.useMemo)(()=>new Map(y.map(e=>[e.id,e])),[y]);(0,p.useEffect)(()=>{ct(null)},[e]),(0,p.useEffect)(()=>{st!==null&&(pt||ft!==null)&&ct(null)},[ft,pt,st]),(0,p.useEffect)(()=>{if(!be){Ce(null);return}let e=It.get(be)??null;e&&Ce(t=>!t||t.id!==be?e:Cy(t,e))},[be,It]),(0,p.useEffect)(()=>{T&&(Ce(e=>!e||e.id!==T.id?e:Cy(e,T)),Ae(e=>{if(!e)return e;let t=T.worktree_bundle_id;if(!t||e.bundle.id!==t)return e;let n=e.tickets.some(e=>e.id===T.id)?e.tickets.map(e=>e.id===T.id?Cy(e,T):e):[...e.tickets,T];return{...e,tickets:n}}))},[T]),(0,p.useEffect)(()=>{T===null||be!==null||Te!==null||E()},[E,T,Te,be]);let Lt=(0,p.useCallback)(async e=>{let t=await j(e);if(!t)return null;let n=It.get(e),r=n?Cy(t,n):t;return Ce(t=>t&&t.id!==e||be&&be!==e?t:r),r},[j,be,It]),Rt=(0,p.useCallback)(e=>{Ce(e),xe(e.id),Lt(e.id)},[Lt]),zt=(0,p.useMemo)(()=>new Map(C.map(e=>[e.id,e])),[C]),Bt=(0,p.useMemo)(()=>{if(!ke)return null;let e=ke.bundle.id,t=T?.worktree_bundle_id===e?T:null,n=y.filter(t=>t.worktree_bundle_id===e),r=new Map(n.map(e=>[e.id,e])),i=ke.tickets.filter(e=>!A.current.has(e.id)).map(e=>t&&e.id===t.id?Cy(e,t):e);t&&!i.some(e=>e.id===t.id)&&!A.current.has(t.id)&&i.push(t);let a=i.map(e=>Cy(e,r.get(e.id)));for(let e of n)a.some(t=>t.id===e.id)||a.push(e);a=Q3(a);let o=ke.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=qy(a),p=a.find(e=>e.id===ke.review_owner_ticket_id&&e.state===`review`)??a.find(e=>e.state===`review`)??null,m=Xy(a,{targetTicketId:ke.target_ticket_id,reviewOwnerTicketId:p?.id??ke.review_owner_ticket_id,latestSessionTicketId:f?.id??ke.latest_session_ticket_id});return{...ke,bundle:zt.get(e)??ke.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:ke.has_completed_review,has_follow_up_since_last_review:l?d.has_follow_up_since_last_review:ke.has_follow_up_since_last_review,can_re_review:l?d.can_re_review:ke.can_re_review}},[zt,T,A,ke,y]),Vt=(0,p.useMemo)(()=>y.filter(e=>{if(Ze&&ky(e))return!1;if(Qe&&e.worktree_bundle_id){let t=zt.get(e.worktree_bundle_id);if(t&&t.pull_request!==void 0?t.pull_request:e.bundle?.pull_request)return!1}return wy(J,e)}),[zt,Qe,Ze,J,y]),Ht=(0,p.useMemo)(()=>$y(Vt),[Vt]),Ut=(0,p.useMemo)(()=>Vt.filter(e=>Dy(e)),[Vt]),Wt=(0,p.useMemo)(()=>Zy(Ut,C,W8),[C,Ut]),{boardViewportRef:Gt,boardContentRef:Kt,registerTicketNode:qt,registerDependencyClipNodes:Yt,measuredCardRects:Zt,dependencyClipRects:Qt,overlayPreview:$t,overlaySize:en,getDependencyTargetState:tn,handleDependencyStart:nn,handleDeleteDependency:rn}=Sle({activeProjectId:e,tickets:y,dependencies:x,setDependencies:S,activeTicket:B,activeOverlayNode:ee,dragOffset:ne}),an=qle(),xn=!!t?.run_ide?.trim(),Cn=(0,p.useCallback)((e,t,n=y)=>{let r=Zy(n,C,t).find(t=>t.kind===`bundle`&&t.group.bundle.id===e);return r?.kind===`bundle`?r.group:null},[C,y]),En=(0,p.useCallback)(e=>{let n=eI(e,i);return(0,X.jsx)(W3,{ticket:e,allTickets:y,dependencies:x,bundles:C,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:e.worktree_bundle_id?z.get(e.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:tI(n)&&de(n).length>0,availableModels:de(n),runDisabled:!0,hideBundleScopedControls:!0})},[t?.memory_enabled,i,z,C,x,de,y]),Dn=(0,p.useCallback)(t=>Yy(t)?t.project_id===e?xn:!!t.has_run_ide:!1,[xn,e]),On=(0,p.useCallback)(e=>!!e.project_id&&!!(e.bundle?.branch??e.branch)&&Yy(e),[]),kn=(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?Dn(t):!1},[Dn]),An=(0,p.useCallback)(e=>{let t=Q3(y.filter(t=>t.worktree_bundle_id===e));return ke?.bundle.id===e?K8(Q3(ke.tickets.map(e=>t.find(t=>t.id===e.id)??e)),{targetTicketId:ke.target_ticket_id,reviewOwnerTicketId:ke.review_owner_ticket_id,latestSessionTicketId:ke.latest_session_ticket_id}):K8(t)},[ke,y]),jn=(0,p.useCallback)(e=>{let t=An(e),n=C.some(t=>t.id===e&&t.has_prepared_worktree===!0)||y.some(t=>t.worktree_bundle_id===e&&Yy(t))||!!(ke?.bundle.id===e&&ke.tickets.some(Yy));return!!(t?.project_id&&(t.bundle?.branch??t.branch)&&n)},[C,An,ke,y]);(0,p.useEffect)(()=>{he(!1),_e(!1),Ie(null),Be(null),it.current!==e&&(Be(null),at.current=e),e||(at.current=null,Xe(``)),it.current=e},[e,d]),(0,p.useLayoutEffect)(()=>{!e||D!==e||at.current===e&&(at.current=null,Xe(``))},[e,D]),(0,p.useEffect)(()=>{if(!et){se([]);return}let t=new AbortController;return(async()=>{try{se(await kF(`opencode`,t.signal,e))}catch(e){Ye(e)||se([])}})(),()=>{t.abort()}},[e,et]);let Mn=({active:e})=>{pe(!1),te(null),re({x:0,y:0}),G(null);let t=eb(String(e.id));if(t){U(Cn(t.bundleId,t.column)),V(null);return}U(null),V(y.find(t=>t.id===e.id)??null)},Nn=()=>{pe(!1),te(null),re({x:0,y:0}),V(null),U(null),G(null)},Pn=(0,p.useCallback)(e=>{b(t=>e.reduce((e,t)=>M8(e,t),t))},[b]),Fn=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=e[0]?.state;n&&b(r=>e.reduce((e,r)=>P8(e,r.id,t,zy(r,n,t)),r))},[b]),In=(0,p.useCallback)((e,t=y)=>!e.worktree_bundle_id||!e.project_id||e.state!==`build`?[]:Q3(t.filter(t=>t.project_id===e.project_id&&t.worktree_bundle_id===e.worktree_bundle_id&&t.state===`build`&&t.parked_at===null)),[y]),Ln=async({active:e,over:t})=>{let n=eb(String(e.id)),r=y.find(t=>t.id===e.id),i=n?Cn(n.bundleId,n.column):null,a=t?.id===`trash`&&(r!==void 0&&By(r,`trash`)||i!==null&&Py(i)),o=t?.id&&U8.includes(t.id)?t.id:null;if(pe(a),te(null),re({x:0,y:0}),V(null),U(null),t){if(n){if(t.id===`trash`){if(!i||!Py(i))return;await Yn(i);return}if(t.id===W8){if(!i||!Fy(i))return;await Kn(i);return}if(o){if(n.column===W8){if(!i||!Iy(i))return;await qn(i);return}await Fr(n.bundleId,n.column,o)}return}if(t.id===`trash`){if(!r||!By(r,`trash`))return;Zn(e.id);return}if(t.id===W8){if(!r||!By(r,W8))return;await Wn(e.id);return}if(o){if(r&&Ny(r,o)){await Gn(e.id);return}if(!(!r||!By(r,o)))try{await Hn(r,o,{optimistic:!0})}catch(e){$.error(e instanceof Ge?e.message:_(`board.errors.moveTicket`),{id:`board-move-error`})}}}},Rn=async(t,n,r,i,a,o,s)=>{let c=await Jt({title:t,description:n,model:i,variant:a,skills:o,project_id:e,...s});if(Kle(i,a,o),b(e=>M8(e,E8(c))),c.bundle&&w(e=>A8(e,c.bundle)),r===`build`)try{await Hn(c,`build`)}catch(e){$.error(e instanceof Ge?e.message:_(`board.errors.moveTicket`),{id:`board-move-error`})}r===`plan`&&Tn(c.id,c.project_id)},zn=async t=>{if(!e)throw Error(_(`board.errors.createBundleWithoutProject`));let n=await ht(e,{name:t,prepare:!0});return w(e=>A8(e,n)),n},Bn=(0,p.useCallback)((e,t={})=>{let n=E8(e);b(e=>t.reorderInState?M8(e,n):j8(e,n)),Ce(t=>!t||t.id!==e.id?t:Cy(e,n)),e.bundle&&w(t=>A8(t,e.bundle))},[w,b]),Vn=(0,p.useCallback)(e=>{w(t=>A8(t,e)),b(t=>t.map(t=>t.worktree_bundle_id===e.id?{...t,bundle:e}:t)),Ae(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)})},[w,Ae,b]),Hn=async(e,t,n={})=>{let r=y.findIndex(t=>t.id===e.id),i=t===`review`?In(e):[],a=t===`review`&&i.length>1,o=n.optimistic?a?i.map(e=>e.id):[e.id]:[];n.optimistic&&(P(o,t),a?Fn(i,t):b(n=>P8(n,e.id,t,Ly(e,t))));try{if(a&&e.project_id&&e.worktree_bundle_id){let t=await wt(e.project_id,e.worktree_bundle_id);_r(t);let n=t.tickets.find(t=>t.id===e.id);if(!n)throw Error(_(`board.errors.missingBundleReviewTicket`));return F(o),n}let n=await Xt(e.id,e.project_id,t);return b(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:D8(i,n)?M8(r,n):j8(r,n)}),n.bundle&&w(e=>A8(e,n.bundle)),F(o),n}catch(t){throw n.optimistic&&(a?Pn(i):b(t=>P8(t,e.id,e.state,{agent_status:e.agent_status,agent_log:e.agent_log,build_completed_at:e.build_completed_at},{preferredIndex:r})),F(o)),t}},Un=(e,t)=>{b(n=>n.map(n=>n.id===e?{...n,...t}:n))},Wn=async t=>{let n=y.find(e=>e.id===t);if(n)try{let r=new Date().toISOString();I([t],r),Un(t,{parked_at:r}),Bn(await un(t,n.project_id??e),{reorderInState:!0}),L([t])}catch(e){L([t]),Un(t,{parked_at:n.parked_at}),$.error(e instanceof Ge?e.message:_(`board.errors.parkTicket`),{id:`board-park-error`})}},Gn=async t=>{let n=y.find(e=>e.id===t);if(n)try{I([t],null),Un(t,{parked_at:null}),Bn(await dn(t,n.project_id??e),{reorderInState:!0}),L([t])}catch(e){L([t]),Un(t,{parked_at:n.parked_at}),$.error(e instanceof Ge?e.message:_(`board.errors.returnTicket`),{id:`board-unpark-error`})}},Kn=(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();I(e.tickets.map(e=>e.id),r),b(e=>e.map(e=>t.has(e.id)?{...e,parked_at:r}:e));let i=await Promise.allSettled(e.tickets.map(e=>un(e.id,e.project_id??k.current))),a=new Set;if(i.forEach((t,n)=>{if(t.status===`fulfilled`){L([t.value.id]),Bn(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&a.add(r.id)}),a.size===0)return;L([...a]),b(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 Ge?o.reason.message:_(`board.errors.moveBundleToDone`):_(`board.toasts.movedBundleToDonePartial`,{movedCount:e.tickets.length-a.size,totalCount:e.tickets.length});$.error(s,{id:`board-bundle-park-error`})},[k,Bn,L,I,b,_]),qn=(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}));I(e.tickets.map(e=>e.id),null),b(e=>e.map(e=>t.has(e.id)?{...e,parked_at:null}:e));let r=await Promise.allSettled(e.tickets.map(e=>dn(e.id,e.project_id??k.current))),i=new Set;if(r.forEach((t,n)=>{if(t.status===`fulfilled`){L([t.value.id]),Bn(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&i.add(r.id)}),i.size===0)return;L([...i]),b(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 Ge?a.reason.message:_(`board.errors.restoreBundle`):_(`board.toasts.restoredBundlePartial`,{restoredCount:e.tickets.length-i.size,totalCount:e.tickets.length});$.error(o,{id:`board-bundle-unpark-error`})},[k,Bn,L,I,b,_]),Jn=async t=>{e&&(await Mt(e,t),w(e=>e.filter(e=>e.id!==t)))},Yn=(0,p.useCallback)(async t=>{let n=t.tickets.map(e=>({ticket:e,index:y.findIndex(t=>t.id===e.id)})).filter(e=>e.index!==-1);if(n.length===0)return;for(let e of n)A.current.set(e.ticket.id,e);let r=new Set(n.map(e=>e.ticket.id));b(e=>e.filter(e=>!r.has(e.id))),S(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),A.current.delete(t.ticket.id),t.ticket.id)));t.tickets.some(e=>e.project_id===k.current)&&M().catch(()=>{});let a=n.filter((e,t)=>i[t]?.status===`rejected`);if(a.length===0)return;for(let e of a)A.current.delete(e.ticket.id);a.some(e=>e.ticket.project_id===k.current)&&b(e=>[...a].sort((e,t)=>e.index-t.index).reduce((e,t)=>q8(e,t),e));let o=i.find(e=>e.status===`rejected`),s=a.length===n.length?o?.reason instanceof Ge?o.reason.message:_(`board.errors.deleteBundleTickets`):_(`board.toasts.deletedBundleTicketsPartial`,{deletedCount:n.length-a.length,totalCount:n.length});$.error(s,{id:`board-delete-bundle-wrapper-error`})},[e,k,A,M,S,b,y,_]),Xn=e=>{let t=It.get(e.id);Bn(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&&w(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===k.current&&M().catch(()=>{})},Zn=async t=>{let n=y.find(e=>e.id===t),r=y.findIndex(e=>e.id===t);if(!(!n||r===-1)){A.current.set(t,{ticket:n,index:r}),b(e=>N8(e,t)),S(e=>$v(e,t));try{await cn(t,n.project_id??e),n.project_id===k.current&&M().catch(()=>{}),A.current.delete(t)}catch(e){let n=A.current.get(t);A.current.delete(t),n&&n.ticket.project_id===k.current&&(b(e=>q8(e,n)),$.error(e instanceof Ge?e.message:_(`board.errors.deleteTicket`),{id:`board-delete-error`}))}}},Qn=async t=>{let n=y.find(e=>e.id===t);if(!n)return;let r=n.state===`review`?`review`:`build`;try{if(ye(r),n.project_id&&n.worktree_bundle_id&&n.state===`review`){_r(await Tt(n.project_id,n.worktree_bundle_id));return}Bn(await ln(t,n.project_id??e),{reorderInState:!0})}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.undoTicket`),{id:`board-undo-error`}),e}finally{ye(e=>e===r?null:e)}},$n=t=>{pn(t,y.find(e=>e.id===t)?.project_id??e)},er=async t=>{let n=y.find(e=>e.id===t),r=n?yy(n):t;try{ct(r),await mn(t,n?.project_id??e),s?.()}catch(e){ct(e=>e===r?null:e),$.error(e instanceof Ge?e.message:_(`board.errors.startRun`),{id:`board-run-error`})}},tr=(0,p.useCallback)(async t=>{let n=y.find(e=>e.id===t);try{await hn(t,n?.project_id??e)}catch(e){$.error(e instanceof Ge?e.message:_(`board.errors.openIde`),{id:`board-open-ide-error`})}},[e,_,y]),nr=async t=>{let n=y.find(e=>e.id===t),i=r?.kind===`ticket`&&n&&ft===yy(n)?dt:null;try{await gn(t,n?.project_id??e),o?.(i),s?.()}catch{}},rr=t=>{_n(t,y.find(e=>e.id===t)?.project_id??e).then(()=>{b(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e))})},ir=async t=>{let n=y.find(e=>e.id===t);try{await vn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:_(`reviewInterrupt.error`))}},ar=t=>{yn(t,y.find(e=>e.id===t)?.project_id??e).then(()=>{b(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e))})},or=(0,p.useCallback)(e=>{let t=An(e);!t||!Dn(t)||tr(t.id)},[Dn,An,tr]),sr=(0,p.useCallback)((e,t)=>{let n=An(e);!n||!jn(e)||Re({target:{kind:`bundle`,bundleId:e,ticketId:n.id},projectId:n.project_id,title:n.bundle?rb(n.bundle):n.title,bundleTargetName:n.bundle&&rb(n.bundle)||null,initialMode:t,followUpMode:`build`})},[jn,An]),cr=(0,p.useCallback)((e,t)=>{let n=An(e);if(!n?.project_id||!Yy(n))return;let r=n.latest_check_gate_evaluation?.id??y.find(t=>t.worktree_bundle_id===e&&t.latest_check_gate_evaluation)?.latest_check_gate_evaluation?.id??null;if(xt.length===0&&!r)return;let i=C.find(t=>t.id===e)??n.bundle;i&&Be({bundleId:e,label:rb(i),requestedInitialTab:t,gateEvaluationId:r,requiredCheckPolicy:i.required_check_policy??null})},[C,An,xt.length,y]),lr=(0,p.useCallback)((e,t)=>{let n=y.find(t=>t.id===e);if(!(!n||!On(n))){if(n.worktree_bundle_id){sr(n.worktree_bundle_id,t);return}Re({target:{kind:`ticket`,ticketId:n.id},projectId:n.project_id,title:n.title,bundleTargetName:null,initialMode:t,followUpMode:`build`})}},[On,sr,y]),ur=(0,p.useCallback)(e=>sr(e,`files`),[sr]),dr=(0,p.useCallback)(e=>sr(e,`changes`),[sr]),fr=(0,p.useCallback)(e=>lr(e,`files`),[lr]),pr=(0,p.useCallback)(e=>lr(e,`changes`),[lr]),mr=(0,p.useCallback)(e=>{let t=y.find(t=>t.id===e);!t?.project_id||!Yy(t)||Ie({ticketId:t.id,label:t.title})},[y]),hr=(0,p.useCallback)(async(t,n,r=`build`,i)=>{let a=y.find(e=>e.id===t);if(a)try{Bn(a.state===`plan`?await wn(t,a.project_id??e,n):await bn(t,a.project_id??e,n,r,i))}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.sendFollowUp`),{id:`board-follow-up-error`}),e}},[e,Bn,_,y]),gr=(0,p.useCallback)(e=>{b(t=>e.reduce((e,t)=>{let n=e.find(e=>e.id===t.id),r=N(n,t);if(!r)return e;let i=E8(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 D8(n,i)?M8(e,i):j8(e,i)},t))},[N,b]),_r=(0,p.useCallback)(e=>{Ae(e),w(t=>A8(t,e.bundle)),gr(e.tickets)},[gr,w]),vr=(0,p.useCallback)((e,t)=>{Array.isArray(t.tickets)&&Ae(n=>!n||n.bundle.id!==e?n:{...n,tickets:t.tickets,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,target_ticket_id:t.target_ticket_id})},[]),yr=(0,p.useCallback)(async e=>{let t=k.current;if(!t)return null;let n=await vt(t,e);return k.current===t?(_r(n),n):null},[k,_r]),br=(0,p.useCallback)(async()=>{let e=Ne?.bundle.id,t=k.current;if(!e||!t)return null;let n=++Pe.current,r=await vt(t,e);return n!==Pe.current||k.current!==t?null:(_r(r),q(r),r)},[k,_r,Ne?.bundle.id]),xr=(0,p.useCallback)(async t=>{if(!e)return;Me(t),q(null);let n=++Pe.current;try{let r=await vt(e,t);if(k.current!==e||n!==Pe.current)return;_r(r),q(r)}catch{if(n!==Pe.current||k.current!==e)return;Me(null),$.error(_(`buildOpenQuestionsDialog.refreshFailedError`),{id:`board-build-open-questions-load-error`})}},[e,k,_r,_]),Sr=(0,p.useCallback)(async t=>{let n=Ne?.bundle.id;if(!e||!n)return;let r=++Pe.current,i=await Ft(e,n,t);r===Pe.current&&(_r(i),q(i),Me(null))},[e,_r,Ne?.bundle.id]),Cr=Ne?.bundle.id??null;(0,p.useEffect)(()=>{if(!Cr)return;let e=new Map(y.map(e=>[e.id,e])),t=C.find(e=>e.id===Cr);q(n=>!n||n.bundle.id!==Cr?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})})},[C,Cr,y]);let wr=(0,p.useCallback)(async e=>{let t=k.current;if(!t)return null;let n=await yt(t,e);return k.current===t?(vr(e,n),n):null},[k,vr]),Tr=(0,p.useCallback)(async(e,t=null)=>{let n=k.current;if(!n)return;xe(null),Ce(null),Ee(e),Oe(t),Ke(G8());let r=zt.get(e)??null,i=y.filter(t=>t.worktree_bundle_id===e);if(r&&i.length>0){let e=qy(i),t=Xy(i,{reviewOwnerTicketId:i.find(e=>e.state===`review`)?.id??null,latestSessionTicketId:e?.id??null});Ae({bundle:r,tickets:i,latest_session_ticket_id:e?.id??null,latest_session_id:e?.session_id??null,review_owner_ticket_id:i.find(e=>e.state===`review`)?.id??null,target_ticket_id:t?.id??null})}else Ae(null);Ue(!0);try{await wr(e)}catch{}finally{k.current===n&&Ue(!1)}},[k,zt,wr,y]),Er=(0,p.useCallback)(async(e,t)=>{Ke(t=>({...t,[e]:!0}));try{return await t()}finally{Ke(t=>({...t,[e]:!1}))}},[]),Dr=(0,p.useCallback)(async t=>{await Er(`stopBuild`,async()=>{let n=y.find(e=>e.id===t);await _n(t,n?.project_id??e),b(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,Er,b,y]),Or=(0,p.useCallback)(async t=>{await Er(`stopBuild`,async()=>{let n=y.find(e=>e.id===t);try{await vn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:_(`reviewInterrupt.error`))}})},[e,Er,_,y]),kr=(0,p.useCallback)(async t=>{await Er(`resumeBuild`,async()=>{let n=y.find(e=>e.id===t);await yn(t,n?.project_id??e),b(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e)),n?.worktree_bundle_id&&await yr(n.worktree_bundle_id)})},[e,yr,Er,b,y]),Ar=(0,p.useCallback)(async t=>{if(e)try{_r(await Er(`build`,()=>Ct(e,t))),Te===t&&Oe(`build`),s?.()}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.buildBundle`),{id:`board-bundle-build-error`}),e}},[e,_r,s,Er,Te,_]),jr=(0,p.useCallback)(async t=>{if(e)try{_r(await Er(`review`,()=>wt(e,t))),Te===t&&Oe(`review`)}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.reviewBundle`),{id:`board-bundle-review-error`}),e}},[e,_r,Er,Te,_]),Mr=(0,p.useCallback)(async t=>{if(e)try{ye(`review`),_r(await Er(`undoReview`,()=>Tt(e,t))),Te===t&&Oe(`build`)}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.undoBundleReview`),{id:`board-bundle-undo-review-error`}),e}finally{ye(e=>e===`review`?null:e)}},[e,_r,Er,Te,_]),Nr=(0,p.useCallback)(async t=>{if(e)try{_r(await Nt(e,t))}catch(e){$.error(e instanceof Ge?e.message:`Unable to resume the automation right now.`,{id:`board-bundle-resume-automation-error`})}},[e,_r]),Pr=(0,p.useCallback)(async t=>{if(e)try{_r(await Pt(e,t))}catch(e){$.error(e instanceof Ge?e.message:`Unable to dismiss the automation pause right now.`,{id:`board-bundle-dismiss-automation-error`})}},[e,_r]),Fr=(0,p.useCallback)(async(e,t,n)=>{if(t===W8||n===W8)return;let r=Ry(t,n);if(!r)return;let i=y.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);P(a,n),Fn(i,n);try{if(r===`build`){await Ar(e),F(a);return}if(r===`review`){await jr(e),F(a);return}await Mr(e),F(a)}catch(e){Pn(i),F(a),$.error(e instanceof Ge?e.message:_(`board.errors.moveBundle`),{id:`board-bundle-move-error`})}},[F,Ar,jr,Mr,P,Fn,Pn,y,_]),Ir=async t=>{e&&(_r(await Er(`run`,()=>At(e,t))),s?.())},Lr=async t=>{if(!e)return;let n=r?.kind===`ticket`&&ft===t?dt:null,i=await Er(`stop`,()=>jt(e,t));o?.(n),_r(i),s?.()},Rr=(0,p.useCallback)(async(t,n,r=`build`,i)=>{e&&_r(await Er(`followUp`,()=>Et(e,t,n,r,i)))},[e,_r,Er]);(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:_(`board.preview.disabledProjectRoot`),submitPrompt:null});return}let e=y.find(e=>e.id===r.ticket_id);if(!e){a({target:null,canSelect:!1,disabledReason:_(`board.preview.disabledBuildCapable`),submitPrompt:null});return}if(e.state===`plan`){a({target:{kind:`ticket`,id:e.id},canSelect:!1,disabledReason:_(`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:_(`board.preview.followUpBundlePlaceholder`),submitPrompt:t=>Rr(e.worktree_bundle_id,t)});return}a({target:{kind:`ticket`,id:e.id},canSelect:!0,disabledReason:null,promptPlaceholder:_(`board.preview.followUpTicketPlaceholder`),submitPrompt:t=>hr(e.id,t)})},[r,hr,Rr,a,_,y]);let zr=async t=>{let n=y.find(e=>e.id===t),r=n?_y(n.state):null;if(n)try{if(n.state===`review`&&n.can_re_review&&n.agent_status!==`running`){let t=await Sn(n.id,n.project_id??e);Bn(t),t.worktree_bundle_id&&await yr(t.worktree_bundle_id);return}if(!r)return;if(n.worktree_bundle_id&&r===`review`){await jr(n.worktree_bundle_id);return}await Hn(n,r)}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.moveTicket`),{id:`board-move-error`}),e}},Br=async t=>{let n=y.find(e=>e.id===t);try{Bn(await on(t,n?.project_id??e))}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.startBuildChain`),{id:`board-build-chain-error`}),e}},Vr=async t=>{let n=y.find(e=>e.id===t);try{await sn(t,n?.project_id??e)}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.stopBuildChain`),{id:`board-stop-build-chain-error`}),e}},Hr=async()=>{if(!(!e||ge)){_e(!0);try{let t=await fn(e);b(e=>e.filter(e=>!t.deleted_ticket_ids.includes(e.id))),S(e=>t.deleted_ticket_ids.reduce($v,e)),await M(),he(!1),t.failed_count>0?$.error(_(`board.toasts.deleteDonePartial`,{count:t.deleted_count,deletedCount:t.deleted_count,failedCount:t.failed_count}),{id:`board-delete-parked-error`}):$.success(_(`board.toasts.deleteDoneSuccess`,{count:t.deleted_count}),{id:`board-delete-parked-success`})}catch(e){$.error(e instanceof Ge?e.message:_(`board.errors.emptyDone`),{id:`board-delete-parked-error`})}finally{_e(!1)}}},Ur=({delta:e})=>{re(e)},Wr=(0,p.useCallback)((t=null)=>{e&&ae({initialWorktreeBundleId:t})},[e]);(0,p.useEffect)(()=>{!h||!e||(ae({initialWorktreeBundleId:null,initialImportedDraft:h}),g?.())},[h,e,g]),(0,p.useEffect)(()=>{if(!f||!e){we.current=null;return}let t=`${e}:${f}`;if(D!==e||we.current===t)return;we.current=t;let n=It.get(f);n&&Rt(n),m?.()},[e,f,D,m,Rt,It]);let Gr=(0,p.useCallback)(()=>{ot.current?.focus({preventScroll:!0})},[]);return Dle([{key:`n`,onKeyDown:Wr,disabled:!e},{key:`k`,ctrlKey:!0,onKeyDown:Gr}],{isBlocked:Ele}),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Iie,{sensors:v,collisionDetection:Wre,onDragStart:Mn,onDragMove:Ur,onDragCancel:Nn,onDragEnd:Ln,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)(hse,{query:J,inputRef:ot,hideStaleTickets:Ze,hideBundlesWithPullRequests:Qe,onQueryChange:Xe,onClear:()=>{Xe(``),ot.current?.focus()},onHideStaleTicketsChange:Y,onHideBundlesWithPullRequestsChange:$e}),(0,X.jsx)(`div`,{ref:Gt,className:`flex min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,children:(0,X.jsxs)(`div`,{ref:Kt,className:`relative flex min-h-0 w-max min-w-full gap-4`,children:[(0,X.jsx)(ple,{dependencies:x,cardRects:Zt,clipRects:Qt,preview:$t,ticketsById:It,overlaySize:en}),U8.map(t=>{let n=y.filter(e=>e.state===t&&!Dy(e)),r=Vt.filter(e=>e.state===t&&!Dy(e)),a=Zy(r,C,t),o=bt&&n.length===0?t===`plan`?1:t===`build`?2:0:0;return(0,X.jsx)(G3,{id:t,title:_(`card.columnLabels.${t}`),items:a,ticketCount:r.length,allTickets:y,dependencies:x,bundles:C,activeTool:i,modelsByTool:ue,availableSkills:oe,activeRunContextKey:mt,automationStatuses:z,isProjectRootRunActive:pt,isBundleRunDisabled:gt,getDependencyTargetState:tn,onDependencyStart:nn,onDeleteDependency:rn,onRegisterTicketNode:qt,onRegisterDependencyClipNodes:Yt,onAddTicket:t===`plan`&&e?Wr:void 0,onCreateBundle:t===`plan`&&e?zn:void 0,onDeleteBundle:t===`plan`&&e?Jn:void 0,onDeleteBundleWrapper:Yn,onRefreshBundles:t===`plan`&&e?M:void 0,onUpdateTicket:Xn,onDeleteTicket:Zn,onUndoTicket:Qn,undoingColumn:ve,onRetryTicket:$n,onAdvanceTicket:zr,onParkTicket:Wn,onUnparkTicket:Gn,onBuildChainTicket:Br,onRunTicket:er,onOpenVerificationTicket:xt.length>0?mr:void 0,canOpenChangesForTicket:On,onOpenFilesTicket:fr,onOpenChangesTicket:pr,canOpenIdeForTicket:Dn,onOpenIdeTicket:tr,onStopTicket:nr,onStopBuildTicket:rr,onStopBuildChainTicket:Vr,onResumeBuildTicket:ar,onInterruptReviewTicket:ir,onOpenBundleFiles:ur,onOpenBundleChanges:dr,canOpenReviewForBundle:jn,onOpenBundleVerification:xt.length>0?e=>cr(e):void 0,onOpenBundleChecks:e=>cr(e,`checks`),hasConfiguredChecks:xt.length>0,onOpenBundleIde:or,onAddTicketToBundle:Wr,onStartChatFromBundle:u,onFollowUpTicket:hr,bundleActionState:We,onBuildBundle:Ar,onReviewBundle:jr,onUndoBundleReview:Mr,onRunBundle:Ir,onStopBundle:Lr,onParkBundleWrapper:Kn,onUnparkBundleWrapper:qn,onOpenTicketDetails:Rt,onOpenBundleDetails:(e,t)=>{Tr(e,t)},onRequestBundleRefresh:e=>{Er(`bundleRefresh`,()=>yr(e))},onRequestTicketRefresh:j,hoveredBundleId:W,onHoverBundleChange:K,multiColumnBundleIds:Ht,onResumeBundleAutomation:Nr,onDismissBundleAutomationPause:Pr,onOpenBuildQuestions:e=>{xr(e)},loadingSkeletonCount:o},t)}),(0,X.jsx)(G3,{id:W8,title:_(`card.columnLabels.done`),items:Wt,ticketCount:Ut.length,allTickets:y,dependencies:x,activeTool:i,modelsByTool:ue,availableSkills:oe,bundles:C,activeRunContextKey:mt,automationStatuses:z,isProjectRootRunActive:pt,isBundleRunDisabled:gt,getDependencyTargetState:tn,onDependencyStart:nn,onDeleteDependency:rn,onRegisterTicketNode:qt,onRegisterDependencyClipNodes:Yt,onUpdateTicket:Xn,onDeleteTicket:Zn,onUndoTicket:Qn,undoingColumn:ve,onRetryTicket:$n,onAdvanceTicket:zr,onParkTicket:Wn,onUnparkTicket:Gn,onBuildChainTicket:Br,onRunTicket:er,onOpenVerificationTicket:xt.length>0?mr:void 0,canOpenChangesForTicket:On,onOpenFilesTicket:fr,onOpenChangesTicket:pr,canOpenIdeForTicket:Dn,onOpenIdeTicket:tr,onStopTicket:nr,onStopBuildTicket:rr,onStopBuildChainTicket:Vr,onResumeBuildTicket:ar,onInterruptReviewTicket:ir,onOpenBundleFiles:ur,onOpenBundleChanges:dr,canOpenReviewForBundle:jn,onOpenBundleVerification:xt.length>0?e=>cr(e):void 0,onOpenBundleChecks:e=>cr(e,`checks`),hasConfiguredChecks:xt.length>0,onOpenBundleIde:or,onAddTicketToBundle:Wr,onStartChatFromBundle:u,onFollowUpTicket:hr,bundleActionState:We,onBuildBundle:Ar,onReviewBundle:jr,onUndoBundleReview:Mr,onRunBundle:Ir,onStopBundle:Lr,onParkBundleWrapper:Kn,onUnparkBundleWrapper:qn,onOpenTicketDetails:Rt,onOpenBundleDetails:(e,t)=>{Tr(e,t)},onRequestBundleRefresh:e=>{Er(`bundleRefresh`,()=>yr(e))},onRequestTicketRefresh:j,hoveredBundleId:W,onHoverBundleChange:K,multiColumnBundleIds:Ht,onResumeBundleAutomation:Nr,onDismissBundleAutomationPause:Pr,onOpenBuildQuestions:e=>{xr(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:Ut.length===0||ge,onClick:()=>he(!0),children:[(0,X.jsx)(OC,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:_(`board.doneColumn.emptyAction`)})]})})]})})]})}),(0,X.jsxs)(Qie,{zIndex:5,dropAnimation:fe?null:void 0,children:[B&&(0,X.jsx)(W3,{ticket:B,allTickets:y,dependencies:x,bundles:C,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:B.worktree_bundle_id?z.get(B.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:(()=>{let e=eI(B,i);return tI(e)&&de(e).length>0})(),availableModels:de(eI(B,i)),runDisabled:Sy(B,mt,pt,_(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:Sy(B,mt,pt,_(`board.errors.runBlockedByActive`)),onDependencyStart:nn,onDeleteDependency:rn,onRegisterOverlayNode:te,onCreateBundle:zn,onDeleteBundle:Jn,onRefreshBundles:M,onUpdate:Xn,onDelete:()=>Zn(B.id),onUndo:()=>Qn(B.id),undoInProgress:ve===B.state&&(B.state===`build`||B.state===`review`),onRetry:()=>$n(B.id),onAdvance:()=>zr(B.id),onPark:()=>Wn(B.id),onUnpark:()=>Gn(B.id),onBuildChain:()=>Br(B.id),onRun:B.worktree_bundle_id===null&&Yy(B)&&B.has_run_config?()=>er(B.id):void 0,onOpenIde:B.worktree_bundle_id===null&&Dn(B)?()=>tr(B.id):void 0,onStop:B.worktree_bundle_id===null?()=>nr(B.id):void 0,onStopBuild:()=>rr(B.id),onStopBuildChain:()=>Vr(B.id),onResumeBuild:()=>ar(B.id),onInterruptReview:()=>void ir(B.id),onFollowUp:e=>hr(B.id,e),onRequestTicketRefresh:j}),!B&&H&&(0,X.jsx)(qF,{group:H,automationStatus:z.get(H.bundle.id),overlay:!0,renderTicket:En})]}),_t&&(0,X.jsx)(hle,{className:`pointer-events-auto fixed left-1/2 top-4 z-20 w-[min(14rem,calc(100vw-2rem))] -translate-x-1/2`})]}),ie&&(()=>{let t=de(i),r=tt&&an.model&&nI(an.model,t),a=r?an.model:``,o=r?an.variant:``;return(0,X.jsx)(mle,{onSubmit:Rn,bundles:C,projectId:e,projectBranchState:n,tool:i,showModelSelector:tt,showSkillsSelector:i===`opencode`,availableModels:t,availableSkills:oe,initialModel:a,initialVariant:o,initialSkills:tt&&i===`opencode`?an.skills:[],initialWorktreeBundleId:ie.initialWorktreeBundleId,initialImportedDraft:ie.initialImportedDraft,onCreateBundle:zn,onDeleteBundle:Jn,onRefreshBundles:M,onClose:()=>ae(null)})})(),me&&(0,X.jsx)(gse,{ticketCount:Ut.length,isDeleting:ge,onCancel:()=>he(!1),onConfirm:()=>{Hr()}}),Se&&(0,X.jsx)(U3,{ticket:Se,allTickets:y,dependencies:x,bundles:C,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:Se.automation_paused_reason?null:Se.worktree_bundle_id?z.get(Se.worktree_bundle_id):null,projectBranchState:n,onClose:()=>{let e=Se.id;xe(null),Ce(null),b(t=>t.map(t=>t.id===e?E8(t):t))},showModelSelector:nt,showSkillsSelector:eI(Se,i)===`opencode`,activeTool:i,availableModels:de(eI(Se,i)),availableSkills:oe,runDisabled:Sy(Se,mt,pt,_(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:Sy(Se,mt,pt,_(`board.errors.runBlockedByActive`)),onDeleteDependency:rn,onCreateBundle:zn,onDeleteBundle:Jn,onRefreshBundles:M,onUpdate:Xn,onAdvance:()=>zr(Se.id),onBuildChain:()=>Br(Se.id),onRun:Yy(Se)&&Se.has_run_config?()=>er(Se.id):void 0,onOpenIde:Dn(Se)?()=>tr(Se.id):void 0,onStop:()=>nr(Se.id),onStopBuild:()=>rr(Se.id),onStopBuildChain:()=>Vr(Se.id),onResumeBuild:()=>ar(Se.id),onInterruptReview:()=>void ir(Se.id),onFollowUp:(e,t)=>hr(Se.id,e,t),onReviewFollowUp:(e,t)=>Se.worktree_bundle_id?Rr(Se.worktree_bundle_id,e,t,`changes`):hr(Se.id,e,t,`changes`),onProjectMemorySuggestionsChanged:()=>{Je(e=>e+1)},onRequestTicketRefresh:e=>{Lt(e)},onViewSourceSpec:c,onNavigateToLifecycleSource:l,onOpenBuildQuestions:e=>{xr(e)},onOpenChecks:Se.worktree_bundle_id&&(xt.length>0||Se.latest_check_gate_evaluation)?()=>{cr(Se.worktree_bundle_id,`checks`)}:void 0,onStopAutomation:Se.worktree_bundle_id?()=>Lr(Se.worktree_bundle_id):void 0}),Fe&&e&&t&&(()=>{let t=y.find(e=>e.id===Fe.ticketId);if(!t)return null;let n=!!t.worktree_bundle_id,r=t.worktree_bundle_id?zt.get(t.worktree_bundle_id)?.required_check_policy??t.bundle?.required_check_policy:void 0,i=r?.required_check_definition_ids??Dt,a=r?.pre_review_check_definition_ids??Ot,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)(z8,{targetLabel:Fe.label,definitions:xt,requiredDefinitionIds:i,preReviewDefinitionIds:a,checksTarget:o,testsTarget:s,onClose:()=>Ie(null),requestedInitialTab:Fe.requestedInitialTab})})})(),Le&&(()=>{let{target:e}=Le,t=y.find(t=>t.id===e.ticketId),n=e.kind===`bundle`,r=n?y.some(t=>t.worktree_bundle_id===e.bundleId):!!t,i=n?y.some(t=>t.worktree_bundle_id===e.bundleId&&t.agent_status===`running`):t?.agent_status===`running`,a=n?r&&!i:!!t&&!i,o=i?_(`board.changes.reviewPromptDisabledReason`):r?!n&&t?B3(t).disabledReason??void 0:void 0:_(`board.changes.targetUnavailableReason`),s=!i&&(n||t?.state===`build`||t?.state===`review`);return(0,X.jsx)(l8,{target:{scope:`ticket`,ticketId:e.ticketId,onTicketUpdate:Xn,onRequestTicketRefresh:j},initialMode:Le.initialMode,enabledModes:[`changes`,`files`],projectId:Le.projectId,reviewCommentsBundleId:n?e.bundleId:null,title:Le.title,bundleTargetName:Le.bundleTargetName,onSubmitReviewPrompt:t=>n?Rr(e.bundleId,t,Le.followUpMode,`changes`):hr(e.ticketId,t,Le.followUpMode,`changes`),canSubmitReviewPrompt:a,reviewSubmitDisabledReason:o,canAddReviewComments:a,canModifyChanges:a,changesDisabledReason:i?_(`board.changes.modifyChangesDisabledReason`):o,mode:Le.followUpMode,onModeChange:e=>Re(t=>t&&{...t,followUpMode:e}),canToggleMode:s,onClose:()=>{if(Re(null),n){yr(e.bundleId);return}Lt(e.ticketId)},onViewSourceSpec:c,originSpecSessionId:t?.origin_spec_session_id??null,originSpecSnapshotId:t?.origin_spec_snapshot_id??null})})(),ze&&e&&t&&(()=>{let t=zt.get(ze.bundleId)?.required_check_policy??ze.requiredCheckPolicy,n=t?.required_check_definition_ids??Dt,r=t?.pre_review_check_definition_ids??Ot;return(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(z8,{targetLabel:ze.label,definitions:xt,requiredDefinitionIds:n,preReviewDefinitionIds:r,checksTarget:{projectId:e,targetKind:`bundle`,targetBundleId:ze.bundleId,gateEvaluationId:ze.gateEvaluationId},testsTarget:kt?{scope:`project`,projectId:e,targetKind:`bundle`,targetBundleId:ze.bundleId}:null,onClose:()=>Be(null),requestedInitialTab:ze.requestedInitialTab})})})(),Te&&Bt&&(0,X.jsx)(Ese,{details:Bt,activeColumn:De,isLoading:Ve||We.bundleRefresh,actionState:We,canOpenIde:kn(Bt),projectMemoryEnabled:!!t?.memory_enabled,memorySuggestionsRefreshKey:qe,automationStatus:Bt.tickets.some(e=>e.automation_paused_reason)?null:z.get(Bt.bundle.id),runDisabled:gt(Bt.bundle.id),showModelSelector:rt,activeTool:i,modelsByTool:ue,availableSkills:oe,onClose:()=>{let e=Bt.bundle.id;Ee(null),Oe(null),Ae(null),Ue(!1),Ke(G8()),b(t=>t.map(t=>t.worktree_bundle_id===e&&t.id!==be?E8(t):t))},onOpenTicketDetails:Rt,onNavigateToLifecycleSource:l,onUpdateTicket:Xn,onOpenIde:()=>{let e=Bt.tickets.find(e=>e.id===Bt.target_ticket_id)??Bt.tickets.find(e=>e.has_worktree);e&&tr(e.id)},onOpenVerification:xt.length>0?()=>{cr(Bt.bundle.id)}:void 0,onOpenChecks:xt.length>0||Bt.tickets.some(e=>e.latest_check_gate_evaluation)?()=>{cr(Bt.bundle.id,`checks`)}:void 0,onRefresh:e=>{Er(`bundleRefresh`,()=>yr(e))},onUpdateBundle:Vn,onBuildBundle:Ar,onStopBuildTicket:Dr,onResumeBuildTicket:kr,onInterruptReviewTicket:Or,onReviewBundle:jr,onUndoBundleReview:Mr,onRunBundle:Ir,onStopBundle:Lr,onFollowUpBundle:Rr,onOpenBuildQuestions:e=>{xr(e)},onResumeBundleAutomation:Nr,onDismissBundleAutomationPause:Pr}),je&&Ne&&(0,X.jsx)(ale,{details:Ne,onClose:()=>{Pe.current+=1,Me(null),q(null)},onRefresh:br,onSubmit:Sr})]})},J8=({count:e,title:t,isDeleting:n,onConfirm:r,onCancel:i,labels:a})=>{let o=e>1;return(0,X.jsxs)(hC,{onClose:i,overlayClassName:`bg-black/60`,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})]})]})},Y8=({label:e})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),X8=({label:e})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),Z8=({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)(bC,{className:`w-full max-w-lg border-dashed border-border/70 bg-card/40`,children:[(0,X.jsxs)(xC,{children:[(0,X.jsx)(SC,{children:e}),(0,X.jsx)(CC,{children:t})]}),(0,X.jsx)(TC,{children:(0,X.jsx)(Q,{type:`button`,onClick:r,disabled:!i,children:n})})]})}),Yle=({className:e})=>(0,X.jsx)(Gg,{"aria-hidden":`true`,className:e}),Xle=({className:e})=>(0,X.jsx)(Ng,{"aria-hidden":`true`,className:e}),Zle=({className:e})=>(0,X.jsx)(Pg,{"aria-hidden":`true`,className:e}),Q8=({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,onSessionSelect:T,onConfirmDeleteSession:E,getSessionId:D,getSessionTitle:O,getDeleteDisabledReason:k,getActivityState:A,getRowAriaLabel:j,renderRowContent:M,labels:N})=>{let P=(0,p.useMemo)(()=>new Set(e.filter(e=>!k(e)&&!y.has(D(e))).map(e=>D(e))),[y,k,D,e]),F=(0,p.useRef)(null),I=(0,p.useRef)(!1),L=(0,p.useRef)(null),R=(0,p.useCallback)(()=>{L.current!==null&&(window.clearTimeout(L.current),L.current=null)},[]),z=(0,p.useCallback)(()=>{R(),L.current=window.setTimeout(()=>{I.current=!1,L.current=null},0)},[R]),B=(0,p.useCallback)(()=>{F.current&&(F.current=null,z())},[z]),V=(0,p.useCallback)(e=>{let t=F.current;!t||t.visitedSessionIds.has(e)||!P.has(e)||(t.visitedSessionIds.add(e),C(e,t.mode===`select`))},[C,P]),H=(0,p.useCallback)(e=>{let t=F.current;!t||e.pointerId!==t.pointerId||B()},[B]);return(0,p.useEffect)(()=>{if(!h){B();return}return window.addEventListener(`pointerup`,H),window.addEventListener(`pointercancel`,H),()=>{window.removeEventListener(`pointerup`,H),window.removeEventListener(`pointercancel`,H),B(),R()}},[R,H,h,B]),(0,X.jsx)(`aside`,{"data-testid":s,"data-state":a?`expanded`:`collapsed`,"aria-label":N.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)(jv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:N.newSession}),f]}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":N.collapseAriaLabel,"aria-expanded":a,className:`ml-auto`,onClick:o,children:(0,X.jsx)(Xle,{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:N.cancelSelection}),(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:N.deleteSelected})]}),(0,X.jsx)(`div`,{className:`flex justify-end text-xs font-medium text-muted-foreground`,children:N.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)(Yle,{className:`h-3.5 w-3.5`}),N.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:N.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:N.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=D(e),i=!r&&t===n,a=k(e),o=y.has(t),s=!!a||o,c=g.has(t),l=A(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(),R(),I.current=!0,F.current={pointerId:e.pointerId,mode:c?`deselect`:`select`,visitedSessionIds:new Set},V(t))},onPointerMove:e=>{let n=F.current;!n||n.pointerId!==e.pointerId||V(t)},children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":j(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(I.current){I.current=!1;return}if(s)return;S(t);return}T(e)},children:M({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??N.selectSessionTitle(O(e)),children:(0,X.jsx)(`input`,{type:`checkbox`,"aria-label":N.selectSessionAriaLabel(O(e)),checked:c,disabled:s,onClick:e=>{e.stopPropagation()},onChange:()=>{I.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":N.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??N.deleteSessionTitle(O(e)),disabled:s,onClick:e=>{e.stopPropagation(),E(t)},children:(0,X.jsx)(OC,{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)(Ov,{content:m,side:`right`,children:(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":N.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,X.jsx)(jv,{className:`h-4 w-4`})})}):(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":N.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,X.jsx)(jv,{className:`h-4 w-4`})}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":N.openAriaLabel,"aria-expanded":a,className:`h-9 w-9`,onClick:o,children:(0,X.jsx)(Zle,{className:`h-4 w-4`})})]})})},$8=({isInterrupting:e,onStop:t,interruptLabel:n,interruptingLabel:r})=>(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:e,onClick:t,children:[e?(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Vv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:e?r:n})]}),e5=4,Qle=5e3,t5=(e,t)=>vC.t(`common:chatChangesPanel.${e}`,t),n5=e=>e.replace(/^[ab]\//,``),r5=e=>{let t=`oldPath`in e&&typeof e.oldPath==`string`?n5(e.oldPath):``,n=`newPath`in e&&typeof e.newPath==`string`?n5(e.newPath):``;return[...new Set([n,t].filter(e=>e&&e!==`/dev/null`))]},i5=e=>{let[t,n]=r5(e);return!t&&!n?t5(`unknownFile`):t&&n&&t!==n?`${n} -> ${t}`:t??n??t5(`unknownFile`)},a5=e=>{let t=zG((()=>{let[t,n]=r5(e);return t??n??null})());if(!t)return null;try{return PM(e.hunks,{highlight:!0,refractor:PK.default,language:t,enhancers:[MM(e.hunks)]})}catch{return null}},o5=(e,t)=>e instanceof Error?e.message:t,$le=(e,t)=>{if(!t)return e;let n=i5(t);return[t,...e.filter(e=>i5(e)!==n)]},eue=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}),tue=({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}))},s5=e=>{let t=e.split(/[\\/]/);return t[t.length-1]||e},nue={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`},rue=e=>t5(`fileStatus.${e}`),iue=({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`?t5(`picker.diff`):s?s5(s.path):t5(`picker.file`):e===`all`?t5(`picker.allChanges`):s?s5(s.path):e;return(0,X.jsxs)(gv,{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":t5(`picker.openChangedFilesAriaLabel`),title:e===`all`?void 0:s?.path??e,children:[(0,X.jsx)(`span`,{className:`truncate`,children:c}),r===`full`&&(0,X.jsx)(yC,{variant:`outline`,className:`shrink-0 text-[10px] uppercase tracking-wide`,children:t5(`picker.fileCount`,{count:t.length})}),(0,X.jsx)(Av,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,X.jsxs)(vv,{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:t5(`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`,w6(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:t5(`picker.allChanges`)}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground transition-colors group-hover:text-foreground/70`,children:t5(`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:t5(`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`,w6(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:s5(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)(yC,{variant:`outline`,className:nue[t.status],children:rue(t.status)}),t.staged&&(0,X.jsx)(yC,{variant:`outline`,children:t5(`fileStatus.staged`)}),t.unstaged&&(0,X.jsx)(yC,{variant:`outline`,children:t5(`fileStatus.unstaged`)}),t.conflicted&&(0,X.jsx)(yC,{variant:`destructive`,children:t5(`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`?t5(`fileStatus.renamedFrom`,{path:t.originalPath}):t.originalPath})]})]})},`${t.path}:${t.originalPath??``}`))]})})]})]})},c5=(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=>[YM(e.filePath,e.changeKey),e])),[a.reviewComments]),F=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await ore(e,t):await Un(e)},[t,e]),I=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await sre(e,t):await Xn(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,i]=await Promise.allSettled([F(),I()]);T.current===t&&(r.status===`fulfilled`?(D.current=r.value,f(r.value),_(null)):_(o5(r.reason,t5(`errors.loadDiff`))),i.status===`fulfilled`&&(O.current=i.value,h(i.value)),E.current===n&&y(!1),b(!1))},[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&&j6(e)}catch(e){if(T.current!==r)return;D.current||_(o5(e,t5(`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 M6(t=>{t===e&&R()})},[e,R]),(0,p.useEffect)(()=>{if(!e)return;let t=rx(()=>{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})},Qle);return()=>{window.clearInterval(t)}},[e,R]);let z=(0,p.useMemo)(()=>{let e=typeof d?.diff==`string`?d.diff:``;return e.trim()?TD(e,{nearbySequences:`zip`}).map(e=>({...e,pathCandidates:r5(e)})):[]},[d]),B=(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]),V=(0,p.useMemo)(()=>tue({diffResponse:d,gitStatus:m}),[d,m]);(0,p.useEffect)(()=>{if(k!==`all`&&!(!d&&!m)){if(V.length===0){o(e=>({...e,selectedDiffPath:`all`}));return}V.some(e=>e.path===k)||o(e=>({...e,selectedDiffPath:`all`}))}},[d,m,o,k,V]);let H=k===`all`?null:B.get(k)??null,U=(0,p.useMemo)(()=>$le(z,H),[z,H]),W=(0,p.useMemo)(()=>k===`all`?z:H?[H]:[],[z,k,H]);(0,p.useEffect)(()=>{S(new Map)},[z]),(0,p.useEffect)(()=>{if(U.length===0)return;let e=!1,t=null,n=0,r=()=>{if(e)return;let i=U.slice(n,n+e5);i.length!==0&&(S(e=>{let t=new Map(e);for(let e of i){let n=i5(e);t.has(n)||t.set(n,a5(e))}return t}),n+=e5,n<U.length&&(t=window.setTimeout(r,0)))};return t=window.setTimeout(r,0),()=>{e=!0,t!==null&&window.clearTimeout(t)}},[U]);let G=(0,p.useMemo)(()=>{let e=new Map;for(let t of U.slice(0,e5))e.set(i5(t),a5(t));return e},[U]),K=(0,p.useMemo)(()=>W.map(e=>({...e,tokens:x.get(i5(e))??G.get(i5(e))??null})),[G,x,W]),ee=(0,p.useMemo)(()=>z.map(e=>({...e,tokens:null})),[z]),te=(0,p.useMemo)(()=>eue(a.reviewComments),[a.reviewComments]),ne=te.length,re=n&&!C&&ne>0,ie=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}))},[o]),ae=(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]),oe=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``}))},[o]),se=(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=>[YM(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:XM(e.hunk,e.change),comment:r}),{...t,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[...n.values()]}})},[n,o,P,N]),ce=(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]),le=(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=>YM(t.filePath,t.changeKey)!==e)}))},[o]),ue=(0,p.useCallback)(async()=>{if(!re)return;w(!0);let e=aN({drafts:te,findings:[],githubComments:[],uncommittedFiles:z});try{await i(e),ie(),$.success(t5(`toasts.sendChangesSuccess`),{id:`chat-diff-review-submit-success`})}catch(e){$.error(o5(e,t5(`errors.sendChanges`)),{id:`chat-diff-review-submit-error`})}finally{w(!1)}},[re,ie,i,z,te]),de=(0,p.useCallback)(e=>(0,X.jsx)(a6,{reviewComments:te,pendingFixCount:ne,triggerMode:e===`wide`?`full`:`compact`,canSendReview:re,isSubmittingReview:C,reviewSubmitDisabledReason:r??void 0,onClearPendingFixes:ie,onSubmitReview:()=>{ue()}}),[re,ie,ue,C,ne,te,r]),fe=c?(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":t5(`closeAriaLabel`),className:`text-muted-foreground hover:text-foreground`,onClick:c,children:(0,X.jsx)(cC,{className:`h-4 w-4`})}):null,pe=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:pe,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)(C6,{selectedDiffPath:k,sidebarFiles:V,diffResponse:d,isDiffLoading:v,diffError:g,allDiffFiles:ee,renderedFiles:K,viewType:`unified`,onViewTypeChange:()=>{},onRetry:()=>{L()},activeReviewTarget:A,editingReviewCommentKey:j,reviewDraftInstanceKey:M,reviewDraftInput:N,reviewComments:te,reviewFindings:[],githubComments:[],selectedReviewFindingIds:[],selectedGitHubCommentIds:[],canSelectReviewTarget:n,canEditActiveReviewDraft:n,reviewFindingsError:null,gitHubCommentsError:null,hasStaleReviewFindings:!1,onSelectReviewTarget:ae,onToggleReviewFindingSelection:()=>{},onToggleGitHubCommentSelection:()=>{},onReviewDraftInputChange:e=>{o(t=>({...t,reviewDraftInput:e}))},onCancelReviewDraft:oe,onEditReviewDraft:ce,onRemoveReviewDraft:le,onSaveReviewDraft:se,diffThemeClassName:T6,resolveFilePath:i5,normalizeDiffPath:n5,emptyStateTitle:t5(`emptyStateTitle`),emptyStateDescription:t5(`emptyStateDescription`),filePickerControl:e=>(0,X.jsx)(iue,{selectedDiffPath:k,sidebarFiles:V,diffStats:d?.stats??null,triggerMode:e===`wide`?`full`:`compact`,onSelectDiffPath:e=>{o(t=>({...t,selectedDiffPath:e}))}}),reviewSummaryControl:de,extraHeaderControl:fe,surfaceVariant:`flat`,showViewTypeToggle:!1,gutterVariant:`compact`,isResizing:s,resizePlaceholderLineThreshold:200})})});c5.displayName=`ChatChangesPanel`;var l5=({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:B,onFollowUpKeyDown:V,onFollowUpPaste:H,onUploadAttachments:U,onRemoveAttachment:W,onFollowUpSubmit:G})=>(0,X.jsx)(aY,{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:B,onFollowUpKeyDown:V,onFollowUpPaste:H,onUploadAttachments:U,onRemoveAttachment:W,onFollowUpSubmit:G}),u5=({disabled:e=!1,onClick:t})=>{let n=vC.t(`chatView.startBuilding.label`);return(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2 border-emerald-400/40 bg-emerald-400/10 text-emerald-100 hover:bg-emerald-400/20 hover:text-white`,"aria-label":vC.t(`chatView.startBuilding.ariaLabel`),disabled:e,onClick:t,children:[(0,X.jsx)(zv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:n})]})},aue=`mt-1 flex min-h-5 flex-wrap items-center gap-2 text-xs text-muted-foreground`,oue=({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}),d5=({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:aue,children:[(0,X.jsx)(rI,{tool:t,className:`text-[11px]`}),n?(0,X.jsx)(`p`,{children:n}):null,r?(0,X.jsx)(oue,{label:i}):null,a?(0,X.jsx)(iI,{totalTokens:a.totalTokens,contextWindow:a.contextWindow,cost:a.cost,tool:a.tool,model:a.model,availableModels:a.availableModels}):null,o]})]}),s]}),c]}),f5=({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})]}),p5=()=>({selectedDiffPath:`all`,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}),sue=[{key:`today`,label:`Today`},{key:`yesterday`,label:`Yesterday`},{key:`last_7_days`,label:`Last 7 Days`},{key:`older`,label:`Older`}],cue=e=>{if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t},m5=e=>e.activity_at??e.last_user_message_at??e.created_at,lue=(e,t)=>{let n=m5(e),r=m5(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)},h5=e=>[...e].sort(lue),uue=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),due=(e,t=new Date)=>{let n=cue(m5(e));if(!n)return`older`;let r=uue(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`},g5=(e,t=new Date)=>{let n=new Map;for(let r of h5(e)){let e=due(r,t);n.set(e,[...n.get(e)??[],r])}return sue.flatMap(e=>{let t=n.get(e.key)??[];return t.length===0?[]:[{key:e.key,label:e.label,sessions:t}]})},_5=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},v5=e=>e===`claude`?vC.t(`chatView.tool.claude`):vC.t(`chatView.tool.opencode`),y5=e=>new Map(e.map(e=>[e.id,e.label])),b5=({availableModelsById:e,model:t})=>t?e.get(t)??t:null,x5=({modelLabel:e,tool:t})=>e??v5(t),S5=()=>vC.t(`chatView.user.you`),C5=`archon.chat-draft`,w5=({projectId:e,tool:t,chatSessionId:n})=>n?`${C5}:${e}:session:${n}`:`${C5}:${e}:draft:${t}`,T5=e=>{if(!e)return``;try{return window.localStorage.getItem(e)??``}catch{return``}},E5=({storageKey:e,value:t})=>{if(e)try{if(t){window.localStorage.setItem(e,t);return}window.localStorage.removeItem(e)}catch{}},D5=(e,t)=>vC.t(`chatView.${e}`,t),fue=1500,pue=`archon.chat-run-config`,mue=`archon.chat-changes-panel-layout`,hue=`archon.chat-session-list-layout`,O5=512,k5=360,gue=.6,_ue=6,A5=`/`,vue=`Slash`,yue=`NumpadDivide`,bue=600,j5=4,M5=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):O5;if(!Number.isFinite(t))return Math.max(k5,n);let r=Math.max(k5,Math.round(t*gue));return Math.max(k5,Math.min(r,n))},xue=e=>D5(e===`plan`?`mode.plan`:`mode.build`),N5=e=>D5(e===`plan`?`placeholders.plan`:`placeholders.build`),P5=e=>D5(`pendingMemorySuggestions`,{count:e}),Sue=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===A5||e.code===vue||e.code===yue),F5=({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)(lX,{"aria-hidden":n,children:e}),t.map(e=>(0,X.jsxs)(`span`,{className:`contents`,children:[(0,X.jsx)(`span`,{children:`+`}),(0,X.jsx)(lX,{"aria-hidden":n,children:e})]},e))]}),Cue=({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)(F5,{modifierLabel:t,keys:n,ariaHidden:!0})]}),I5=({projectId:e,tool:t})=>`${pue}:${e}:${t}`,L5=e=>`${mue}:${e}`,R5=e=>`${hue}:${e}`,z5=e=>{if(!e)return{isOpen:!0,width:O5};try{let t=window.localStorage.getItem(L5(e));if(!t)return{isOpen:!0,width:O5};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(k5,Math.round(n.width)):O5;return{isOpen:n.isOpen!==!1,width:r}}catch{return{isOpen:!0,width:O5}}},B5=e=>{if(!e)return{isOpen:!0};try{let t=window.localStorage.getItem(R5(e));return t?{isOpen:JSON.parse(t).isOpen!==!1}:{isOpen:!0}}catch{return{isOpen:!0}}},wue=({projectId:e,isOpen:t,width:n})=>{if(e)try{window.localStorage.setItem(L5(e),JSON.stringify({isOpen:t,width:n}))}catch{}},Tue=({projectId:e,isOpen:t})=>{if(e)try{window.localStorage.setItem(R5(e),JSON.stringify({isOpen:t}))}catch{}},V5=({projectId:e,tool:t})=>{if(!e||t!==`opencode`&&t!==`claude`)return null;try{let n=window.localStorage.getItem(I5({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}}catch{return null}},H5=({projectId:e,tool:t,model:n,variant:r,mode:i})=>{if(!(!e||t!==`opencode`&&t!==`claude`||!n&&!i))try{window.localStorage.setItem(I5({projectId:e,tool:t}),JSON.stringify({model:n,variant:n?r:null,mode:i}))}catch{}},U5=({projectId:e,tool:t})=>V5({projectId:e,tool:t})?.mode??`plan`,W5=({activeProjectId:e,helperModel:t,helperVariant:n,activeTool:r,availableModels:i})=>{let a=V5({projectId:e,tool:r}),o=t??``,s=a?.model??``,c=nI(s,i)?s:nI(o,i)?o:``,l=c===s?a?.variant??null:c&&c===o?n??null:null,u=i.find(e=>e.id===c)??null;return{model:c,variant:u?u.variants.includes(l??``)?l??``:``:c?l??``:``,mode:a?.mode??`plan`}},G5=e=>e&&e.replace(/\s+/g,` `).trim()||null,Eue=e=>{let t=G5(e.first_user_message_preview);if(t)return t;let n=e.messages?.find(e=>e.role===`user`)?.content;return G5(n)},Due=({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}),Oue=({session:e,instruction:t,attachments:n,createdAt:r})=>({...e,messages:[...e.messages??[],Due({chatSessionId:e.id,instruction:t,attachments:n,createdAt:r})],activity_at:r,last_user_message_at:r,updated_at:r}),kue=e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),K5=({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,Aue=({session:e,activeProject:t,activeProjectBranchState:n})=>e.target_kind===`bundle`?e.target_label_snapshot||D5(`targets.bundleFallback`):!t||t.active_target_kind===`bundle`||n?.status!==`ready`||!n.branch||!e.target_branch_snapshot||n.branch===e.target_branch_snapshot?null:D5(`targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}),jue=e=>e.target_kind===`bundle`?e.target_label_snapshot||D5(`targets.bundleFallback`):e.target_branch_snapshot?D5(`targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}):D5(`targets.repoRoot`),Mue=({activeProject:e,activeProjectBranchState:t})=>e?e.active_target_kind===`bundle`?D5(`targets.selectedBundleTarget`):t?.branch?D5(`targets.repoRootWithBranch`,{branch:t.branch}):D5(`targets.repoRoot`):D5(`targets.currentTarget`),q5=e=>e.agent_status===`running`?D5(`sidebar.deleteDisabledReason`):null,Nue=({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:D5(`ticketProposal.createdTitle`)}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:D5(`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:D5(`ticketProposal.proposedTitle`)}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:D5(`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:D5(`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:D5(t?`ticketProposal.creating`:`ticketProposal.create`)})})]}),Pue=({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,initialChatSessionId:d=null,onInitialChatNavigationConsumed:f,initialDraftOpen:m=!1,onInitialDraftOpenConsumed:h,initialSpecDraft:g=null,onInitialSpecDraftConsumed:_,onViewSourceSpec:v,onNavigateToLifecycleSource:y,onRestoreSessionTarget:b,onReviewCapabilityChange:x,isExternallyResizing:S=!1,showChangesPanel:C=!0})=>{let w=Aq(),[T,E]=(0,p.useState)([]),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(null),j=bJ(k?.post_build_check),[M,N]=(0,p.useState)(null),[P,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(null),[R,z]=(0,p.useState)(()=>U5({projectId:e,tool:u})),[B,V]=(0,p.useState)({}),[H,U]=(0,p.useState)({}),[W,G]=(0,p.useState)({}),[K,ee]=(0,p.useState)([]),[te,ne]=(0,p.useState)(``),[re,ie]=(0,p.useState)(``),[ae,oe]=(0,p.useState)([]),[se,ce]=(0,p.useState)(!1),[le,ue]=(0,p.useState)(!1),[de,fe]=(0,p.useState)(!1),[pe,me]=(0,p.useState)(!1),[he,ge]=(0,p.useState)(!1),[_e,ve]=(0,p.useState)(null),[ye,be]=(0,p.useState)([]),[xe,Se]=(0,p.useState)(()=>new Set),[Ce,we]=(0,p.useState)(!1),[Te,Ee]=(0,p.useState)(()=>new Set),[De,Oe]=(0,p.useState)(!1),[ke,Ae]=(0,p.useState)(!1),[je,Me]=(0,p.useState)(null),[Ne,q]=(0,p.useState)(null),[Pe,Fe]=(0,p.useState)([]),[Ie,Le]=(0,p.useState)(!1),[Re,ze]=(0,p.useState)(!1),[Be,Ve]=(0,p.useState)(0),[He,Ue]=(0,p.useState)(p5),[We,qe]=(0,p.useState)(()=>B5(e).isOpen),[Je,J]=(0,p.useState)(()=>z5(e).isOpen),[Xe,Ze]=(0,p.useState)(!1),[Y,Qe]=(0,p.useState)(!1),[$e,et]=(0,p.useState)(()=>z5(e).width),[tt,nt]=(0,p.useState)(0),[rt,it]=(0,p.useState)(null),[at,ot]=(0,p.useState)(()=>new Set),st=(0,p.useRef)({model:``,variant:``,skills:[],showModelSelector:!1}),ct=(0,p.useRef)(!1),lt=(0,p.useRef)(I),ut=(0,p.useRef)(null),dt=(0,p.useRef)(null),ft=(0,p.useRef)(0),pt=(0,p.useRef)(0),mt=(0,p.useRef)(!1),ht=(0,p.useRef)(null),gt=(0,p.useRef)(null),_t=(0,p.useRef)(null),vt=(0,p.useRef)(null),yt=(0,p.useRef)(null),bt=(0,p.useRef)(null),xt=(0,p.useRef)(!1),St=(0,p.useRef)(!1),Ct=(0,p.useRef)(0),wt=(0,p.useRef)(O5),Tt=(0,p.useRef)(O5),Et=(0,p.useRef)(!1),Dt=(0,p.useRef)(0),Ot=(0,p.useRef)({id:null,status:null}),kt=(0,p.useRef)(new Map),At=(0,p.useRef)({}),jt=(0,p.useRef)({}),Mt=(0,p.useRef)(new Set),Nt=(0,p.useRef)(!1),Pt=e?w5({projectId:e,tool:P?u:k?.tool??u,chatSessionId:P?null:D}):null,Ft=Pt?B[Pt]??``:``,It=P?u:k?.tool??u,Lt=k?H[k.id]??[]:[],Rt=(k?W[k.id]??0:0)>0,{models:zt,isLoading:Bt}=OF(It);(0,p.useEffect)(()=>{ct.current=P},[P]),(0,p.useEffect)(()=>{At.current=B},[B]),(0,p.useEffect)(()=>{jt.current=H},[H]),(0,p.useEffect)(()=>{if(!(!d||T.length===0)&&T.some(e=>e.id===d)){if(D===d){f?.();return}N(null),ve(null),O(d),F(!1),Et.current=!0,f?.()}},[d,T,D,f]),(0,p.useEffect)(()=>{if(!Pt||Mt.current.has(Pt))return;Mt.current.add(Pt);let e=T5(Pt);e&&V(t=>Object.prototype.hasOwnProperty.call(t,Pt)?t:{...t,[Pt]:e})},[Pt]),(0,p.useEffect)(()=>{!Pt||!Object.prototype.hasOwnProperty.call(B,Pt)||E5({storageKey:Pt,value:B[Pt]??``})},[Pt,B]),(0,p.useEffect)(()=>{if(!P){ut.current=null;return}let e=ut.current;!e||!Pt||Ft||V(t=>t[Pt]?t:{...t,[Pt]:e})},[P,Pt,Ft]),(0,p.useEffect)(()=>{dt.current=D},[D]),(0,p.useEffect)(()=>{lt.current=I},[I]);let Vt=(0,p.useCallback)(()=>{pt.current+=1},[]),Ht=(0,p.useCallback)(e=>{Vt(),A(e)},[Vt]);(0,p.useEffect)(()=>{if(!Nt.current){Nt.current=!0;return}let t=z5(e),n=B5(e);ct.current=!1,Et.current=!1,Mt.current=new Set,O(null),Ht(null),F(!1),V({}),U({}),G({}),ve(null),be([]),Se(new Set),we(!1),Ee(new Set),it(null),Fe([]),ze(!1),ue(!1),Ue(p5()),ot(new Set),kt.current=new Map,Tt.current=t.width,qe(n.isOpen),et(t.width),J(t.isOpen)},[e,Ht]),(0,p.useEffect)(()=>{Xe||(Tt.current=$e,_t.current&&(_t.current.style.setProperty(`--chat-changes-panel-width`,`${$e}px`),_t.current.setAttribute(`data-desktop-width`,String($e))))},[$e,Xe]),(0,p.useEffect)(()=>{if(!C||!ht.current)return;let e=ht.current.getBoundingClientRect().width;if(e<=0)return;let t=M5($e,e);t!==$e&&(Tt.current=t,et(t))},[$e,C]),(0,p.useEffect)(()=>{Tue({projectId:e,isOpen:We})},[e,We]),(0,p.useEffect)(()=>{C&&wue({projectId:e,isOpen:Je,width:$e})},[e,$e,Je,C]),(0,p.useEffect)(()=>{ze(!1)},[D,P]);let Ut=(0,p.useCallback)(e=>{let t=_5(e);E(e=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return h5([...e,t]);let r=[...e];return r[n]=t,h5(r)})},[]),Wt=(0,p.useCallback)(t=>{let n=Array.from(new Set(t));if(n.length===0)return;let r=new Set(n),i=dt.current,a=e?n.map(t=>w5({projectId:e,tool:u,chatSessionId:t})):[];V(e=>{let t=a.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}),U(e=>{let t={...e},r=!1;for(let e of n)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],r=!0);return r?t:e}),G(e=>{let t={...e},r=!1;for(let e of n)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],r=!0);return r?t:e});for(let e of a)E5({storageKey:e,value:``});E(e=>{let t=e.filter(e=>!r.has(e.id));if(i&&r.has(i)){let e=t[0]??null;O(e?.id??null),Ht(null),F(e===null),Fe([]),Le(!1),ze(!1)}return t}),ot(e=>{let t=new Set(e),r=!1;for(let e of n)t.delete(e)&&(r=!0);return r?t:e}),it(e=>e&&r.has(e.parentId)?null:e),ve(e=>e&&r.has(e)?null:e),be(e=>e.filter(e=>!r.has(e))),Se(e=>{let t=new Set(e),r=!1;for(let e of n)t.delete(e)&&(r=!0);return r?t:e}),Ee(e=>{let t=new Set(e),r=!1;for(let e of n)t.delete(e)&&(r=!0);return r?t:e})},[e,u,Ht]),Gt=(0,p.useCallback)(e=>{Wt([e])},[Wt]),Kt=(0,p.useCallback)((e,t)=>{e&&V(n=>n[e]===t?n:{...n,[e]:t})},[]),qt=(0,p.useCallback)(e=>{e&&(V(t=>t[e]===``?t:{...t,[e]:``}),E5({storageKey:e,value:``}))},[]),Jt=(0,p.useCallback)((e,t)=>{U(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}})},[]),Yt=(0,p.useCallback)(e=>{U(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),G(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),Xt=(0,p.useCallback)((e,t)=>{G(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}})},[]),Zt=(0,p.useCallback)(({fromStorageKey:e,toStorageKey:t})=>{if(!e||!t||e===t)return;let n=Object.prototype.hasOwnProperty.call(At.current,e)?At.current[e]??``:T5(e);V(r=>{let i={...r,[t]:n};return delete i[e],i}),E5({storageKey:t,value:n}),E5({storageKey:e,value:``})},[]),Qt=(0,p.useCallback)((e,t)=>{E(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}),A(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:(pt.current+=1,{...n,pending_memory_suggestion_count:t}))},[]),$t=(0,p.useCallback)(async r=>{if(!e){E([]),O(null),Ht(null),F(!1),ue(!1);return}ce(!0);try{let i=await LN(e,r);if(r?.aborted)return;let a=h5(i.map(_5)),o=a[0]??null,s=t?.active_target_kind===`bundle`||n?.status!==`loading`;E(a),O(e=>ct.current?null:e&&a.some(t=>t.id===e)?e:e?a[0]?.id??null:Et.current?null:o?s?(Et.current=!0,K5({activeProject:t,activeProjectBranchState:n,session:o})?o.id:null):null:(Et.current=!0,null)),a.length===0&&F(!0)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:D5(`errors.loadSessions`))}finally{r?.aborted||(ce(!1),ue(!0))}},[t,n,e,Ht]),en=(0,p.useCallback)(async(t,n)=>{if(!e){Ht(null);return}fe(!0);let r=ft.current+1;ft.current=r;let i=pt.current;try{let a=await zN(e,t,n);if(n?.aborted)return;let o=pt.current!==i,s=ft.current===r,c=dt.current===t&&!ct.current;if(!s||o||!c)return;Ht(a),Ut(a)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:D5(`errors.loadSession`))}finally{n?.aborted||fe(!1)}},[e,Ht,Ut]),tn=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){Fe([]),Le(!1);return}Le(!0);try{let t=await hr(e,null,r,n);if(r?.aborted)return;Fe(t.suggestions),Qt(n,t.suggestions.length)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:D5(`errors.loadMemorySuggestions`))}finally{r?.aborted||Le(!1)}},[t?.memory_enabled,e,Qt]),nn=(0,p.useCallback)(e=>{Fe(t=>{let n=t.filter(t=>t.id!==e);return D&&Qt(D,n.length),n}),Ve(e=>e+1),$t(),D&&en(D)},[D,en,$t,Qt]);(0,p.useEffect)(()=>{let e=new AbortController;return $t(e.signal),()=>{e.abort()}},[$t]),(0,p.useEffect)(()=>{if(ct.current||P||D||Et.current||T.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;Et.current=!0;let e=T[0]??null;e&&K5({activeProject:t,activeProjectBranchState:n,session:e})&&O(e.id)},[t,n,D,P,T]),(0,p.useEffect)(()=>{if(It!==`opencode`&&It!==`claude`){ee([]),Ae(!1);return}if(It!==`opencode`){ee([]);return}let t=new AbortController;return(async()=>{Ae(!0);try{ee(await kF(It,t.signal,e))}catch(e){Ye(e)||ee(e=>e)}finally{t.signal.aborted||Ae(!1)}})(),()=>{t.abort()}},[e,It]),(0,p.useEffect)(()=>{if(P||!D){Ht(null);return}if(k?.id===D)return;Ht(null);let e=new AbortController;return en(D,e.signal),()=>{e.abort()}},[k,D,P,en,Ht]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||P||!D){Fe([]),Le(!1);return}let e=new AbortController;return tn(D,e.signal),()=>{e.abort()}},[t?.memory_enabled,D,P,tn,Be]),(0,p.useEffect)(()=>{!Re||Ie||Pe.length>0||ze(!1)},[Ie,Re,Pe.length]),(0,p.useEffect)(()=>{if(!D||k?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([$t(e.signal),en(D,e.signal)])},fue);return()=>{e.abort(),window.clearInterval(t)}},[k?.agent_status,D,en,$t]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(t.id===D&&Ht(t),kue(t)&&Ut(t))},n=t=>{!t||t.project_id!==e||Gt(t.id)},r=()=>{$t();let e=dt.current;e&&!ct.current&&en(e)};return w.on(`connect`,r),w.on(`chat-session:created`,t),w.on(`chat-session:updated`,t),w.on(`chat-session:deleted`,n),()=>{w.off(`connect`,r),w.off(`chat-session:created`,t),w.off(`chat-session:updated`,t),w.off(`chat-session:deleted`,n)}},[e,D,en,$t,Gt,Ht,w,Ut]),(0,p.useEffect)(()=>{P&&(lt.current||z(U5({projectId:e,tool:u})))},[e,u,P]),(0,p.useEffect)(()=>{if(It!==`opencode`&&It!==`claude`){ne(``),ie(``),oe([]);return}if(P){let n=W5({activeProjectId:e,helperModel:t?.helper_model??null,helperVariant:t?.helper_variant??null,activeTool:It,availableModels:zt});ne(n.model),ie(n.variant),oe([]);return}ne(k?.model??``),ie(k?.variant??``)},[e,t?.helper_model,t?.helper_variant,k?.id,k?.model,k?.variant,zt,It,P]),(0,p.useEffect)(()=>{if(It!==`opencode`){oe([]);return}if(P){oe([]);return}oe(k?.skills??[])},[k?.skills,It,P]),(0,p.useEffect)(()=>{let e=zt.find(e=>e.id===te)??null;ie(t=>e?e.variants.includes(t)?t:``:t)},[zt,te]),(0,p.useEffect)(()=>{if(It!==`opencode`||!P||!te||re)return;let n=W5({activeProjectId:e,helperModel:t?.helper_model??null,helperVariant:t?.helper_variant??null,activeTool:It,availableModels:zt});n.model===te&&n.variant&&ie(n.variant)},[e,t?.helper_model,t?.helper_variant,It,zt,P,te,re]),(0,p.useEffect)(()=>{if(!_e)return;let e=k?.id===_e?k:T.find(e=>e.id===_e)??null;(!e||e.agent_status!==`running`)&&ve(null)},[k,_e,T]),(0,p.useEffect)(()=>{let e=Ot.current,n=k?.id??null,r=k?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&Ve(e=>e+1),Ot.current={id:n,status:r}},[t?.memory_enabled,e,k?.agent_status,k?.id,k?.title]),(0,p.useEffect)(()=>{D&&ot(e=>{if(!e.has(D))return e;let t=new Set(e);return t.delete(D),t})},[D]),(0,p.useEffect)(()=>{rt&&(rt.parentId===D&&(he||k?.agent_status===`running`)||it(null))},[k?.agent_status,D,he,rt]),(0,p.useEffect)(()=>{let e=kt.current,t=new Map,n=[];for(let r of T){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&a===`done`&&r.id!==D&&n.push(r),t.set(r.id,a)}kt.current=t,ot(e=>{let t=new Set(e),r=!1,i=new Set(T.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of T){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===D||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,D,T]);let rn=(0,p.useMemo)(()=>y5(zt),[zt]),an=(0,p.useMemo)(()=>g5(T),[T]),on=(0,p.useMemo)(()=>ye.length===0?[]:ye.flatMap(e=>{let t=T.find(t=>t.id===e)??(k?.id===e?k:null);return t?[t]:[]}),[k,ye,T]),sn=on.length===1?on[0]?.title??null:null;(0,p.useEffect)(()=>{ye.length>0&&on.length!==ye.length&&be(on.map(e=>e.id))},[ye,on]),(0,p.useEffect)(()=>{let e=new Set(T.filter(e=>!q5(e)&&!xe.has(e.id)).map(e=>e.id));Ee(t=>{let n=new Set(Array.from(t).filter(t=>e.has(t)));return n.size===t.size?t:n})},[xe,T]),(0,p.useEffect)(()=>{!Ce||We||(we(!1),Ee(new Set))},[We,Ce]);let cn=(0,p.useMemo)(()=>k?x5({modelLabel:b5({availableModelsById:rn,model:k.model}),tool:k.tool}):null,[k,rn]),ln=(0,p.useMemo)(()=>k?(k.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?fq(e.response_timing):null,created_at:e.created_at,displayTitle:e.role===`assistant`?cn??v5(k.tool):S5()})):[],[k,cn]),un=(0,p.useMemo)(()=>[...k?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[k]),dn=!!un,fn=(0,p.useCallback)(async(t,n)=>{if(!e||!k||Ne)return;let r=cY({parentType:`chat`,parentId:k.id,setId:n.set_id});q(n.set_id);try{let r=await UN(e,k.id,t,n);Ht(r),Ut(r)}catch(e){if(e instanceof Ge&&e.status===409){uY(r);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?(Ht(t),Ut(t)):await en(k.id)}throw $.error(e instanceof Error?e.message:D5(`errors.resolveQuestions`)),e}finally{q(null)}},[e,k,en,Ht,Ne,Ut]),pn=(0,p.useCallback)(e=>{let t=e.metadata?.ask_question;if(e.role!==`assistant`||!t||!k)return;let n=cY({parentType:`chat`,parentId:k.id,setId:t.id});return(0,X.jsx)(_Y,{messageContent:e.content,questionSet:t,storageKey:n,isActive:t.status===`pending`&&un?.id===e.id,isDisabled:k.agent_status===`running`||Ne===t.id,onResolve:t=>fn(e.id,t)})},[k,un?.id,fn,Ne]),mn=k?.id&&k.agent_status===`running`&&rt?.parentId===k.id?rt.turnKey:null,hn=(It===`opencode`||It===`claude`)&&zt.length>0,gn=(It===`opencode`||It===`claude`)&&!hn&&(ke||Bt);(0,p.useEffect)(()=>{st.current={model:te,variant:re,skills:ae,showModelSelector:hn}},[te,ae,re,hn]);let _n=(0,p.useMemo)(()=>zt.find(e=>e.id===te)??null,[zt,te]),vn=P?R:k?.mode??`build`,yn=P?D5(`composer.newChatTitle`):k?.title??D5(`composer.chatTitle`),bn=P?u:k?.tool??u,xn=(0,p.useMemo)(()=>pX(),[]),Sn=hn?te||null:k?.model??null,Cn=bn===`opencode`||bn===`claude`,wn=b5({availableModelsById:rn,model:Sn}),Tn=P?`draft:${e??`none`}:${u}`:k?.id,En=(0,p.useCallback)(()=>{ct.current=!0,F(!0),z(U5({projectId:e,tool:u})),N(null),O(null),Ht(null),ve(null),we(!1),Ee(new Set),it(null),L(null),ut.current=null},[e,u,Ht]);(0,p.useEffect)(()=>{g&&(En(),z(`build`),L({specSessionId:g.specSessionId,specSnapshotId:g.specSnapshotId}),ut.current=g.text,_?.())},[g,En,_]),(0,p.useEffect)(()=>{m&&(En(),h?.())},[m,En,h]);let Dn=(0,p.useCallback)((e,t=null)=>{ct.current=!1,F(!1),N(null),O(e),Ht(t),L(null)},[Ht]),On=(0,p.useCallback)(async()=>{if(!(!k||!b)){N(k.id);try{await b(k)}catch(e){$.error(e instanceof Error?e.message:D5(`errors.restoreTarget`))}finally{N(e=>e===k.id?null:e)}}},[k,b]),kn=!!(k&&k.target_available!==!1&&!P&&!K5({activeProject:t,activeProjectBranchState:n,session:k})),An=kn&&k?D5(`review.mismatchReason`,{sessionTarget:jue(k),currentTarget:Mue({activeProject:t,activeProjectBranchState:n})}):null,jn=kn&&M===null,Mn=(0,p.useCallback)(async r=>{N(r.id);let i=r;if(e)try{let t=await zN(e,r.id);i=t,Ut(t)}catch(e){$.error(e instanceof Error?e.message:D5(`errors.loadSession`)),N(e=>e===r.id?null:e);return}if(i.target_available===!1){Dn(i.id,i);return}if(!K5({activeProject:t,activeProjectBranchState:n,session:i})&&b)try{if(!await b(i)){N(e=>e===i.id?null:e);return}}catch(e){$.error(e instanceof Error?e.message:D5(`errors.restoreTarget`)),N(e=>e===i.id?null:e);return}Dn(i.id,i)},[t,n,e,b,Dn,Ut]),Nn=(0,p.useCallback)(()=>{nt(e=>e+1)},[]),Pn=(0,p.useCallback)(async t=>{if(P){let n=st.current;return z(t),H5({projectId:e,tool:u,model:n.showModelSelector&&n.model||null,variant:n.showModelSelector&&n.model&&n.variant||null,mode:t}),Nn(),null}if(!e||!k||k.mode===t||De||dn)return null;Oe(!0);try{let n=await VN(e,k.id,{mode:t});return H5({projectId:e,tool:n.tool,model:n.model,variant:n.variant,mode:n.mode}),Ht(n),Ut(n),Nn(),n}catch(e){return $.error(e instanceof Error?e.message:D5(`errors.updateMode`)),null}finally{Oe(!1)}},[e,k,u,Nn,dn,P,De,Ht,Ut]),Fn=(0,p.useCallback)(async({instruction:t,attachments:n,targetSession:r,startedAt:i})=>{if(!e)return null;let a=st.current;Dt.current+=1;let o={parentType:`chat`,parentId:r.id,turnKey:`${r.id}:${Dt.current}`,startedAt:i};it(o);try{let i=await HN(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 H5({projectId:e,tool:i.tool,model:i.model,variant:i.variant,mode:i.mode}),ct.current=!1,Ht(i),O(i.id),F(!1),Ut(i),i}catch(e){throw it(e=>e?.turnKey===o.turnKey?null:e),e}},[e,Ht,Ut]),In=(0,p.useCallback)(async({fromStorageKey:t})=>{if(!e)return null;let n=st.current,r=lt.current,i=await RN(e,{mode:vn,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});ct.current=!1,F(!1),O(i.id),Ht(i),L(null);let a=w5({projectId:e,tool:i.tool,chatSessionId:i.id});return Zt({fromStorageKey:t,toStorageKey:a}),{session:i,storageKey:a}},[e,u,vn,Zt,Ht]),Ln=(0,p.useCallback)(async(t,n={})=>{let r=n.targetSession??k;if(!e||he||pe||Rt||r?.agent_status===`running`||bJ(r?.post_build_check)||r?.target_available===!1||jn||dn)return!1;let i=t.trim(),a=n.preserveComposerDraft===!0,o=a?[]:r?jt.current[r.id]??[]:[];if(!i&&o.length===0)return!1;ge(!0);let s=null,c=r,l=performance.now(),u=e&&r?w5({projectId:e,tool:r.tool,chatSessionId:r.id}):null,d=o;try{let t=r;if(!t){me(!0);let e=await In({fromStorageKey:Pt});s=e?.session??null,t=s,u=e?.storageKey??null,d=s?jt.current[s.id]??[]:[]}if(!t)return!1;a||qt(u??Pt);let n=Oue({session:t,instruction:i,attachments:d,createdAt:new Date().toISOString()});Ht(n),O(n.id),Ut(n);let o=await Fn({instruction:i,attachments:d,targetSession:t,startedAt:l});return a||qt(o&&e?w5({projectId:e,tool:o.tool,chatSessionId:o.id}):u),o&&!a&&Yt(o.id),!0}catch(e){a||Kt(u??Pt,i);let t=Ke(e,`chat_session`);if(t?(ct.current=!1,Ht(t),O(t.id),F(!1),Ut(t)):s?(Ht(s),O(s.id),F(!1),Ut(s)):c&&(Ht(c),Ut(c)),e instanceof Ge&&e.status===409&&!t){let e=s?.id??c?.id;e&&await en(e)}throw e}finally{me(!1),ge(!1)}},[e,k,Yt,qt,In,Pt,dn,pe,he,Rt,en,Ht,Fn,Kt,jn,Ut]),Rn=(0,p.useCallback)(async()=>{if(!(!k||!fX(k,dn)||mt.current)){mt.current=!0;try{let e=await Pn(`build`);if(!e)return;await Ln(dX,{preserveComposerDraft:!0,targetSession:e})}catch(e){$.error(e instanceof Error?e.message:D5(`errors.sendPrompt`))}finally{mt.current=!1}}},[k,Pn,dn,Ln]),zn=(0,p.useCallback)(e=>{ct.current=!0,F(!0),z(e),N(null),O(null),Ht(null),ve(null),it(null)},[Ht]),Bn=(0,p.useCallback)(async t=>{if(!e||t.length===0||It!==`opencode`&&It!==`claude`)return;let n=t.slice(0,j5);if(n.length===0)return;let r=null,i=k;try{if(i||=(me(!0),r=await In({fromStorageKey:Pt}),r?.session??null),!i)return;if((jt.current[i.id]??[]).length+n.length>j5){$.error(`You can attach up to 4 images per turn.`);return}Xt(i.id,1);let t=await WN(e,i.id,n),a=jt.current[i.id]??[];Jt(i.id,[...a,...t.attachments])}catch(t){if(r&&!Ft.trim())try{await GN(e,r.session.id),Gt(r.session.id),zn(r.session.mode)}catch{}$.error(t instanceof Error?t.message:D5(`errors.uploadAttachments`))}finally{i&&Xt(i.id,-1),me(!1)}},[e,k,In,Ft,Pt,Xt,zn,Gt,Jt,It]),Vn=(0,p.useCallback)(async t=>{if(!e||!k)return;let n=(jt.current[k.id]??[]).filter(e=>e.id!==t);try{await ire(e,k.id,t),Jt(k.id,n),n.length===0&&!Ft.trim()&&(k.messages?.length??0)===0&&(await GN(e,k.id),Gt(k.id),zn(k.mode))}catch(e){$.error(e instanceof Error?e.message:D5(`errors.removeAttachment`))}},[e,k,Ft,zn,Gt,Jt]),Hn=(0,p.useCallback)(e=>{if(It!==`opencode`&&It!==`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(),Bn(t))},[It,Bn]),Un=(0,p.useCallback)(async e=>{await Ln(e)},[Ln]),Wn=!!(e&&(P||k&&k.target_available!==!1&&!jn)),Gn=k?.agent_status===`running`,Kn=k?.agent_status===`stopped`,qn=Gn&&_e===k?.id,Jn=Wn&&!dn&&!Gn&&!j&&!he&&!pe&&!Rt,Yn=Wn?k?.target_available===!1?k.target_unavailable_reason??D5(`review.unavailableTarget`):jn?An??D5(`review.restoreTargetFallback`):dn?vC.t(`common:questionSet.waitForResolution`):Gn?D5(`review.waitTurn`):j?vC.t(`common:postBuildChecks.blockedReason`):Rt?D5(`review.waitUpload`):pe||he?D5(`review.waitPrompt`):null:D5(`review.missingTarget`),Xn=(0,p.useCallback)(async()=>{if(!(!e||!k||k.agent_status!==`running`||qn)){ve(k.id);try{await are(e,k.id)}catch(e){ve(e=>e===k.id?null:e),$.error(e instanceof Error?e.message:D5(`errors.interruptResponse`))}}},[e,k,qn]),Zn=(0,p.useCallback)(async()=>{if(!e||ye.length===0||xe.size>0)return;let t=Array.from(new Set(ye)),n=Ce||t.length>1;Se(new Set(t));let r=await Promise.allSettled(t.map(async t=>(await GN(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&&Wt(i),Se(new Set),a.length===0){be([]),n&&(we(!1),Ee(new Set),$.success(D5(`toasts.deleteSelectedSuccess`,{count:i.length})));return}let o=a.map(e=>e.sessionId);if(be(o),n&&Ee(new Set(o)),i.length>0){$.error(D5(`toasts.deleteSelectedPartial`,{count:i.length,deletedCount:i.length,failedCount:a.length}));return}$.error(a[0]?.message??D5(`errors.deleteSession`))},[e,ye,xe,Ce,Wt]),Qn=(0,p.useMemo)(()=>T.some(e=>!q5(e)),[T]),$n=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:e.agent_status===`stopped`?`interrupted`:!t&&at.has(e.id)?`finished`:null,[at]),er=(0,p.useCallback)((e,n)=>[e.title,xue(e.mode),v5(e.tool),t?.memory_enabled&&e.pending_memory_suggestion_count>0?P5(e.pending_memory_suggestion_count):null,n===`running`?D5(`sidebar.running`):n===`interrupted`?D5(`sidebar.interrupted`):n===`finished`?D5(`sidebar.finished`):null].filter(Boolean).join(` `),[t]),tr=(0,p.useCallback)(({session:e,isActive:r,activityState:i})=>{let a=Eue(e),o=Aue({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)(Rw,{tone:r?`default`:`muted`,className:`shrink-0`,"aria-label":P5(e.pending_memory_suggestion_count),title:P5(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??D5(`sidebar.targetUnavailable`)}):null]}),(0,X.jsx)(pb,{state:s,className:`mt-1`})]})},[t,n]),nr=(0,p.useMemo)(()=>({ariaLabel:D5(`sidebar.ariaLabel`),newSession:D5(`sidebar.newSession`),collapseAriaLabel:D5(`sidebar.collapseAriaLabel`),openAriaLabel:D5(`sidebar.openAriaLabel`),cancelSelection:D5(`sidebar.cancelSelection`),deleteSelected:D5(`sidebar.deleteSelected`),selectedCount:e=>D5(`sidebar.selectedCount`,{count:e}),select:D5(`sidebar.select`),loadingSessions:D5(`sidebar.loadingSessions`),noSessions:D5(`sidebar.noSessions`),deleteSessionAriaLabel:D5(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>D5(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>D5(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>D5(`sidebar.deleteSessionTitle`,{title:e})}),[]),rr=(0,p.useMemo)(()=>({title:D5(`deleteSessionModal.title`),bulkTitle:D5(`deleteSessionModal.bulkTitle`),description:D5(`deleteSessionModal.description`),bulkDescription:e=>D5(`deleteSessionModal.bulkDescription`,{count:e}),cancel:D5(`deleteSessionModal.cancel`),delete:D5(`deleteSessionModal.delete`),deleting:D5(`deleteSessionModal.deleting`)}),[]),ir=(0,p.useMemo)(()=>(0,X.jsx)(F5,{modifierLabel:xn,keys:[A5],ariaHidden:!0}),[xn]),ar=(0,p.useMemo)(()=>(0,X.jsx)(Cue,{label:D5(`shortcuts.startNewSession`),modifierLabel:xn,keys:[A5]}),[xn]),or=(0,p.useCallback)((e,t)=>{Ee(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)(()=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(cX,{value:vn,planInactiveTooltip:(0,X.jsx)(vX,{label:D5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(vX,{label:D5(`shortcuts.switchToBuild`)}),disabled:De||dn,onChange:e=>{Pn(e)}}),Gn?(0,X.jsx)($8,{isInterrupting:qn,onStop:()=>{Xn()},interruptLabel:D5(`review.interrupt`),interruptingLabel:D5(`review.interrupting`)}):null]}),[vn,Xn,Pn,dn,qn,Gn,De]),cr=(0,p.useMemo)(()=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(cX,{value:vn,planInactiveTooltip:(0,X.jsx)(vX,{label:D5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(vX,{label:D5(`shortcuts.switchToBuild`)}),disabled:De||dn,onChange:e=>{Pn(e)}}),k&&fX(k,dn)&&(0,X.jsx)(u5,{disabled:he||De,onClick:()=>void Rn()}),P&&t&&(0,X.jsx)(ob,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:vC.t(`common:projectTargetSelector.newChatAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l}),Gn&&(0,X.jsx)($8,{isInterrupting:qn,onStop:()=>{Xn()},interruptLabel:D5(`review.interrupt`),interruptingLabel:D5(`review.interrupting`)})]}),[t,n,k,vn,Xn,Pn,Rn,dn,P,qn,he,Gn,a,o,De,c,l,s,i,r]),lr=(0,p.useMemo)(()=>hn?(0,X.jsx)(LY,{model:te,variant:re,skills:ae,showModelSelector:!0,showSkillsSelector:K.length>0,availableModels:zt,availableSkills:K,selectedModel:_n,onModelChange:e=>{let t=zt.find(t=>t.id===e)??null;ne(e),ie(e=>t&&t.variants.includes(e)?e:``)},onVariantChange:ie,onSkillsChange:oe,modelSelectId:`project-chat-model-selector`,variantSelectId:`project-chat-variant-selector`,skillsSelectId:`project-chat-skills-selector`,disabled:he||pe||k?.agent_status===`running`}):gn?(0,X.jsx)(IY,{dataTestId:`chat-model-selector-skeleton`}):null,[k?.agent_status,zt,K,pe,he,_n,te,ae,re,hn,gn]);(0,p.useEffect)(()=>{if(x)return()=>{x(null)}},[x]),(0,p.useEffect)(()=>{if(x){if(!e||!Wn){x(null);return}x({chatSessionId:k?.id??null,canSubmitReviewPrompt:Jn,reviewSubmitDisabledReason:Yn,mode:vn,onModeChange:async e=>{await Pn(e)},isUpdatingMode:De,promptPlaceholder:N5(vn),promptComposerControls:sr,promptComposerInlineControls:lr,submitPrompt:Un})}},[e,k,Jn,vn,Pn,Un,Wn,De,x,sr,lr,Yn]);let ur=async()=>{if(!(!Ft.trim()&&Lt.length===0||Rt||dn||j))try{if(!await Ln(Ft))return}catch(e){$.error(e instanceof Error?e.message:D5(`errors.sendPrompt`))}},dr=e=>{e.key!==`Enter`||e.shiftKey||k?.agent_status===`running`||j||pe||he||Rt||dn||(e.preventDefault(),ur())};(0,p.useEffect)(()=>{let t=t=>{if(Sue(t)){if(!e||pe||he)return;t.preventDefault(),En(),Nn();return}hX(t)&&(!e||!P&&!k||(t.preventDefault(),Pn(mX(vn))))};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,k,vn,Nn,En,Pn,pe,P,he]);let fr=(0,p.useCallback)(async t=>{if(!(!e||!k)){Me(t);try{let n=await cre(e,k.id,t);Ht(n.chatSession),Ut(n.chatSession),$.success(D5(`ticketProposal.createdFromChat`,{count:n.created_tickets.length}))}catch(e){$.error(e instanceof Error?e.message:D5(`errors.createTickets`))}finally{Me(e=>e===t?null:e)}}},[e,k,Ht,Ut]),pr=(0,p.useCallback)(e=>e.ticket_proposals?(0,X.jsx)(Nue,{proposals:e.ticket_proposals,isApplying:je===e.id,onApply:()=>{fr(e.id)}}):null,[je,fr]),mr=(0,p.useCallback)(e=>{if(!ht.current)return;let t=ht.current.getBoundingClientRect().width,n=M5(e,t);Tt.current=n,_t.current&&(_t.current.style.setProperty(`--chat-changes-panel-width`,`${n}px`),_t.current.setAttribute(`data-desktop-width`,String(n)))},[]),gr=(0,p.useCallback)(()=>{bt.current?.(),bt.current=null},[]),_r=(0,p.useCallback)(e=>{let t=vt.current,n=yt.current,r=xt.current;if(t!==null){if(vt.current=null,yt.current=null,xt.current=!1,Ze(!1),Qe(!1),gr(),e!==null&&typeof gt.current?.hasPointerCapture==`function`&&gt.current.hasPointerCapture(e)&&typeof gt.current.releasePointerCapture==`function`&&gt.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;et(Tt.current),J(!0);return}et(Tt.current)}},[gr]),vr=(0,p.useCallback)((e,t)=>{if(vt.current!==e)return;let n=t-Ct.current,r=wt.current-n;if(yt.current===`collapsed`){if(!xt.current&&r<_ue)return;xt.current||(xt.current=!0,St.current=!0,Qe(!0),Ze(!0))}mr(r)},[mr]),yr=(0,p.useCallback)((e,t)=>{if(vt.current===e){if(t!==null&&(yt.current===`inline`||xt.current)){let e=t-Ct.current;mr(wt.current-e)}_r(e)}},[_r,mr]),br=(0,p.useCallback)(e=>{if(!C)return;e.preventDefault(),vt.current=e.pointerId,yt.current=Je?`inline`:`collapsed`,xt.current=!1,St.current=!1,Ct.current=e.clientX,wt.current=Je?Tt.current:0,Ze(Je),gr(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{vr(e.pointerId,e.clientX)},n=e=>{yr(e.pointerId,e.clientX)},r=e=>{yr(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),bt.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[yr,vr,Je,C,gr]),xr=(0,p.useCallback)(e=>{vr(e.pointerId,e.clientX)},[vr]),Sr=(0,p.useCallback)(e=>{yr(e.pointerId,e.clientX)},[yr]),Cr=(0,p.useCallback)(e=>{yr(e.pointerId,e.clientX)},[yr]),wr=(0,p.useCallback)(e=>{vt.current===e.pointerId&&_r(e.pointerId)},[_r]),Tr=(0,p.useCallback)(()=>{if(St.current){St.current=!1;return}J(!0)},[]),Er=(0,p.useCallback)(()=>{J(!1)},[]),Dr=(0,p.useCallback)(e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),Tr())},[Tr]);(0,p.useEffect)(()=>{C||(vt.current=null,yt.current=null,xt.current=!1,St.current=!1,Ze(!1),Qe(!1),gr())},[C,gr]),(0,p.useEffect)(()=>()=>{gr()},[gr]);let Or=!!D,kr=k?.target_available===!1,Ar=kr?k?.target_unavailable_reason??D5(`review.unavailableTarget`):null,jr=P||!!(k&&k.target_available!==!1&&!jn),Mr=!!(t?.memory_enabled&&k&&(Pe.length>0||Ie)),Nr=C&&(P||Or)&&!kr&&!jn,Pr=Nr&&!Je&&!Y,Fr=Nr&&(Je||Y),Ir=`${Tn??`none`}:${Nr?`changes-enabled`:`changes-disabled`}:${Fr?`panel-visible`:`panel-hidden`}`,Lr=(0,p.useCallback)(e=>{ut.current=null,Kt(Pt,e)},[Pt,Kt]),Rr=k||P?(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(l5,{projectId:e,agentRunParentType:k?`chat`:null,agentRunParentId:k?.id??null,messages:k?ln:[],internalLog:k?.agent_log??null,currentThinkingMessageId:k?.agent_message_id??null,previousThinkingLog:k?.previous_agent_log??null,previousThinkingMessageId:k?.previous_agent_message_id??null,pendingAgentTitle:cn,streamingResponse:k?.streaming_response??null,isRunning:k?.agent_status===`running`,isLoading:!P&&de,canShowComposer:jr,cardClassName:`border-t-0`,isExternallyResizing:S||Xe,pendingAgentRevealKey:mn,pendingAgentRevealDelayMs:bue,liveResponseTiming:rt,composerFocusNonce:tt,header:(0,X.jsx)(d5,{title:yn,tool:P?null:k?.tool??null,modelLabel:wn,interrupted:Kn,interruptedLabel:D5(`sidebar.interrupted`),usage:{totalTokens:k?.usage_snapshot_total_tokens??null,contextWindow:k?.usage_snapshot_context_window??null,cost:k?.usage_snapshot_cost??null,tool:bn,model:Sn,availableModels:zt},metadataExtra:(0,X.jsxs)(X.Fragment,{children:[k?.external_source?(0,X.jsx)(sI,{externalSource:k.external_source}):null,k?.origin_spec_session_id&&k.origin_spec_snapshot_id&&v?(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:()=>{v(k.origin_spec_session_id,k.origin_spec_snapshot_id)},children:vC.t(`common:specView.provenance.viewSourceSpec`)}):null]}),actions:k&&e?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Mr&&(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>ze(!0),children:Ie?D5(`composer.loadingMemory`):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:D5(`composer.memorySuggestions`)}),(0,X.jsx)(Rw,{children:Pe.length})]})}),(0,X.jsx)(L3,{projectId:e,scope:{type:`chat`,id:k.id},size:`xs`,onNavigateToLifecycleSource:y})]}):null,warnings:jn&&An?(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:An}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{On()},children:D5(`composer.switchBack`)}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:En,children:D5(`composer.startNewSession`)})]})]})}):kr&&Ar?(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:Ar}):null}),composerControls:cr,composerInlineControls:lr,composerTheme:vn,layoutKey:Tn,scrollLayoutKey:Ir,followUpPrompt:Ft,draftAttachments:Lt,followUpPlaceholder:N5(vn),emptyStateText:null,renderMessageFooter:pr,renderMessageBody:pn,isSendingFollowUp:he||pe,isComposerSubmitDisabled:dn||j,postBuildCheck:k?.post_build_check,isUploadingAttachments:Rt,canAttachImages:Cn,followUpDisabledReason:kr?Ar??void 0:k?.agent_status===`running`?D5(`review.waitTurnShort`):j?vC.t(`common:postBuildChecks.blockedReason`):Rt?D5(`review.waitUpload`):dn?vC.t(`common:questionSet.waitForResolution`):void 0,onFollowUpPromptChange:Lr,onFollowUpKeyDown:dr,onFollowUpPaste:Hn,onUploadAttachments:e=>{Bn(e)},onRemoveAttachment:e=>{Vn(e)},onFollowUpSubmit:()=>{ur()}})}):Or?(0,X.jsx)(Y8,{label:D5(`composer.loadingSession`)}):!le||se?(0,X.jsx)(X8,{label:D5(`sidebar.loadingSessions`)}):(0,X.jsx)(Z8,{title:D5(`composer.noSessionSelectedTitle`),description:D5(`composer.noSessionSelectedDescription`),startNewSessionLabel:D5(`composer.startNewSession`),onStartNewSession:En,canStartNewSession:!!e&&!pe&&!he}),zr=Nr?(0,X.jsx)(`div`,{ref:gt,"aria-label":D5(Pr?`composer.openDiff`:`composer.resizeDiffPanel`),"aria-orientation":Pr?void 0:`vertical`,className:Z(Pr?`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`,Xe&&!Pr&&`bg-background`),"data-testid":Pr?`collapsed-changes-rail`:void 0,onLostPointerCapture:wr,onPointerCancel:Cr,onPointerDown:br,onPointerMove:xr,onPointerUp:Sr,onClick:Pr?Tr:void 0,onKeyDown:Pr?Dr:void 0,role:Pr?`button`:`separator`,tabIndex:Pr?0:void 0,children:Pr?(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)(Iv,{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)(Iv,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:D5(`composer.diff`)})]})]}):(0,X.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,Xe?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})}):null,Br=Re&&e&&t?.memory_enabled?(0,X.jsx)(hC,{onClose:()=>ze(!1),overlayClassName:`bg-background/45 p-4 backdrop-blur-sm`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,X.jsxs)(bC,{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)(xC,{className:`border-b border-border/80 pb-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(SC,{children:D5(`composer.memorySuggestionsTitle`)}),(0,X.jsx)(CC,{children:D5(`composer.memorySuggestionsDescription`)})]}),(0,X.jsx)(wC,{children:t})]}),(0,X.jsx)(TC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,X.jsx)(f5,{projectId:e,suggestions:Pe,emptyState:D5(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:nn})})]}),closeButtonLabel:D5(`composer.closeMemorySuggestions`)}):null,Vr=on.length>0?(0,X.jsx)(J8,{count:on.length,title:sn,isDeleting:xe.size>0,onConfirm:()=>{Zn()},onCancel:()=>{xe.size>0||be([])},labels:rr}):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)(Q8,{sessions:T,sessionGroups:an,activeSessionId:D,isDraftOpen:P,isLoadingSessions:se,isOpen:We,onToggleOpen:()=>{qe(e=>!e)},testId:`chat-sessions-sidebar`,railTestId:`chat-sessions-rail`,onDraftOpen:En,isCreatingSession:pe||!e,isSendingPrompt:he,newSessionShortcutHint:ir,newSessionTooltip:ar,isSelectionMode:Ce,selectedSessionIds:Te,selectedSessionCount:Te.size,hasDeletableSessions:Qn,deletingSessionIds:xe,onEnterSelectionMode:()=>{we(!0),Ee(new Set)},onExitSelectionMode:()=>{we(!1),Ee(new Set)},onToggleSessionSelection:e=>{Ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:or,onConfirmDeleteSelectedSessions:()=>{be(Array.from(Te))},onSessionSelect:e=>{Mn(e)},onConfirmDeleteSession:e=>{be([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:q5,getActivityState:$n,getRowAriaLabel:er,renderRowContent:tr,labels:nr}),(0,X.jsxs)(`div`,{ref:ht,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:Rr}),Nr?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ov,{content:D5(`composer.openDiff`),disabled:!Pr,side:`left`,children:zr}),Fr?(0,X.jsx)(c5,{projectId:e,chatSessionId:P?null:D,canSubmitReviewPrompt:Jn,reviewSubmitDisabledReason:Yn,onSubmitReviewPrompt:Un,state:He,onStateChange:Ue,isResizing:Xe,onClose:Er,desktopWidth:$e,panelElementRef:_t}):null]}):null]}),Br,Vr]})},Fue=({className:e})=>(0,X.jsx)(Mg,{"aria-hidden":`true`,className:e}),Iue=({activeProject:e,onNavigateToSource:t})=>{let{t:n}=He(`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)($T,{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`)})},Lue=(e,t,n,r)=>Y(qe(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{method:`POST`,body:r,fallbackErrorMessage:`Unable to start the spec review right now.`}),Rue=(e,t,n)=>Y(qe(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the spec review right now.`}),J5=(e,t,n,r)=>Y(qe(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{signal:r,fallbackErrorMessage:`Unable to load the spec review right now.`}),zue=(e,t,n,r)=>Y(qe(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review-runs/${r}/revision-draft`),{method:`POST`,fallbackErrorMessage:`Unable to build the revision draft right now.`}),Bue=(e,t)=>!!t&&e===t,Vue=({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]}),Hue=({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]}),Y5=({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&&$E(s.current)},[a]),!t)return(0,X.jsx)(Hue,{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)(bb,{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)(Vue,{suggestion:e,isRecommended:Bue(e.id,l),recommendedLabel:i.recommendedSuggestionLabel,onPick:u},e.id))})]}):null,(0,X.jsx)(nv,{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})})]})},Uue=({className:e})=>(0,X.jsx)(hg,{"aria-hidden":`true`,className:e}),Wue=[`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(` `),Gue=[`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(` `),X5=({on:e,disabled:t=!1,onToggle:n,tooltipContent:r,ariaLabelOn:i,ariaLabelOff:a,className:o})=>(0,X.jsx)(Ov,{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?Wue:Gue,o),onClick:()=>{t||n(!e)},children:(0,X.jsx)(Uue,{className:`h-5 w-5`})})})}),Kue=({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:B,onUploadAttachments:V,onRemoveAttachment:H,onFollowUpSubmit:U})=>(0,X.jsx)(aY,{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:B,onUploadAttachments:V,onRemoveAttachment:H,onFollowUpSubmit:U}),Z5=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},Q5=({className:e})=>(0,X.jsx)(Wg,{"aria-hidden":`true`,className:e}),que=({className:e})=>(0,X.jsx)(tg,{"aria-hidden":`true`,className:e}),$5=({className:e})=>(0,X.jsx)(cg,{"aria-hidden":`true`,className:e}),e7=({heading:e,open:t,onOpenChange:n,children:r})=>(0,X.jsxs)(RC,{open:t,onOpenChange:n,children:[(0,X.jsx)(zC,{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)(Av,{className:`h-3 w-3 shrink-0 transition-transform ${t?``:`-rotate-90`}`}),e]})}),(0,X.jsx)(BC,{children:r})]}),Jue=({actions:e})=>{let{t}=He(`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)(xb,{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.isCreatingTickets||e.isImplementingInChat||e.isExporting,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)(Q5,{className:`h-3.5 w-3.5`}),e.isCreatingTickets?t(`specView.actions.creatingTickets`):t(`specView.actions.createTickets`)]})},t7={high:0,medium:1,low:2},Yue=e=>[...e].sort((e,t)=>{let n=t7[e.severity]??99,r=t7[t.severity]??99;return n===r?e.ordinal-t.ordinal:n-r}),Xue=e=>{let t={high:0,medium:0,low:0};for(let n of e)t[n.severity]+=1;return t},Zue=({run:e})=>{let{t}=He(`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})},Que=({review:e})=>{let{t}=He(`common`),[n,r]=(0,p.useState)(!0),i=e.review?.run??null,a=e.review?.findings??[],o=Yue(a),s=Xue(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?b5({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)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)($5,{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)(Zue,{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 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:`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)(Vv,{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.isSendingToPlanner,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(HE,{className:`h-3.5 w-3.5`}),e.isSendingToPlanner?t(`specView.review.sendingToPlanner`):t(`specView.review.sendToPlanner`)]})})]})})},$ue=({review:e})=>{let{t}=He(`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)(gv,{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,"aria-label":o,className:`gap-1.5 text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)($5,{className:`h-4 w-4`}),t(`specView.review.heading`)]})}),(0,X.jsx)(vv,{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)(Ev,{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)($5,{className:`h-3.5 w-3.5`}),t(`specView.review.launchAction`)]})]})})]})},ede=(0,p.memo)((0,p.forwardRef)(({snapshot:e,isLoading:t,desktopWidth:n,onClose:r,actions:i,review:a,className:o},s)=>{let{t:c}=He(`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=(0,p.useCallback)(e=>{u(e)},[]),j=(0,p.useCallback)(()=>{f(!0)},[]),M=`flex shrink-0 flex-col border-l border-border/70 bg-surface ${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)] ${M}`:M,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)(cC,{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)] ${M}`:M,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)(cC,{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 N=e.likely_files.length>0,P=!!e.file_relation_graph,F=e.tickets.length>0,I=e.dependencies.length>0,L=e.open_questions.length>0,R=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)] ${M}`:M,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)($ue,{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)(cC,{className:`h-4 w-4`})})]})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4`,children:[a&&(a.review?.run||a.isRunning)&&(0,X.jsx)(Que,{review:a}),(0,X.jsx)(e7,{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)(e7,{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)(jG,{mermaid:e.mermaid,onClick:()=>{A(e.mermaid)}})})}),e.mockup&&(0,X.jsx)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(que,{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)(IG,{html:e.mockup,onClick:j})})}),(N||P)&&(0,X.jsx)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Fv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.likelyFiles`)]}),open:b,onOpenChange:x,children:(0,X.jsxs)(`section`,{children:[N&&(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:e.likely_files.map((e,t)=>(0,X.jsxs)(`li`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`min-w-0 break-all text-xs text-foreground`,children:e.path}),e.is_new&&(0,X.jsx)(yC,{variant:`success`,className:`shrink-0 px-1.5 py-0 text-[10px]`,children:c(`specView.artifactPanel.newFile`)})]}),e.reason&&(0,X.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.reason})]},t))}),P&&(0,X.jsxs)(`div`,{className:`mt-3`,children:[(0,X.jsx)(`p`,{className:`mb-1.5 text-[0.65rem] font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`specView.artifactPanel.fileRelationGraph`)}),(0,X.jsx)(`div`,{className:`overflow-auto rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,X.jsx)(jG,{mermaid:e.file_relation_graph,onClick:()=>{A(e.file_relation_graph)}})})]})]})}),F&&(0,X.jsx)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Q5,{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,t)=>(0,X.jsxs)(`li`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.title}),e.key&&(0,X.jsx)(`div`,{className:`mt-0.5 text-xs text-violet-400`,children:e.key})]},t))})})}),I&&(0,X.jsx)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(bw,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.dependencies`)]}),open:w,onOpenChange:T,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 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.blocker_key}),(0,X.jsx)(`span`,{children:`→`}),(0,X.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.dependent_key})]},t))})})}),L&&(0,X.jsx)(e7,{heading:c(`specView.artifactPanel.openQuestions`),open:E,onOpenChange:D,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`,{children:e})]},t))})})}),R&&(0,X.jsx)(e7,{heading:c(`specView.artifactPanel.assumptions`),open:O,onOpenChange:k,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`,{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)(Jue,{actions:i}),(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onImplementInChat,disabled:i.isCreatingTickets||i.isImplementingInChat||i.isExporting,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(HE,{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.isCreatingTickets||i.isImplementingInChat||i.isExporting,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(Cb,{className:`h-3.5 w-3.5`}),i.isExporting?c(`specView.actions.exportingSpec`):c(`specView.actions.exportSpec`)]})]}),l&&(0,X.jsx)(NG,{mermaid:l,open:!0,onClose:()=>{u(null)}}),e.mockup&&(0,X.jsx)(LG,{html:e.mockup,open:d,onClose:()=>{f(!1)}})]})})),n7=({className:e})=>(0,X.jsx)(gg,{"aria-hidden":`true`,className:e}),r7=(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},i7=(e,t)=>vC.t(`specView.${e}`,t),a7=e=>i7(`pendingMemorySuggestions`,{count:e}),tde=1500,o7=`archon.spec-draft`,s7=`archon.spec-run-config`,c7=`archon.spec-review-run-config`,l7=`archon.spec-session-list-layout`,u7=`archon.spec-artifact-panel-layout`,nde=`archon.spec-import-notice`,d7=420,f7=320,p7=.5,m7=6,h7=`/`,rde=`Slash`,ide=`NumpadDivide`,ade=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===h7||e.code===rde||e.code===ide),g7=({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)(lX,{"aria-hidden":n,children:e}),t.map(e=>(0,X.jsxs)(`span`,{className:`contents`,children:[(0,X.jsx)(`span`,{children:`+`}),(0,X.jsx)(lX,{"aria-hidden":n,children:e})]},e))]}),ode=({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)(g7,{modifierLabel:t,keys:n,ariaHidden:!0})]}),_7=({projectId:e,tool:t,sessionId:n=null})=>e?n?`${o7}/${e}/sessions/${n}`:`${o7}/${e}/draft/${t}`:null,v7=({projectId:e,sessionId:t})=>e&&t?`${nde}/${e}/${t}`:null,y7=({projectId:e,tool:t})=>{if(e)try{localStorage.setItem(`${o7}/${e}/tool`,t)}catch{}},b7=e=>{if(!e)return{isOpen:!0};try{let t=localStorage.getItem(`${l7}/${e}`);return{isOpen:(t?JSON.parse(t):null)?.isOpen??!0}}catch{return{isOpen:!0}}},sde=({projectId:e,isOpen:t})=>{if(e)try{localStorage.setItem(`${l7}/${e}`,JSON.stringify({isOpen:t}))}catch{}},cde=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):d7;if(!Number.isFinite(t))return Math.max(f7,n);let r=Math.max(f7,Math.round(t*p7));return Math.max(f7,Math.min(r,n))},x7=e=>{if(!e)return{isOpen:!1,width:d7};try{let t=localStorage.getItem(`${u7}/${e}`);if(!t)return{isOpen:!1,width:d7};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(f7,Math.round(n.width)):d7;return{isOpen:n.isOpen===!0,width:r}}catch{return{isOpen:!1,width:d7}}},lde=({projectId:e,isOpen:t,width:n})=>{if(e)try{localStorage.setItem(`${u7}/${e}`,JSON.stringify({isOpen:t,width:n}))}catch{}},ude=e=>{if(!e)return null;try{return localStorage.getItem(e)}catch{return null}},S7=({storageKey:e,value:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,t)}catch{}},dde=e=>{if(!e)return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},C7=({storageKey:e,notice:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(t))}catch{}},fde=e=>{if(!e)return null;let t=e.skipped.reduce((e,t)=>e+t.count,0),n=e.skipped.map(e=>i7(`importNotice.skipReasons.${e.code}`,{count:e.count})).join(`, `);return e.imported_count>0&&t>0?i7(`importNotice.importedWithSkips`,{importedCount:e.imported_count,skippedCount:t,skippedSummary:n}):e.imported_count>0?i7(`importNotice.importedOnly`,{importedCount:e.imported_count}):t>0?i7(`importNotice.skippedOnly`,{skippedCount:t,skippedSummary:n}):null},w7=({keyPrefix:e,projectId:t,tool:n})=>`${e}:${t}:${n}`,T7=({keyPrefix:e,projectId:t,tool:n})=>{if(!t||n!==`opencode`&&n!==`claude`)return null;try{let r=window.localStorage.getItem(w7({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}:null}catch{return null}},E7=({keyPrefix:e,projectId:t,tool:n,model:r,variant:i})=>{if(!(!t||n!==`opencode`&&n!==`claude`||!r))try{window.localStorage.setItem(w7({keyPrefix:e,projectId:t,tool:n}),JSON.stringify({model:r,variant:r?i:null}))}catch{}},pde=({projectId:e,tool:t})=>T7({keyPrefix:s7,projectId:e,tool:t}),mde=({projectId:e,tool:t,model:n,variant:r})=>E7({keyPrefix:s7,projectId:e,tool:t,model:n,variant:r}),hde=({projectId:e,tool:t})=>T7({keyPrefix:c7,projectId:e,tool:t}),gde=({projectId:e,tool:t,model:n,variant:r})=>E7({keyPrefix:c7,projectId:e,tool:t,model:n,variant:r}),_de=`archon.spec-draft-grill`,D7=e=>e?`${_de}/${e}`:null,O7=e=>{let t=D7(e);if(!t)return!1;try{return window.localStorage.getItem(t)===`true`}catch{return!1}},k7=({projectId:e,grillOn:t})=>{let n=D7(e);if(n)try{t?window.localStorage.setItem(n,`true`):window.localStorage.removeItem(n)}catch{}},vde=({activeProjectId:e,activeProject:t=null,activeTool:n,initialSpecSessionId:r=null,initialSpecSnapshotId:i=null,initialIssueDraft:a=null,onInitialSpecNavigationConsumed:o,onInitialIssueDraftConsumed:s,onImplementInChat:c,onNavigateToLifecycleSource:l})=>{let u=Aq(),{t:d}=He(`common`),{jiraImportState:f,prepareSpecImportFromJira:m}=Ew(e),{gitHubImportState:h,prepareSpecImportFromGitHub:g}=QC(e),[_,v]=(0,p.useState)([]),[y,b]=(0,p.useState)(null),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)({}),[j,M]=(0,p.useState)({}),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)({}),[L,R]=(0,p.useState)({}),[z,B]=(0,p.useState)([]),[V,H]=(0,p.useState)(``),[U,W]=(0,p.useState)(``),[G,K]=(0,p.useState)([]),[ee,te]=(0,p.useState)(!1),[ne,re]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(!1),[oe,se]=(0,p.useState)(!1),[ce,le]=(0,p.useState)(!1),[ue,de]=(0,p.useState)(null),[fe,pe]=(0,p.useState)([]),[me,he]=(0,p.useState)(()=>new Set),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(()=>new Set),[be,xe]=(0,p.useState)(!1),[Se,Ce]=(0,p.useState)(()=>b7(e).isOpen),[we,Te]=(0,p.useState)(0),[Ee,De]=(0,p.useState)(null),[Oe,ke]=(0,p.useState)(()=>new Set),[Ae,je]=(0,p.useState)(null),[Me,Ne]=(0,p.useState)(null),[q,Pe]=(0,p.useState)(!1),[Fe,Ie]=(0,p.useState)(()=>x7(e).isOpen),[Le,Re]=(0,p.useState)(()=>x7(e).width),[ze,Be]=(0,p.useState)(!1),[Ve,Ue]=(0,p.useState)(!1),[We,qe]=(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)(null),[tt,nt]=(0,p.useState)(()=>O7(e)),[rt,it]=(0,p.useState)(!1),[at,ot]=(0,p.useState)([]),[st,ct]=(0,p.useState)(!1),[lt,ut]=(0,p.useState)(!1),[dt,ft]=(0,p.useState)(0),[pt,mt]=(0,p.useState)(null),[ht,gt]=(0,p.useState)(!1),[_t,vt]=(0,p.useState)(!1),[yt,bt]=(0,p.useState)(!1),[xt,St]=(0,p.useState)(!1),[Ct,wt]=(0,p.useState)(``),[Tt,Et]=(0,p.useState)(``),Dt=(0,p.useRef)(null),Ot=(0,p.useRef)(null),kt=(0,p.useRef)(null),At=(0,p.useRef)(null),jt=(0,p.useRef)(null),Mt=(0,p.useRef)(null),Nt=(0,p.useRef)(!1),Pt=(0,p.useRef)(!1),Ft=(0,p.useRef)(0),It=(0,p.useRef)(d7),Lt=(0,p.useRef)(d7),Rt=(0,p.useRef)(null),zt=(0,p.useRef)(0),Bt=(0,p.useRef)(0),Vt=(0,p.useRef)(!1),Ht=(0,p.useRef)(!1),Ut=(0,p.useRef)(!1),Wt=(0,p.useRef)({}),Gt=(0,p.useRef)({}),Kt=(0,p.useRef)({}),qt=(0,p.useRef)(new Set),Jt=(0,p.useRef)(new Set),Yt=(0,p.useRef)(0),Xt=(0,p.useRef)({id:null,status:null}),Zt=(0,p.useRef)(new Map),Qt=(0,p.useRef)(!1),$t=(0,p.useRef)(!1),en=e?_7({projectId:e,tool:T?n:x?.tool??n,sessionId:x?.id??null}):null,tn=v7({projectId:e,sessionId:x?.id??null}),nn=en?k[en]??``:``,rn=x?j[tn??``]??null:N,an=T?n:x?.tool??n,on=(0,p.useMemo)(()=>x?F[x.id]??[]:[],[x,F]),sn=(0,p.useMemo)(()=>x?L[x.id]??0:0,[x,L])>0,{models:cn,isLoading:ln}=OF(an);(0,p.useEffect)(()=>{Vt.current=T},[T]),(0,p.useEffect)(()=>{Wt.current=k},[k]),(0,p.useEffect)(()=>{Gt.current=j},[j]),(0,p.useEffect)(()=>{Kt.current=F},[F]),(0,p.useEffect)(()=>{if(!en||qt.current.has(en))return;qt.current.add(en);let e=ude(en);e&&A(t=>Object.prototype.hasOwnProperty.call(t,en)?t:{...t,[en]:e})},[en]),(0,p.useEffect)(()=>{if(!tn||Jt.current.has(tn))return;Jt.current.add(tn);let e=dde(tn);e&&M(t=>({...t,[tn]:e}))},[tn]),(0,p.useEffect)(()=>{!en||!Object.prototype.hasOwnProperty.call(k,en)||S7({storageKey:en,value:k[en]??``})},[en,k]),(0,p.useEffect)(()=>{!tn||!Object.prototype.hasOwnProperty.call(j,tn)||C7({storageKey:tn,notice:j[tn]??null})},[tn,j]),(0,p.useEffect)(()=>{Rt.current=y},[y]),(0,p.useEffect)(()=>{let t=Me??x?.latest_snapshot_id;if(!x?.id||!t||!e){je(null),Qe(!1),Ie(!1);return}let n=!1;return Pe(!0),gre(e,x.id,t).then(e=>{n||(je(e),Qe((e.created_ticket_ids?.length??0)>0),Ie(!0))}).catch(()=>{n||(je(null),Qe(!1))}).finally(()=>{n||Pe(!1)}),()=>{n=!0}},[x?.latest_snapshot_id,x?.id,e,Me]);let un=Ae?.id??null,dn=x?.id??null;(0,p.useEffect)(()=>{if(!e||!dn||!un){mt(null);return}let t=!1;return gt(!0),J5(e,dn,un).then(e=>{t||mt(e)}).catch(()=>{t||mt(null)}).finally(()=>{t||gt(!1)}),()=>{t=!0}},[e,dn,un]);let fn=(0,p.useCallback)(()=>{!e||!dn||!un||J5(e,dn,un).then(mt).catch(()=>{})},[e,dn,un]);(0,p.useEffect)(()=>{lde({projectId:e,isOpen:Fe,width:Le})},[e,Fe,Le]),(0,p.useEffect)(()=>{if(!(!r||_.length===0)){if(!_.some(e=>e.id===r)){$.error(i7(`errors.initialSessionMissing`)),Ht.current=!0,o?.();return}if(y===r){Ne(i??null),o?.();return}de(null),b(r),Ne(i??null),E(!1),Ht.current=!0,o?.()}},[r,i,_,y,o]),(0,p.useEffect)(()=>{ze||(Lt.current=Le,kt.current&&(kt.current.style.setProperty(`--spec-artifact-panel-width`,`${Le}px`),kt.current.setAttribute(`data-desktop-width`,String(Le))))},[Le,ze]);let pn=(0,p.useCallback)(async t=>{if(!e){v([]),te(!1);return}te(!ne);try{let n=await KN(e,t);if(t?.aborted)return;v(h5(n)),re(!0);let r=new Set(n.map(e=>e.id));ke(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:i7(`errors.loadSessions`))}finally{t?.aborted||te(!1)}},[e,ne]);(0,p.useEffect)(()=>{let e=Zt.current,t=new Map,n=[];for(let r of _){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&(a===`done`||a===`error`)&&r.id!==y&&n.push(r),t.set(r.id,a)}Zt.current=t,ke(e=>{let t=new Set(e),r=!1,i=new Set(_.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of _){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===y||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,y,_]);let mn=(0,p.useCallback)(async(t,n)=>{if(!e)return;ae(!0);let r=zt.current+1;zt.current=r;let i=Bt.current;try{let a=await JN(e,t,n);if(n?.aborted)return;let o=Bt.current!==i,s=zt.current===r,c=Rt.current===t&&!Vt.current;if(!s||o||!c)return;S(a)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.loadSession`))}finally{n?.aborted||ae(!1)}},[e]),hn=(0,p.useCallback)(e=>{v(t=>{let n=t.findIndex(t=>t.id===e.id);if(n===-1)return h5([...t,Z5(e)]);let r=t.slice();return r[n]=Z5(e),h5(r)})},[]),gn=(0,p.useCallback)((e,t)=>{v(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}),S(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:{...n,pending_memory_suggestion_count:t})},[]),_n=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){ot([]),ct(!1);return}ct(!0);try{let t=await hr(e,null,r,void 0,n);if(r?.aborted)return;ot(t.suggestions),gn(n,t.suggestions.length)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.loadMemorySuggestions`))}finally{r?.aborted||ct(!1)}},[t?.memory_enabled,e,gn]),vn=(0,p.useCallback)(e=>{ot(t=>{let n=t.filter(t=>t.id!==e);return y&&gn(y,n.length),n}),ft(e=>e+1),pn(),y&&mn(y)},[y,mn,pn,gn]),yn=(0,p.useCallback)(t=>t.project_id===e,[e]),bn=(0,p.useCallback)(()=>({tool:n,mode:tt?`grill`:`standard`,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[]}),[n,tt,cn.length,V,U,z.length,G]),xn=(0,p.useCallback)(()=>{oe||ce||(Rt.current=null,E(!0),b(null),Ne(null),S(null),P(null))},[oe,ce]),Sn=(0,p.useMemo)(()=>pX(),[]),Cn=(0,p.useMemo)(()=>(0,X.jsx)(g7,{modifierLabel:Sn,keys:[h7],ariaHidden:!0}),[Sn]),wn=(0,p.useMemo)(()=>(0,X.jsx)(ode,{label:i7(`sidebar.newSessionTooltip`),modifierLabel:Sn,keys:[h7]}),[Sn]);(0,p.useEffect)(()=>{let t=t=>{if(ade(t)){if(!e||oe||ce)return;t.preventDefault(),xn(),Te(e=>e+1);return}};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,oe,ce,xn]);let Tn=(0,p.useCallback)(e=>{ce||(de(null),b(e.id),Ne(null),E(!1),O(null),P(null),Yt.current+=1)},[ce]),En=(0,p.useCallback)(async t=>{if(e){de(t);try{await mre(e,t)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.stopSession`))}}},[e]),Dn=(0,p.useCallback)(async()=>{if(!(!e||!x||!Ae)){qe(!0);try{let t=await vre(e,x.id,Ae.id);Qe(!0),$.success(i7(`actions.createTicketsSuccess`,{count:t.tickets.length})),pn()}catch(e){if(Ye(e))return;if(e.status===409){Qe(!0);return}$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{qe(!1)}}},[e,x,Ae,pn]),On=(0,p.useCallback)(()=>{Dn()},[Dn]),kn=(0,p.useCallback)(async()=>{if(!(!e||!x||!Ae)&&c){J(!0);try{let t=await yre(e,x.id,Ae.id);c(t.draft_text,t.spec_session_id,t.spec_snapshot_id)}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{J(!1)}}},[e,x,Ae,c]),An=(0,p.useCallback)(async t=>{let n=t?.projectId??e,r=t?.sessionId??x?.id,i=t?.snapshotId??Ae?.id;if(!(!n||!r||!i)){Ze(!0);try{await _re(n,r,i,{overwrite:t?.overwrite}),et(null),$.success(i7(`actions.exportSuccess`))}catch(e){if(Ye(e))return;if(e instanceof XN){et({path:e.conflictingPath,projectId:n,sessionId:r,snapshotId:i});return}$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{Ze(!1)}}},[e,x,Ae]),jn=(0,p.useCallback)(()=>{Mt.current?.(),Mt.current=null},[]),Mn=(0,p.useCallback)(e=>{if(!Dt.current)return;let t=Dt.current.getBoundingClientRect().width,n=cde(e,t);Lt.current=n,kt.current&&(kt.current.style.setProperty(`--spec-artifact-panel-width`,`${n}px`),kt.current.setAttribute(`data-desktop-width`,String(n)))},[]),Nn=(0,p.useCallback)(e=>{let t=At.current,n=jt.current,r=Nt.current;if(t!==null){if(At.current=null,jt.current=null,Nt.current=!1,Be(!1),Ue(!1),jn(),e!==null&&typeof Ot.current?.hasPointerCapture==`function`&&Ot.current.hasPointerCapture(e)&&typeof Ot.current.releasePointerCapture==`function`&&Ot.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;Re(Lt.current),Ie(!0);return}Re(Lt.current)}},[jn]),Pn=(0,p.useCallback)((e,t)=>{if(At.current!==e)return;let n=t-Ft.current,r=It.current-n;if(jt.current===`collapsed`){if(!Nt.current&&r<m7)return;Nt.current||(Nt.current=!0,Pt.current=!0,Ue(!0),Be(!0))}Mn(r)},[Mn]),Fn=(0,p.useCallback)((e,t)=>{if(At.current===e){if(t!==null&&(jt.current===`inline`||Nt.current)){let e=t-Ft.current;Mn(It.current-e)}Nn(e)}},[Nn,Mn]),In=(0,p.useCallback)(e=>{e.preventDefault(),At.current=e.pointerId,jt.current=Fe?`inline`:`collapsed`,Nt.current=!1,Pt.current=!1,Ft.current=e.clientX,It.current=Fe?Lt.current:0,Be(Fe),jn(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{Pn(e.pointerId,e.clientX)},n=e=>{Fn(e.pointerId,e.clientX)},r=e=>{Fn(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Mt.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[Fn,Pn,Fe,jn]),Ln=(0,p.useCallback)(e=>{Pn(e.pointerId,e.clientX)},[Pn]),Rn=(0,p.useCallback)(e=>{Fn(e.pointerId,e.clientX)},[Fn]),zn=(0,p.useCallback)(e=>{Fn(e.pointerId,e.clientX)},[Fn]),Bn=(0,p.useCallback)(e=>{At.current===e.pointerId&&Nn(e.pointerId)},[Nn]),Vn=(0,p.useCallback)(()=>{Ie(!1)},[]),Hn=(0,p.useCallback)(async()=>{if(!e||fe.length===0)return;let t=fe;he(e=>{let n=new Set(e);for(let e of t)n.add(e);return n});let n=[];for(let r of t)try{await hre(e,r)}catch(e){Ye(e)||n.push(e instanceof Error?e.message:i7(`errors.deleteSession`))}if(he(e=>{let n=new Set(e);for(let e of t)n.delete(e);return n}),pe([]),n.length>0){$.error(n.join(`
274
- `));return}ge&&(_e(!1),ye(new Set),$.success(i7(`specView.toasts.deleteSelectedSuccess`,{count:t.length})))},[e,fe,ge]),Un=(0,p.useCallback)(t=>{let r=new Set(t),i=Rt.current;for(let t of r)S7({storageKey:_7({projectId:e,tool:n,sessionId:t}),value:``}),C7({storageKey:v7({projectId:e,sessionId:t}),notice:null});I(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}),M(t=>{let n={...t},i=!1;for(let t of r){let r=v7({projectId:e,sessionId:t});r&&Object.prototype.hasOwnProperty.call(n,r)&&(delete n[r],i=!0)}return i?n:t}),v(e=>{let t=e.filter(e=>!r.has(e.id));if(i&&r.has(i)){let e=t[0]??null;b(e?.id??null),S(null),E(e===null)}return t}),ke(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),De(e=>e&&r.has(e.parentId)?null:e),de(e=>e&&r.has(e)?null:e),pe(e=>e.filter(e=>!r.has(e))),he(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),ye(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,n]),Wn=(0,p.useCallback)(e=>{Un([e])},[Un]),Gn=(0,p.useCallback)((e,t)=>{e&&A(n=>n[e]===t?n:{...n,[e]:t})},[]),Kn=(0,p.useCallback)((e,t)=>{I(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}})},[]),qn=(0,p.useCallback)(e=>{I(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),R(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),Jn=(0,p.useCallback)((e,t)=>{e&&M(n=>(n[e]??null)===t?n:{...n,[e]:t})},[]),Yn=(0,p.useCallback)(e=>{e&&(M(t=>!Object.prototype.hasOwnProperty.call(t,e)||t[e]===null?t:{...t,[e]:null}),C7({storageKey:e,notice:null}))},[]),Xn=(0,p.useCallback)(t=>{if(e){if(t.spec_session){let n=_7({projectId:e,tool:t.spec_session.tool,sessionId:t.spec_session.id}),r=v7({projectId:e,sessionId:t.spec_session.id});Gn(n,t.prompt_text),Jn(r,t.import_notice),Kn(t.spec_session.id,t.imported_attachments),hn(t.spec_session),S(t.spec_session),b(t.spec_session.id),E(!1),O(null),P(null),Te(e=>e+1);return}O(t.external_source),P(t.import_notice),E(!0),b(null),S(null),Ne(null),Gn(_7({projectId:e,tool:n}),t.prompt_text),Te(e=>e+1)}},[e,n,Gn,Jn,Kn,hn]),Zn=(0,p.useCallback)(async({provider:e,issueReference:t})=>{let n=$.loading(i7(`toasts.importPreparing`));try{let r=e===`jira`?await m?.({issueReference:t,...bn()}):await g?.({issueReference:t,...bn()});if(!r)throw Error(i7(`toasts.importError`));return(r.import_notice?.skipped.reduce((e,t)=>e+t.count,0)??0)>0?$.warning(i7(`toasts.importPartialSuccess`),{id:n}):$.success(i7(`toasts.importSuccess`),{id:n}),r}catch(e){if(Ye(e))$.dismiss(n);else{let t=e instanceof Error&&e.message?e.message:i7(`toasts.importError`);$.error(t,{id:n})}throw e}},[bn,g,m]),Qn=(0,p.useMemo)(()=>[{key:`jira`,label:d(`jiraImportField.label`),placeholder:d(`jiraImportField.placeholder`),state:f,onImport:e=>Zn({provider:`jira`,issueReference:e})},{key:`github`,label:d(`githubImportField.label`),placeholder:d(`githubImportField.placeholder`),state:h,onImport:e=>Zn({provider:`github`,issueReference:e})}],[d,f,h,Zn]),$n=Qn.some(e=>e.state===`enabled`);(0,p.useEffect)(()=>{a&&(Zn({provider:a.external_source.provider,issueReference:a.external_source.external_key}).then(Xn).catch(()=>void 0),s?.())},[a,Zn,Xn,s]);let er=(0,p.useCallback)(async()=>{if(!(!e||!x||!Ae)){vt(!0);try{let t=Ct||x.model,n=Tt||x.variant;await Lue(e,x.id,Ae.id,{tool:x.tool,model:t,variant:n,skills:x.skills}),gde({projectId:e,tool:x.tool,model:t,variant:n}),fn()}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{vt(!1)}}},[e,x,Ae,Ct,Tt,fn]),tr=(0,p.useCallback)(async()=>{if(!(!e||!x||!Ae)){bt(!0);try{await Rue(e,x.id,Ae.id),fn()}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{bt(!1)}}},[e,x,Ae,fn]),nr=(0,p.useCallback)(async()=>{if(!e||!x||!Ae)return;let t=pt?.run;if(t){St(!0);try{Gn(en,(await zue(e,x.id,Ae.id,t.id)).draft_text),Te(e=>e+1)}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{St(!1)}}},[e,x,Ae,pt,Gn,en]),rr=(0,p.useCallback)(e=>{e&&(A(t=>t[e]===``?t:{...t,[e]:``}),S7({storageKey:e,value:``}))},[]),ir=(0,p.useCallback)((e,t)=>{R(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||rt||$t.current)&&!(x&&x.agent_status===`running`)){if(!y||!x){nt(t),k7({projectId:e,grillOn:t});return}if(x.mode===(t?`grill`:`standard`)){nt(t);return}it(!0);try{let n=await ure(e,x.id,{mode:t?`grill`:`standard`});S(n),hn(n),nt(t),t||r7(n.messages,n.latest_snapshot_created_at)&&await YN(e,n.id,{instruction:i7(`grill.finalizePrompt`),tool:n.tool,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[]})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`grill.updateModeError`))}finally{it(!1)}}},[e,x,y,rt,hn,cn,V,U,z,G]),or=(0,p.useCallback)(async()=>{if(!e||oe||ce||Qt.current||$t.current)return;let t=nn.trim();if(!t&&on.length===0)return;le(!0);let r=en,i=performance.now();Yt.current+=1;let a=`spec:${Yt.current}`;try{let o=y,s=!o;if(o&&!x&&(await JN(e,o)||(s=!0,o=null)),s&&(se(!0),o=(await qN(e,{tool:n,mode:tt?`grill`:`standard`,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[],external_source:D??null})).id,b(o),E(!1),O(null),nt(!1),k7({projectId:e,grillOn:!1}),y7({projectId:e,tool:n}),se(!1)),!o)throw Error(`Unable to resolve the spec session.`);De({parentType:`spec`,parentId:o,turnKey:a,startedAt:i});let c=on.map(e=>e.id),l=await YN(e,o,{instruction:t,tool:n,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[],attachment_ids:c.length>0?c:void 0});S(l),mde({projectId:e,tool:l.tool,model:l.model,variant:l.variant}),Te(e=>e+1),qn(o),rr(r),Yn(v7({projectId:e,sessionId:o})),P(null)}catch(e){De(e=>e?.turnKey===a?null:e);let t=Ke(e,`spec_session`);t?(S(t),hn(t)):e instanceof Ge&&e.status===409&&Rt.current&&await mn(Rt.current),Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{le(!1),se(!1)}},[e,oe,ce,nn,on,en,y,x,n,tt,cn,V,U,z,G,D,mn,hn,qn,rr,Yn]),sr=(0,p.useCallback)(async t=>{if(!e||an!==`opencode`&&an!==`claude`)return;let r=y;if(!r&&t.length>0)try{se(!0),r=(await qN(e,{tool:n,mode:tt?`grill`:`standard`,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[],external_source:D??null})).id,b(r),E(!1),y7({projectId:e,tool:n})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.upload`));return}finally{se(!1)}if(r){ir(r,t.length);try{let n=await fre(e,r,t),i=[...Kt.current[r]??[],...n.attachments];Kn(r,i)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.upload`))}finally{ir(r,-t.length)}}},[e,y,n,an,cn,V,U,z,G,tt,D,ir,Kn]),cr=(0,p.useCallback)(async t=>{if(!(!e||!y))try{await pre(e,y,t),Kn(y,(Kt.current[y]??[]).filter(e=>e.id!==t))}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.removeAttachment`))}},[e,y,Kn]);(0,p.useEffect)(()=>{Ee&&(Ee.parentId===y&&(ce||x?.agent_status===`running`)||De(null))},[x?.agent_status,y,ce,Ee]),(0,p.useEffect)(()=>{if(!Ut.current){Ut.current=!0;return}let t=b7(e),n=x7(e);Vt.current=!1,Ht.current=!1,qt.current=new Set,Jt.current=new Set,b(null),S(null),E(!1),O(null),A({}),M({}),P(null),I({}),R({}),de(null),pe([]),he(new Set),_e(!1),ye(new Set),De(null),ot([]),ct(!1),ut(!1),re(!1),ke(new Set),Zt.current=new Map,Lt.current=n.width,Ce(t.isOpen),Re(n.width),Ie(n.isOpen),nt(O7(e)),it(!1)},[e]);let lr=(0,p.useCallback)((e,t)=>{ye(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 pn(e.signal),()=>{e.abort()}},[pn]),(0,p.useEffect)(()=>{if(Vt.current||T||y||Ht.current||_.length===0)return;Ht.current=!0;let e=_[0]??null;e&&b(e.id)},[y,T,_]),(0,p.useEffect)(()=>{if(an!==`opencode`&&an!==`claude`){B([]),xe(!1);return}if(an!==`opencode`){B([]);return}let t=new AbortController;return(async()=>{xe(!0);try{B(await kF(an,t.signal,e))}catch(e){Ye(e)||B(e=>e)}finally{t.signal.aborted||xe(!1)}})(),()=>{t.abort()}},[e,an]),(0,p.useEffect)(()=>{if(an!==`opencode`&&an!==`claude`){H(``),W(``),K([]);return}if(T){let t=pde({projectId:e,tool:an}),n=new Set(cn.map(e=>e.id)),r=t?.model??``,i=r&&(n.size===0||n.has(r));H(i?r:``),W(e=>i?t?.variant??e:``),K([]);return}H(x?.model??``),W(x?.variant??``),K(x?.skills??[])},[e,x?.id,x?.model,x?.skills,x?.variant,cn,an,T]),(0,p.useEffect)(()=>{if(T||!y){S(null);return}if(x?.id===y)return;S(null);let e=new AbortController;return mn(y,e.signal),()=>{e.abort()}},[x,y,T,mn]),(0,p.useEffect)(()=>{ut(!1)},[y,T]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||T||!y){ot([]),ct(!1);return}let e=new AbortController;return _n(y,e.signal),()=>{e.abort()}},[t?.memory_enabled,y,T,_n,dt]),(0,p.useEffect)(()=>{!lt||st||at.length>0||ut(!1)},[st,lt,at.length]),(0,p.useEffect)(()=>{let e=Xt.current,n=x?.id??null,r=x?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&ft(e=>e+1),Xt.current={id:n,status:r}},[t?.memory_enabled,x?.agent_status,x?.id]),(0,p.useEffect)(()=>{if(!y||x?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([pn(e.signal),mn(y,e.signal)])},tde);return()=>{e.abort(),window.clearInterval(t)}},[x?.agent_status,y,mn,pn]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(!T&&t.id===Rt.current&&(Bt.current+=1,S(t)),yn(t)&&hn(t))},n=t=>{!t||t.project_id!==e||Wn(t.id)},r=()=>{pn();let e=Rt.current;e&&!Vt.current&&mn(e)};return u.on(`connect`,r),u.on(`spec-session:created`,t),u.on(`spec-session:updated`,t),u.on(`spec-session:deleted`,n),()=>{u.off(`connect`,r),u.off(`spec-session:created`,t),u.off(`spec-session:updated`,t),u.off(`spec-session:deleted`,n)}},[e,T,mn,pn,yn,hn,Wn,u]),(0,p.useEffect)(()=>{if(!e||!un)return;let t=e=>{!e||e.spec_snapshot_id!==un||fn()};return u.on(`spec-review:updated`,t),()=>{u.off(`spec-review:updated`,t)}},[e,un,fn,u]);let ur=(0,p.useMemo)(()=>g5(_),[_]),dr=(0,p.useCallback)(e=>{e.key!==`Enter`||e.shiftKey||x?.agent_status===`running`||oe||ce||sn||Qt.current||$t.current||(e.preventDefault(),or())},[or,x?.agent_status,oe,ce,sn]),fr=(0,p.useCallback)(t=>{if(!e||an!==`opencode`&&an!==`claude`)return;let n=Array.from(t.clipboardData.files).filter(e=>e.type.startsWith(`image/`));n.length!==0&&(t.preventDefault(),sr(n))},[e,an,sr]),pr=(0,p.useMemo)(()=>y5(cn),[cn]),mr=(0,p.useMemo)(()=>x?x5({modelLabel:b5({availableModelsById:pr,model:x.model}),tool:x.tool}):null,[x,pr]),gr=(0,p.useMemo)(()=>x?.messages?x.messages.map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],responseTiming:e.response_timing?fq(e.response_timing):null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,created_at:e.created_at,displayTitle:e.role===`assistant`?mr??v5(x.tool):S5()})):[],[x,mr]),_r=y!==null||T,vr=T?null:x,yr=vr?.streaming_response??null,br=vr?.agent_status===`running`,xr=!!(ce&&Ee?.parentType===`spec`&&Ee.parentId===y),Sr=br||xr,Cr=Sr?mr:null,wr=ue!==null,Tr=!!e&&!oe&&(T||y!==null),Er=!!(t?.memory_enabled&&x&&!T&&(x.pending_memory_suggestion_count>0||st)),Dr=(an===`opencode`||an===`claude`)&&(T||y!==null)&&vr?.agent_status!==`running`,Or=(0,p.useMemo)(()=>{if(!x?.messages)return null;for(let e=x.messages.length-1;e>=0;--e){let t=x.messages[e];if(t.kind===`grill-question`)return t.id}return null},[x]),kr=(0,p.useMemo)(()=>!x||x.mode!==`grill`?!1:r7(x.messages,x.latest_snapshot_created_at),[x]),Ar=(0,p.useMemo)(()=>[...x?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[x]),jr=!!Ar,Mr=(0,p.useCallback)(async t=>{if(!e||!y||!x)return;le(!0),Yt.current+=1;let n={parentType:`spec`,parentId:y,turnKey:`spec:${Yt.current}`,startedAt:performance.now()};De(n);try{S(await YN(e,y,{instruction:t,tool:x.tool,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[]})),Te(e=>e+1)}catch(e){De(e=>e?.turnKey===n.turnKey?null:e),Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{le(!1)}},[e,y,x,cn,V,U,z,G]),Nr=(0,p.useCallback)(async(t,n)=>{if(!e||!x||C)return;let r=cY({parentType:`spec`,parentId:x.id,setId:n.set_id});w(n.set_id),le(!0),Yt.current+=1;let i={parentType:`spec`,parentId:x.id,turnKey:`spec:${Yt.current}`,startedAt:performance.now()};De(i);try{let r=await dre(e,x.id,t,n);S(r),hn(r)}catch(e){if(e instanceof Ge&&e.status===409){uY(r);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?(S(t),hn(t)):await mn(x.id)}throw De(e=>e?.turnKey===i.turnKey?null:e),$.error(e instanceof Error?e.message:i7(`errors.resolveQuestions`)),e}finally{w(null),le(!1)}},[e,x,mn,C,hn]),Pr=(0,p.useCallback)(e=>{if(e.role!==`assistant`)return;let t=e.metadata,n=t?.ask_question;if(n&&x)return(0,X.jsx)(_Y,{messageContent:e.content,questionSet:n,storageKey:cY({parentType:`spec`,parentId:x.id,setId:n.id}),isActive:n.status===`pending`&&Ar?.id===e.id,isDisabled:x.agent_status===`running`||C===n.id,onResolve:t=>Nr(e.id,t)});if(e.kind!==`grill-question`)return;let r=t?.grill_question;if(r)return(0,X.jsx)(Y5,{question:r,isActive:Sr?!1:e.id===Or&&x?.agent_status!==`running`&&x?.mode===`grill`,isDisabled:ce||oe||rt,labels:{rationaleLabel:i7(`grill.rationaleLabel`),suggestionsLabel:i7(`grill.suggestionsLabel`),recommendedSuggestionLabel:i7(`grill.recommendedSuggestionLabel`),answerPlaceholder:i7(`grill.answerPlaceholder`),submitLabel:i7(`grill.submitLabel`),submittingLabel:i7(`grill.submittingLabel`)},onSubmitAnswer:e=>{Mr(e)}})},[x,Sr,ce,oe,rt,Or,Ar?.id,Nr,C,Mr]),Fr=(an===`opencode`||an===`claude`)&&cn.length>0,Ir=an,Lr=T?i7(`composer.newSpecTitle`):x?.title??i7(`composer.specTitle`),Rr=Fr?V||null:x?.model??null,zr=b5({availableModelsById:pr,model:Rr}),Br=x?.agent_status===`stopped`,Vr=i7(`composer.placeholderSpec`),Hr=_.some(e=>e.agent_status!==`running`),Ur=(0,p.useMemo)(()=>({ariaLabel:i7(`sidebar.ariaLabel`),newSession:i7(`sidebar.newSession`),collapseAriaLabel:i7(`sidebar.collapseAriaLabel`),openAriaLabel:i7(`sidebar.openAriaLabel`),cancelSelection:i7(`sidebar.cancelSelection`),deleteSelected:i7(`sidebar.deleteSelected`),selectedCount:e=>`${e} selected`,select:i7(`sidebar.select`),loadingSessions:i7(`sidebar.loadingSessions`),noSessions:i7(`sidebar.noSessions`),deleteSessionAriaLabel:i7(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>i7(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>i7(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>i7(`sidebar.deleteSessionTitle`,{title:e})}),[]),Wr=(0,p.useMemo)(()=>({title:i7(`deleteModal.title`),bulkTitle:i7(`deleteModal.bulkTitle`),description:i7(`deleteModal.description`),bulkDescription:e=>i7(`deleteModal.bulkDescription`,{count:e}),cancel:i7(`deleteModal.cancel`),delete:i7(`deleteModal.delete`),deleting:i7(`deleteModal.deleting`)}),[]),Gr=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:!t&&Oe.has(e.id)?`finished`:null,[Oe]),Kr=(0,p.useCallback)(e=>e.agent_status===`running`?i7(`sidebar.cannotDeleteRunning`):null,[]),qr=!!(t?.memory_enabled&&y&&!T),Jr=(0,p.useCallback)(e=>{let t=qr&&e.pending_memory_suggestion_count>0?a7(e.pending_memory_suggestion_count):null,n=(e.linked_ticket_count??0)+(e.linked_chat_count??0);return n>0?[e.title,t,i7(`sidebar.linkedImplementationsAriaLabel`,{itemCount:n})].filter(Boolean).join(` `):e.has_completed_work===1?[e.title,t,i7(`sidebar.linkedImplementationsAriaLabelHistorical`)].filter(Boolean).join(` `):[e.title,t].filter(Boolean).join(` `)},[qr]),Yr=e=>{let t=e.first_user_message_preview??e.messages?.find(e=>e.role===`user`)?.content;return t&&t.replace(/\s+/g,` `).trim()||null},Xr=(0,p.useCallback)(({session:e,activityState:t})=>{let n=Yr(e),r=e.linked_ticket_count??0,i=e.linked_chat_count??0,a=r+i,o=e.has_completed_work===1||a>0,s=a>0,c=s?i7(`sidebar.linkedImplementationsTooltip`,{ticketCount:r,chatCount:i}):i7(`sidebar.linkedImplementationsTooltipHistorical`),l=qr&&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:[(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}),l?(0,X.jsx)(Rw,{tone:`muted`,className:`shrink-0`,"aria-label":a7(e.pending_memory_suggestion_count),title:a7(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null,o&&(0,X.jsx)(Ov,{content:c,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)(JF,{className:`size-3`}),s&&(0,X.jsx)(`span`,{children:a})]})})]}),n?(0,X.jsx)(`div`,{className:`mt-0.5 line-clamp-1 text-xs leading-4 text-muted-foreground`,children:n}):null]}),(0,X.jsx)(pb,{state:t,className:`mt-1`})]})},[qr]),Zr=br?(0,X.jsx)($8,{isInterrupting:wr,onStop:()=>{y&&En(y)},interruptLabel:i7(`composer.interrupt`),interruptingLabel:i7(`composer.interrupting`)}):null,Qr=(0,p.useMemo)(()=>cn.find(e=>e.id===V)??null,[cn,V]),$r=an===`opencode`||an===`claude`?be||ln?(0,X.jsx)(IY,{}):cn.length>0?(0,X.jsx)(LY,{model:V,variant:U,skills:G,showModelSelector:!0,showSkillsSelector:z.length>0,availableModels:cn,availableSkills:z,selectedModel:Qr,onModelChange:e=>{let t=cn.find(t=>t.id===e)??null;H(e),W(e=>t&&t.variants.includes(e)?e:``)},onVariantChange:W,onSkillsChange:K,modelSelectId:`spec-model-select`,variantSelectId:`spec-variant-select`,skillsSelectId:`spec-skills-select`}):null:null,ei=(0,p.useMemo)(()=>fe.length===1?_.find(e=>e.id===fe[0])?.title??``:``,[fe,_]),ti=(0,p.useMemo)(()=>_.filter(e=>fe.includes(e.id)),[_,fe]),ni=_r&&x!==null,ri=ni&&!Fe&&!Ve,ii=ni&&(Fe||Ve),ai=x?.tool??n,oi=ai===`opencode`&&cn.length>0,si=(0,p.useMemo)(()=>cn.find(e=>e.id===Ct)??null,[cn,Ct]),ci=Ae&&ni?{review:pt,isRunning:_t||yt,isLoading:ht,availableModels:cn,showModelSelector:oi,runConfigTool:ai,runConfigModel:Ct,runConfigVariant:Tt,selectedDiscoveredModel:si,onRunConfigModelChange:e=>{let t=cn.find(t=>t.id===e)??null;wt(e),Et(e=>t&&t.variants.includes(e)?e:``)},onRunConfigVariantChange:Et,onLaunchReview:()=>{er()},onStopReview:()=>{tr()},onSendToPlanner:()=>{nr()},isSendingToPlanner:xt}:void 0;(0,p.useEffect)(()=>{if(ai!==`opencode`){wt(``),Et(``);return}let t=hde({projectId:e,tool:ai}),n=new Set(cn.map(e=>e.id)),r=t?.model??``,i=!!r&&(n.size===0||n.has(r)),a=x?.model??``,o=i?r:a&&(n.size===0||n.has(a))?a:``;wt(o),Et(e=>o?i&&t?.variant?t.variant:e||(o===a?x?.variant??``:``):``)},[e,x?.model,x?.variant,cn,ai]),(0,p.useEffect)(()=>{ni||(At.current=null,jt.current=null,Nt.current=!1,Pt.current=!1,Be(!1),Ue(!1),jn())},[ni,jn]),(0,p.useEffect)(()=>()=>{jn()},[jn]);let li=(0,X.jsx)(Ov,{content:i7(`artifactPanel.open`),disabled:!ri,side:`left`,children:(0,X.jsx)(`div`,{ref:Ot,className:Z(ri?`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`,ze&&!ri&&`bg-background`),role:ri?`button`:`separator`,tabIndex:ri?0:void 0,"aria-label":i7(ri?`artifactPanel.open`:`artifactPanel.resize`),"aria-valuemin":ri?void 0:f7,"aria-valuemax":ri?void 0:Dt.current?Math.round(Dt.current.clientWidth*p7):800,"aria-valuenow":ri?void 0:Le,onClick:ri?()=>{if(Pt.current){Pt.current=!1;return}Ie(!0)}:void 0,onPointerDown:In,onPointerMove:Ln,onPointerUp:Rn,onPointerCancel:zn,onLostPointerCapture:Bn,children:ri?(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)(n7,{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)(n7,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:i7(`artifactPanel.title`)})]})]}):(0,X.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,ze?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})})}),ui=T&&$n?(0,X.jsx)(YY,{providers:Qn,onImported:Xn,inputId:`spec-draft-external-import`,className:`max-w-md`,showImportSpinner:!0,showImportErrorToast:!1}):null,di=x?x.mode===`grill`:tt,fi=kr;Qt.current=fi,$t.current=jr;let pi=(0,X.jsx)(X5,{on:di,disabled:rt||br||oe||ce||jr,tooltipContent:i7(`grill.toggleTooltip`),ariaLabelOn:i7(`grill.toggleAriaLabelOn`),ariaLabelOff:i7(`grill.toggleAriaLabelOff`),onToggle:e=>{ar(e)}}),mi=fde(rn),hi=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[mi?(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:i7(`importNotice.title`)}),(0,X.jsx)(`div`,{children:mi})]}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[pi,ui,Zr]})]}),gi=$r,_i=(0,p.useCallback)(t=>{x?Yn(v7({projectId:e,sessionId:x.id})):P(null),Gn(en,t)},[x,e,en,Gn,Yn]),vi=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Kue,{projectId:e,specSessionId:T?null:y,messages:gr,internalLog:vr?.agent_log??null,currentThinkingMessageId:vr?.agent_message_id??null,previousThinkingLog:vr?.previous_agent_log??null,previousThinkingMessageId:vr?.previous_agent_message_id??null,pendingAgentTitle:Cr,streamingResponse:yr,isRunning:Sr,isLoading:ie,canShowComposer:Tr,isExternallyResizing:ze,layoutKey:x?.id??`spec-draft`,scrollLayoutKey:ni?ii?`artifact-visible`:`artifact-hidden`:`artifact-disabled`,header:(0,X.jsx)(d5,{title:Lr,tool:T?null:x?.tool??null,modelLabel:zr,interrupted:Br,interruptedLabel:i7(`sidebar.interrupted`),usage:{totalTokens:x?.usage_snapshot_total_tokens??null,contextWindow:x?.usage_snapshot_context_window??null,cost:x?.usage_snapshot_cost??null,tool:Ir,model:Rr,availableModels:cn},metadataExtra:x?.external_source?(0,X.jsx)(sI,{externalSource:x.external_source}):null,actions:x&&e?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Er&&(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>ut(!0),children:st?i7(`composer.loadingMemory`):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:i7(`composer.memorySuggestions`)}),(0,X.jsx)(Rw,{children:at.length})]})}),(0,X.jsx)(L3,{projectId:e,scope:{type:`spec`,id:x.id},size:`xs`,onNavigateToLifecycleSource:l})]}):null}),composerControls:hi,composerInlineControls:gi,composerTheme:`default`,composerFocusNonce:we,pendingAgentRevealKey:Sr&&Ee?.parentId===y?Ee?.turnKey??null:null,pendingAgentRevealDelayMs:Sr&&Ee?.parentId===y?400:0,liveResponseTiming:Ee,followUpPrompt:nn,draftAttachments:on,followUpPlaceholder:Vr,emptyStateText:T?i7(`composer.describeFeature`):null,isSendingFollowUp:ce||oe,isComposerSubmitDisabled:fi||jr,isUploadingAttachments:sn,canAttachImages:Dr,followUpDisabledReason:vr?.agent_status===`running`?i7(`composer.waitTurn`):sn?i7(`composer.waitUpload`):fi?i7(`composer.waitGrill`):jr?vC.t(`common:questionSet.waitForResolution`):void 0,renderMessageBody:Pr,onFollowUpPromptChange:_i,onFollowUpKeyDown:dr,onFollowUpPaste:fr,onUploadAttachments:e=>{sr(e)},onRemoveAttachment:e=>{cr(e)},onFollowUpSubmit:()=>{or()}})}),yi=!_r&&ne&&!ee?(0,X.jsx)(Z8,{title:i7(`composer.noSessionSelectedTitle`),description:i7(`composer.noSessionSelectedDescription`),startNewSessionLabel:i7(`composer.startNewSession`),onStartNewSession:xn,canStartNewSession:!!e&&!oe&&!ce}):_r&&!T&&!ie&&!x?(0,X.jsx)(Y8,{label:i7(`composer.loadingSession`)}):!ne||ee?(0,X.jsx)(X8,{label:i7(`sidebar.loadingSessions`)}):vi,bi=lt&&e&&t?.memory_enabled?(0,X.jsx)(hC,{onClose:()=>ut(!1),overlayClassName:`bg-background/45 p-4 backdrop-blur-sm`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,X.jsxs)(bC,{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)(xC,{className:`border-b border-border/80 pb-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(SC,{children:i7(`composer.memorySuggestionsTitle`)}),(0,X.jsx)(CC,{children:i7(`composer.memorySuggestionsDescription`)})]}),(0,X.jsx)(wC,{children:t})]}),(0,X.jsx)(TC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,X.jsx)(f5,{projectId:e,suggestions:at,emptyState:i7(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:vn})})]}),closeButtonLabel:i7(`composer.closeMemorySuggestions`)}):null,xi=ti.length>0?(0,X.jsx)(J8,{count:ti.length,title:ei,isDeleting:me.size>0,onConfirm:()=>{Hn()},onCancel:()=>{me.size>0||pe([])},labels:Wr}):null,Si=$e===null?null:(0,X.jsx)(gC,{title:i7(`actions.exportConflictTitle`),description:i7(`actions.exportConflictDescription`,{path:$e.path}),confirmLabel:i7(`actions.exportConflictConfirm`),cancelLabel:i7(`actions.exportConflictCancel`),confirmVariant:`destructive`,onConfirm:()=>{et(null),An({projectId:$e.projectId,sessionId:$e.sessionId,snapshotId:$e.snapshotId,overwrite:!0})},onCancel:()=>{et(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)(Q8,{sessions:_,sessionGroups:ur,activeSessionId:y,isDraftOpen:T,isLoadingSessions:ee,isOpen:Se,onToggleOpen:()=>{Ce(t=>{let n=!t;return sde({projectId:e,isOpen:n}),n})},testId:`spec-sessions-sidebar`,railTestId:`spec-sessions-rail`,onDraftOpen:xn,isCreatingSession:oe||!e,isSendingPrompt:ce,newSessionShortcutHint:Cn,newSessionTooltip:wn,isSelectionMode:ge,selectedSessionIds:ve,selectedSessionCount:ve.size,hasDeletableSessions:Hr,deletingSessionIds:me,onEnterSelectionMode:()=>{_e(!0),ye(new Set)},onExitSelectionMode:()=>{_e(!1),ye(new Set)},onToggleSessionSelection:e=>{ye(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:lr,onConfirmDeleteSelectedSessions:()=>{pe(Array.from(ve))},onSessionSelect:e=>{Tn(e)},onConfirmDeleteSession:e=>{pe([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:Kr,getActivityState:Gr,getRowAriaLabel:Jr,renderRowContent:Xr,labels:Ur}),(0,X.jsxs)(`div`,{ref:Dt,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:yi}),ni?(0,X.jsxs)(X.Fragment,{children:[li,ii?(0,X.jsx)(ede,{snapshot:Ae,isLoading:q,desktopWidth:Le,onClose:Vn,ref:kt,actions:Ae?{onCreateTickets:On,onImplementInChat:()=>{kn()},onExport:()=>{An()},isCreatingTickets:We,isImplementingInChat:Je,isExporting:Xe,hasExistingTicketsFromSnapshot:Y}:void 0,review:ci}):null]}):null]}),bi,xi,Si]})},A7=()=>({hasRunning:!1,hasFinishedUnseen:!1,hasErrorUnseen:!1}),j7=()=>({board:A7(),chat:A7(),spec:A7(),memory:A7()}),M7=(e,t)=>{let n=e[t];return!n.hasFinishedUnseen&&!n.hasErrorUnseen?e:{...e,[t]:{...n,hasFinishedUnseen:!1,hasErrorUnseen:!1}}},yde=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}),N7=e=>e.hasErrorUnseen?`error`:e.hasRunning?`running`:e.hasFinishedUnseen?`finished`:null,bde=(e,t)=>t?null:N7(e),P7=320,xde=.7,Sde=28,Cde=6,wde=(e,t)=>{let n=Math.max(P7,Math.round(t*xde));return Math.max(P7,Math.min(n,Math.round(e)))},Tde=(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},Ede=(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},Dde=(e,t)=>{if(t.type===`reset`)return j7();if(t.type===`mark-workspace-visible`)return M7(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}},Ode=({activeProjectId:e,onActivity:t})=>{let{tickets:n}=R8(),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;n===`running`&&r===`done`&&(a=!0),n===`running`&&r===`error`&&(o=!0),i.set(t.id,r)}r.current=i,t({hasRunning:n.some(e=>e.agent_status===`running`),didFinish:a,didError:o})},[t,n]),null},kde=({activeProjectId:e,onActivity:t})=>{let n=Aq(),[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 LN(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=rx(()=>{document.visibilityState===`visible`&&LN(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=>Tde(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)e.title&&F8(`Chat response ready`,e.title);o.length>0&&e&&j6(e),t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:o.length>0,didError:s})},[e,t,r]),null},Ade=({activeProjectId:e,onActivity:t})=>{let n=Aq(),[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 KN(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=rx(()=>{document.visibilityState===`visible`&&KN(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=>Ede(e,t))},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)e.title&&F8(`Spec response ready`,e.title);t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:i.length>0,didError:o})},[e,t,r]),null},jde=({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,onRestoreChatSessionTarget:f,onChatReviewCapabilityChange:m,onPreviewReviewCapabilityChange:h,previewDisplayMode:g=`hidden`,previewPane:_=null,previewPaneWidth:v=480,isPreviewButtonDisabled:y=!1,previewButtonTitle:b,visibleWorkspace:x,onProjectUsageChange:S,onBundlesChange:C,onBundlesLoadingChange:w,onBoardLoadedProjectIdChange:T,onPreviewToggle:E,onPreviewPaneWidthChange:D,onRunStopped:O,onRunStatusChange:k,onWorkspaceActivityChange:A,onWorkspaceActivityEvent:j,pendingWorkspaceNavigation:M=null,onPendingWorkspaceNavigationConsumed:N,onSpecImplementationChatReady:P,onViewSourceSpec:F,onNavigateToLifecycleSource:I,onViewMemorySource:L,onStartChatFromBundle:R,refreshKey:z=0})=>{let B=(0,p.useRef)(null),V=(0,p.useRef)(null),H=(0,p.useRef)(null),U=(0,p.useRef)(null),W=(0,p.useRef)(!1),G=(0,p.useRef)(!1),K=(0,p.useRef)(0),ee=(0,p.useRef)(v),te=(0,p.useRef)(v),ne=x===`board`||x===`chat`,re=_!==null,[ie,ae]=(0,p.useState)(!1),[oe,se]=(0,p.useState)(!1),[ce,le]=(0,p.useState)(v),[ue,de]=(0,p.useReducer)(Dde,void 0,j7),fe=ne&&re&&g===`expanded`,pe=ne&&re&&g===`inline`,me=ne&&re&&g===`hidden`&&!oe,he=(pe||oe)&&!fe,ge=fe||he,_e=ne&&re&&!fe,ve=ie?ce:v,ye=x!==`chat`||!he,be=e=>{let t=H.current,n=U.current,r=W.current;if(t!==null){if(H.current=null,U.current=null,W.current=!1,ae(!1),se(!1),e!==null&&V.current?.hasPointerCapture(e)&&V.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;D?.(te.current),E?.();return}D?.(te.current)}},xe=e=>{if(!B.current)return;let t=B.current.getBoundingClientRect().width,n=wde(e,t);te.current=n,le(n)},Se=e=>{D&&(me&&y||(e.preventDefault(),H.current=e.pointerId,U.current=me?`collapsed`:`inline`,W.current=!1,G.current=!1,K.current=e.clientX,ee.current=me?0:te.current,ae(!me),e.currentTarget.setPointerCapture(e.pointerId)))},Ce=e=>{if(H.current!==e.pointerId)return;let t=e.clientX-K.current,n=ee.current-t;if(U.current===`collapsed`){if(!W.current&&n<Cde)return;W.current||(W.current=!0,G.current=!0,se(!0),ae(!0))}xe(n)},we=e=>{if(H.current===e.pointerId){if(U.current===`inline`||W.current){let t=e.clientX-K.current;xe(ee.current-t)}be(e.pointerId)}},Te=e=>{H.current===e.pointerId&&be(e.pointerId)},Ee=(0,p.useCallback)((e,t)=>{j?.(e,t),de({type:`update-workspace`,workspace:e,activity:t,visibleWorkspace:x})},[j,x]);(0,p.useEffect)(()=>{de({type:`reset`})},[e]),(0,p.useEffect)(()=>{x!==`memory`&&de({type:`mark-workspace-visible`,workspace:x})},[x]),(0,p.useEffect)(()=>{A?.(ue)},[A,ue]),(0,p.useEffect)(()=>{ie||(te.current=v),!re&&(H.current=null,U.current=null,W.current=!1,G.current=!1,te.current=v)},[re,ie,v]);let De=()=>{if(G.current){G.current=!1;return}y||E?.()};return(0,X.jsx)(Wle,{activeProjectId:e,refreshKey:z,onLoadedProjectIdChange:T,onProjectUsageChange:S,onBundlesChange:C,onBundlesLoadingChange:w,children:(0,X.jsxs)(`div`,{ref:B,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(Ode,{activeProjectId:e,onActivity:e=>{Ee(`board`,e)}}),(0,X.jsx)(kde,{activeProjectId:e,onActivity:e=>{Ee(`chat`,e)}}),(0,X.jsx)(Ade,{activeProjectId:e,onActivity:e=>{Ee(`spec`,e)}}),x===`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)(vde,{activeProjectId:e,activeProject:t,activeTool:d,initialSpecSessionId:M?.workspace===`spec`&&`specSessionId`in M?M.specSessionId:null,initialSpecSnapshotId:M?.workspace===`spec`&&`specSnapshotId`in M?M.specSnapshotId??null:null,initialIssueDraft:M?.workspace===`spec`&&`issueDraft`in M?M.draft:null,onInitialSpecNavigationConsumed:N,onInitialIssueDraftConsumed:N,onImplementInChat:P,onNavigateToLifecycleSource:I})}):x===`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)(Iue,{activeProject:t,onNavigateToSource:L})}):(0,X.jsxs)(`div`,{id:x===`chat`?`project-workspace-panel-chat`:`project-workspace-panel-board`,role:`tabpanel`,"aria-labelledby":x===`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:x===`chat`?(0,X.jsx)(Pue,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeTool:d,initialChatSessionId:M?.workspace===`chat`&&`chatSessionId`in M?M.chatSessionId:null,initialDraftOpen:M?.workspace===`chat`&&`startNewDraft`in M,onInitialDraftOpenConsumed:N,initialSpecDraft:M?.workspace===`chat`&&`draft`in M?{text:M.draftText,specSessionId:M.specSessionId,specSnapshotId:M.specSnapshotId}:null,onInitialSpecDraftConsumed:N,onInitialChatNavigationConsumed:N,onViewSourceSpec:F,onNavigateToLifecycleSource:I,isExternallyResizing:ie,onRestoreSessionTarget:f,onReviewCapabilityChange:m,showChangesPanel:ye}):(0,X.jsx)(Jle,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,activeRun:u,activeTool:d,onPreviewReviewCapabilityChange:h,onRunStopped:O,onRunStatusChange:k,onViewSourceSpec:F,onNavigateToLifecycleSource:I,onStartChatFromBundle:R,refreshKey:z,initialTicketId:M?.workspace===`board`&&`ticketId`in M?M.ticketId:null,onInitialTicketNavigationConsumed:N,initialImportedDraft:M?.workspace===`board`&&`issueDraft`in M?M.draft:null,onInitialImportedDraftConsumed:N})}),[_e?(0,X.jsx)(Ov,{content:y?b??`Preview unavailable`:`Open preview`,disabled:!me,side:`left`,children:(0,X.jsx)(`div`,{"aria-label":me?b??`Show preview`:`Resize preview pane`,"aria-orientation":me?void 0:`vertical`,className:me?`group flex shrink-0 touch-none select-none items-center justify-center border-l border-border/70 bg-background/90 transition-colors ${y?`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 ${ie?`bg-background`:``}`,"data-preview-divider":`true`,"data-testid":me?`collapsed-preview-rail`:void 0,onLostPointerCapture:Te,onPointerCancel:we,onPointerDown:Se,onPointerMove:Ce,onPointerUp:we,onClick:me?De:void 0,onKeyDown:me?e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),De())}:void 0,ref:V,role:me?`button`:`separator`,style:me?{width:`${Sde}px`}:void 0,tabIndex:me?y?-1:0:void 0,children:me?(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)(Fue,{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 ${ie?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`}`})})},`preview-divider`):null,ge?(0,X.jsx)(`div`,{className:fe?`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:fe?void 0:{width:`${ve}px`},children:(0,X.jsx)(`div`,{className:`h-full w-full`,children:_})},`preview-container`):null]]})]})})},Mde=({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)(b3,{createSession:()=>gae(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})}),Nde=({activeWorkspace:e,activityByWorkspace:t,className:n,memoryEnabled:r=!1,onWorkspaceChange:i})=>{let{t:a}=He(`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=bde(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)(pb,{state:a,className:`mt-0`})]})},n)})})})},F7=32,Pde=5.5,Fde=2,Ide=24,Lde=8,I7=new Map,Rde={running:{fill:`#fcd34d`,stroke:`#f59e0b`},finished:{fill:`#34d399`,stroke:`#059669`},error:{fill:`#fb7185`,stroke:`#e11d48`}},L7=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),R7=e=>{if(!e)return null;let t=e.trim().match(/^([0-9]+(?:\.[0-9]+)?)/);return t?Number(t[1]):null},z7=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=R7(n.getAttribute(`width`)),a=R7(n.getAttribute(`height`)),o=r??(i&&a?`0 0 ${i} ${a}`:`0 0 ${F7} ${F7}`);return`<svg ${[Array.from(n.attributes).filter(e=>![`width`,`height`,`viewBox`,`x`,`y`,`preserveAspectRatio`].includes(e.name)).map(e=>`${e.name}="${L7(e.value)}"`).join(` `),`x="0"`,`y="0"`,`width="${F7}"`,`height="${F7}"`,`viewBox="${L7(o)}"`,`preserveAspectRatio="xMidYMid meet"`].filter(e=>e.length>0).join(` `)}>${n.innerHTML}</svg>`},zde=async e=>{if(!e)return null;let t=I7.get(e);if(t)return t;let n=(async()=>{try{if(e.startsWith(`data:image/svg+xml,`))return z7(decodeURIComponent(e.slice(19)));if(e.startsWith(`data:image/svg+xml;base64,`))return z7(atob(e.slice(26)));let t=await fetch(e);return t.ok?z7(await t.text()):null}catch{return null}})();return I7.set(e,n),n},Bde=async(e,t)=>{let{fill:n,stroke:r}=Rde[e],i=await zde(t);return i?[`<svg xmlns="http://www.w3.org/2000/svg" width="${F7}" height="${F7}" viewBox="0 0 ${F7} ${F7}">`,i,`<circle cx="${Ide}" cy="${Lde}" r="${Pde}" fill="${n}" stroke="${r}" stroke-width="${Fde}"/>`,`</svg>`].join(``):null},Vde=async(e,t)=>{if(!e)return t;let n=await Bde(e,t);return n?`data:image/svg+xml,${encodeURIComponent(n)}`:t},Hde=()=>{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},B7=({defaultHref:e,state:t})=>{let n=Hde(),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}Vde(t,e).then(e=>{if(n.dataset.browserTabActivityRequestId===String(r)){if(e){n.href=e;return}n.removeAttribute(`href`)}})},V7=(e,t)=>vC.t(`common:projectFooter.${e}`,t),Ude=1e3,H7=`archon.active-project-id`,U7=`archon.workspace-by-project`,W7=`archon.preview-mode-by-project`,G7=`archon.dismissed-preview-run-context-by-project`,K7=5e3,q7=`archon.preview-pane-width`,J7=`archon.preview-viewport-preset`,Y7=`archon.preview-zoom`,Wde=480,Gde=`responsive`,Kde=1,X7={hasMounted:!1,isOpen:!1,isExpanded:!1},Z7=`hidden`,qde=(0,p.lazy)(()=>kG(()=>Promise.resolve().then(()=>s8).then(e=>({default:e.WorkspaceReviewModal})),void 0)),Jde=(0,p.lazy)(()=>kG(()=>import(`./VerificationDialog-YUi8g2ou.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),Yde=(0,p.lazy)(()=>kG(()=>import(`./GitHubActionsDialog-Cmb9Yebr.js`).then(e=>({default:e.GitHubActionsDialog})),__vite__mapDeps([20,3]))),Xde=(0,p.lazy)(()=>kG(()=>import(`./ActivityView-CbdDNsdO.js`).then(e=>({default:e.ActivityView})),[])),Q7=e=>{if(!e)return null;try{return JSON.parse(e)}catch{return null}},$7=e=>{let t=Q7(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]},e9=e=>{let t=Q7(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}]}):[]},Zde=e=>{let t=Q7(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}]}):[]},Qde=e=>{let t=new Set(lw(e)),n=new Set(uw(e)),r=new Set(jne(e));return{name:e.name,repoPath:e.repo_path,linkedProjectIds:e.linked_project_ids,runSetup:$7(e.run_setup),runServices:e9(e.run_services),checkDefinitions:cw(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`,required:t.has(e.id),preReview:t.has(e.id)&&n.has(e.id),postBuild:r.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_model??``,helperVariant:e.helper_variant??``,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:Zde(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}},t9=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,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),runner:e.runner}:{id:e.id,name:e.name,category:e.category,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs)}),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)),run_ide:e.runIde||null,preview_service_name:t,preview_path:r,preview_capability_mode:i,helper_model:e.helperModel||null,helper_variant:e.helperModel&&e.helperVariant||null,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}},$de=e=>e?$7(e.run_setup).length>0||e9(e.run_services).length>0||(e.run_ide?.trim().length??0)>0:!1,n9=(e,t,n)=>`${e} ${e===1?t:n}`,efe=e=>{if(!e.repo_path_locked)return null;let t=[];return e.ticket_count>0&&t.push(n9(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&t.push(n9(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 `)}.`},tfe=(e,t)=>{if(t.length<=1)return`Keep at least one project in Archon.`;let n=[];e.ticket_count>0&&n.push(n9(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&n.push(n9(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(n9(r,`project links to it`,`projects link to it`)),n.length===0?null:`This project can't be deleted while ${n.join(` and `)}.`},nfe=(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},rfe=(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}),r9=e=>({projectId:e,branch:null,status:`loading`,ahead:0,behind:0,hasUpstream:!1,canPull:!1,diffStats:null}),i9=(e,t)=>t?e[t]??X7:X7,a9=(e,t)=>t?e[t]??Z7:Z7,ife=()=>{let e=window.localStorage.getItem(q7),t=Number(e);return Number.isFinite(t)&&t>=320?t:Wde},afe=()=>{let e=window.localStorage.getItem(J7);return e===`phone`||e===`tablet`||e===`laptop`||e===`responsive`?e:Gde},ofe=()=>{let e=Number(window.localStorage.getItem(Y7));return Number.isFinite(e)&&e>0?e:Kde},sfe=()=>{let e=Q7(window.localStorage.getItem(U7));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]]:[]))},cfe=()=>{let e=Q7(window.localStorage.getItem(W7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>e===`hidden`||e===`inline`||e===`expanded`))},lfe=()=>{let e=Q7(window.localStorage.getItem(G7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`||e===null))},o9=e=>!!e?.preview_service_name?.trim()&&e?.preview_capability_mode!==`force_disabled`,ufe=({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)},dfe=({activeRun:e,project:t,projectId:n})=>!e||!n?null:e.kind===`ticket`?e.project_id===n?e:null:ufe({activeRun:e,project:t})?e:null,s9=`Project root has uncommitted changes. Confirm branch switch to continue.`,ffe=({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,pfe=()=>{let[e,t]=(0,p.useState)(`opencode`),[n,r]=(0,p.useState)(!1),[i,a]=(0,p.useState)([]),[o,s]=(0,p.useState)(()=>window.localStorage.getItem(H7)),[c,l]=(0,p.useState)(null),[u,d]=(0,p.useState)(null),[f,m]=(0,p.useState)(null),[h,g]=(0,p.useState)({}),[_,v]=(0,p.useState)({}),[y,b]=(0,p.useState)({}),[x,S]=(0,p.useState)({}),[C,w]=(0,p.useState)({}),[T,E]=(0,p.useState)(cfe),[D,O]=(0,p.useState)(lfe),[k,A]=(0,p.useState)(ife),[j,M]=(0,p.useState)(afe),[N,P]=(0,p.useState)(ofe),[F,I]=(0,p.useState)(null),[L,R]=(0,p.useState)([]),[z,B]=(0,p.useState)(!1),[V,H]=(0,p.useState)(``),[U,W]=(0,p.useState)(``),[G,K]=(0,p.useState)(!1),[ee,te]=(0,p.useState)(null),[ne,re]=(0,p.useState)(null),[ie,ae]=(0,p.useState)(null),[oe,se]=(0,p.useState)(!1),[ce,le]=(0,p.useState)({}),[ue,de]=(0,p.useState)(sfe),[fe,pe]=(0,p.useState)(null),[me,he]=(0,p.useState)(()=>j7()),[ge,_e]=(0,p.useState)(()=>A7()),[ve,ye]=(0,p.useState)(0),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)(null),[we,Te]=(0,p.useState)({}),[Ee,De]=(0,p.useState)({}),[Oe,ke]=(0,p.useState)({}),[Ae,je]=(0,p.useState)({}),[Me,Ne]=(0,p.useState)(!1),[q,Pe]=(0,p.useState)(!1),[Fe,Ie]=(0,p.useState)(!1),[Le,Re]=(0,p.useState)(!1),[ze,Be]=(0,p.useState)(!1),{isGitHubConnected:Ve,defaultBaseBranch:He}=QC(o),[Ue,We]=(0,p.useState)(null),Ke=(0,p.useRef)(null),qe=(0,p.useRef)(null),Je=(0,p.useRef)(null),J=i.find(e=>e.id===o)??null,Xe=!!J?.memory_enabled,Ze=o?ue[o]??`board`:`board`,Y=Ze===`memory`?Xe?`memory`:`board`:Ze,Qe=(0,p.useCallback)(e=>{o&&(de(t=>({...t,[o]:e.workspace})),he(t=>M7(t,e.workspace)),pe(e))},[o]),$e=(0,p.useCallback)((e,t,n)=>{o&&Qe({workspace:`chat`,draft:!0,draftText:e,specSessionId:t,specSnapshotId:n})},[o,Qe]),et=(0,p.useCallback)((e,t)=>{Qe({workspace:`spec`,specSessionId:e,specSnapshotId:t})},[Qe]),tt=(0,p.useCallback)(e=>{if(e.source_available){if(e.ticket_id){Qe({workspace:`board`,ticketId:e.ticket_id});return}if(e.chat_session_id){Qe({workspace:`chat`,chatSessionId:e.chat_session_id});return}e.spec_session_id&&Qe({workspace:`spec`,specSessionId:e.spec_session_id})}},[Qe]),nt=(0,p.useCallback)(e=>{if(e.available){if(e.kind===`ticket`){Qe({workspace:`board`,ticketId:e.id});return}if(e.kind===`chat_session`){Qe({workspace:`chat`,chatSessionId:e.id});return}e.kind===`spec_session`&&Qe({workspace:`spec`,specSessionId:e.id})}},[Qe]),it=(0,p.useCallback)(e=>{Qe({workspace:`spec`,issueDraft:!0,draft:e})},[Qe]),at=(0,p.useCallback)(e=>{Qe({workspace:`board`,issueDraft:!0,draft:e})},[Qe]),ot=(0,p.useCallback)(()=>{pe(null)},[]),st=J!==null,ct=$de(J),lt=!!J?.run_ide?.trim(),ut=o!==null&&u===o,dt=o!==null&&(!ct||f===o),ft=o?h[o]??r9(o):null,pt=o?_[o]??null:null,mt=o?!!y[o]:!1,gt=o?x[o]??null:null,_t=(0,p.useMemo)(()=>o?we[o]??[]:[],[o,we]),vt=o?!!Ee[o]:!1,yt=o?Oe[o]??{current_branch:null,default_branch:null,previous_branch:null}:{current_branch:null,default_branch:null,previous_branch:null},bt=o?!!Ae[o]:!1,xt=o?C[o]??null:null,St=a9(T,o),Ct=St!==`hidden`,wt=dfe({activeRun:c,project:J,projectId:o}),Tt=wt?.context_key??null,Et=o?D[o]??null:null,Dt=o9(J),Ot=Tt===F,kt=(0,p.useMemo)(()=>yde(me),[me]),At=(0,p.useMemo)(()=>N7({hasRunning:kt.hasRunning,hasFinishedUnseen:ge.hasFinishedUnseen,hasErrorUnseen:ge.hasErrorUnseen}),[kt.hasRunning,ge.hasErrorUnseen,ge.hasFinishedUnseen]);(0,p.useEffect)(()=>{xe(null),Ce(null),qe.current=null},[o]),(0,p.useEffect)(()=>{Ce(null)},[Y]),(0,p.useEffect)(()=>{Ct||(qe.current=null)},[Ct]),(0,p.useEffect)(()=>{let e=be?.target?.kind??null;if(e===`ticket`||e===`bundle`){qe.current=be;return}(Y===`board`||!Ct)&&(qe.current=be)},[Ct,be,Y]),(0,p.useEffect)(()=>{he(j7())},[o]),(0,p.useEffect)(()=>{_e(A7())},[o]),(0,p.useEffect)(()=>{if(!o||lx(o))return;let e=new AbortController;return rt(o,e.signal).then(e=>{cx(o,e.connections)}).catch(e=>{Ye(e)}),()=>{e.abort()}},[o]);let jt=(0,p.useCallback)((e,t)=>{document.visibilityState!==`visible`&&(!t.didFinish&&!t.didError||_e(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`&&_e(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)(()=>(Ke.current===null&&(Ke.current=document.querySelector(`link[rel="icon"]`)?.getAttribute(`href`)??`/favicon.svg`),B7({defaultHref:Ke.current,state:At}),()=>{B7({defaultHref:Ke.current,state:null})}),[At]);let Nt=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r}=t;try{let t=await zn(e,r,{refreshRemote:n});if(r?.aborted)return;g(n=>({...n,[e]:rfe(e,t)}))}catch(t){if(Ye(t))return;if(t instanceof Ge&&t.status===404){g(t=>({...t,[e]:{...r9(e),status:`unknown`}}));return}g(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}}))}},[]),Pt=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r,suppressLoading:i=!1}=t;i||b(t=>({...t,[e]:!0}));try{let t=await Xn(e,{refreshRemote:n,signal:r});if(r?.aborted)return;v(n=>({...n,[e]:t}))}catch(t){if(Ye(t))return;t instanceof Ge&&t.status===404&&v(t=>({...t,[e]:null}))}finally{!r?.aborted&&!i&&b(t=>({...t,[e]:!1}))}},[]),Ft=(0,p.useCallback)((e,t)=>{S(n=>({...n,[e]:t}))},[]),Lt=(0,p.useCallback)(async(e,t)=>{v(n=>({...n,[e.id]:t})),e.active_target_kind!==`bundle`&&await Nt(e.id),j6(e.id)},[Nt]);(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let{tool:n}=await wr(e.signal);t(n)}catch(e){Ye(e)}finally{e.signal.aborted||r(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!G||i.length>0&&ee===null||z)return;let e=new AbortController;return(async()=>{try{R(await Cr(`opencode`,e.signal))}catch(e){Ye(e)||R(e=>e)}finally{e.signal.aborted||B(!0)}})(),()=>{e.abort()}},[z,ee,i.length,G]),(0,p.useEffect)(()=>{let e=new AbortController,t=window.localStorage.getItem(H7);return(async()=>{try{let n=await Dn(e.signal);if(e.signal.aborted)return;a(n);let r=n[0]?.id??null;s(n.some(e=>e.id===t)?t:r)}catch(e){Ye(e)||a([])}finally{e.signal.aborted||K(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(Be(!1),!o||!Ve||Le)return;let e=new AbortController,t=async()=>{try{let t=await Vt(o,e.signal);e.signal.aborted||Be(t.activeCount>0)}catch(e){Ye(e)}};t();let n=window.setInterval(()=>{t()},K7);return()=>{e.abort(),window.clearInterval(n)}},[o,Le,Ve]),(0,p.useEffect)(()=>{if(G){if(o){window.localStorage.setItem(H7,o);return}window.localStorage.removeItem(H7)}},[o,G]),(0,p.useEffect)(()=>{window.localStorage.setItem(U7,JSON.stringify(ue))},[ue]),(0,p.useEffect)(()=>{window.localStorage.setItem(W7,JSON.stringify(T))},[T]),(0,p.useEffect)(()=>{window.localStorage.setItem(G7,JSON.stringify(D))},[D]),(0,p.useEffect)(()=>{g(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),v(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),b(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[i]),(0,p.useEffect)(()=>{le(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[i]),(0,p.useEffect)(()=>{let e=new Set(i.map(e=>e.id));Te(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),De(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),ke(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),je(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t))))},[i]),(0,p.useEffect)(()=>{G&&(w(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),E(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),O(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}))},[i,G]),(0,p.useEffect)(()=>{G&&de(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[i,G]),(0,p.useEffect)(()=>{if(!G||!o||!st)return;let e=!1,t=null,n=null;g(e=>e[o]?e:{...e,[o]:r9(o)});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([Nt(o,{refreshRemote:r,signal:a.signal}),Pt(o,{refreshRemote:r,signal:a.signal})])}catch{if(e||a.signal.aborted)return}finally{t===a&&(t=null,n=null)}};r(!1);let i=rx(()=>{document.visibilityState===`visible`&&r(!1)});return()=>{e=!0,t?.abort(),i()}},[o,st,G,Nt,Pt]),(0,p.useEffect)(()=>{if(o)return M6(e=>{e===o&&(Nt(e),Pt(e))})},[o,Nt,Pt]),(0,p.useEffect)(()=>{if(!o||!st)return;let e=pt?.operation_state??`idle`;if(!(gt===`rebase`||e!==`idle`))return;let t=!1,n=null,r=null,i=async()=>{r?.abort(),r=new AbortController;try{await Pt(o,{signal:r.signal,suppressLoading:!0})}catch{}finally{t||(n=window.setTimeout(()=>{i()},Ude))}};return i(),()=>{t=!0,r?.abort(),n!==null&&window.clearTimeout(n)}},[gt,o,pt?.operation_state,st,Pt]);let Rt=(0,p.useCallback)(async e=>{let t=o;if(!t){l(null),m(null);return}try{let n=await Ht(t,e);e?.aborted||(l(n.active_run),m(t))}catch(e){Ye(e)}},[o]),zt=(0,p.useCallback)(async e=>{let t=o;if(t)try{let n=await It(t,e);e?.aborted||w(e=>({...e,[t]:n}))}catch(e){Ye(e)}},[o]);(0,p.useEffect)(()=>{if(!G)return;if(!ct){l(null),m(null);return}if(!ut)return;let e=new AbortController;m(null),Rt(e.signal);let t=window.setInterval(()=>{Rt(e.signal)},K7),n=rx(()=>{document.visibilityState===`visible`&&Rt(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[ut,ct,G,Rt]),(0,p.useEffect)(()=>{if(!G||!o||!ut||!Dt)return;let e=new AbortController;zt(e.signal);let t=window.setInterval(()=>{zt(e.signal)},K7),n=rx(()=>{document.visibilityState===`visible`&&zt(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[o,ut,Dt,G,zt]),(0,p.useEffect)(()=>{window.localStorage.setItem(q7,String(k))},[k]),(0,p.useEffect)(()=>{window.localStorage.setItem(J7,j)},[j]),(0,p.useEffect)(()=>{window.localStorage.setItem(Y7,String(N))},[N]),(0,p.useEffect)(()=>{o&&Tt&&O(e=>{let t=e[o]??null;return!t||t===Tt?e:{...e,[o]:null}})},[o,Tt]),(0,p.useEffect)(()=>{!o||!wt||!o9(J)||Et!==wt.context_key&&E(e=>a9(e,o)===`hidden`?{...e,[o]:`inline`}:e)},[J,o,Et,wt]);let Bt=async e=>{try{t((await Tr(e)).tool)}catch{}},Gt=(0,p.useCallback)(e=>{a(t=>t.map(t=>t.id===e.id?e:t))},[]),Kt=(0,p.useCallback)((e,t)=>{Te(n=>{let r=[t,...(n[e]??[]).filter(e=>e.id!==t.id)];return{...n,[e]:r}})},[]),qt=(0,p.useCallback)(async e=>{je(t=>({...t,[e]:!0}));try{let t=await Nn(e);ke(n=>({...n,[e]:t}))}catch(e){$.error(e instanceof Ge?e.message:`Unable to load the project target options right now.`,{id:`project-target-selector-load-error`})}finally{je(t=>({...t,[e]:!1}))}},[]),Jt=async e=>{try{let t=await On(t9(e));return a(e=>[...e,t]),s(t.id),te(null),null}catch(e){return e instanceof Ge?e.message:`Unable to create the project right now.`}},Yt=async e=>{if(!J)return`Select a project before editing settings.`;try{let t=await kn(J.id,t9(e));return a(e=>e.map(e=>e.id===t.id?t:e)),ye(e=>e+1),te(null),null}catch(e){return e instanceof Ge?e.message:`Unable to update the project right now.`}},Xt=async()=>{if(!J)return`Select a project before deleting it.`;try{await jn(J.id);let e=i.filter(e=>e.id!==J.id);return a(e),s(e[0]?.id??null),te(null),null}catch(e){return e instanceof Ge?e.message:`Unable to delete the project right now.`}},Zt=(0,p.useCallback)(e=>{a(t=>t.map(t=>nfe(t,e)))},[]),Qt=(0,p.useCallback)((e,t)=>{e&&Te(n=>({...n,[e]:t}))},[]),$t=(0,p.useCallback)((e,t)=>{e&&De(n=>({...n,[e]:t}))},[]),en=async(e,t,n)=>await Fn({repo_path:e,helper_model:t||null,helper_variant:t&&n||null}),tn=async()=>(await In()).repo_path,nn=(0,p.useCallback)(async e=>{let t=await Ln({repo_path:e});return{valid:t.valid,repoRoot:t.repo_root,error:t.error,willInitialize:t.will_initialize,hasInitialCommit:t.has_initial_commit}},[]),rn=(0,p.useCallback)(async()=>{if(!(!J||oe)){se(!0);try{let e=await An(J.id);a(t=>t.map(t=>t.id===e.id?e:t)),$.success(`Initial commit created.`,{id:`project-initial-commit-success`}),Nt(e.id),Pt(e.id)}catch(e){$.error(e instanceof Ge?e.message:`Unable to create the initial commit right now.`,{id:`project-initial-commit-error`})}finally{se(!1)}}},[J,oe,Nt,Pt]),an=(0,p.useCallback)((e,t)=>{E(t=>({...t,[e]:`hidden`})),t&&O(n=>({...n,[e]:t}))},[]),on=(0,p.useCallback)(()=>{o&&an(o,Tt)},[o,an,Tt]),sn=(0,p.useCallback)(e=>{o&&(E(e=>({...e,[o]:`hidden`})),e&&l(t=>t?.context_key===e?null:t))},[o]),cn=(0,p.useCallback)(async()=>{if(!wt||F===wt.context_key)return;let{context_key:e}=wt;I(e);try{wt.kind===`ticket`?await gn(wt.ticket_id,wt.project_id):l((await Wt(wt.project_id)).active_run),sn(e),await Promise.all([Rt(),zt()])}catch(e){$.error(e instanceof Ge?e.message:`Unable to stop the preview run right now.`,{id:`app-preview-run-stop-error`})}finally{I(t=>t===e?null:t)}},[sn,wt,zt,Rt,F]),ln=(0,p.useCallback)(e=>{!e||!o||qt(o)},[o,qt]),un=(0,p.useCallback)(e=>new Promise(t=>{Je.current=t,We(e)}),[]),dn=(0,p.useCallback)(e=>{let t=Je.current;Je.current=null,We(null),t?.(e)},[]),fn=(0,p.useCallback)(async e=>{if(!J||!o)throw Error(`Select a project first.`);if(!ffe({activeProject:J,activeProjectBranchState:ft,nextTarget:e})||!c||c.kind!==`project`||c.project_id!==J.id)return!0;if(!await un({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=c.context_key,t=await Wt(J.id);return sn(e),l(t.active_run),await zt(),!0}catch(e){return $.error(e instanceof Ge?e.message:`Unable to stop the project run right now.`,{id:`project-target-switch-stop-run-error`}),!1}},[J,ft,o,c,sn,zt,un]),pn=(0,p.useCallback)(async e=>{if(!o)throw Error(`Select a project first.`);return await fn({kind:`bundle`,bundleId:e})?(Gt(await Pn(o,{kind:`bundle`,bundle_id:e})),v(e=>({...e,[o]:null})),await Promise.all([Nt(o),Pt(o)]),!0):!1},[o,fn,Nt,Pt,Gt]),mn=(0,p.useCallback)(async(e,t={})=>{if(!o)throw Error(`Select a project first.`);if(!await fn({kind:`repo_root`,branch:e}))return!1;let n=n=>Pn(o,{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 Ge&&e.status===409&&e.message===s9){if(!await un({title:`Switch repo root branch?`,description:`${s9}\n\nSwitch anyway?`,confirmLabel:`Switch anyway`,cancelLabel:`Keep current branch`}))return!1;r=await n(!0)}else throw e}return Gt(r),v(e=>({...e,[o]:null})),await Promise.all([Nt(o),Pt(o),qt(o)]),!0},[o,fn,qt,Nt,Pt,Gt,un]),hn=(0,p.useCallback)(async e=>!e.target_kind||e.target_available===!1?!0:e.target_kind===`bundle`?e.target_bundle_id?await pn(e.target_bundle_id):!1:await mn(e.target_branch_snapshot??null,{createBranch:!1}),[pn,mn]),_n=(0,p.useCallback)(async e=>{o&&await pn(e)&&Qe({workspace:`chat`,startNewDraft:!0})},[o,pn,Qe]),vn=(0,p.useCallback)(()=>{Ne(!0)},[]),yn=(0,p.useCallback)(()=>{Ne(!1)},[]),bn=(0,p.useCallback)(e=>{if(e){pn(e);return}mn(null)},[pn,mn]),xn=(0,p.useCallback)(async e=>{if(!o)throw Error(`Select a project first.`);let t=await ht(o,{name:e,prepare:!0});return Kt(o,t),ye(e=>e+1),t},[o,Kt]),Sn=(0,p.useCallback)(async e=>{if(!o)throw Error(`Select a project first.`);await Mt(o,e),Te(t=>({...t,[o]:(t[o]??[]).filter(t=>t.id!==e)})),ye(e=>e+1)},[o]),Cn=(0,p.useCallback)(async()=>{if(!J)return;let e=J.active_target_kind??`repo_root`,t=J.active_target_bundle_id??null,n=c?.kind===`project`&&c.project_id===J.id&&(c.target_kind??`repo_root`)===e&&((c.target_kind??`repo_root`)!==`bundle`||c.target_bundle_id===t),r=n?c?.context_key??null:null,i=!n&&o9(J)&&St===`hidden`;i&&(E(e=>({...e,[J.id]:`inline`})),O(e=>({...e,[J.id]:null})));try{let e=n?await Wt(J.id):await Ut(J.id);n&&sn(r),l(e.active_run),zt()}catch(e){i&&E(e=>({...e,[J.id]:`hidden`})),$.error(e instanceof Ge?e.message:`Unable to update the project run right now.`,{id:`app-project-run-error`})}},[St,J,c,sn,zt]),wn=(0,p.useCallback)(async()=>{if(!(!J||!lt))try{await Mn(J.id)}catch(e){$.error(e instanceof Error?e.message:`Unable to open the IDE right now.`,{id:`app-project-open-ide-error`})}},[J,lt]),Tn=(0,p.useCallback)(async()=>{if(J){Ft(J.id,`pull`);try{let e=await Bn(J.id);await Lt(J,e),$.success(e.behind===0?V7(`branchSynced`):V7(`branchUpdated`),{id:`app-project-pull-success`})}catch(e){$.error(e instanceof Ge?e.message:V7(`syncFallbackError`),{id:`app-project-pull-error`})}finally{Ft(J.id,null)}}},[J,Lt,Ft]),En=(0,p.useCallback)(async()=>{if(!J)return;let e=pt?.base_branch??null;Ft(J.id,`rebase`);try{let t=await Vn(J.id);await Lt(J,t);let n=t.base_branch??e;$.success(n?V7(`branchRebasedOnto`,{branch:n}):V7(`branchRebased`),{id:`app-project-rebase-success`})}catch(e){await Promise.allSettled([Nt(J.id),Pt(J.id,{suppressLoading:!0})]),$.error(e instanceof Ge?e.message:V7(`rebaseFallbackError`),{id:`app-project-rebase-error`})}finally{Ft(J.id,null)}},[J,pt?.base_branch,Lt,Nt,Pt,Ft]),Rn=(0,p.useCallback)(async()=>{if(J){Ft(J.id,`abort`);try{await Lt(J,await Hn(J.id)),$.success(V7(`gitOperationAborted`),{id:`app-project-abort-success`})}catch(e){$.error(e instanceof Ge?e.message:V7(`abortFallbackError`),{id:`app-project-abort-error`})}finally{Ft(J.id,null)}}},[J,Lt,Ft]),Un=(0,p.useCallback)(e=>{if(!J)return;let t=J.active_target_kind??`repo_root`,n=J.active_target_bundle_id??null,r=t===`bundle`?_t.find(e=>e.id===n):null;re({projectId:J.id,title:J.name,initialMode:e,targetKind:t,targetBundleId:n,bundleTargetName:r&&rb(r)||null,hasHelperModel:!!J.helper_model,repoRootDefaultBranch:yt.default_branch})},[J,yt.default_branch,_t]),Wn=(0,p.useCallback)(()=>{if(!ne)return;let{projectId:e}=ne;re(null),Nt(e),Pt(e)},[Nt,Pt,ne]),Gn=(0,p.useCallback)(()=>{if(!J)return;let e=J.active_target_kind??`repo_root`,t=J.active_target_bundle_id??null,n=e===`bundle`?_t.find(e=>e.id===t):null,r=n?.required_check_policy;ae({projectId:J.id,targetKind:e,targetBundleId:t,targetLabel:n?rb(n):J.name,definitions:cw(J),requiredDefinitionIds:r?.required_check_definition_ids??lw(J),preReviewDefinitionIds:r?.pre_review_check_definition_ids??uw(J)})},[J,_t]),Kn=(0,p.useCallback)(()=>{ae(null)},[]),qn=i9(ce,o),Jn=J?fw(J).length>0:!1,Yn=J?cw(J).length>0:!1,Zn=Y===`chat`?Se:null,Qn=qe.current,$n=Qn?.target?.kind??null,er=Y===`chat`?$n===`ticket`||$n===`bundle`?{target:Qn?.target??null,canSelect:!1,disabledReason:`This preview belongs to a ticket run. Return to Board to send preview comments.`,promptMode:Qn?.promptMode??null,onPromptModeChange:Qn?.onPromptModeChange??null,isUpdatingPromptMode:Qn?.isUpdatingPromptMode??!1,promptPlaceholder:Qn?.promptPlaceholder??null,promptComposerControls:Qn?.promptComposerControls,promptComposerInlineControls:Qn?.promptComposerInlineControls,submitPrompt:null}:Zn?{target:{kind:`chat_session`,id:Zn.chatSessionId??`draft:${o}`},canSelect:Zn.canSubmitReviewPrompt,disabledReason:Zn.canSubmitReviewPrompt?null:Zn.reviewSubmitDisabledReason??`Wait for the current chat turn to finish before sending preview comments.`,promptMode:Zn.mode,onPromptModeChange:Zn.onModeChange,isUpdatingPromptMode:Zn.isUpdatingMode,promptPlaceholder:Zn.promptPlaceholder,promptComposerControls:Zn.promptComposerControls,promptComposerInlineControls:Zn.promptComposerInlineControls,submitPrompt:Zn.canSubmitReviewPrompt?Zn.submitPrompt:null}:{target:null,canSelect:!1,disabledReason:`Select a chat session to send preview comments.`,submitPrompt:null}:be,tr=Zn?.canSubmitReviewPrompt??!1,nr=Y===`chat`?Zn?Zn.reviewSubmitDisabledReason:`Select a chat session to send review comments.`:vC.t(`common:workspaceReviewModal.chatRequired`),rr=(0,p.useCallback)(()=>{o&&le(e=>{let t=e[o]??X7;return{...e,[o]:{hasMounted:!0,isOpen:!t.isOpen,isExpanded:t.isExpanded}}})},[o]),ir=(0,p.useCallback)(e=>{le(t=>{let n=t[e]??X7;return!n.hasMounted||!n.isOpen?t:{...t,[e]:X7}})},[]),ar=(0,p.useCallback)(e=>{le(t=>{let n=t[e]??X7;return{...t,[e]:{hasMounted:!0,isOpen:n.isOpen,isExpanded:!n.isExpanded}}})},[]),or=(0,p.useCallback)(()=>{te(`create`)},[]),sr=(0,p.useCallback)(()=>{if(o){if(Ct){on();return}E(e=>({...e,[o]:`inline`})),O(e=>({...e,[o]:null}))}},[o,on,Ct]),cr=(0,p.useCallback)(()=>{o&&E(e=>{let t=a9(e,o);return{...e,[o]:t===`expanded`?`inline`:`expanded`}})},[o]),lr=J?J.preview_service_name?.trim()?J.preview_capability_mode===`force_disabled`?`Preview is disabled for this project.`:xt?.state===`unsupported`?xt.message??`Preview is unavailable for this project.`:Ct?`Hide preview`:`Show preview`:`Choose a named preview service in project settings first.`:`Select a project first.`,ur=!J||!J.preview_service_name?.trim()||J.preview_capability_mode===`force_disabled`||xt?.state===`unsupported`,dr=J&&J.preview_service_name?.trim()?(0,X.jsx)(IN,{project:J,mode:St===`expanded`?`expanded`:`inline`,status:xt,viewportPreset:j,zoom:N,activeRun:wt,reviewCapability:er,isStoppingActiveRun:Ot,onHide:on,onStopActiveRun:()=>{cn()},onToggleExpanded:cr,onViewportPresetChange:M,onZoomChange:P}):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)(tx,{}),i.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)(ote,{activeProjectId:o,onCreateProject:or,projects:i,onEditProject:()=>te(`edit`),onProjectChange:s})}),o&&(0,X.jsx)(sC,{projectId:o,onStartSpecFromDraft:it,onCreateTicketFromDraft:at})]})}),(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)(Qb,{activeTool:e,onMobileAccessOpen:()=>Pe(!0),onOpenActivity:()=>Ie(!0),onToolChange:Bt,...Ve?{hasActiveGitHubRuns:ze,onOpenGitHubActions:()=>Re(!0)}:{}})}),o&&(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)(Nde,{activeWorkspace:Y,activityByWorkspace:me,className:`w-fit max-w-full`,memoryEnabled:Xe,onWorkspaceChange:e=>{o&&(de(t=>({...t,[o]:e})),he(t=>M7(t,e)))}})})]})}),G?i.length===0?(0,X.jsx)(ite,{activeTool:e,availableHelperModels:L,helperModel:V,helperVariant:U,isHelperModelsLoaded:z,isToolLoaded:n,onCreateProject:or,onHelperModelChange:e=>{H(e),W(``)},onHelperVariantChange:W,onToolChange:Bt}):(0,X.jsxs)(X.Fragment,{children:[J?.has_initial_commit===!1&&(0,X.jsx)(Mte,{isSubmitting:oe,onCreateInitialCommit:()=>{rn()}}),(0,X.jsx)(jde,{activeProjectId:o,activeProject:J,activeProjectBranchState:ft,targetBundles:_t,targetBranchSuggestions:yt,isTargetBundleLoading:vt,isTargetSelectorLoading:bt,onTargetSelectorOpenChange:ln,onSelectBundleTarget:pn,onSelectRepoRootTarget:mn,activeRun:c,activeTool:e,onRestoreChatSessionTarget:hn,onChatReviewCapabilityChange:Ce,isPreviewButtonDisabled:ur,onPreviewReviewCapabilityChange:xe,onPreviewToggle:sr,onRunStopped:sn,onWorkspaceActivityChange:he,onWorkspaceActivityEvent:jt,pendingWorkspaceNavigation:fe,onPendingWorkspaceNavigationConsumed:ot,onSpecImplementationChatReady:$e,onViewSourceSpec:et,onNavigateToLifecycleSource:nt,onViewMemorySource:tt,onStartChatFromBundle:_n,previewDisplayMode:St,previewPane:dr,previewPaneWidth:k,previewButtonTitle:lr,visibleWorkspace:Y,refreshKey:ve,onBoardLoadedProjectIdChange:d,onBundlesChange:Qt,onBundlesLoadingChange:$t,onPreviewPaneWidthChange:A,onProjectUsageChange:Zt,onRunStatusChange:()=>{Rt(),zt()}},o??`no-project`)]}):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Loading projects...`}),i.length>0&&(0,X.jsx)(cb,{activeProject:J,activeRun:c,branchState:ft,targetGitStatus:pt,isBoardLoadedForActiveProject:ut,activeProjectBranchAction:gt,isProjectIdeAvailable:lt,isProjectRunAvailable:ct,isRunStatusLoadedForActiveProject:dt,isTerminalOpen:qn.isOpen,targetBundles:_t,targetBranchSuggestions:yt,isTargetBundleLoading:vt,isTargetSelectorLoading:bt,isTargetGitStatusLoading:mt,hasConfiguredTests:Jn,hasConfiguredChecks:Yn,onProjectIdeOpen:()=>{wn()},onProjectPull:()=>{Tn()},onProjectRebase:En,onProjectAbortGitOperation:Rn,onProjectRunToggle:()=>{Cn()},onProjectFilesOpen:()=>Un(`files`),onProjectChangesOpen:()=>Un(`changes`),onProjectVerificationOpen:Gn,onTerminalToggle:rr,onTargetSelectorOpenChange:ln,onSelectBundleTarget:pn,onSelectRepoRootTarget:mn,onManageBundles:vn}),(0,X.jsx)(wne,{activeProjectId:o,open:q,onOpenChange:Pe}),Fe&&o&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(Xde,{projectId:o,onClose:()=>Ie(!1),onNavigateToLifecycleSource:nt})}),Le&&o&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(Yde,{projectId:o,defaultBranch:He,onClose:()=>Re(!1)})}),Me&&J&&(0,X.jsx)(AC,{bundles:_t,selectedBundleId:J.active_target_kind===`bundle`?J.active_target_bundle_id??null:null,activeTargetBundleId:J.active_target_kind===`bundle`?J.active_target_bundle_id??null:null,onSelectBundle:bn,onCreateBundle:xn,onDeleteBundle:Sn,onClose:yn}),Ue&&(0,X.jsx)(gC,{title:Ue.title,description:Ue.description,confirmLabel:Ue.confirmLabel,cancelLabel:Ue.cancelLabel,confirmVariant:Ue.confirmVariant,onConfirm:()=>dn(!0),onCancel:()=>dn(!1)}),i.map(e=>{let t=i9(ce,e.id);return t.hasMounted?(0,X.jsx)(Mde,{project:e,isExpanded:t.isExpanded,isVisible:e.id===o&&t.isOpen,onClose:()=>ir(e.id),onToggleExpanded:()=>ar(e.id)},e.id):null}),ee&&(0,X.jsx)(wE,{mode:ee,projectId:ee===`edit`&&J?J.id:null,availableHelperModels:L,isLoadingHelperModels:!z,isAutoConfigReady:n,initialValues:ee===`edit`&&J?Qde(J):i.length===0?{name:``,repoPath:``,linkedProjectIds:[],runSetup:[],runServices:[],checkDefinitions:[],runIde:``,previewServiceName:``,previewPath:``,previewCapabilityMode:`auto`,helperModel:V,helperVariant:U,commitMessageRules:``,commitAfterEachTicket:!1,autoParkStaleTickets:!1,memoryEnabled:!1,worktreeSync:[],specAwareCodeReviewEnabled:!1,automationDepth:`manual`,automationReviewFixEnabled:!1,automationPauseOnOpenQuestions:!1,automationReviewSeverity:`medium`,automationReviewMaxIterations:3}:void 0,linkedProjectOptions:i.filter(e=>e.id!==J?.id).map(e=>({id:e.id,name:e.name})),repoPathLocked:ee===`edit`&&J?J.repo_path_locked:!1,repoPathLockedMessage:ee===`edit`&&J?efe(J):null,deleteBlockedMessage:ee===`edit`&&J?tfe(J,i):null,onDelete:ee===`edit`?Xt:void 0,onAutoConfig:en,onBrowseRepoPath:tn,onValidateRepoPath:nn,onClose:()=>te(null),onSubmit:ee===`edit`?Yt:Jt}),ne&&ne.projectId===o&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(qde,{target:{scope:`project_root`},initialMode:ne.initialMode,enabledModes:[`changes`,`files`],projectId:ne.projectId,targetKind:ne.targetKind,reviewCommentsBundleId:ne.targetKind===`bundle`?ne.targetBundleId:null,title:ne.title,bundleTargetName:ne.bundleTargetName,hasHelperModel:ne.hasHelperModel,repoRootDefaultBranch:ne.repoRootDefaultBranch,onSubmitReviewPrompt:Zn?.submitPrompt,canSubmitReviewPrompt:tr,reviewSubmitDisabledReason:nr??void 0,canAddReviewComments:tr,canModifyChanges:!0,mode:Zn?.mode,onModeChange:Zn?.onModeChange,canToggleMode:!!Zn?.canSubmitReviewPrompt,isUpdatingMode:Zn?.isUpdatingMode??!1,onClose:Wn})}),ie&&ie.projectId===o&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(Jde,{targetLabel:ie.targetLabel,definitions:ie.definitions,requiredDefinitionIds:ie.requiredDefinitionIds,preReviewDefinitionIds:ie.preReviewDefinitionIds,checksTarget:{projectId:ie.projectId,targetKind:ie.targetKind,targetBundleId:ie.targetBundleId},testsTarget:{scope:`project`,projectId:ie.projectId,targetKind:ie.targetKind,targetBundleId:ie.targetBundleId},onClose:Kn,onOpenActivity:()=>{ae(null),Ie(!0)}})})]})},mfe=({className:e})=>(0,X.jsx)(Og,{"aria-hidden":`true`,className:e}),c9=`X-Archon-Mobile-CSRF`,hfe=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 Ge(await Xe(n,`Mobile request failed.`),n.status,e)}return n},l9=async(e,t={})=>await(await hfe(e,t)).json(),gfe=e=>l9(`/mobile/projects`,{signal:e}),_fe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/summary`,{signal:t}),vfe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/target-options`,{signal:t}),yfe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,{signal:t}),bfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,{signal:n}),xfe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets`,{signal:t}),Sfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,{signal:n}),Cfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/agent-runs`,{signal:n}),wfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),Tfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),Efe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}`,{signal:n}),Dfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/build`,u9(n)),Ofe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/review`,u9(n)),u9=(e,t,n=`POST`)=>({method:n,headers:{"Content-Type":`application/json`,[c9]:e},body:t===void 0?void 0:JSON.stringify(t)}),kfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,u9(t,n)),Afe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/messages`,u9(n,r)),jfe=(e,t,n,r,i)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Mfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),Nfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/stop`,u9(n)),Pfe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,{signal:t}),Ffe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,{signal:n}),Ife=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,u9(t,n)),d9=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/messages`,u9(n,r)),Lfe=(e,t,n,r,i)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Rfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),zfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/stop`,u9(n)),f9=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/state`,u9(n,{state:r},`PATCH`)),Bfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/run`,u9(n)),Vfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop`,u9(n)),p9=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop-build`,u9(n)),m9=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/resume-build`,u9(n)),Hfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),Ufe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-follow-up`,u9(n,{instruction:r})),Wfe=(e,t,n,r,i)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Gfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/follow-up`,u9(n,{instruction:r})),Kfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/follow-up`,u9(n,{instruction:r})),h9=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/target`,u9(t,n)),qfe=(e,t)=>l9(`/mobile/models?tool=${encodeURIComponent(e)}`,{signal:t}),Jfe=(e,t,n)=>{let r=new URLSearchParams({tool:e});return t&&r.set(`project_id`,t),l9(`/mobile/skills?${r.toString()}`,{signal:n})},Yfe=({className:e})=>(0,X.jsx)(Cg,{"aria-hidden":`true`,className:e}),g9=e=>vC.t(`common:mobileApp.${e}`),Xfe={key:`overview`,label:g9(`navigation.overview`),Icon:Yfe},_9={key:`tickets`,label:g9(`navigation.tickets`),Icon:Q5,ctaAriaLabel:g9(`overviewActions.ticketsAriaLabel`)},v9={key:`chats`,label:g9(`navigation.chats`),Icon:HE,ctaAriaLabel:g9(`overviewActions.chatsAriaLabel`)},y9={key:`spec`,label:g9(`navigation.spec`),Icon:iC,ctaAriaLabel:g9(`overviewActions.specAriaLabel`)},Zfe=[Xfe,_9,v9,y9],Qfe=({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})})}),b9=({title:e,description:t,children:n})=>(0,X.jsx)(Qfe,{children:(0,X.jsxs)(bC,{className:`w-full border-border/80 bg-card/90 shadow-2xl shadow-black/20`,children:[(0,X.jsxs)(xC,{children:[(0,X.jsx)(SC,{children:e}),(0,X.jsx)(CC,{children:t})]}),n&&(0,X.jsx)(TC,{className:`space-y-4`,children:n})]})}),$fe=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`},epe=({status:e})=>{let t=$fe(e);return(0,X.jsxs)(yC,{variant:t.variant,className:`gap-1.5 px-2.5 py-1 text-[11px] uppercase tracking-[0.14em]`,children:[(0,X.jsx)(pb,{state:t.indicatorState,className:`mt-0`}),t.label]})},tpe=({status:e,onRetry:t})=>e===`connected`?null:e===`unavailable`?(0,X.jsx)(bC,{className:`border-red-500/25 bg-destructive/10 shadow-none`,children:(0,X.jsxs)(TC,{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)(bC,{className:`border-amber-500/25 bg-amber-500/10 shadow-none`,children:(0,X.jsx)(TC,{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.`})}),npe=({selectedProject:e,targetLabel:t,isTargetLoading:n,isTargetDisabled:r,connectionState:i,onOpenProjects:a,onOpenTargetSelector:o})=>(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:a,children:[(0,X.jsx)(`div`,{className:`truncate text-base font-medium text-foreground`,children:e?.name??`Choose a project`}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e?.repo_path??`Select a desktop project to continue`})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(epe,{status:i}),(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:r,onClick:o,children:[(0,X.jsx)(Yv,{className:`h-3.5 w-3.5 shrink-0`}),n?(0,X.jsx)(Mv,{className:`h-3.5 w-16`}):(0,X.jsx)(`span`,{className:`truncate text-xs sm:text-sm`,children:t})]}),(0,X.jsx)(Q,{variant:`outline`,size:`icon-sm`,"aria-label":`Choose project`,onClick:a,children:(0,X.jsx)(Fv,{className:`h-4 w-4`})})]})]})}),rpe=({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:Zfe.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)})})}),x9=({title:e,description:t,action:n})=>(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsxs)(xC,{children:[(0,X.jsx)(SC,{children:e}),(0,X.jsx)(CC,{children:t})]}),n&&(0,X.jsx)(TC,{children:n})]}),S9=({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)(Rv,{className:`h-4 w-4 animate-spin`}),(0,X.jsx)(`span`,{children:e})]}),ipe=e=>e?`Repo root (${e})`:`Repo root`,ape=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)}...`},C9=(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?rb(n):`Selected bundle`}return ape(t?.current_branch??null)},w9=({title:e,description:t,children:n})=>(0,X.jsxs)(`div`,{className:`flex max-h-[80vh] flex-col overflow-hidden`,children:[(0,X.jsxs)(Z_,{className:`border-b border-border/70 px-4 py-4`,children:[(0,X.jsx)($_,{children:e}),t&&(0,X.jsx)(ev,{children:t})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:n})]}),ope=({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)(yC,{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...`}),spe=({open:e,projects:t,selectedProjectId:n,error:r,onOpenChange:i,onSelectProject:a,onRetry:o})=>(0,X.jsx)(K_,{open:e,onOpenChange:i,children:(0,X.jsx)(X_,{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)(w9,{title:`Projects`,children:(0,X.jsx)(ope,{projects:t,selectedProjectId:n,error:r,onSelectProject:e=>{a(e),i(!1)},onRetry:o})})})}),cpe=({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=Ky(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)(hv,{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:ipe(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)(Rv,{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:rb(e)})},e.id))})]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(hv,{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)(hv,{htmlFor:`mobile-project-target-branch-input`,className:`text-xs text-muted-foreground`,children:`Switch or create branch`}),(0,X.jsx)(tv,{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)(S9,{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)(K_,{open:e,onOpenChange:o,children:(0,X.jsx)(X_,{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)(w9,{title:`Target`,description:t?C9(t,n):void 0,children:g})})})},T9=e=>e.parked_at?`parked`:e.state,E9=e=>{let t=T9(e);return t===`parked`?`Done`:`${t.slice(0,1).toUpperCase()}${t.slice(1)}`},D9=e=>e===`plan`?`info`:e===`build`?`success`:e===`review`?`warning`:`outline`,O9=({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)(yC,{variant:D9(T9(e)),children:E9(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})]})]}),lpe=({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=rb(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)(RC,{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)(yC,{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)(zC,{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)(Av,{className:Z(`h-4 w-4 transition-transform`,s&&`rotate-180`)})})})]}),(0,X.jsx)(BC,{className:`pt-2`,children:(0,X.jsx)(`div`,{className:`space-y-2 pl-3`,children:e.tickets.map(t=>(0,X.jsx)(O9,{ticket:t,isSelected:t.id===n,onSelectTicket:t=>i(t,e.bundle.id),className:`rounded-xl`},t.id))})})]})},k9=(e,t)=>Zy(e,[],t),upe=e=>[{key:`plan`,label:`Plan`,tickets:e.filter(e=>!e.parked_at&&e.state===`plan`),items:k9(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:k9(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:k9(e.filter(e=>!e.parked_at&&e.state===`review`),`review`)},{key:`parked`,label:`Done`,tickets:e.filter(e=>e.parked_at),items:k9(e.filter(e=>e.parked_at),`done`)}].filter(e=>e.tickets.length>0),A9=({selectedProjectId:e,tickets:t,selectedBundleId:n,selectedTicketId:r,error:i,onRetry:a,onSelectBundle:o,onSelectTicket:s})=>{if(!e)return(0,X.jsx)(x9,{title:`Choose a project`,description:`Select a project before browsing tickets from this phone.`});if(i)return(0,X.jsx)(x9,{title:`Tickets unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:a,children:`Retry tickets`})});if(!t)return(0,X.jsx)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,X.jsx)(TC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading tickets...`})});if(t.length===0)return(0,X.jsx)(x9,{title:`No tickets`,description:`This project does not have any tickets yet.`});let c=upe(t);return(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(xC,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(SC,{children:`Tickets`}),(0,X.jsxs)(CC,{children:[t.length,` total`]})]}),(0,X.jsx)(TC,{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)(lpe,{group:e.group,selectedBundleId:n,selectedTicketId:r,onSelectBundle:o,onSelectTicket:s},e.group.id):(0,X.jsx)(O9,{ticket:e.ticket,isSelected:e.ticket.id===r,onSelectTicket:e=>s(e,null)},e.ticket.id))})]},e.key))})]})},dpe=e=>l9(`/mobile-auth/status`,{signal:e}),fpe=(e,t)=>l9(`/mobile-auth/pair/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t}),ppe=e=>l9(`/mobile-auth/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),mpe=e=>l9(`/mobile-auth/logout`,{method:`POST`,headers:{[c9]:e}}),hpe=()=>eC(window.location.origin,{withCredentials:!0}),j9=e=>vC.t(`common:mobileApp.${e}`),M9=`Project root has uncommitted changes. Confirm branch switch to continue.`,gpe=()=>{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},N9=({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})]}),_pe=()=>(0,X.jsxs)(`div`,{className:`space-y-3`,"data-testid":`mobile-overview-skeleton`,children:[(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(xC,{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)(Mv,{className:`h-6 w-28`}),(0,X.jsx)(Mv,{className:`h-6 w-28 rounded-full`})]})}),(0,X.jsxs)(TC,{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)(Mv,{className:`h-6 w-10`}),(0,X.jsx)(Mv,{className:`mt-2 h-3 w-16`})]},t))}),(0,X.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,X.jsx)(Mv,{className:`h-10 w-full rounded-xl`}),(0,X.jsx)(Mv,{className:`h-10 w-full rounded-xl`})]})]})]}),(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(xC,{children:(0,X.jsx)(Mv,{className:`h-6 w-20`})}),(0,X.jsx)(TC,{children:(0,X.jsx)(Mv,{className:`h-10 w-40 rounded-xl`})})]})]}),vpe=({isLoggingOut:e,onLogout:t})=>(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(xC,{children:(0,X.jsx)(SC,{children:`Session`})}),(0,X.jsx)(TC,{children:(0,X.jsxs)(Q,{variant:`destructive`,className:`gap-2`,disabled:e,onClick:t,children:[(0,X.jsx)(mfe,{className:`h-4 w-4`}),e?`Logging out...`:`Log out this phone`]})})]}),ype=({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=WF(a.filter(e=>e.state===`review`));return o===`building`?{label:vC.t(`common:statusBadge.building`),variant:`success`}:o===`reviewing`?{label:vC.t(`common:statusBadge.reviewing`),variant:`warning`}:a.some(e=>e.state===`build`)?{label:vC.t(`common:statusBadge.building`),variant:`success`}:a.some(e=>e.state===`plan`)?{label:`Planning`,variant:`info`}:{label:`Idle`,variant:`outline`}},bpe=({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r})=>{let i=ype({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r});return(0,X.jsx)(yC,{variant:i.variant,children:i.label})},xpe=({selectedProjectId:e,summary:t,tickets:n,error:r,chatSessions:i,chatSessionDetail:a,onRetry:o,onOpenTickets:s,onOpenChats:c,onOpenSpec:l})=>{let u=_9.Icon,d=v9.Icon,f=y9.Icon;return r?(0,X.jsx)(x9,{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)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,X.jsx)(TC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading project summary...`})}):(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsxs)(xC,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(SC,{children:`Overview`}),(0,X.jsx)(wC,{children:(0,X.jsx)(bpe,{activeRun:t.active_run,tickets:n,chatSessions:i,chatSessionDetail:a})})]}),(0,X.jsxs)(TC,{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)(N9,{label:`Tickets`,value:t.tickets.total}),(0,X.jsx)(N9,{label:`Plan`,value:t.tickets.plan,accentClassName:`text-sky-200`}),(0,X.jsx)(N9,{label:`Build`,value:t.tickets.build,accentClassName:`text-emerald-200`}),(0,X.jsx)(N9,{label:`Review`,value:t.tickets.review,accentClassName:`text-amber-200`}),(0,X.jsx)(N9,{label:`Done`,value:t.tickets.parked}),(0,X.jsx)(N9,{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":_9.ctaAriaLabel,onClick:s,children:[(0,X.jsx)(u,{className:`h-4 w-4`}),_9.label]}),(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":v9.ctaAriaLabel,onClick:c,children:[(0,X.jsx)(d,{className:`h-4 w-4`}),v9.label]}),(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2 sm:col-span-2`,"aria-label":y9.ctaAriaLabel,onClick:l,children:[(0,X.jsx)(f,{className:`h-4 w-4`}),y9.label]})]})]})]}):(0,X.jsx)(x9,{title:`Choose a project`,description:`Select a desktop project before opening tickets or chats from this phone.`})},P9=(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)},F9=({selectedProjectId:e,chatSessions:t,selectedChatSessionId:n,error:r,onRetry:i,onOpenNewChat:a,onSelectChat:o})=>e?r?(0,X.jsx)(x9,{title:`Chats unavailable`,description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry chats`})}):(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(xC,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(SC,{children:`Chats`}),(0,X.jsx)(CC,{children:t?`${t.length} recent`:`Loading chats...`}),(0,X.jsx)(wC,{children:(0,X.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:`New chat`})})]}),(0,X.jsx)(TC,{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)(x9,{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)(yC,{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)(x9,{title:`Choose a project`,description:`Select a project before browsing chats from this phone.`}),I9=({label:e,disabled:t,onClick:n})=>(0,X.jsx)(Q,{type:`button`,variant:`outline`,disabled:t,onClick:n,children:e}),L9=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=>Ty(e)&&e.agent_status===`running`&&!!e.session_id)??null,s=t.find(e=>Ty(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}},Spe=({ticket:e,actionState:t,actionError:n,onAction:r})=>{let i=z3(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)(x3,{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)(I9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},Cpe=({bundleDetail:e,actionState:t,actionError:n,onAction:r})=>{let{actions:i}=L9(e);return i.length===0?null:(0,X.jsx)(x3,{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)(I9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},R9=(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?fq(e.response_timing):null,transcript_runs:e.transcript_runs??null})),z9=e=>[...e??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,B9=({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)(RF,{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]}),wpe=({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)(RF,{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})]}),V9=({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)(wpe,{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})]}),H9=({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`})]}),U9=({controls:e})=>{let[t,n]=(0,p.useState)(!1);return(0,X.jsxs)(RC,{open:t,onOpenChange:n,children:[(0,X.jsx)(`div`,{className:`px-1 pb-1`,children:(0,X.jsx)(zC,{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)(Av,{className:Z(`h-3.5 w-3.5 transition-transform`,t&&`rotate-180`)})]})})}),(0,X.jsx)(BC,{className:`px-1 pb-1`,children:(0,X.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-background/35 p-2`,children:e})})]})},Tpe=({ticket:e})=>{let t=[{label:`State`,value:E9(e)},{label:`Tool`,value:eI(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))})]})},W9=({ticket:e,badges:t,actionState:n,actionError:r,onAction:i,className:a})=>(0,X.jsxs)(bC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,a),children:[(0,X.jsx)(xC,{className:`min-w-0 pb-3`,children:(0,X.jsx)(B9,{title:e.title,badges:t})}),(0,X.jsxs)(TC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,X.jsx)(Spe,{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)(dq,{content:e.description,className:`min-w-0 text-foreground`})]}):null,(0,X.jsx)(Tpe,{ticket:e})]})]}),G9=({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)(bC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,f),children:[(0,X.jsx)(xC,{className:`min-w-0 pb-3`,children:(0,X.jsx)(B9,{title:t,subtitle:n,badges:r})}),(0,X.jsxs)(TC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,X.jsx)(Cpe,{bundleDetail:e,actionState:i,actionError:a,onAction:o}),(0,X.jsxs)(RC,{open:l,onOpenChange:u,children:[(0,X.jsx)(zC,{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)(Av,{className:Z(`h-3.5 w-3.5 transition-transform`,l&&`rotate-180`)})]})}),(0,X.jsx)(BC,{className:`pt-2`,children:(0,X.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-background/35 p-3`,children:(0,X.jsx)(q3,{tickets:s,highlightedTicketId:c,onOpenTicketDetails:e=>d(e.id,e.worktree_bundle_id),availableModels:p})})})]})]})]}),K9=({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)(x9,{title:`Choose a project`,description:`Select a project before opening bundle details from this phone.`});if(!t)return(0,X.jsx)(x9,{title:`Choose a bundle`,description:`Open a bundle to review its transcript and grouped ticket progress.`});if(a)return(0,X.jsx)(V9,{title:`Bundle unavailable`,backLabel:`Back to tickets`,onBack:f,children:(0,X.jsx)(x9,{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)(V9,{title:`Loading bundle`,backLabel:`Back to tickets`,onBack:f,children:(0,X.jsx)(S9,{text:`Loading bundle details...`})});let w=rb(n.bundle)||n.bundle.branch||n.bundle.name||`Bundle`,T=new Map(d.map(e=>[e.id,e.label])),E=Z3(n.tickets,T),D=e6(n),O=Q3(n.tickets,n.execution_order_ticket_ids),k=$3(n.tickets,T,E,n.execution_order_ticket_ids),A=KF(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`&&Yy(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)(BF,{status:A}),(0,X.jsx)(yC,{variant:`outline`,children:L}),M?(0,X.jsxs)(yC,{variant:`outline`,children:[`Target: `,M.title]}):null]});return(0,X.jsx)(V9,{title:w,backLabel:`Back to tickets`,onBack:f,subheader:x?void 0:(0,X.jsx)(H9,{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)(G9,{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)(K3,{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:vy(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)(G9,{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)(K3,{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:vy(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]})})},q9=({selectedProjectId:e,chatSession:t,chatSessionId:n,openNonce:r,error:i,isStopping:a,composerMode:o,composerTool:s,prompt:c,selectedModel:l,selectedVariant:u,selectedSkills:d,availableModels:f,availableSkills:p,isLoadingAgentSettings:m,isSending:h,isUpdatingMode:g,showStartBuilding:_,composerDisabledReason:v,onBack:y,onRetry:b,onStop:x,onModeChange:S,onStartBuilding:C,onPromptChange:w,onModelChange:T,onVariantChange:E,onSkillsChange:D,onPromptKeyDown:O,onSubmit:k,onResolveQuestionSet:A,liveResponseTiming:j,isLargeScreen:M})=>{if(!e)return(0,X.jsx)(x9,{title:`Choose a project`,description:`Select a project before opening the chat workspace.`});if(n&&i)return(0,X.jsx)(x9,{title:`Chat unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:b,children:`Retry chat`})});if(n&&(!t||t.id!==n))return(0,X.jsx)(V9,{title:`Loading chat`,backLabel:`Back to chats`,onBack:y,children:(0,X.jsx)(S9,{text:`Loading chat transcript...`})});let N=t?.mode??o,P=s===`opencode`&&f.length>0,F=f.find(e=>e.id===l)??null,I=R9(t?.messages),L=z9(t?.messages),R=!!L,z=bJ(t?.post_build_check),B=z?vC.t(`common:postBuildChecks.blockedReason`):R?vC.t(`common:questionSet.waitForResolution`):v,V=t?.agent_status===`running`?(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:a,onClick:x,children:[a?(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Vv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:a?`Interrupting...`:`Interrupt`})]}):null,H=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yC,{variant:N===`plan`?`info`:`success`,children:N}),(0,X.jsx)(yC,{variant:`outline`,children:t?.tool??s}),t?.agent_status?(0,X.jsx)(yC,{variant:`outline`,children:t.agent_status}):null]}),U=P?(0,X.jsx)(LY,{model:l,variant:u,skills:d,showModelSelector:!0,showSkillsSelector:!0,availableModels:f,availableSkills:p,selectedModel:F,onModelChange:T,onVariantChange:E,onSkillsChange:D,modelSelectId:`mobile-chat-model-selector`,variantSelectId:`mobile-chat-variant-selector`,skillsSelectId:`mobile-chat-skills-selector`,disabled:!!B||h}):s===`opencode`&&m?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,W=!M&&U?(0,X.jsx)(U9,{controls:U}):U,G=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(cX,{value:N,disabled:!!B||h||g,onChange:S}),_&&(0,X.jsx)(u5,{disabled:h||g,onClick:C})]}),K=M?void 0:({showThinkingControl:e})=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[G,(0,X.jsx)(`div`,{className:`ml-auto`,children:e})]}),ee=`mobile-chat:${n??`new`}:${r}`;return(0,X.jsx)(V9,{title:t?.title??`New chat`,backLabel:`Back to chats`,onBack:y,action:V,children:(0,X.jsx)(l5,{projectId:e,agentRunParentType:t?`chat`:null,agentRunParentId:t?.id??null,messages:I,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:j?.turnKey??null,liveResponseTiming:j,canShowComposer:!0,header:M?(0,X.jsx)(B9,{title:t?.title??`New chat`,subtitle:t?.target_label_snapshot??`Project root`,badges:H}):K,composerControls:M?G:void 0,composerInlineControls:W,composerTheme:N,forceScrollToBottomKey:ee,layoutKey:ee,scrollLayoutKey:ee,composerFocusNonce:r,blurComposerOnSendStart:!M,followUpPrompt:c,followUpPlaceholder:n?`Continue this chat`:N===`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)(_Y,{messageContent:e.content,questionSet:n,storageKey:cY({parentType:`chat`,parentId:t.id,setId:n.id}),isActive:n.status===`pending`&&L?.id===e.id,isDisabled:t.agent_status===`running`||h||g,onResolve:t=>A(e.id,t)})},isSendingFollowUp:h,isComposerSubmitDisabled:R||z,postBuildCheck:t?.post_build_check,followUpDisabledReason:B??void 0,hidePendingAgentTitle:!M,onFollowUpPromptChange:w,onFollowUpKeyDown:O,onFollowUpSubmit:k},ee)})},Epe=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?fq(e.response_timing):null,transcript_runs:e.transcript_runs??null})),Dpe=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},J9=({selectedProjectId:e,specSessions:t,selectedSpecSessionId:n,error:r,onRetry:i,onOpenNewSpec:a,onSelectSpec:o})=>e?r?(0,X.jsx)(x9,{title:j9(`specList.listError`),description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:j9(`specList.retry`)})}):(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(xC,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(SC,{children:j9(`specList.title`)}),(0,X.jsx)(CC,{children:t?`${t.length} recent`:j9(`specList.loading`)}),(0,X.jsx)(wC,{children:(0,X.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:j9(`specList.newSpec`)})})]}),(0,X.jsx)(TC,{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)(x9,{title:j9(`specList.emptyTitle`),description:j9(`specList.emptyDescription`),action:(0,X.jsx)(Q,{onClick:a,children:j9(`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)(yC,{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:j9(`specList.loading`)})})]}):(0,X.jsx)(x9,{title:j9(`specList.emptyTitle`),description:`Select a project before browsing specs from this phone.`}),Y9=({selectedProjectId:e,specSession:t,specSessionId:n,openNonce:r,error:i,isStopping:a,composerMode:o,composerTool:s,prompt:c,selectedModel:l,selectedVariant:u,selectedSkills:d,availableModels:f,availableSkills:p,isLoadingAgentSettings:m,isSending:h,isUpdatingMode:g,composerDisabledReason:_,onBack:v,onRetry:y,onStop:b,onModeChange:x,onPromptChange:S,onModelChange:C,onVariantChange:w,onSkillsChange:T,onPromptKeyDown:E,onSubmit:D,onSubmitAnswer:O,onResolveQuestionSet:k,liveResponseTiming:A,isLargeScreen:j})=>{if(!e)return(0,X.jsx)(x9,{title:j9(`specList.emptyTitle`),description:`Select a project before opening the spec workspace.`});if(n&&i)return(0,X.jsx)(x9,{title:j9(`specDetail.unavailableTitle`),description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:y,children:j9(`specDetail.retry`)})});if(n&&(!t||t.id!==n))return(0,X.jsx)(V9,{title:j9(`specDetail.loadingTitle`),backLabel:j9(`specDetail.back`),onBack:v,children:(0,X.jsx)(S9,{text:j9(`specDetail.loading`)})});let M=t?.mode??o,N=s===`opencode`&&f.length>0,P=f.find(e=>e.id===l)??null,F=Epe(t?.messages),I=Dpe(t?.messages),L=z9(t?.messages),R=!!L,z=R?vC.t(`common:questionSet.waitForResolution`):_,B=t?.agent_status===`running`,V=B?(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:a,onClick:b,children:[a?(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Vv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:j9(a?`specDetail.interrupting`:`specDetail.interrupt`)})]}):null,H=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yC,{variant:M===`grill`?`info`:`success`,children:M}),(0,X.jsx)(yC,{variant:`outline`,children:t?.tool??s}),t?.agent_status?(0,X.jsx)(yC,{variant:`outline`,children:t.agent_status}):null]}),U=N?(0,X.jsx)(LY,{model:l,variant:u,skills:d,showModelSelector:!0,showSkillsSelector:!0,availableModels:f,availableSkills:p,selectedModel:P,onModelChange:C,onVariantChange:w,onSkillsChange:T,modelSelectId:`mobile-spec-model-selector`,variantSelectId:`mobile-spec-variant-selector`,skillsSelectId:`mobile-spec-skills-selector`,disabled:!!z||h}):s===`opencode`&&m?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,W=!j&&U?(0,X.jsx)(U9,{controls:U}):U,G={rationaleLabel:vC.t(`common:specView.grill.rationaleLabel`),suggestionsLabel:vC.t(`common:specView.grill.suggestionsLabel`),recommendedSuggestionLabel:vC.t(`common:specView.grill.recommendedSuggestionLabel`),answerPlaceholder:vC.t(`common:specView.grill.answerPlaceholder`),submitLabel:vC.t(`common:specView.grill.submitLabel`),submittingLabel:vC.t(`common:specView.grill.submittingLabel`)},K=e=>{if(e.role!==`assistant`)return;let n=e.metadata,r=n?.ask_question;if(r&&t)return(0,X.jsx)(_Y,{messageContent:e.content,questionSet:r,storageKey:cY({parentType:`spec`,parentId:t.id,setId:r.id}),isActive:r.status===`pending`&&L?.id===e.id,isDisabled:B||h||g,onResolve:t=>k(e.id,t)});if(e.kind!==`grill-question`)return;let i=n?.grill_question;if(i)return(0,X.jsx)(Y5,{question:i,isActive:B?!1:e.id===I&&t?.agent_status!==`running`&&t?.mode===`grill`,isDisabled:h||g,labels:G,onSubmitAnswer:O})},ee=(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,X.jsx)(X5,{on:M===`grill`,disabled:!!z||h||g,onToggle:e=>x(e?`grill`:`standard`),tooltipContent:vC.t(`common:specView.grill.toggleTooltip`),ariaLabelOn:vC.t(`common:specView.grill.toggleAriaLabelOn`),ariaLabelOff:vC.t(`common:specView.grill.toggleAriaLabelOff`)})}),te=j?void 0:({showThinkingControl:e})=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[ee,(0,X.jsx)(`div`,{className:`ml-auto`,children:e})]}),ne=`mobile-spec:${n??`new`}:${r}`;return(0,X.jsx)(V9,{title:t?.title??j9(`specDetail.newSpecTitle`),backLabel:j9(`specDetail.back`),onBack:v,action:V,children:(0,X.jsx)(l5,{projectId:e,agentRunParentType:n?`spec`:null,agentRunParentId:n,messages:F,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??j9(`specDetail.newSpecTitle`),streamingResponse:t?.streaming_response??null,isRunning:B,pendingAgentRevealKey:A?.turnKey??null,liveResponseTiming:A,canShowComposer:!0,header:j?(0,X.jsx)(B9,{title:t?.title??j9(`specDetail.newSpecTitle`),subtitle:t?.first_user_message_preview??null,badges:H}):te,composerControls:j?ee:void 0,composerInlineControls:W,composerTheme:`default`,forceScrollToBottomKey:ne,layoutKey:ne,scrollLayoutKey:ne,composerFocusNonce:r,blurComposerOnSendStart:!j,followUpPrompt:c,followUpPlaceholder:j9(n?`specDetail.composerPlaceholder`:`specDetail.composerPlaceholderDraft`),emptyStateText:j9(n?`specDetail.emptyMessages`:`specDetail.emptyDraft`),renderMessageBody:K,isSendingFollowUp:h,isComposerSubmitDisabled:R,followUpDisabledReason:z??void 0,hidePendingAgentTitle:!j,onFollowUpPromptChange:S,onFollowUpKeyDown:E,onFollowUpSubmit:D},ne)})},X9=({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)(x9,{title:`Choose a project`,description:`Select a project before opening ticket details from this phone.`});if(!t)return(0,X.jsx)(x9,{title:`Choose a ticket`,description:`Open a ticket to review its transcript and continue the workflow.`});if(i)return(0,X.jsx)(x9,{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)(V9,{title:`Loading ticket`,backLabel:`Back to tickets`,onBack:_,children:(0,X.jsx)(S9,{text:`Loading ticket details...`})});let j=B3(n,{requireWorktree:!0}),M=R9(n.messages,n.id),N=z9(n.messages),P=!!N,F=bJ(n.post_build_check),I=F?vC.t(`common:postBuildChecks.blockedReason`):P?vC.t(`common:questionSet.waitForResolution`):j.disabledReason,L=d.find(e=>e.id===c)??null,R=eI(n,`opencode`)===`opencode`&&d.length>0?(0,X.jsx)(LY,{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}):eI(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)(U9,{controls:R}):R,B=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yC,{variant:D9(T9(n)),children:E9(n)}),n.tool?(0,X.jsx)(yC,{variant:`outline`,children:n.tool}):null,n.agent_status?(0,X.jsx)(yC,{variant:`outline`,children:n.agent_status}):null,n.branch?(0,X.jsx)(yC,{variant:`outline`,children:n.branch}):null,n.bundle?.name?(0,X.jsx)(yC,{variant:`outline`,children:n.bundle.name}):null]}),V=`mobile-ticket:${n.id}:${r}`,H=e=>{let t=e.metadata?.ask_question;if(!(e.role!==`assistant`||!t))return(0,X.jsx)(_Y,{messageContent:e.content,questionSet:t,storageKey:cY({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)})},U=(0,X.jsx)(H9,{value:k,onTranscript:()=>A(`transcript`),onDetails:()=>A(`details`)});return(0,X.jsx)(V9,{title:n.title,backLabel:`Back to tickets`,onBack:_,subheader:O?void 0:U,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)(W9,{ticket:n,badges:B,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)(TY,{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:vy(n.state),forceScrollToBottomKey:V,layoutKey:V,scrollLayoutKey:V,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:H,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},V)}),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)(W9,{ticket:n,badges:B,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)(TY,{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:vy(n.state),surfaceVariant:`chat`,composerSize:`compact-on-laptop`,forceScrollToBottomKey:V,layoutKey:V,scrollLayoutKey:V,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:H,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},V),g?(0,X.jsx)(`p`,{className:`shrink-0 px-1 pt-2 text-sm text-red-200`,children:g}):null]})})},Ope=()=>{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}},kpe=()=>{window.history.replaceState({},``,`/mobile`)},Ape=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Z9=(e,t)=>e instanceof Ge&&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}),jpe=e=>e instanceof Ge&&(e.status===401||e.status===403),Mpe=()=>{let[e,t]=(0,p.useState)({status:`checking`}),[n,r]=(0,p.useState)(`connecting`),[i,a]=(0,p.useState)(null),[o,s]=(0,p.useState)(`overview`),[c,l]=(0,p.useState)(!1),[u,d]=(0,p.useState)(!1),[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)(``),[C,w]=(0,p.useState)(`build`),[T,E]=(0,p.useState)(``),[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)(!1),[L,R]=(0,p.useState)(!1),[z,B]=(0,p.useState)(!1),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(null),[G,K]=(0,p.useState)(null),[ee,te]=(0,p.useState)(!1),[ne,re]=(0,p.useState)(``),[ie,ae]=(0,p.useState)(`standard`),[oe,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)(null),[ve,ye]=(0,p.useState)(null),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)(0),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)(null),[Oe,ke]=(0,p.useState)(null),[Ae,je]=(0,p.useState)(null),[Me,Ne]=(0,p.useState)(``),[q,Pe]=(0,p.useState)(``),[Fe,Ie]=(0,p.useState)(``),[Le,Re]=(0,p.useState)([]),[ze,Be]=(0,p.useState)(!1),[Ve,He]=(0,p.useState)(null),[Ue,We]=(0,p.useState)(null),[qe,Je]=(0,p.useState)(``),[J,Xe]=(0,p.useState)(!1),[Ze,Y]=(0,p.useState)(null),[Qe,$e]=(0,p.useState)(0),[et,tt]=(0,p.useState)(0),[nt,rt]=(0,p.useState)(0),[it,at]=(0,p.useState)(`transcript`),[ot,st]=(0,p.useState)(null),[ct,lt]=(0,p.useState)(null),[ut,dt]=(0,p.useState)(!1),[ft,pt]=(0,p.useState)(!1),[mt,ht]=(0,p.useState)(!1),[gt,_t]=(0,p.useState)(null),[vt,yt]=(0,p.useState)(null),bt=(0,p.useRef)(null),xt=(0,p.useRef)(null),St=(0,p.useRef)(null),Ct=(0,p.useRef)(null),wt=(0,p.useRef)(null),Tt=(0,p.useRef)(0),Et=(0,p.useRef)(!1),Dt=(0,p.useCallback)(e=>jpe(e)?(t($9(`session_revoked`)),r(`unavailable`),l(!1),d(!1),m(!1),g(!1),te(!1),!0):!1,[]),Ot=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await Sfe(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(Dt(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.`)})}}},[Dt]),kt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await Efe(n,r,i);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedBundleId!==r?t:{...t,bundleDetail:a,bundleDetailError:null,tickets:P9(t.tickets,a)})}catch(i){if(!Ye(i)){if(Dt(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.`)})}}},[Dt]),At=(0,p.useCallback)(async(e,n,r)=>{try{let i=await xfe(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(Dt(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})}}},[Dt]),jt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await bfe(n,r,i);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(Dt(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.`)})}}},[Dt]),Mt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await yfe(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(Dt(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})}}},[Dt]),Nt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await Ffe(n,r,i);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(Dt(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`))})}}},[Dt]),Pt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await Pfe(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(Dt(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})}}},[Dt]),Ft=(0,p.useCallback)(async(e,n,r)=>{try{let i=await _fe(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(Dt(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.`)})}}},[Dt]),It=(0,p.useCallback)(async(e,t)=>{pt(!0);try{let n=await vfe(e,t),r=bt.current;if(r&&r!==e)return;st(n),lt(null),_t(null)}catch(t){if(!Ye(t)){if(Dt(t))return;let n=bt.current;if(n&&n!==e)return;st(null),lt(Z9(t,`Unable to load project target options.`))}}finally{t?.aborted||pt(!1)}},[Dt]),Lt=(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)},[]),Rt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await gfe(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&&(Ft(e,a,n),o?.active_target_kind===`bundle`&&It(a,n),Mt(e,a,n),Pt(e,a,n),At(e,a,n))}catch(n){if(!Ye(n)){if(Dt(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.`)})}}},[Dt,Mt,Ft,It,Pt,At]),zt=(0,p.useCallback)(async e=>{t({status:`checking`}),r(`connecting`);try{let n=await dpe(e);if(n.authenticated&&n.csrf_token){r(`connecting`),t(Q9(n.csrf_token)),Rt(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.`)})}},[Rt]),Bt=(0,p.useCallback)((e,n,i)=>{r(`connecting`),t(Q9(e)),Rt(e,i,n)},[Rt]);(0,p.useEffect)(()=>{let e=new AbortController;if(window.location.pathname===`/mobile/pair`){let n=Ope();return kpe(),n?(t({status:`pairing`}),fpe(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 zt(e.signal),()=>e.abort()},[Bt,zt]);let Vt=e.status===`authenticated`?e.csrfToken:null,Ht=e.status===`authenticated`?e.selectedProjectId:null,Ut=e.status===`authenticated`?e.selectedChatSessionId:null,Wt=e.status===`authenticated`?e.selectedBundleId:null,Gt=e.status===`authenticated`?e.selectedTicketId:null,Kt=e.status===`authenticated`?e.selectedSpecSessionId:null,qt=e.status===`authenticated`?e.projects?.find(t=>t.id===e.selectedProjectId)??null:null,Jt=e.status===`authenticated`?e.chatSessionDetail:null,Yt=e.status===`authenticated`?e.bundleDetail:null,Xt=e.status===`authenticated`?e.ticketDetail:null,Zt=e.status===`authenticated`?e.specSessionDetail:null,Qt=C9(qt,ot),$t=ft&&(!qt||qt.active_target_kind===`bundle`),en=gpe(),tn=Jt?.tool??`opencode`,nn=Zt?.tool??`opencode`,rn=!!z9(Jt?.messages),an=!!z9(Zt?.messages),on=!!z9(Xt?.messages),sn=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:z?`Wait for the chat mode change before sending another prompt.`:Jt?.agent_status===`running`?`Stop or wait for the current response before sending another prompt.`:rn?vC.t(`common:questionSet.waitForResolution`):null,cn=!!(Jt&&fX(Jt,rn)),ln=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:me?`Wait for the spec mode change before sending another prompt.`:Zt?.agent_status===`running`?`Stop or wait for the current response before sending another prompt.`:an?vC.t(`common:questionSet.waitForResolution`):null,un=!en&&(o===`tickets`&&(f&&!!Gt||u&&!!Wt)||o===`chats`&&h||o===`spec`&&ee);(0,p.useEffect)(()=>{bt.current=Ht},[Ht]),(0,p.useEffect)(()=>{Ht||(st(null),lt(null),_t(null),dt(!1),pt(!1),ht(!1))},[Ht]),(0,p.useEffect)(()=>{xt.current=Ut},[Ut]),(0,p.useEffect)(()=>{St.current=Wt},[Wt]),(0,p.useEffect)(()=>{Ct.current=Gt},[Gt]),(0,p.useEffect)(()=>{wt.current=Kt},[Kt]),(0,p.useEffect)(()=>{if(!Vt||!Ht){M([]),P([]),I(!1);return}if(!(tn===`opencode`||Xt?.tool===`opencode`||nn===`opencode`)){M([]),P([]),I(!1);return}let e=new AbortController;return I(!0),Promise.all([qfe(`opencode`,e.signal),Jfe(`opencode`,Ht,e.signal)]).then(([e,t])=>{M(e),P(t)}).catch(e=>{Dt(e)||Ye(e)||(M([]),P([]))}).finally(()=>{e.signal.aborted||I(!1)}),()=>e.abort()},[Vt,tn,Dt,Ht,Xt?.tool,nn]),(0,p.useEffect)(()=>{if(tn!==`opencode`){E(``),O(``),A([]);return}E(Jt?.model??qt?.helper_model??``),O(Jt?.variant??qt?.helper_variant??``),A(Jt?.skills??[])},[tn,Jt?.id,Jt?.model,Jt?.skills,Jt?.variant,qt?.helper_model,qt?.helper_variant]),(0,p.useEffect)(()=>{Jt?.mode&&w(Jt.mode)},[Jt?.id,Jt?.mode]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===T)??null;O(t=>e?e.variants.includes(t)?t:``:t)},[j,T]),(0,p.useEffect)(()=>{Ne(``),He(null),Pe(Xt?.model??``),Ie(Xt?.variant??``),Re(Xt?.skills??[])},[Xt?.id,Xt?.model,Xt?.skills,Xt?.variant]),(0,p.useEffect)(()=>{Je(``),Y(null)},[Yt?.bundle.id]),(0,p.useEffect)(()=>{if(nn!==`opencode`){se(``),le(``),de([]);return}se(Zt?.model??qt?.helper_model??``),le(Zt?.variant??qt?.helper_variant??``),de(Zt?.skills??[])},[nn,qt?.helper_model,qt?.helper_variant,Zt?.id,Zt?.model,Zt?.skills,Zt?.variant]),(0,p.useEffect)(()=>{Zt?.mode&&ae(Zt.mode)},[Zt?.id,Zt?.mode]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===oe)??null;le(t=>e?e.variants.includes(t)?t:``:t)},[j,oe]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===q)??null;Ie(t=>e?e.variants.includes(t)?t:``:t)},[j,q]),(0,p.useEffect)(()=>{if(!Vt)return;let e=hpe();a(e),r(`connecting`);let t=()=>{let e=bt.current,t=xt.current,n=St.current,r=Ct.current,i=wt.current;Rt(Vt,void 0,e),e&&(Ft(Vt,e),Mt(Vt,e),Pt(Vt,e),At(Vt,e)),e&&t&&jt(Vt,e,t),e&&n&&kt(Vt,e,n),e&&r&&Ot(Vt,e,r),e&&i&&Nt(Vt,e,i)},n=()=>{r(`connected`),t()},i=()=>{r(`reconnecting`)},o=()=>{r(`unavailable`)},s=()=>{Rt(Vt,void 0,bt.current)},c=(e=null)=>{let t=bt.current;t&&(e?.project_id&&e.project_id!==t||Ft(Vt,t))},l=(e=null)=>{let t=bt.current;t&&(e?.project_id&&e.project_id!==t||Mt(Vt,t))},u=(e=null)=>{let t=bt.current;t&&(e?.project_id&&e.project_id!==t||At(Vt,t))},d=(e=null)=>{let t=bt.current,n=xt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||jt(Vt,t,n)},f=(e=null)=>{let t=bt.current,n=Ct.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Ot(Vt,t,n)},p=(e=null)=>{let t=bt.current,n=St.current;!t||!n||e?.project_id&&e.project_id!==t||kt(Vt,t,n)},m=(e=null)=>{let t=bt.current;t&&(e?.project_id&&e.project_id!==t||Pt(Vt,t))},h=(e=null)=>{let t=bt.current,n=wt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Nt(Vt,t,n)};return e.on(`connect`,n),e.on(`disconnect`,i),e.on(`connect_error`,o),e.on(`ticket:created`,c),e.on(`ticket:created`,u),e.on(`ticket:updated`,c),e.on(`ticket:updated`,u),e.on(`ticket:updated`,p),e.on(`ticket:updated`,f),e.on(`ticket:deleted`,s),e.on(`ticket:deleted`,u),e.on(`ticket:deleted`,p),e.on(`ticket-dependency:created`,c),e.on(`ticket-dependency:deleted`,c),e.on(`chat-session:created`,l),e.on(`chat-session:updated`,l),e.on(`chat-session:updated`,d),e.on(`chat-session:deleted`,l),e.on(`spec-session:created`,m),e.on(`spec-session:updated`,m),e.on(`spec-session:updated`,h),e.on(`spec-session:deleted`,m),()=>{e.off(`connect`,n),e.off(`disconnect`,i),e.off(`connect_error`,o),e.off(`ticket:created`,c),e.off(`ticket:created`,u),e.off(`ticket:updated`,c),e.off(`ticket:updated`,u),e.off(`ticket:updated`,p),e.off(`ticket:updated`,f),e.off(`ticket:deleted`,s),e.off(`ticket:deleted`,u),e.off(`ticket:deleted`,p),e.off(`ticket-dependency:created`,c),e.off(`ticket-dependency:deleted`,c),e.off(`chat-session:created`,l),e.off(`chat-session:updated`,l),e.off(`chat-session:updated`,d),e.off(`chat-session:deleted`,l),e.off(`spec-session:created`,m),e.off(`spec-session:updated`,m),e.off(`spec-session:updated`,h),e.off(`spec-session:deleted`,m),e.disconnect(),a(null)}},[Vt,kt,jt,Mt,Ft,Rt,Nt,Pt,Ot,At]),(0,p.useEffect)(()=>{Wt||d(!1)},[Wt]),(0,p.useEffect)(()=>{Gt||m(!1)},[Gt]);let dn=()=>{zt()},fn=e=>{s(e),d(!1),m(!1),g(!1),te(!1),yt(null)},pn=()=>{l(!0)},mn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(_t(null),dt(!0),!ot&&!ft&&It(e.selectedProjectId))},hn=()=>{e.status===`authenticated`&&(v(!0),mpe(e.csrfToken).then(()=>t($9())).catch(e=>{Dt(e)||t({status:`error`,message:Z9(e,`Logout failed. Mobile access may have already been revoked from desktop Archon.`)})}).finally(()=>v(!1)))},gn=()=>{if(e.status!==`pairing_confirmation`||y)return;let n=e.payload;b(!0),t({...e,error:null}),ppe(n).then(e=>{if(e.authenticated&&e.csrf_token){window.history.replaceState({},``,`/mobile`),Bt(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(()=>b(!1))},_n=()=>{window.history.replaceState({},``,`/mobile`),t($9())},vn=()=>{e.status===`authenticated`&&(t({...e,projects:null,projectError:null}),Rt(e.csrfToken))},yn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,projectSummary:null,projectSummaryError:null}),Ft(e.csrfToken,e.selectedProjectId))},bn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(st(null),lt(null),_t(null),It(e.selectedProjectId))},xn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),Mt(e.csrfToken,e.selectedProjectId))},Sn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||(t({...e,chatSessionDetail:null,chatSessionDetailError:null}),jt(e.csrfToken,e.selectedProjectId,e.selectedChatSessionId))},Cn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),At(e.csrfToken,e.selectedProjectId))},wn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||(t({...e,ticketDetail:null,ticketDetailError:null}),Ot(e.csrfToken,e.selectedProjectId,e.selectedTicketId))},Tn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||(t({...e,bundleDetail:null,bundleDetailError:null}),kt(e.csrfToken,e.selectedProjectId,e.selectedBundleId))},En=n=>{if(e.status!==`authenticated`)return;let r=e.projects?.find(e=>e.id===n)??null;bt.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}),Te(null),De(null),ke(null),je(null),W(null),je(null),ye(null),Y(null),st(null),lt(null),_t(null),l(!1),dt(!1),d(!1),m(!1),g(!1),te(!1),at(`transcript`),yt(null),s(`overview`),Ft(e.csrfToken,n),r?.active_target_kind===`bundle`&&It(n),Mt(e.csrfToken,n),Pt(e.csrfToken,n),At(e.csrfToken,n)},Dn=async t=>{if(!(e.status!==`authenticated`||!e.selectedProjectId)){ht(!0),_t(null);try{Lt(await h9(e.selectedProjectId,e.csrfToken,{kind:`bundle`,bundle_id:t})),dt(!1),Ft(e.csrfToken,e.selectedProjectId),It(e.selectedProjectId)}catch(e){if(Dt(e))return;_t(Z9(e,`Unable to update the project target right now.`))}finally{ht(!1)}}},On=async(t,n={})=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;ht(!0),_t(null);let r=r=>h9(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 Ge&&e.status===409&&e.message===M9){if(!window.confirm(`${M9}\n\nSwitch anyway?`))return;t=await r(!0)}else throw e}Lt(t),dt(!1),Ft(e.csrfToken,e.selectedProjectId),It(e.selectedProjectId)}catch(e){if(Dt(e))return;_t(Z9(e,`Unable to update the project target right now.`))}finally{ht(!1)}},kn=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:n,chatSessionDetail:null,chatSessionDetailError:null}),W(null),$e(e=>e+1),g(!0),s(`chats`),jt(e.csrfToken,e.selectedProjectId,n))},An=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),W(null),S(``),$e(e=>e+1),g(!0),s(`chats`))},jn=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedBundleId:n,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),Te(null),De(null),je(null),Y(null),yt(null),at(`transcript`),tt(e=>e+1),d(!0),m(!1),s(`tickets`),kt(e.csrfToken,e.selectedProjectId,n))},Mn=(n,r)=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedTicketId:n,ticketDetail:null,ticketDetailError:null}),yt(r),rt(e=>e+1),d(r!==null),m(!0),s(`tickets`),Ot(e.csrfToken,e.selectedProjectId,n))},Nn=()=>{g(!1)},Pn=async n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return null;if(!e.chatSessionDetail||!e.selectedChatSessionId)return w(n),null;if(e.chatSessionDetail.mode===n||z||rn)return null;let r=e.selectedProjectId,i=e.selectedChatSessionId,a=e.csrfToken;B(!0),W(null);try{let e=await Mfe(r,i,a,{mode:n});return w(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 Dt(e)||W(Z9(e,`Unable to update the chat mode right now.`)),null}finally{B(!1)}},Fn=()=>{if(e.status===`authenticated`&&vt&&e.selectedBundleId===vt){t({...e,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),m(!1),d(!0),yt(null);return}yt(null),m(!1)},In=()=>{d(!1)},Ln=e=>{let t=j.find(t=>t.id===e)??null;E(e),O(e=>t&&t.variants.includes(e)?e:``)},Rn=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Vn())},zn=(e,n,r)=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==e||t.selectedChatSessionId!==n?t:{...t,chatSessions:t.chatSessions?.map(e=>e.id===r.id?r:e)??t.chatSessions,chatSessionDetail:r,chatSessionDetailError:null})},Bn=(n,r,i=e.status===`authenticated`?e.chatSessionDetail:null)=>{if(e.status!==`authenticated`||!e.selectedProjectId||L||sn)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=tn===`opencode`&&T?T:null,u=tn===`opencode`&&T&&D?D:null,d=tn===`opencode`?k:[],f=performance.now();Tt.current+=1;let p=`mobile-chat:${Tt.current}`;i&&K({parentType:`chat`,parentId:i.id,turnKey:p,startedAt:f}),W(null),R(!0);let m=e=>Afe(o,e.id,c,{instruction:a,tool:e.tool,model:l,variant:u,skills:d});return(i?m(i):kfe(o,c,{mode:C,tool:tn,model:l,variant:u,skills:d}).then(m)).then(e=>(K({parentType:`chat`,parentId:e.id,turnKey:p,startedAt:f}),r&&S(``),g(!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}}),Mt(c,o),!0)).catch(async e=>{K(e=>e?.turnKey===p?null:e);let t=Ke(e,`chat_session`);return t&&s?zn(o,s,t):e instanceof Ge&&e.status===409&&s&&await jt(c,o,s),Dt(e)||W(Z9(e,`Unable to send the chat prompt.`)),!1}).finally(()=>{R(!1)})},Vn=()=>{x.trim()&&Bn(x,!0)},Hn=async()=>{let t=e.status===`authenticated`?e.chatSessionDetail:null;if(!(!t||!fX(t,rn)||Et.current||L||sn)){Et.current=!0;try{let e=await Pn(`build`);if(!e)return;await Bn(dX,!1,e)}finally{Et.current=!1}}},Un=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=cY({parentType:`chat`,parentId:a,setId:r.set_id});W(null);try{let e=await jfe(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 Ge&&e.status===409){uY(s);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?zn(i,a,t):await jt(o,i,a)}throw Dt(e)||W(Z9(e,`Unable to resolve the chat questions.`)),e}},Wn=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||V)return;let t=e.selectedProjectId,n=e.selectedChatSessionId;W(null),H(n),K(e=>e?.parentId===n?null:e),Nfe(t,n,e.csrfToken).then(()=>jt(e.csrfToken,t,n)).catch(e=>{Dt(e)||W(Z9(e,`Unable to stop the chat response.`))}).finally(()=>H(null))},Gn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),Pt(e.csrfToken,e.selectedProjectId))},Kn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||(t({...e,specSessionDetail:null,specSessionDetailError:null}),Nt(e.csrfToken,e.selectedProjectId,e.selectedSpecSessionId))},qn=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:n,specSessionDetail:null,specSessionDetailError:null}),ye(null),Ce(e=>e+1),te(!0),s(`spec`),Nt(e.csrfToken,e.selectedProjectId,n))},Jn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),ye(null),re(``),Ce(e=>e+1),te(!0),s(`spec`))},Yn=()=>{te(!1)},Xn=n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;if(!e.specSessionDetail||!e.selectedSpecSessionId){ae(n);return}if(e.specSessionDetail.mode===n||me||an)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken;he(!0),ye(null),Rfe(r,i,a,{mode:n}).then(e=>{ae(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=>{Dt(e)||ye(Z9(e,j9(`specDetail.modeError`)))}).finally(()=>he(!1))},Zn=e=>{let t=j.find(t=>t.id===e)??null;se(e),le(e=>t&&t.variants.includes(e)?e:``)},Qn=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),er())},$n=(e,n,r)=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==e||t.selectedSpecSessionId!==n?t:{...t,specSessions:t.specSessions?.map(e=>e.id===r.id?r:e)??t.specSessions,specSessionDetail:r,specSessionDetailError:null})},er=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||fe||ln)return;let n=ne.trim();if(!n)return;let r=e.selectedProjectId,i=e.specSessionDetail?.id??null,a=e.csrfToken,o=nn===`opencode`&&oe?oe:null,s=nn===`opencode`&&oe&&ce?ce:null,c=nn===`opencode`?ue:[],l=performance.now();Tt.current+=1;let u=`mobile-spec:${Tt.current}`;e.specSessionDetail&&xe({parentType:`spec`,parentId:e.specSessionDetail.id,turnKey:u,startedAt:l}),ye(null),pe(!0);let d=e=>d9(r,e.id,a,{instruction:n,tool:e.tool,model:o,variant:s,skills:c});(e.specSessionDetail?d(e.specSessionDetail):Ife(r,a,{mode:ie,tool:nn,model:o,variant:s,skills:c}).then(d)).then(e=>{xe({parentType:`spec`,parentId:e.id,turnKey:u,startedAt:l}),re(``),te(!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}}),Pt(a,r)}).catch(e=>{xe(e=>e?.turnKey===u?null:e);let t=e instanceof Ge&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&i&&$n(r,i,t),!Dt(e)&&ye(Z9(e,j9(`specDetail.sendError`)))}).finally(()=>pe(!1))},tr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||fe)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken,o=e.specSessionDetail?.tool??nn,s=nn===`opencode`&&oe?oe:null,c=nn===`opencode`&&oe&&ce?ce:null,l=nn===`opencode`?ue:[],u=performance.now();Tt.current+=1;let d=`mobile-spec:${Tt.current}`;xe({parentType:`spec`,parentId:i,turnKey:d,startedAt:u}),ye(null),pe(!0),d9(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=>{xe(e=>e?.turnKey===d?null:e);let t=e instanceof Ge&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&$n(r,i,t),!Dt(e)&&ye(Z9(e,j9(`specDetail.sendError`)))}).finally(()=>pe(!1))},nr=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=cY({parentType:`spec`,parentId:a,setId:r.set_id});ye(null);try{let e=await Lfe(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 Ge&&e.status===409){uY(s);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?$n(i,a,t):await Nt(o,i,a)}throw Dt(e)||ye(Z9(e,`Unable to resolve the spec questions.`)),e}},rr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||ge)return;let t=e.selectedProjectId,n=e.selectedSpecSessionId;ye(null),_e(n),xe(e=>e?.parentId===n?null:e),zfe(t,n,e.csrfToken).then(()=>Nt(e.csrfToken,t,n)).catch(e=>{Dt(e)||ye(Z9(e,j9(`specDetail.stopError`)))}).finally(()=>_e(null))},ir=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||Oe||(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`?f9(r,i,a,`build`):n===`review`?f9(r,i,a,`review`):n===`run`?Bfe(r,i,a):n===`stop-run`?Vfe(r,i,a):n===`pause-build`?p9(r,i,a):m9(r,i,a);ke(n),je(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}}),Ft(a,r),At(a,r),Ot(a,r,i)}).catch(e=>{Dt(e)||je(Z9(e,`Unable to update this ticket from mobile.`))}).finally(()=>ke(null))},ar=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||we)return;let r=e.selectedProjectId,i=e.selectedBundleId,a=e.csrfToken,o=e.bundleDetail,{runningBuildTicketId:s,resumableBuildTicketId:c}=L9(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:P9(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`?Dfe(r,i,a):n===`review`?Ofe(r,i,a):n===`pause-build`?s?p9(r,s,a):null:c?m9(r,c,a):null;d&&(Te(n),De(null),d.then(e=>{`tickets`in e?l(e):u(e),Ft(a,r),At(a,r),kt(a,r,i)}).catch(e=>{Dt(e)||De(Z9(e,`Unable to update this bundle from mobile.`))}).finally(()=>Te(null)))},or=e=>{let t=j.find(t=>t.id===e)??null;Pe(e),Ie(e=>t&&t.variants.includes(e)?e:``)},sr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),cr())},cr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||!e.ticketDetail||ze||on)return;let n=Me.trim();if(!n)return;let r=e.selectedProjectId,i=e.ticketDetail,a=e.csrfToken,o=V3(i,{model:q||null,variant:Fe||null,skills:Le});Tt.current+=1;let s={parentType:`ticket`,parentId:i.id,turnKey:`mobile-ticket:${Tt.current}`,startedAt:performance.now()};We(s);let c=()=>i.state===`plan`?Ufe(r,i.id,a,n):Gfe(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}})};Be(!0),He(null),(async()=>{o.shouldPersist&&l(await Hfe(r,i.id,a,{model:o.model,variant:o.variant,skills:o.skills})),l(await c()),Ne(``),At(a,r),Ot(a,r,i.id)})().catch(async e=>{We(e=>e?.turnKey===s.turnKey?null:e);let t=Ke(e,`ticket`);t?l(t):e instanceof Ge&&e.status===409&&await Ot(a,r,i.id),!Dt(e)&&He(Z9(e,`Unable to send the ticket follow-up.`))}).finally(()=>Be(!1))},lr=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=cY({parentType:`ticket`,parentId:a,setId:r.set_id});He(null);try{let e=await Wfe(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 Ge&&e.status===409){uY(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 Ot(o,i,a)}throw Dt(e)||He(Z9(e,`Unable to resolve the ticket questions.`)),e}},ur=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),dr())},dr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||J)return;let n=qe.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:P9(t.tickets,e),bundleDetail:e,bundleDetailError:null})};Xe(!0),Y(null),Kfe(r,i,a,n).then(e=>{o(e),Je(``),At(a,r),kt(a,r,i)}).catch(e=>{Dt(e)||Y(Z9(e,`Unable to send the bundle follow-up.`))}).finally(()=>Xe(!1))},fr=(0,p.useCallback)(async(e,t,n)=>{try{return await Cfe(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]),pr=(0,p.useCallback)(async(e,t,n)=>{try{return await wfe(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]),mr=(0,p.useCallback)(async(e,t,n)=>{try{return await Tfe(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]);return e.status===`checking`?(0,X.jsx)(b9,{title:`Checking mobile session`,description:`Archon is validating this browser before showing project controls.`}):e.status===`pairing`?(0,X.jsx)(b9,{title:`Checking pairing link`,description:`Keep this page open while Archon verifies the one-time pairing link.`}):e.status===`pairing_confirmation`?(0,X.jsxs)(b9,{title:`Compare pairing code`,description:`Confirm this code matches the desktop dialog before pairing this phone.`,children:[(0,X.jsx)(bC,{className:`border-primary/25 bg-primary/10 shadow-none`,children:(0,X.jsxs)(TC,{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 `,Ape(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:y,onClick:gn,children:y?`Pairing...`:`Pair this phone`}),(0,X.jsx)(Q,{variant:`outline`,size:`lg`,disabled:y,onClick:_n,children:`Cancel`})]})]}):e.status===`unauthenticated`?(0,X.jsx)(b9,{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:dn,children:`Retry`})}):e.status===`error`?(0,X.jsx)(b9,{title:`Mobile access unavailable`,description:e.message,children:(0,X.jsx)(Q,{onClick:dn,children:`Retry`})}):(0,X.jsx)(Iq,{socket:i??void 0,fetchTicketRuns:fr,fetchChatRuns:pr,fetchSpecRuns:mr,children:(0,X.jsxs)(`main`,{className:Z(`bg-background text-foreground`,un?`flex h-[100dvh] flex-col overflow-hidden`:`min-h-screen`),children:[(0,X.jsx)(spe,{open:c,projects:e.projects,selectedProjectId:e.selectedProjectId,error:e.projectError,onOpenChange:l,onSelectProject:En,onRetry:vn}),(0,X.jsx)(cpe,{open:ut,project:qt,targetOptions:ot,error:gt??ct,isLoading:ft,isSubmitting:mt,onOpenChange:dt,onRetry:bn,onSelectBundle:e=>{Dn(e)},onSelectRepoRoot:(e,t)=>{On(e,t)}}),(0,X.jsx)(npe,{selectedProject:qt,targetLabel:Qt,isTargetLoading:$t,isTargetDisabled:!Ht,connectionState:n,onOpenProjects:pn,onOpenTargetSelector:mn}),un?(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:[o===`tickets`?(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:f&&e.selectedTicketId?(0,X.jsx)(X9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:nt,error:e.ticketDetailError,actionState:Oe,actionError:Ae,followUpPrompt:Me,followUpSelectedModel:q,followUpSelectedVariant:Fe,followUpSelectedSkills:Le,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSendingFollowUp:ze,liveResponseTiming:Xt?.agent_status===`running`&&Ue?.parentId===Xt.id?Ue:null,followUpError:Ve,onBack:Fn,onRetry:wn,onAction:ir,onFollowUpPromptChange:Ne,onFollowUpModelChange:or,onFollowUpVariantChange:Ie,onFollowUpSkillsChange:Re,onFollowUpKeyDown:sr,onFollowUpSubmit:cr,onResolveQuestionSet:lr,isLargeScreen:!1}):(0,X.jsx)(K9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:et,mobileDetailView:it,error:e.bundleDetailError,actionState:we,actionError:Ee,followUpPrompt:qe,isSendingFollowUp:J,followUpError:Ze,availableModels:j,onBack:In,onRetry:Tn,onAction:ar,onDetailViewChange:at,onSelectTicket:Mn,onFollowUpPromptChange:Je,onFollowUpKeyDown:ur,onFollowUpSubmit:dr,isLargeScreen:!1})}):null,o===`chats`?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(q9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:Qe,error:e.chatSessionDetailError,isStopping:V===e.selectedChatSessionId,composerMode:e.chatSessionDetail?.mode??C,composerTool:tn,prompt:x,selectedModel:T,selectedVariant:D,selectedSkills:k,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:L,liveResponseTiming:Jt?.agent_status===`running`&&G?.parentId===Jt.id?G:null,isUpdatingMode:z,showStartBuilding:cn,composerDisabledReason:sn,onBack:Nn,onRetry:Sn,onStop:Wn,onModeChange:Pn,onStartBuilding:Hn,onPromptChange:S,onModelChange:Ln,onVariantChange:O,onSkillsChange:A,onPromptKeyDown:Rn,onSubmit:Vn,onResolveQuestionSet:Un,isLargeScreen:!1}),U?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:U}):null]}):null,o===`spec`?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(Y9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:Se,error:e.specSessionDetailError,isStopping:ge===e.selectedSpecSessionId,composerMode:e.specSessionDetail?.mode??ie,composerTool:nn,prompt:ne,selectedModel:oe,selectedVariant:ce,selectedSkills:ue,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:fe,liveResponseTiming:Zt?.agent_status===`running`&&be?.parentId===Zt.id?be:null,isUpdatingMode:me,composerDisabledReason:ln,onBack:Yn,onRetry:Kn,onStop:rr,onModeChange:Xn,onPromptChange:re,onModelChange:Zn,onVariantChange:le,onSkillsChange:de,onPromptKeyDown:Qn,onSubmit:er,onSubmitAnswer:tr,onResolveQuestionSet:nr,isLargeScreen:!1}),ve?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:ve}):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)(tpe,{status:n,onRetry:dn}),o===`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)(x9,{title:`Projects unavailable`,description:e.projectError,action:(0,X.jsx)(Q,{variant:`warning`,onClick:vn,children:`Retry projects`})}):e.selectedProjectId&&!e.projectSummary&&!e.projectSummaryError?(0,X.jsx)(_pe,{}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(xpe,{selectedProjectId:e.selectedProjectId,summary:e.projectSummary,tickets:e.tickets,error:e.projectSummaryError,chatSessions:e.chatSessions,chatSessionDetail:e.chatSessionDetail,onRetry:yn,onOpenTickets:()=>fn(`tickets`),onOpenChats:()=>fn(`chats`),onOpenSpec:()=>fn(`spec`)}),(0,X.jsx)(vpe,{isLoggingOut:_,onLogout:hn})]})}):null,o===`tickets`?en?(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,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:Cn,onSelectBundle:jn,onSelectTicket:Mn})}),(0,X.jsx)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:f&&e.selectedTicketId?(0,X.jsx)(X9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:nt,error:e.ticketDetailError,actionState:Oe,actionError:Ae,followUpPrompt:Me,followUpSelectedModel:q,followUpSelectedVariant:Fe,followUpSelectedSkills:Le,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSendingFollowUp:ze,liveResponseTiming:Xt?.agent_status===`running`&&Ue?.parentId===Xt.id?Ue:null,followUpError:Ve,onBack:Fn,onRetry:wn,onAction:ir,onFollowUpPromptChange:Ne,onFollowUpModelChange:or,onFollowUpVariantChange:Ie,onFollowUpSkillsChange:Re,onFollowUpKeyDown:sr,onFollowUpSubmit:cr,onResolveQuestionSet:lr,isLargeScreen:!0}):(0,X.jsx)(K9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:et,mobileDetailView:it,error:e.bundleDetailError,actionState:we,actionError:Ee,followUpPrompt:qe,isSendingFollowUp:J,followUpError:Ze,availableModels:j,onBack:In,onRetry:Tn,onAction:ar,onDetailViewChange:at,onSelectTicket:Mn,onFollowUpPromptChange:Je,onFollowUpKeyDown:ur,onFollowUpSubmit:dr,isLargeScreen:!0})})]}):(0,X.jsx)(A9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:Cn,onSelectBundle:jn,onSelectTicket:Mn}):null,o===`chats`?en?(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)(F9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:xn,onOpenNewChat:An,onSelectChat:kn})}),(0,X.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,X.jsx)(q9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:Qe,error:e.chatSessionDetailError,isStopping:V===e.selectedChatSessionId,composerMode:e.chatSessionDetail?.mode??C,composerTool:tn,prompt:x,selectedModel:T,selectedVariant:D,selectedSkills:k,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:L,liveResponseTiming:Jt?.agent_status===`running`&&G?.parentId===Jt.id?G:null,isUpdatingMode:z,showStartBuilding:cn,composerDisabledReason:sn,onBack:Nn,onRetry:Sn,onStop:Wn,onModeChange:Pn,onStartBuilding:Hn,onPromptChange:S,onModelChange:Ln,onVariantChange:O,onSkillsChange:A,onPromptKeyDown:Rn,onSubmit:Vn,onResolveQuestionSet:Un,isLargeScreen:!0}),U?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:U}):null]})]}):(0,X.jsx)(F9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:xn,onOpenNewChat:An,onSelectChat:kn}):null,o===`spec`?en?(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:Gn,onOpenNewSpec:Jn,onSelectSpec:qn})}),(0,X.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,X.jsx)(Y9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:Se,error:e.specSessionDetailError,isStopping:ge===e.selectedSpecSessionId,composerMode:e.specSessionDetail?.mode??ie,composerTool:nn,prompt:ne,selectedModel:oe,selectedVariant:ce,selectedSkills:ue,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:fe,liveResponseTiming:Zt?.agent_status===`running`&&be?.parentId===Zt.id?be:null,isUpdatingMode:me,composerDisabledReason:ln,onBack:Yn,onRetry:Kn,onStop:rr,onModeChange:Xn,onPromptChange:re,onModelChange:Zn,onVariantChange:le,onSkillsChange:de,onPromptKeyDown:Qn,onSubmit:er,onSubmitAnswer:tr,onResolveQuestionSet:nr,isLargeScreen:!0}),ve?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:ve}):null]})]}):(0,X.jsx)(J9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:Gn,onOpenNewSpec:Jn,onSelectSpec:qn}):null]})}),un?null:(0,X.jsx)(rpe,{activeSection:o,onChange:fn})]})})},Npe=({socket:e=tC,children:t})=>(0,X.jsx)(kq.Provider,{value:e,children:t}),Ppe=()=>typeof window<`u`&&window.location.pathname.startsWith(`/mobile`),Fpe=()=>{let e=Ppe();return zb(e?null:tC),(0,X.jsx)(Ue,{i18n:vC,children:(0,X.jsx)(nt,{children:(0,X.jsxs)(Npe,{children:[e&&(0,X.jsx)(Mpe,{}),!e&&(0,X.jsx)(Iq,{children:(0,X.jsx)(Rle,{children:(0,X.jsx)(pfe,{})})})]})})})};document.documentElement.classList.add(`dark`),document.documentElement.style.colorScheme=`dark`,(0,f.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(Fpe,{}));export{Lt as $,ub as A,K_ as B,tC as C,lb as D,pb as E,Fv as F,Z_ as G,X_ as H,Pv as I,Z as J,$_ as K,Av as L,Vv as M,zv as N,db as O,Rv as P,Bt as Q,hv as R,rC as S,Sb as T,ev as U,J_ as V,Q_ as W,zt as X,Dn as Y,Rt as Z,BC as _,T3 as a,Y as at,vC as b,kG as c,dw as d,tt as et,$C as f,RC as g,tw as h,D3 as i,Ze as it,$ as j,fb as k,gw as l,ew as m,T8 as n,qe as nt,E3 as o,He as ot,nw as p,Q as q,I3 as r,Ye as rt,Aq as s,c as st,n7 as t,Ge as tt,fw as u,zC as v,rx as w,cC as x,yC as y,tv as z};
273
+ `);R.current+=1,H([...M.current,{kind:`source`,id:`${E.content.path}:${e}:${Date.now()}:${R.current}`,target:t,filePath:E.content.path,lineNumber:e,lineContent:r[e-1]??``,sourceContext:Qce(E.content.content,e),contentSignature:E.content.content_signature,comment:n,stale:!1}])},[H,E,t]);return(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":a8(`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:[a8(`searchFiles`),(0,X.jsx)(tv,{ref:z,type:`search`,className:`mt-1 h-8`,value:_,onChange:e=>v(e.target.value),placeholder:a8(`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)}),a8(`changedOnly`)]}),(0,X.jsx)(Ov,{content:a8(`refreshFiles`),children:(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":a8(`refreshFiles`),disabled:h,onClick:()=>{G(!0)},children:h?(0,X.jsx)(Rv,{className:`size-3.5 animate-spin`}):(0,X.jsx)(Fce,{className:`size-3.5`})})})]})]}),h&&!u&&(0,X.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:a8(`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 G(),children:a8(`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:a8(`truncated`)}),(0,X.jsx)(qce,{entries:u.entries,search:y,changedOnly:b,expandedPaths:S,selectedPath:w,commentCounts:ne,onExpandedPathsChange:C,onSelectPath:K})]})]}),(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??a8(`selectFile`)}),ee&&(0,X.jsx)(`div`,{className:`mt-0.5 text-[11px] capitalize text-muted-foreground`,children:$ce(ee)})]}),(l||w&&ee?.status&&c)&&(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:[w&&ee?.status&&c&&(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>c(w),children:a8(`viewChanges`)}),l]})]}),E.kind===`empty`&&(0,X.jsx)(`div`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:a8(`empty`)}),E.kind===`loading`&&(0,X.jsx)(`div`,{className:`m-auto text-sm text-muted-foreground`,children:a8(`loadingFile`,{path:E.path})}),E.kind===`unsupported`&&(0,X.jsxs)(`div`,{className:`m-auto max-w-md space-y-2 text-center`,children:[(0,X.jsx)(yC,{variant:`outline`,className:`capitalize`,children:E.reason.replace(/_/g,` `)}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:E.message})]}),E.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:E.message}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void W(E.path,!0),children:a8(`retry`)})]}),E.kind===`content`&&(0,X.jsx)(Lce,{file:E.content,comments:te,canComment:r,onAddComment:re})]})]})},s8=r({WorkspaceReviewModal:()=>l8}),c8=e=>vC.t(`common:workspaceReviewModal.${e}`),tle=({activeMode:e,availableModes:t,onModeChange:n})=>(0,X.jsx)(`div`,{role:`tablist`,"aria-label":c8(`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)(Fv,{className:`h-4 w-4`}):(0,X.jsx)(Iv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:c8(t)})]},t))}),l8=({target:e,initialMode:t=`changes`,enabledModes:n=[`changes`],filesView:r,bundleTargetName:i=null,onClose:a,title:o,mode:s,onModeChange:c,canToggleMode:l=!1,...u})=>{let d=n.includes(t)?n:[t,...n],[f]=(0,p.useState)(e),[m,h]=(0,p.useState)(t),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)([]),[S,C]=(0,p.useState)([]),w=(0,p.useRef)(S),[T,E]=(0,p.useState)(null);w.current=S;let D=(0,p.useCallback)(e=>{w.current=e,C(e)},[]),O=(0,p.useCallback)(()=>{w.current=[],C([])},[]),k=d.length>1,A=k&&r===void 0,[j]=(0,p.useState)(i),[M]=(0,p.useState)(()=>f.scope===`project_root`?u.targetKind===`bundle`&&u.reviewCommentsBundleId?{kind:`bundle`,bundle_id:u.reviewCommentsBundleId,ticket_id:null}:{kind:`repo_root`,bundle_id:null,ticket_id:null}:u.reviewCommentsBundleId?{kind:`bundle`,bundle_id:u.reviewCommentsBundleId,ticket_id:null}:{kind:`ticket`,bundle_id:null,ticket_id:f.ticketId}),N=M.kind===`repo_root`?vC.t(`common:workspaceFiles.repositoryRoot`):M.kind===`bundle`?vC.t(`common:workspaceFiles.bundleTarget`,{name:j||M.bundle_id}):vC.t(`common:workspaceFiles.ticketTarget`,{id:M.ticket_id}),P=M.kind===`ticket`?o:N,F=(0,p.useCallback)(async()=>{if(!u.projectId||S.length===0)return S;let e=await i8(u.projectId,S),t=new Map(e.map(e=>[e.id,e.stale])),n=w.current.map(e=>{let n=t.get(e.id);return n===void 0?e:{...e,stale:n}});return D(n),n},[u.projectId,S,D]),I=(0,p.useCallback)(()=>{u.projectId&&localStorage.removeItem(r8(u.projectId,M)),O()},[u.projectId,O,M]),L=(0,p.useCallback)(e=>{_(e),h(`changes`)},[]),R=(0,p.useCallback)(e=>{y(e),h(`files`)},[]),z=(0,p.useCallback)(e=>{_(t=>t===e?null:t)},[]),B=(0,p.useCallback)(e=>{y(t=>t===e?null:t)},[]),V=(0,p.useCallback)(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s!==void 0&&c&&(0,X.jsx)(cX,{value:s,disabled:!l||u.isUpdatingMode,onChange:c,planInactiveTooltip:(0,X.jsx)(vX,{label:vC.t(`common:ticketChangesModal.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(vX,{label:vC.t(`common:ticketChangesModal.switchToBuild`)})}),(0,X.jsx)(a6,{reviewComments:b,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})]}),[l,u.isUpdatingMode,s,c,b]);return(0,p.useEffect)(()=>{if(!c||s===void 0)return;let e=e=>{!hX(e)||!l||(e.preventDefault(),c(mX(s)))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[l,s,c]),(0,X.jsx)(hC,{onClose:a,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:c8(`closeAriaLabel`),renderContent:({closeButton:e})=>{let t=k?(0,X.jsx)(tle,{activeMode:m,availableModes:d,onModeChange:h}):null,n=k?(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t,e]}):null,i=f.scope===`ticket`?(0,X.jsx)(X6,{...u,...f,projectId:u.projectId,title:o,onClose:a,mode:s,onModeChange:c,canToggleMode:l,closeButton:k?null:e,headerControls:n,isActive:m===`changes`,onPendingReviewCommentsChange:x,onReviewControlsStateChange:E,renderReviewControls:V,showReviewControls:!k||m===`changes`,sourceReviewComments:S,onSourceReviewCommentsChange:D,onClearSourceReviewComments:O,onSourceReviewCommentsSubmitted:I,onValidateSourceReviewComments:F,requestedDiffPath:g,onRequestedDiffPathHandled:z,onViewCurrentFile:A?R:void 0}):(0,X.jsx)(X6,{...u,scope:`project_root`,projectId:u.projectId,title:o,onClose:a,mode:s,onModeChange:c,canToggleMode:l,closeButton:k?null:e,headerControls:n,isActive:m===`changes`,onPendingReviewCommentsChange:x,onReviewControlsStateChange:E,renderReviewControls:V,showReviewControls:!k||m===`changes`,sourceReviewComments:S,onSourceReviewCommentsChange:D,onClearSourceReviewComments:O,onSourceReviewCommentsSubmitted:I,onValidateSourceReviewComments:F,requestedDiffPath:g,onRequestedDiffPathHandled:z,onViewCurrentFile:A?R:void 0});return k?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[m===`files`&&(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4`,children:[(0,X.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-lg font-semibold text-foreground`,children:P}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t,e]})]}),(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:m!==`changes`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":m===`changes`,children:i}),(0,X.jsx)(`div`,{id:`workspace-review-files-panel`,role:`tabpanel`,hidden:m!==`files`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":m===`files`,children:r??(0,X.jsx)(ele,{projectId:u.projectId,target:M,isActive:m===`files`,canAddComments:u.canAddReviewComments??!1,comments:S,onCommentsChange:D,requestedPath:v,onRequestedPathHandled:B,onViewChanges:L,headerControls:m===`files`&&T?V(T):void 0})})]})]}):i}})},nle=e=>!(e instanceof Ge)||e.status!==409||typeof e.data!=`object`||e.data===null?!1:`code`in e.data&&e.data.code===`build_open_questions_changed`,rle=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))},ile=e=>e.flatMap(e=>e.questions.map(e=>`${e.id}:${e.updated_at}`)).join(`|`),ale=({details:e,onClose:t,onRefresh:n,onSubmit:r})=>{let{t:i}=He(`common`),a=(0,p.useMemo)(()=>rle(e),[e]),o=(0,p.useMemo)(()=>a.flatMap(e=>e.questions),[a]),s=(0,p.useMemo)(()=>ile(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)(K_,{open:!0,onOpenChange:e=>{!e&&!d&&t()},children:(0,X.jsx)(X_,{showCloseButton:!1,className:`max-h-[calc(100vh-2rem)] 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(nle(e)){try{await n()}catch{_(i(`buildOpenQuestionsDialog.refreshFailedError`))}h(!0),_(e=>e??i(`buildOpenQuestionsDialog.conflictError`))}else _(e instanceof Ge?e.message:i(`buildOpenQuestionsDialog.submitError`))}finally{f(!1)}}},className:`flex min-h-0 flex-col`,children:[(0,X.jsxs)(Z_,{className:`border-b border-border/70 px-5 py-4 sm:px-6`,children:[(0,X.jsx)($_,{children:i(`buildOpenQuestionsDialog.title`)}),(0,X.jsx)(ev,{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)(hv,{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)(hv,{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)(hv,{htmlFor:`answer-${e.id}`,className:`sr-only`,children:i(`buildOpenQuestionsDialog.answerLabel`,{question:e.question_text})}),(0,X.jsx)(nv,{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)(Q_,{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`,disabled:d,onClick:t,children:i(`buildOpenQuestionsDialog.cancel`)}),(0,X.jsx)(Q,{type:`submit`,disabled:!v||m||d,children:i(d?`buildOpenQuestionsDialog.submitting`:`buildOpenQuestionsDialog.submit`)})]})]})})})},u8={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`}},ole=e=>ay(e)?`ready`:`blocked`,d8=180,sle=560,f8=88,p8=12,m8=18,h8=`dependency-overlay-clip`,g8=(e,t,n)=>Math.min(Math.max(e,t),n),cle=(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(` `)}`},lle=(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}),ule=(e,t)=>{let n=g8(Math.round(e.length*7.2)+24,d8,sle),r=Math.max(d8,t-p8*2);return Math.min(n,r)},dle=(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}=py(t,o??{left:e.pointer.x,top:e.pointer.y,width:0,height:0}),d=lle(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=ule(c,d.width);return{text:c,x:o&&s?g8(f.x-p/2,p8,Math.max(p8,d.width-p-p8)):(()=>{let e=f.x+m8,t=f.x-m8-p;return e+p<=d.width-p8?e:t>=p8?t:g8(e,p8,Math.max(p8,d.width-p-p8))})(),y:g8(f.y,p8,Math.max(p8,d.height-f8-p8)),width:p}},_8=({blockerRect:e,dependentRect:t,className:n,testId:r,markerEnd:i})=>{let{start:a,end:o}=py(e,t),{path:s}=my(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})})},fle=({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=dle(e,i,n,t,r);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_8,{blockerRect:i,dependentRect:a,className:u8.preview.className,testId:`dependency-preview`,markerEnd:`url(#${u8.preview.markerId})`}),(e=>o?(0,X.jsx)(`foreignObject`,{x:o.x,y:o.y,width:o.width,height:f8,"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})}))]})},ple=({dependencies:e,cardRects:t,clipRects:n=[],preview:r,ticketsById:i,overlaySize:a})=>{let o=cle(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(u8).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:h8,children:(0,X.jsx)(`path`,{d:o,clipRule:`evenodd`})})]}),(0,X.jsxs)(`g`,{"data-testid":`dependency-overlay-content`,clipPath:o?`url(#${h8})`: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=u8[ole(n)];return!a||!o?null:(0,X.jsx)(_8,{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)(fle,{preview:r,cardRects:t,ticketsById:i,overlaySize:a})]})]})},mle=({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,onClose:_})=>{let{t:v}=He(`common`),{jiraImportState:y,importFromJira:b}=Ew(n),{gitHubImportState:x,importFromGitHub:S}=QC(n),C=[{key:`jira`,label:v(`jiraImportField.label`),placeholder:v(`jiraImportField.placeholder`),state:y,onImport:b},{key:`github`,label:v(`githubImportField.label`),placeholder:v(`githubImportField.placeholder`),state:x,onImport:S}];return(0,X.jsx)(hC,{onClose:_,overlayClassName:`bg-black/60`,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:y})=>(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:y}),(0,X.jsx)(tX,{heading:v(`newTicketModal.heading`),bundles:t,showModelSelector:a,showSkillsSelector:o,availableModels:s,availableSkills:c,projectId:n,initialModel:l,initialVariant:u,initialSkills:d,initialWorktreeBundleId:f,initialImportedDraft:p,projectBranchState:r,externalImportProviders:C,onCancel:_,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,titleInputId:`title`,descriptionInputId:`description`,bundleSelectId:`new-ticket-bundle`,modelSelectId:`new-model`,variantSelectId:`new-variant`,skillsSelectId:`new-skills`,showEmptyBundleOption:!0,planAction:i?{label:v(`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}:{}}),_()}}:void 0,primaryAction:{label:v(`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}:{}}),_()}},secondaryAction:{label:v(`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}:{}}),_()}}})]})})},hle=({className:e=``})=>{let{setNodeRef:t,isOver:n}=SF({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)(yC,{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)(OC,{className:`h-5 w-5 transition-colors ${n?`text-red-100`:`text-red-300/70`}`})})]})},gle=(e,t)=>Y(J(`/ticket-dependencies`,e),{signal:t}),_le=(e,t)=>Y(J(`/ticket-dependencies`,e),{method:`POST`,body:t,fallbackErrorMessage:`Unable to create the dependency right now.`}),vle=(e,t,n)=>Ze(J(`/ticket-dependencies/${t}/${n}`,e),{method:`DELETE`,fallbackErrorMessage:`Unable to remove the dependency right now.`}),yle=(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},ble=(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,xle=(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,Sle=({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=>ble(e,r)?e:r),C.current=n,c(e=>yle(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=>{xle(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},[]),B=(0,p.useCallback)(async t=>{if(e)try{await vle(e,t.blocker_ticket_id,t.dependent_ticket_id),r(e=>ty(e,t.blocker_ticket_id,t.dependent_ticket_id))}catch(e){$.error(e instanceof Ge?e.message:`Unable to remove the dependency right now.`,{id:`board-dependency-error`})}},[e,r]),V=(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?ry(n,t,o):null;if(D.current?.(),D.current=null,F(null),!(!o||!s)){if(!s.valid){$.error(iy(s.reason),{id:`board-dependency-error`});return}try{let n=await _le(e,{blocker_ticket_id:t,dependent_ticket_id:o});r(e=>ey(e,n))}catch(e){$.error(e instanceof Ge?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 H=(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=ry(n,r,e.id);i.set(e.id,t.valid?`valid`:`idle`)}return i},[e,n,g,j,t]),U=(0,p.useCallback)(e=>{if(!H||!g)return`idle`;let t=H.get(e)??`idle`;return e===g.hoveredTicketId&&t===`idle`?`invalid`:t},[H,g]),W=(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:W,overlaySize:d,getDependencyTargetState:U,handleDependencyStart:V,handleDeleteDependency:B}},Cle=`[data-terminal-pane="true"]`,wle=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},Tle=e=>e instanceof HTMLElement?e.closest(Cle)!==null:!1,Ele=e=>wle(e)||Tle(e),Dle=(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])},v8=new Set([`queued`,`running`]),Ole={check_batch:`checks`,check_repair:`auto_fix`,automation_review_fix:`auto_fix`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pr`},y8=e=>{if(!e.id)return null;let t=Date.parse(e.updated_at);return Number.isFinite(t)?t:null},kle=e=>{let t=e.source_reference;if(e.kind!==`automation_progression`||e.status!==`waiting`&&!v8.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=y8(e);return!n||r===null?null:{bundleId:n,id:e.id,isActive:v8.has(e.status),updatedAt:r}},Ale=e=>{let t=Ole[e.kind],n=y8(e);return!t||!v8.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}},b8=(e,t)=>e.updatedAt===t.updatedAt?e.id.localeCompare(t.id)>0:e.updatedAt>t.updatedAt,jle=e=>{let t=new Map,n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=kle(r);if(e){let n=t.get(e.bundleId);(!n||b8(e,n))&&t.set(e.bundleId,e);continue}let i=Ale(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||b8(e,n))&&a.set(t,e)}for(let[e,t]of a)i.set(e,t.status);return i},x8={runs:[],events:[],isLoading:!1,isLoadingMore:!1,hasMoreRuns:!1,hasMoreEvents:!1,error:null},S8=(0,p.createContext)({state:new Map,loadMoreProject:()=>void 0,refreshProject:()=>void 0,subscribeProject:()=>()=>void 0}),Mle=[`queued`,`waiting`,`running`],Nle=(e,t,n,r)=>Noe(e,{cursor:t,limit:200,signal:n,statuses:r}),Ple=(e,t,n)=>Poe(e,{cursor:t,limit:200,signal:n}),Fle=(e,t)=>{let n=t.created_at.localeCompare(e.created_at);return n===0?t.id.localeCompare(e.id):n},Ile=(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},C8=(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(Fle)},w8=(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(Ile)},Lle=async(e,t,n)=>{let r=null,i=[];do{let a=await e(t,r,n,Mle);i=C8(i,a.runs),r=a.next_cursor}while(r);return i},Rle=({socket:e,fetchRunsPage:t,fetchEventsPage:n,children:r})=>{let i=Aq(),a=e??i,o=t??Nle,s=n??Ple,[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)??x8;return n.set(e,{...r,isLoading:!0,isLoadingMore:!1,error:null}),n}),Promise.all([o(e,null,t.signal),Lle(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:C8(C8(n.runs,r),a.runs),events:w8(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)??x8;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)??x8;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)??x8;return i.set(e,{...a,runs:C8(a.runs,t.runs),events:w8(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)??x8;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=C8(t.runs,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??x8;return n.set(e.project_id,{...r,runs:C8(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=w8(t.events,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??x8;return n.set(e.project_id,{...r,events:w8(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)(S8.Provider,{value:x,children:r})},T8=e=>{let{loadMoreProject:t,refreshProject:n,state:r,subscribeProject:i}=(0,p.useContext)(S8);(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)??x8:x8,loadMore:o,refresh:a}},E8=e=>({...e,messages:void 0,agent_log:void 0,streaming_response:void 0}),D8=(e,t)=>e?e.state!==t.state||e.parked_at!==t.parked_at||e.worktree_bundle_id!==t.worktree_bundle_id:!0,O8=(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}},k8=(e,t)=>{let n=e=>Dy(t)?Dy(e):e.state===t.state&&!Dy(e),r=e.findIndex(e=>n(e));if(r===-1)return[...e,t];let i=[...e];return i.splice(r,0,t),i},A8=(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)]},j8=(e,t)=>{let n=e.find(e=>e.id===t.id);if(!n)return[...e,t];let r=O8(n,t);return e.map(e=>e.id===t.id?r:e)},M8=(e,t)=>{let n=O8(e.find(e=>e.id===t.id),t);return k8(N8(e,t.id),n)},zle=(e,t)=>{if(e.length===0)return[...t];let n=[...e];for(let e of t)n=D8(n.find(t=>t.id===e.id),e)?M8(n,e):j8(n,e);let r=new Set(t.map(e=>e.id));return n.filter(e=>r.has(e.id))},N8=(e,t)=>e.filter(e=>e.id!==t),P8=(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=N8(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 k8(s,o)},F8=async(e,t)=>{`Notification`in window&&Notification.permission!==`denied`&&(Notification.permission===`default`&&await Notification.requestPermission(),Notification.permission===`granted`&&new Notification(e,{body:t}))},I8=(0,p.createContext)(null),Ble=15*1e3,Vle=1e3,Hle=async e=>F8(`Ticket done`,e),L8=e=>E8(e),Ule=(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,Wle=({activeProjectId:e,refreshKey:t=0,onLoadedProjectIdChange:n,onProjectUsageChange:r,onBundlesChange:i,onBundlesLoadingChange:a,children:o})=>{let s=Aq(),[c,l]=(0,p.useState)([]),[u,d]=(0,p.useState)([]),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)(null),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(null),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),T=(0,p.useRef)(0),E=(0,p.useRef)(0),D=(0,p.useRef)(new Map),O=(0,p.useRef)(new Map),k=(0,p.useRef)([]),A=(0,p.useRef)(e),j=(0,p.useRef)(new Map),M=(0,p.useRef)(new Map),N=(0,p.useRef)(new Map),P=(0,p.useCallback)((e,t)=>{let n=M.current.get(t.id);return!n||!e||t.state===n?t:e},[]),F=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(M.current);for(let r of e)n.set(r,t);M.current=n},[]),I=(0,p.useCallback)(e=>{if(e.length===0||M.current.size===0)return;let t=new Map(M.current);for(let n of e)t.delete(n);M.current=t},[]),L=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(N.current);for(let r of e)n.set(r,t);N.current=n},[]),R=(0,p.useCallback)(e=>{if(e.length===0||N.current.size===0)return;let t=new Map(N.current);for(let n of e)t.delete(n);N.current=t},[]),z=(0,p.useCallback)((e,t)=>{if(j.current.has(t.id))return null;let n=P(e,t);return N.current.has(t.id)?{...n,parked_at:N.current.get(t.id)??null}:n},[P]),B=(0,p.useCallback)((e,t)=>{if(j.current.size===0&&M.current.size===0&&N.current.size===0)return t;let n=new Map(e.map(e=>[e.id,e]));return t.flatMap(e=>{let t=z(n.get(e.id),e);return t?[t]:[]})},[z]),V=(0,p.useCallback)(async(e,t)=>{let n=await Gt(e,t,{detail:`board`});return Array.isArray(n)?(!t?.aborted&&A.current===e&&l(e=>zle(e,B(e,n).map(L8))),n):null},[B]),H=(0,p.useCallback)(async(e,t)=>{await V(e,t)},[V]),U=(0,p.useCallback)(async(e,t)=>{let n=++E.current,r=await Kt(e,t);if(!Array.isArray(r)||t?.aborted||A.current!==e||E.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}))},[]),W=(0,p.useCallback)(e=>e.some(e=>e.is_stale===void 0),[]),G=(0,p.useCallback)(async e=>{let t=A.current;if(!t)return null;try{let n=await qt(e,t);if(A.current!==t)return null;let r=O.current.get(n.id),i=z(r,n);if(!i)return null;let a=L8(i),o=D8(r,a);return l(e=>o?M8(e,a):j8(e,a)),n}catch{return null}},[z]),K=(0,p.useCallback)(async t=>{if(!e){m([]);return}m(await mt(e,t))},[e]),ee=(0,p.useMemo)(()=>new Map(c.map(e=>[e.id,e])),[c]),te=(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:C}},[C,c]);(0,p.useEffect)(()=>{if(O.current=ee,k.current.length===0)return;let e=[],t=[];for(let n of k.current){let r=ee.get(n.blocker_ticket_id),i=ee.get(n.dependent_ticket_id);r&&i&&r.project_id===A.current&&i.project_id===A.current?e.push(n):t.push(n)}k.current=t,e.length>0&&d(t=>e.reduce((e,t)=>ey(e,t),t))},[ee]),(0,p.useEffect)(()=>{A.current=e,j.current.clear(),k.current=[],M.current.clear(),N.current.clear(),w(null),g(null),D.current.clear()},[e]),(0,p.useEffect)(()=>{n?.(y?null:_)},[_,y,n]),(0,p.useEffect)(()=>{if(i){if(!e){i(null,[]);return}if(_!==e){i(e,[]);return}i(e,f)}},[e,f,_,i]),(0,p.useEffect)(()=>{if(a){if(!e){a(null,!1);return}a(e,x===e)}},[e,x,a]),(0,p.useEffect)(()=>{let t=new AbortController,n=++T.current,r=null,i=async()=>{try{if(!e){l([]),d([]),m([]),v(null),b(null);return}l([]),d([]),m([]),v(null),b(e),S(e);let[n,i,a]=await Promise.allSettled([V(e,t.signal),gle(e,t.signal),mt(e,t.signal)]);if(t.signal.aborted)return;n.status!==`fulfilled`&&!Ye(n.reason)&&l([]),i.status===`fulfilled`?d(i.value):Ye(i.reason)||d([]),a.status===`fulfilled`?m(a.value):Ye(a.reason)||m([]),v(n.status===`fulfilled`&&i.status===`fulfilled`&&a.status===`fulfilled`?e:null),n.status===`fulfilled`&&n.value!==null&&W(n.value)&&(r=window.setTimeout(()=>{t.signal.aborted||U(e,t.signal)},Vle))}finally{!t.signal.aborted&&T.current===n&&(b(null),S(null))}},a=t=>{t.project_id===e&&(g(t),!j.current.has(t.id)&&(t.bundle&&m(e=>A8(e,t.bundle)),l(e=>M8(e,L8(t)))))},o=t=>{if(t.project_id===e&&g(t),l(n=>{if(t.project_id!==e)return N8(n,t.id);let r=n.find(e=>e.id===t.id),i=z(r,t);if(!i)return n;let a=L8(i);return D8(r,a)?M8(n,a):j8(n,a)}),t.project_id!==e){d(e=>$v(e,t.id));return}t.bundle&&m(e=>A8(e,t.bundle))},c=({id:e})=>{j.current.delete(e),N.current.delete(e),M.current.delete(e),l(t=>N8(t,e)),d(t=>$v(t,e))},u=e=>{if(!e)return;let t=O.current.get(e.blocker_ticket_id),n=O.current.get(e.dependent_ticket_id);if(!t||!n){k.current.push(e);return}t.project_id!==A.current||n.project_id!==A.current||d(t=>ey(t,e))},f=e=>{d(t=>ty(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(`ticket-dependency:created`,u),s.on(`ticket-dependency:deleted`,f),()=>{t.abort(),r!==null&&window.clearTimeout(r),s.off(`ticket:created`,a),s.off(`ticket:updated`,o),s.off(`ticket:deleted`,c),s.off(`ticket-dependency:created`,u),s.off(`ticket-dependency:deleted`,f)}},[e,U,t,W,V,z,s]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=()=>{document.visibilityState===`visible`&&Promise.allSettled([V(e,t.signal),K(t.signal)]).then(n=>{n[0]?.status===`fulfilled`&&n[0].value!==null&&W(n[0].value)&&U(e,t.signal)}).catch(()=>{})},r=window.setInterval(n,Ble),i=rx(n);return()=>{t.abort(),window.clearInterval(r),i()}},[e,K,U,W,V]),(0,p.useEffect)(()=>{if(!e||!r||_!==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,_,r,c]),(0,p.useEffect)(()=>{for(let e of c){let t=D.current.get(e.id),n=Ule(e,t);n&&w(n),t!==void 0&&t===`running`&&e.agent_status===`done`&&(e.state===`plan`||e.state===`build`||e.state===`review`)&&Hle(e.title),D.current.set(e.id,e.agent_status)}},[c]);let ne=(0,p.useCallback)(()=>{g(null)},[]),re=(0,p.useMemo)(()=>({tickets:c,setTickets:l,dependencies:u,setDependencies:d,bundles:f,setBundles:m,latestDetailedTicketUpdate:h,clearLatestDetailedTicketUpdate:ne,loadedProjectId:_,loadingProjectId:y,activeProjectIdRef:A,pendingDeletedTicketsRef:j,pendingOptimisticMovesRef:M,pendingParkedTicketsRef:N,refreshTickets:H,requestSingleTicketRefresh:G,refreshBundles:K,resolvePendingTicket:z,resolvePendingTickets:B,markPendingOptimisticMoves:F,clearPendingOptimisticMoves:I,markPendingParkedTickets:L,clearPendingParkedTickets:R,liveActivity:te}),[f,ne,I,R,u,te,_,h,y,F,L,K,H,G,z,B,c]);return(0,X.jsx)(I8.Provider,{value:re,children:o})},R8=()=>{let e=(0,p.useContext)(I8);if(!e)throw Error(`useProjectWorkspace must be used inside ProjectWorkspaceProvider`);return e},z8=(0,p.lazy)(()=>kG(()=>import(`./VerificationDialog-BgEDRfgP.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),B8=`archon.last-model-selection`,V8=`archon.last-variant-selection`,H8=`archon.last-skills-selection`,Gle=()=>{try{let e=window.localStorage.getItem(H8),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}},U8=[`plan`,`build`,`review`],W8=`done`,G8=()=>({build:!1,stopBuild:!1,resumeBuild:!1,review:!1,undoReview:!1,run:!1,stop:!1,followUp:!1,bundleRefresh:!1}),Kle=(e,t,n)=>{e?window.localStorage.setItem(B8,e):window.localStorage.removeItem(B8),t?window.localStorage.setItem(V8,t):window.localStorage.removeItem(V8),n.length>0?window.localStorage.setItem(H8,JSON.stringify(n)):window.localStorage.removeItem(H8)},K8=(e,t={})=>Xy(e,t),qle=()=>({model:window.localStorage.getItem(B8)??``,variant:window.localStorage.getItem(V8)??``,skills:Gle()}),q8=(e,t)=>{let n=N8(e,t.ticket.id),r=Math.max(0,Math.min(t.index,n.length));return n.splice(r,0,t.ticket),n},Jle=({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,initialTicketId:f=null,onInitialTicketNavigationConsumed:m,initialImportedDraft:h=null,onInitialImportedDraftConsumed:g})=>{let{t:_}=He(`common`),v=Pre(Nre(XP,{activationConstraint:{distance:5}})),{tickets:y,setTickets:b,dependencies:x,setDependencies:S,bundles:C,setBundles:w,latestDetailedTicketUpdate:T,clearLatestDetailedTicketUpdate:E,loadedProjectId:D,loadingProjectId:O,activeProjectIdRef:k,pendingDeletedTicketsRef:A,requestSingleTicketRefresh:j,refreshBundles:M,resolvePendingTicket:N,markPendingOptimisticMoves:P,clearPendingOptimisticMoves:F,markPendingParkedTickets:I,clearPendingParkedTickets:L}=R8(),{runs:R}=T8(e),z=(0,p.useMemo)(()=>{let e=jle(R);for(let t of y)t.worktree_bundle_id&&t.automation_paused_reason&&e.delete(t.worktree_bundle_id);return e},[R,y]),[B,V]=(0,p.useState)(null),[H,U]=(0,p.useState)(null),[W,G]=(0,p.useState)(null),K=(0,p.useCallback)(e=>G(e),[]),[ee,te]=(0,p.useState)(null),[ne,re]=(0,p.useState)({x:0,y:0}),[ie,ae]=(0,p.useState)(null),[oe,se]=(0,p.useState)([]),ce=OF(`opencode`),le=OF(`claude`),ue=(0,p.useMemo)(()=>({opencode:ce.models,claude:le.models}),[ce.models,le.models]),de=(0,p.useCallback)(e=>ue[e]??[],[ue]),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(null),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)(null),we=(0,p.useRef)(null),[Te,Ee]=(0,p.useState)(null),[De,Oe]=(0,p.useState)(null),[ke,Ae]=(0,p.useState)(null),[je,Me]=(0,p.useState)(null),[Ne,q]=(0,p.useState)(null),Pe=(0,p.useRef)(0),[Fe,Ie]=(0,p.useState)(null),[Le,Re]=(0,p.useState)(null),[ze,Be]=(0,p.useState)(null),[Ve,Ue]=(0,p.useState)(!1),[We,Ke]=(0,p.useState)(G8()),[qe,Je]=(0,p.useState)(0),[J,Xe]=(0,p.useState)(``),[Ze,Y]=(0,p.useState)(!1),[Qe,$e]=(0,p.useState)(!1),et=tI(i)||tI(Se?.tool)||!!ke?.tickets.some(e=>tI(eI(e,i))),tt=tI(i)&&de(i).length>0,nt=tI(eI(Se,i))&&de(eI(Se,i)).length>0,rt=!!ke?.tickets.some(e=>tI(eI(e,i)))&&(ue.opencode.length>0||ue.claude.length>0),it=(0,p.useRef)(e),at=(0,p.useRef)(null),ot=(0,p.useRef)(null),[st,ct]=(0,p.useState)(null),lt=y.find(e=>e.is_running)??null,ut=lt?yy(lt):null,dt=r?.context_key??null,ft=r?.kind===`ticket`?by(r,y)??ut:ut,pt=r?.kind===`project`,mt=ft??st,gt=(0,p.useCallback)(e=>xy({bundleId:e,activeRunContextKey:mt,isProjectRootRunActive:pt}),[mt,pt]),_t=B!==null&&By(B,`trash`)||H!==null&&Py(H),bt=O===e,xt=(0,p.useMemo)(()=>t?cw(t):[],[t]),St=(0,p.useMemo)(()=>dw(xt),[xt]),Dt=(0,p.useMemo)(()=>t?lw(t):[],[t]),Ot=(0,p.useMemo)(()=>t?uw(t):[],[t]),kt=St.length>0,It=(0,p.useMemo)(()=>new Map(y.map(e=>[e.id,e])),[y]);(0,p.useEffect)(()=>{ct(null)},[e]),(0,p.useEffect)(()=>{st!==null&&(pt||ft!==null)&&ct(null)},[ft,pt,st]),(0,p.useEffect)(()=>{if(!be){Ce(null);return}let e=It.get(be)??null;e&&Ce(t=>!t||t.id!==be?e:Cy(t,e))},[be,It]),(0,p.useEffect)(()=>{T&&(Ce(e=>!e||e.id!==T.id?e:Cy(e,T)),Ae(e=>{if(!e)return e;let t=T.worktree_bundle_id;if(!t||e.bundle.id!==t)return e;let n=e.tickets.some(e=>e.id===T.id)?e.tickets.map(e=>e.id===T.id?Cy(e,T):e):[...e.tickets,T];return{...e,tickets:n}}))},[T]),(0,p.useEffect)(()=>{T===null||be!==null||Te!==null||E()},[E,T,Te,be]);let Lt=(0,p.useCallback)(async e=>{let t=await j(e);if(!t)return null;let n=It.get(e),r=n?Cy(t,n):t;return Ce(t=>t&&t.id!==e||be&&be!==e?t:r),r},[j,be,It]),Rt=(0,p.useCallback)(e=>{Ce(e),xe(e.id),Lt(e.id)},[Lt]),zt=(0,p.useMemo)(()=>new Map(C.map(e=>[e.id,e])),[C]),Bt=(0,p.useMemo)(()=>{if(!ke)return null;let e=ke.bundle.id,t=T?.worktree_bundle_id===e?T:null,n=y.filter(t=>t.worktree_bundle_id===e),r=new Map(n.map(e=>[e.id,e])),i=ke.tickets.filter(e=>!A.current.has(e.id)).map(e=>t&&e.id===t.id?Cy(e,t):e);t&&!i.some(e=>e.id===t.id)&&!A.current.has(t.id)&&i.push(t);let a=i.map(e=>Cy(e,r.get(e.id)));for(let e of n)a.some(t=>t.id===e.id)||a.push(e);a=Q3(a);let o=ke.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=qy(a),p=a.find(e=>e.id===ke.review_owner_ticket_id&&e.state===`review`)??a.find(e=>e.state===`review`)??null,m=Xy(a,{targetTicketId:ke.target_ticket_id,reviewOwnerTicketId:p?.id??ke.review_owner_ticket_id,latestSessionTicketId:f?.id??ke.latest_session_ticket_id});return{...ke,bundle:zt.get(e)??ke.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:ke.has_completed_review,has_follow_up_since_last_review:l?d.has_follow_up_since_last_review:ke.has_follow_up_since_last_review,can_re_review:l?d.can_re_review:ke.can_re_review}},[zt,T,A,ke,y]),Vt=(0,p.useMemo)(()=>y.filter(e=>{if(Ze&&ky(e))return!1;if(Qe&&e.worktree_bundle_id){let t=zt.get(e.worktree_bundle_id);if(t&&t.pull_request!==void 0?t.pull_request:e.bundle?.pull_request)return!1}return wy(J,e)}),[zt,Qe,Ze,J,y]),Ht=(0,p.useMemo)(()=>$y(Vt),[Vt]),Ut=(0,p.useMemo)(()=>Vt.filter(e=>Dy(e)),[Vt]),Wt=(0,p.useMemo)(()=>Zy(Ut,C,W8),[C,Ut]),{boardViewportRef:Gt,boardContentRef:Kt,registerTicketNode:qt,registerDependencyClipNodes:Yt,measuredCardRects:Zt,dependencyClipRects:Qt,overlayPreview:$t,overlaySize:en,getDependencyTargetState:tn,handleDependencyStart:nn,handleDeleteDependency:rn}=Sle({activeProjectId:e,tickets:y,dependencies:x,setDependencies:S,activeTicket:B,activeOverlayNode:ee,dragOffset:ne}),an=qle(),xn=!!t?.run_ide?.trim(),Cn=(0,p.useCallback)((e,t,n=y)=>{let r=Zy(n,C,t).find(t=>t.kind===`bundle`&&t.group.bundle.id===e);return r?.kind===`bundle`?r.group:null},[C,y]),En=(0,p.useCallback)(e=>{let n=eI(e,i);return(0,X.jsx)(W3,{ticket:e,allTickets:y,dependencies:x,bundles:C,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:e.worktree_bundle_id?z.get(e.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:tI(n)&&de(n).length>0,availableModels:de(n),runDisabled:!0,hideBundleScopedControls:!0})},[t?.memory_enabled,i,z,C,x,de,y]),Dn=(0,p.useCallback)(t=>Yy(t)?t.project_id===e?xn:!!t.has_run_ide:!1,[xn,e]),On=(0,p.useCallback)(e=>!!e.project_id&&!!(e.bundle?.branch??e.branch)&&Yy(e),[]),kn=(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?Dn(t):!1},[Dn]),An=(0,p.useCallback)(e=>{let t=Q3(y.filter(t=>t.worktree_bundle_id===e));return ke?.bundle.id===e?K8(Q3(ke.tickets.map(e=>t.find(t=>t.id===e.id)??e)),{targetTicketId:ke.target_ticket_id,reviewOwnerTicketId:ke.review_owner_ticket_id,latestSessionTicketId:ke.latest_session_ticket_id}):K8(t)},[ke,y]),jn=(0,p.useCallback)(e=>{let t=An(e),n=C.some(t=>t.id===e&&t.has_prepared_worktree===!0)||y.some(t=>t.worktree_bundle_id===e&&Yy(t))||!!(ke?.bundle.id===e&&ke.tickets.some(Yy));return!!(t?.project_id&&(t.bundle?.branch??t.branch)&&n)},[C,An,ke,y]);(0,p.useEffect)(()=>{he(!1),_e(!1),Ie(null),Be(null),it.current!==e&&(Be(null),at.current=e),e||(at.current=null,Xe(``)),it.current=e},[e,d]),(0,p.useLayoutEffect)(()=>{!e||D!==e||at.current===e&&(at.current=null,Xe(``))},[e,D]),(0,p.useEffect)(()=>{if(!et){se([]);return}let t=new AbortController;return(async()=>{try{se(await kF(`opencode`,t.signal,e))}catch(e){Ye(e)||se([])}})(),()=>{t.abort()}},[e,et]);let Mn=({active:e})=>{pe(!1),te(null),re({x:0,y:0}),G(null);let t=eb(String(e.id));if(t){U(Cn(t.bundleId,t.column)),V(null);return}U(null),V(y.find(t=>t.id===e.id)??null)},Nn=()=>{pe(!1),te(null),re({x:0,y:0}),V(null),U(null),G(null)},Pn=(0,p.useCallback)(e=>{b(t=>e.reduce((e,t)=>M8(e,t),t))},[b]),Fn=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=e[0]?.state;n&&b(r=>e.reduce((e,r)=>P8(e,r.id,t,zy(r,n,t)),r))},[b]),In=(0,p.useCallback)((e,t=y)=>!e.worktree_bundle_id||!e.project_id||e.state!==`build`?[]:Q3(t.filter(t=>t.project_id===e.project_id&&t.worktree_bundle_id===e.worktree_bundle_id&&t.state===`build`&&t.parked_at===null)),[y]),Ln=async({active:e,over:t})=>{let n=eb(String(e.id)),r=y.find(t=>t.id===e.id),i=n?Cn(n.bundleId,n.column):null,a=t?.id===`trash`&&(r!==void 0&&By(r,`trash`)||i!==null&&Py(i)),o=t?.id&&U8.includes(t.id)?t.id:null;if(pe(a),te(null),re({x:0,y:0}),V(null),U(null),t){if(n){if(t.id===`trash`){if(!i||!Py(i))return;await Yn(i);return}if(t.id===W8){if(!i||!Fy(i))return;await Kn(i);return}if(o){if(n.column===W8){if(!i||!Iy(i))return;await qn(i);return}await Fr(n.bundleId,n.column,o)}return}if(t.id===`trash`){if(!r||!By(r,`trash`))return;Zn(e.id);return}if(t.id===W8){if(!r||!By(r,W8))return;await Wn(e.id);return}if(o){if(r&&Ny(r,o)){await Gn(e.id);return}if(!(!r||!By(r,o)))try{await Hn(r,o,{optimistic:!0})}catch(e){$.error(e instanceof Ge?e.message:_(`board.errors.moveTicket`),{id:`board-move-error`})}}}},Rn=async(t,n,r,i,a,o,s)=>{let c=await Jt({title:t,description:n,model:i,variant:a,skills:o,project_id:e,...s});if(Kle(i,a,o),b(e=>M8(e,E8(c))),c.bundle&&w(e=>A8(e,c.bundle)),r===`build`)try{await Hn(c,`build`)}catch(e){$.error(e instanceof Ge?e.message:_(`board.errors.moveTicket`),{id:`board-move-error`})}r===`plan`&&Tn(c.id,c.project_id)},zn=async t=>{if(!e)throw Error(_(`board.errors.createBundleWithoutProject`));let n=await ht(e,{name:t,prepare:!0});return w(e=>A8(e,n)),n},Bn=(0,p.useCallback)((e,t={})=>{let n=E8(e);b(e=>t.reorderInState?M8(e,n):j8(e,n)),Ce(t=>!t||t.id!==e.id?t:Cy(e,n)),e.bundle&&w(t=>A8(t,e.bundle))},[w,b]),Vn=(0,p.useCallback)(e=>{w(t=>A8(t,e)),b(t=>t.map(t=>t.worktree_bundle_id===e.id?{...t,bundle:e}:t)),Ae(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)})},[w,Ae,b]),Hn=async(e,t,n={})=>{let r=y.findIndex(t=>t.id===e.id),i=t===`review`?In(e):[],a=t===`review`&&i.length>1,o=n.optimistic?a?i.map(e=>e.id):[e.id]:[];n.optimistic&&(P(o,t),a?Fn(i,t):b(n=>P8(n,e.id,t,Ly(e,t))));try{if(a&&e.project_id&&e.worktree_bundle_id){let t=await wt(e.project_id,e.worktree_bundle_id);_r(t);let n=t.tickets.find(t=>t.id===e.id);if(!n)throw Error(_(`board.errors.missingBundleReviewTicket`));return F(o),n}let n=await Xt(e.id,e.project_id,t);return b(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:D8(i,n)?M8(r,n):j8(r,n)}),n.bundle&&w(e=>A8(e,n.bundle)),F(o),n}catch(t){throw n.optimistic&&(a?Pn(i):b(t=>P8(t,e.id,e.state,{agent_status:e.agent_status,agent_log:e.agent_log,build_completed_at:e.build_completed_at},{preferredIndex:r})),F(o)),t}},Un=(e,t)=>{b(n=>n.map(n=>n.id===e?{...n,...t}:n))},Wn=async t=>{let n=y.find(e=>e.id===t);if(n)try{let r=new Date().toISOString();I([t],r),Un(t,{parked_at:r}),Bn(await un(t,n.project_id??e),{reorderInState:!0}),L([t])}catch(e){L([t]),Un(t,{parked_at:n.parked_at}),$.error(e instanceof Ge?e.message:_(`board.errors.parkTicket`),{id:`board-park-error`})}},Gn=async t=>{let n=y.find(e=>e.id===t);if(n)try{I([t],null),Un(t,{parked_at:null}),Bn(await dn(t,n.project_id??e),{reorderInState:!0}),L([t])}catch(e){L([t]),Un(t,{parked_at:n.parked_at}),$.error(e instanceof Ge?e.message:_(`board.errors.returnTicket`),{id:`board-unpark-error`})}},Kn=(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();I(e.tickets.map(e=>e.id),r),b(e=>e.map(e=>t.has(e.id)?{...e,parked_at:r}:e));let i=await Promise.allSettled(e.tickets.map(e=>un(e.id,e.project_id??k.current))),a=new Set;if(i.forEach((t,n)=>{if(t.status===`fulfilled`){L([t.value.id]),Bn(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&a.add(r.id)}),a.size===0)return;L([...a]),b(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 Ge?o.reason.message:_(`board.errors.moveBundleToDone`):_(`board.toasts.movedBundleToDonePartial`,{movedCount:e.tickets.length-a.size,totalCount:e.tickets.length});$.error(s,{id:`board-bundle-park-error`})},[k,Bn,L,I,b,_]),qn=(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}));I(e.tickets.map(e=>e.id),null),b(e=>e.map(e=>t.has(e.id)?{...e,parked_at:null}:e));let r=await Promise.allSettled(e.tickets.map(e=>dn(e.id,e.project_id??k.current))),i=new Set;if(r.forEach((t,n)=>{if(t.status===`fulfilled`){L([t.value.id]),Bn(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&i.add(r.id)}),i.size===0)return;L([...i]),b(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 Ge?a.reason.message:_(`board.errors.restoreBundle`):_(`board.toasts.restoredBundlePartial`,{restoredCount:e.tickets.length-i.size,totalCount:e.tickets.length});$.error(o,{id:`board-bundle-unpark-error`})},[k,Bn,L,I,b,_]),Jn=async t=>{e&&(await Mt(e,t),w(e=>e.filter(e=>e.id!==t)))},Yn=(0,p.useCallback)(async t=>{let n=t.tickets.map(e=>({ticket:e,index:y.findIndex(t=>t.id===e.id)})).filter(e=>e.index!==-1);if(n.length===0)return;for(let e of n)A.current.set(e.ticket.id,e);let r=new Set(n.map(e=>e.ticket.id));b(e=>e.filter(e=>!r.has(e.id))),S(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),A.current.delete(t.ticket.id),t.ticket.id)));t.tickets.some(e=>e.project_id===k.current)&&M().catch(()=>{});let a=n.filter((e,t)=>i[t]?.status===`rejected`);if(a.length===0)return;for(let e of a)A.current.delete(e.ticket.id);a.some(e=>e.ticket.project_id===k.current)&&b(e=>[...a].sort((e,t)=>e.index-t.index).reduce((e,t)=>q8(e,t),e));let o=i.find(e=>e.status===`rejected`),s=a.length===n.length?o?.reason instanceof Ge?o.reason.message:_(`board.errors.deleteBundleTickets`):_(`board.toasts.deletedBundleTicketsPartial`,{deletedCount:n.length-a.length,totalCount:n.length});$.error(s,{id:`board-delete-bundle-wrapper-error`})},[e,k,A,M,S,b,y,_]),Xn=e=>{let t=It.get(e.id);Bn(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&&w(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===k.current&&M().catch(()=>{})},Zn=async t=>{let n=y.find(e=>e.id===t),r=y.findIndex(e=>e.id===t);if(!(!n||r===-1)){A.current.set(t,{ticket:n,index:r}),b(e=>N8(e,t)),S(e=>$v(e,t));try{await cn(t,n.project_id??e),n.project_id===k.current&&M().catch(()=>{}),A.current.delete(t)}catch(e){let n=A.current.get(t);A.current.delete(t),n&&n.ticket.project_id===k.current&&(b(e=>q8(e,n)),$.error(e instanceof Ge?e.message:_(`board.errors.deleteTicket`),{id:`board-delete-error`}))}}},Qn=async t=>{let n=y.find(e=>e.id===t);if(!n)return;let r=n.state===`review`?`review`:`build`;try{if(ye(r),n.project_id&&n.worktree_bundle_id&&n.state===`review`){_r(await Tt(n.project_id,n.worktree_bundle_id));return}Bn(await ln(t,n.project_id??e),{reorderInState:!0})}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.undoTicket`),{id:`board-undo-error`}),e}finally{ye(e=>e===r?null:e)}},$n=t=>{pn(t,y.find(e=>e.id===t)?.project_id??e)},er=async t=>{let n=y.find(e=>e.id===t),r=n?yy(n):t;try{ct(r),await mn(t,n?.project_id??e),s?.()}catch(e){ct(e=>e===r?null:e),$.error(e instanceof Ge?e.message:_(`board.errors.startRun`),{id:`board-run-error`})}},tr=(0,p.useCallback)(async t=>{let n=y.find(e=>e.id===t);try{await hn(t,n?.project_id??e)}catch(e){$.error(e instanceof Ge?e.message:_(`board.errors.openIde`),{id:`board-open-ide-error`})}},[e,_,y]),nr=async t=>{let n=y.find(e=>e.id===t),i=r?.kind===`ticket`&&n&&ft===yy(n)?dt:null;try{await gn(t,n?.project_id??e),o?.(i),s?.()}catch{}},rr=t=>{_n(t,y.find(e=>e.id===t)?.project_id??e).then(()=>{b(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e))})},ir=async t=>{let n=y.find(e=>e.id===t);try{await vn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:_(`reviewInterrupt.error`))}},ar=t=>{yn(t,y.find(e=>e.id===t)?.project_id??e).then(()=>{b(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e))})},or=(0,p.useCallback)(e=>{let t=An(e);!t||!Dn(t)||tr(t.id)},[Dn,An,tr]),sr=(0,p.useCallback)((e,t)=>{let n=An(e);!n||!jn(e)||Re({target:{kind:`bundle`,bundleId:e,ticketId:n.id},projectId:n.project_id,title:n.bundle?rb(n.bundle):n.title,bundleTargetName:n.bundle&&rb(n.bundle)||null,initialMode:t,followUpMode:`build`})},[jn,An]),cr=(0,p.useCallback)((e,t)=>{let n=An(e);if(!n?.project_id||!Yy(n))return;let r=n.latest_check_gate_evaluation?.id??y.find(t=>t.worktree_bundle_id===e&&t.latest_check_gate_evaluation)?.latest_check_gate_evaluation?.id??null;if(xt.length===0&&!r)return;let i=C.find(t=>t.id===e)??n.bundle;i&&Be({bundleId:e,label:rb(i),requestedInitialTab:t,gateEvaluationId:r,requiredCheckPolicy:i.required_check_policy??null})},[C,An,xt.length,y]),lr=(0,p.useCallback)((e,t)=>{let n=y.find(t=>t.id===e);if(!(!n||!On(n))){if(n.worktree_bundle_id){sr(n.worktree_bundle_id,t);return}Re({target:{kind:`ticket`,ticketId:n.id},projectId:n.project_id,title:n.title,bundleTargetName:null,initialMode:t,followUpMode:`build`})}},[On,sr,y]),ur=(0,p.useCallback)(e=>sr(e,`files`),[sr]),dr=(0,p.useCallback)(e=>sr(e,`changes`),[sr]),fr=(0,p.useCallback)(e=>lr(e,`files`),[lr]),pr=(0,p.useCallback)(e=>lr(e,`changes`),[lr]),mr=(0,p.useCallback)(e=>{let t=y.find(t=>t.id===e);!t?.project_id||!Yy(t)||Ie({ticketId:t.id,label:t.title})},[y]),hr=(0,p.useCallback)(async(t,n,r=`build`,i)=>{let a=y.find(e=>e.id===t);if(a)try{Bn(a.state===`plan`?await wn(t,a.project_id??e,n):await bn(t,a.project_id??e,n,r,i))}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.sendFollowUp`),{id:`board-follow-up-error`}),e}},[e,Bn,_,y]),gr=(0,p.useCallback)(e=>{b(t=>e.reduce((e,t)=>{let n=e.find(e=>e.id===t.id),r=N(n,t);if(!r)return e;let i=E8(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 D8(n,i)?M8(e,i):j8(e,i)},t))},[N,b]),_r=(0,p.useCallback)(e=>{Ae(e),w(t=>A8(t,e.bundle)),gr(e.tickets)},[gr,w]),vr=(0,p.useCallback)((e,t)=>{Array.isArray(t.tickets)&&Ae(n=>!n||n.bundle.id!==e?n:{...n,tickets:t.tickets,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,target_ticket_id:t.target_ticket_id})},[]),yr=(0,p.useCallback)(async e=>{let t=k.current;if(!t)return null;let n=await vt(t,e);return k.current===t?(_r(n),n):null},[k,_r]),br=(0,p.useCallback)(async()=>{let e=Ne?.bundle.id,t=k.current;if(!e||!t)return null;let n=++Pe.current,r=await vt(t,e);return n!==Pe.current||k.current!==t?null:(_r(r),q(r),r)},[k,_r,Ne?.bundle.id]),xr=(0,p.useCallback)(async t=>{if(!e)return;Me(t),q(null);let n=++Pe.current;try{let r=await vt(e,t);if(k.current!==e||n!==Pe.current)return;_r(r),q(r)}catch{if(n!==Pe.current||k.current!==e)return;Me(null),$.error(_(`buildOpenQuestionsDialog.refreshFailedError`),{id:`board-build-open-questions-load-error`})}},[e,k,_r,_]),Sr=(0,p.useCallback)(async t=>{let n=Ne?.bundle.id;if(!e||!n)return;let r=++Pe.current,i=await Ft(e,n,t);r===Pe.current&&(_r(i),q(i),Me(null))},[e,_r,Ne?.bundle.id]),Cr=Ne?.bundle.id??null;(0,p.useEffect)(()=>{if(!Cr)return;let e=new Map(y.map(e=>[e.id,e])),t=C.find(e=>e.id===Cr);q(n=>!n||n.bundle.id!==Cr?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})})},[C,Cr,y]);let wr=(0,p.useCallback)(async e=>{let t=k.current;if(!t)return null;let n=await yt(t,e);return k.current===t?(vr(e,n),n):null},[k,vr]),Tr=(0,p.useCallback)(async(e,t=null)=>{let n=k.current;if(!n)return;xe(null),Ce(null),Ee(e),Oe(t),Ke(G8());let r=zt.get(e)??null,i=y.filter(t=>t.worktree_bundle_id===e);if(r&&i.length>0){let e=qy(i),t=Xy(i,{reviewOwnerTicketId:i.find(e=>e.state===`review`)?.id??null,latestSessionTicketId:e?.id??null});Ae({bundle:r,tickets:i,latest_session_ticket_id:e?.id??null,latest_session_id:e?.session_id??null,review_owner_ticket_id:i.find(e=>e.state===`review`)?.id??null,target_ticket_id:t?.id??null})}else Ae(null);Ue(!0);try{await wr(e)}catch{}finally{k.current===n&&Ue(!1)}},[k,zt,wr,y]),Er=(0,p.useCallback)(async(e,t)=>{Ke(t=>({...t,[e]:!0}));try{return await t()}finally{Ke(t=>({...t,[e]:!1}))}},[]),Dr=(0,p.useCallback)(async t=>{await Er(`stopBuild`,async()=>{let n=y.find(e=>e.id===t);await _n(t,n?.project_id??e),b(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,Er,b,y]),Or=(0,p.useCallback)(async t=>{await Er(`stopBuild`,async()=>{let n=y.find(e=>e.id===t);try{await vn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:_(`reviewInterrupt.error`))}})},[e,Er,_,y]),kr=(0,p.useCallback)(async t=>{await Er(`resumeBuild`,async()=>{let n=y.find(e=>e.id===t);await yn(t,n?.project_id??e),b(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e)),n?.worktree_bundle_id&&await yr(n.worktree_bundle_id)})},[e,yr,Er,b,y]),Ar=(0,p.useCallback)(async t=>{if(e)try{_r(await Er(`build`,()=>Ct(e,t))),Te===t&&Oe(`build`),s?.()}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.buildBundle`),{id:`board-bundle-build-error`}),e}},[e,_r,s,Er,Te,_]),jr=(0,p.useCallback)(async t=>{if(e)try{_r(await Er(`review`,()=>wt(e,t))),Te===t&&Oe(`review`)}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.reviewBundle`),{id:`board-bundle-review-error`}),e}},[e,_r,Er,Te,_]),Mr=(0,p.useCallback)(async t=>{if(e)try{ye(`review`),_r(await Er(`undoReview`,()=>Tt(e,t))),Te===t&&Oe(`build`)}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.undoBundleReview`),{id:`board-bundle-undo-review-error`}),e}finally{ye(e=>e===`review`?null:e)}},[e,_r,Er,Te,_]),Nr=(0,p.useCallback)(async t=>{if(e)try{_r(await Nt(e,t))}catch(e){$.error(e instanceof Ge?e.message:`Unable to resume the automation right now.`,{id:`board-bundle-resume-automation-error`})}},[e,_r]),Pr=(0,p.useCallback)(async t=>{if(e)try{_r(await Pt(e,t))}catch(e){$.error(e instanceof Ge?e.message:`Unable to dismiss the automation pause right now.`,{id:`board-bundle-dismiss-automation-error`})}},[e,_r]),Fr=(0,p.useCallback)(async(e,t,n)=>{if(t===W8||n===W8)return;let r=Ry(t,n);if(!r)return;let i=y.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);P(a,n),Fn(i,n);try{if(r===`build`){await Ar(e),F(a);return}if(r===`review`){await jr(e),F(a);return}await Mr(e),F(a)}catch(e){Pn(i),F(a),$.error(e instanceof Ge?e.message:_(`board.errors.moveBundle`),{id:`board-bundle-move-error`})}},[F,Ar,jr,Mr,P,Fn,Pn,y,_]),Ir=async t=>{e&&(_r(await Er(`run`,()=>At(e,t))),s?.())},Lr=async t=>{if(!e)return;let n=r?.kind===`ticket`&&ft===t?dt:null,i=await Er(`stop`,()=>jt(e,t));o?.(n),_r(i),s?.()},Rr=(0,p.useCallback)(async(t,n,r=`build`,i)=>{e&&_r(await Er(`followUp`,()=>Et(e,t,n,r,i)))},[e,_r,Er]);(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:_(`board.preview.disabledProjectRoot`),submitPrompt:null});return}let e=y.find(e=>e.id===r.ticket_id);if(!e){a({target:null,canSelect:!1,disabledReason:_(`board.preview.disabledBuildCapable`),submitPrompt:null});return}if(e.state===`plan`){a({target:{kind:`ticket`,id:e.id},canSelect:!1,disabledReason:_(`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:_(`board.preview.followUpBundlePlaceholder`),submitPrompt:t=>Rr(e.worktree_bundle_id,t)});return}a({target:{kind:`ticket`,id:e.id},canSelect:!0,disabledReason:null,promptPlaceholder:_(`board.preview.followUpTicketPlaceholder`),submitPrompt:t=>hr(e.id,t)})},[r,hr,Rr,a,_,y]);let zr=async t=>{let n=y.find(e=>e.id===t),r=n?_y(n.state):null;if(n)try{if(n.state===`review`&&n.can_re_review&&n.agent_status!==`running`){let t=await Sn(n.id,n.project_id??e);Bn(t),t.worktree_bundle_id&&await yr(t.worktree_bundle_id);return}if(!r)return;if(n.worktree_bundle_id&&r===`review`){await jr(n.worktree_bundle_id);return}await Hn(n,r)}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.moveTicket`),{id:`board-move-error`}),e}},Br=async t=>{let n=y.find(e=>e.id===t);try{Bn(await on(t,n?.project_id??e))}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.startBuildChain`),{id:`board-build-chain-error`}),e}},Vr=async t=>{let n=y.find(e=>e.id===t);try{await sn(t,n?.project_id??e)}catch(e){throw $.error(e instanceof Ge?e.message:_(`board.errors.stopBuildChain`),{id:`board-stop-build-chain-error`}),e}},Hr=async()=>{if(!(!e||ge)){_e(!0);try{let t=await fn(e);b(e=>e.filter(e=>!t.deleted_ticket_ids.includes(e.id))),S(e=>t.deleted_ticket_ids.reduce($v,e)),await M(),he(!1),t.failed_count>0?$.error(_(`board.toasts.deleteDonePartial`,{count:t.deleted_count,deletedCount:t.deleted_count,failedCount:t.failed_count}),{id:`board-delete-parked-error`}):$.success(_(`board.toasts.deleteDoneSuccess`,{count:t.deleted_count}),{id:`board-delete-parked-success`})}catch(e){$.error(e instanceof Ge?e.message:_(`board.errors.emptyDone`),{id:`board-delete-parked-error`})}finally{_e(!1)}}},Ur=({delta:e})=>{re(e)},Wr=(0,p.useCallback)((t=null)=>{e&&ae({initialWorktreeBundleId:t})},[e]);(0,p.useEffect)(()=>{!h||!e||(ae({initialWorktreeBundleId:null,initialImportedDraft:h}),g?.())},[h,e,g]),(0,p.useEffect)(()=>{if(!f||!e){we.current=null;return}let t=`${e}:${f}`;if(D!==e||we.current===t)return;we.current=t;let n=It.get(f);n&&Rt(n),m?.()},[e,f,D,m,Rt,It]);let Gr=(0,p.useCallback)(()=>{ot.current?.focus({preventScroll:!0})},[]);return Dle([{key:`n`,onKeyDown:Wr,disabled:!e},{key:`k`,ctrlKey:!0,onKeyDown:Gr}],{isBlocked:Ele}),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Iie,{sensors:v,collisionDetection:Wre,onDragStart:Mn,onDragMove:Ur,onDragCancel:Nn,onDragEnd:Ln,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)(hse,{query:J,inputRef:ot,hideStaleTickets:Ze,hideBundlesWithPullRequests:Qe,onQueryChange:Xe,onClear:()=>{Xe(``),ot.current?.focus()},onHideStaleTicketsChange:Y,onHideBundlesWithPullRequestsChange:$e}),(0,X.jsx)(`div`,{ref:Gt,className:`flex min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,children:(0,X.jsxs)(`div`,{ref:Kt,className:`relative flex min-h-0 w-max min-w-full gap-4`,children:[(0,X.jsx)(ple,{dependencies:x,cardRects:Zt,clipRects:Qt,preview:$t,ticketsById:It,overlaySize:en}),U8.map(t=>{let n=y.filter(e=>e.state===t&&!Dy(e)),r=Vt.filter(e=>e.state===t&&!Dy(e)),a=Zy(r,C,t),o=bt&&n.length===0?t===`plan`?1:t===`build`?2:0:0;return(0,X.jsx)(G3,{id:t,title:_(`card.columnLabels.${t}`),items:a,ticketCount:r.length,allTickets:y,dependencies:x,bundles:C,activeTool:i,modelsByTool:ue,availableSkills:oe,activeRunContextKey:mt,automationStatuses:z,isProjectRootRunActive:pt,isBundleRunDisabled:gt,getDependencyTargetState:tn,onDependencyStart:nn,onDeleteDependency:rn,onRegisterTicketNode:qt,onRegisterDependencyClipNodes:Yt,onAddTicket:t===`plan`&&e?Wr:void 0,onCreateBundle:t===`plan`&&e?zn:void 0,onDeleteBundle:t===`plan`&&e?Jn:void 0,onDeleteBundleWrapper:Yn,onRefreshBundles:t===`plan`&&e?M:void 0,onUpdateTicket:Xn,onDeleteTicket:Zn,onUndoTicket:Qn,undoingColumn:ve,onRetryTicket:$n,onAdvanceTicket:zr,onParkTicket:Wn,onUnparkTicket:Gn,onBuildChainTicket:Br,onRunTicket:er,onOpenVerificationTicket:xt.length>0?mr:void 0,canOpenChangesForTicket:On,onOpenFilesTicket:fr,onOpenChangesTicket:pr,canOpenIdeForTicket:Dn,onOpenIdeTicket:tr,onStopTicket:nr,onStopBuildTicket:rr,onStopBuildChainTicket:Vr,onResumeBuildTicket:ar,onInterruptReviewTicket:ir,onOpenBundleFiles:ur,onOpenBundleChanges:dr,canOpenReviewForBundle:jn,onOpenBundleVerification:xt.length>0?e=>cr(e):void 0,onOpenBundleChecks:e=>cr(e,`checks`),hasConfiguredChecks:xt.length>0,onOpenBundleIde:or,onAddTicketToBundle:Wr,onStartChatFromBundle:u,onFollowUpTicket:hr,bundleActionState:We,onBuildBundle:Ar,onReviewBundle:jr,onUndoBundleReview:Mr,onRunBundle:Ir,onStopBundle:Lr,onParkBundleWrapper:Kn,onUnparkBundleWrapper:qn,onOpenTicketDetails:Rt,onOpenBundleDetails:(e,t)=>{Tr(e,t)},onRequestBundleRefresh:e=>{Er(`bundleRefresh`,()=>yr(e))},onRequestTicketRefresh:j,hoveredBundleId:W,onHoverBundleChange:K,multiColumnBundleIds:Ht,onResumeBundleAutomation:Nr,onDismissBundleAutomationPause:Pr,onOpenBuildQuestions:e=>{xr(e)},loadingSkeletonCount:o},t)}),(0,X.jsx)(G3,{id:W8,title:_(`card.columnLabels.done`),items:Wt,ticketCount:Ut.length,allTickets:y,dependencies:x,activeTool:i,modelsByTool:ue,availableSkills:oe,bundles:C,activeRunContextKey:mt,automationStatuses:z,isProjectRootRunActive:pt,isBundleRunDisabled:gt,getDependencyTargetState:tn,onDependencyStart:nn,onDeleteDependency:rn,onRegisterTicketNode:qt,onRegisterDependencyClipNodes:Yt,onUpdateTicket:Xn,onDeleteTicket:Zn,onUndoTicket:Qn,undoingColumn:ve,onRetryTicket:$n,onAdvanceTicket:zr,onParkTicket:Wn,onUnparkTicket:Gn,onBuildChainTicket:Br,onRunTicket:er,onOpenVerificationTicket:xt.length>0?mr:void 0,canOpenChangesForTicket:On,onOpenFilesTicket:fr,onOpenChangesTicket:pr,canOpenIdeForTicket:Dn,onOpenIdeTicket:tr,onStopTicket:nr,onStopBuildTicket:rr,onStopBuildChainTicket:Vr,onResumeBuildTicket:ar,onInterruptReviewTicket:ir,onOpenBundleFiles:ur,onOpenBundleChanges:dr,canOpenReviewForBundle:jn,onOpenBundleVerification:xt.length>0?e=>cr(e):void 0,onOpenBundleChecks:e=>cr(e,`checks`),hasConfiguredChecks:xt.length>0,onOpenBundleIde:or,onAddTicketToBundle:Wr,onStartChatFromBundle:u,onFollowUpTicket:hr,bundleActionState:We,onBuildBundle:Ar,onReviewBundle:jr,onUndoBundleReview:Mr,onRunBundle:Ir,onStopBundle:Lr,onParkBundleWrapper:Kn,onUnparkBundleWrapper:qn,onOpenTicketDetails:Rt,onOpenBundleDetails:(e,t)=>{Tr(e,t)},onRequestBundleRefresh:e=>{Er(`bundleRefresh`,()=>yr(e))},onRequestTicketRefresh:j,hoveredBundleId:W,onHoverBundleChange:K,multiColumnBundleIds:Ht,onResumeBundleAutomation:Nr,onDismissBundleAutomationPause:Pr,onOpenBuildQuestions:e=>{xr(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:Ut.length===0||ge,onClick:()=>he(!0),children:[(0,X.jsx)(OC,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:_(`board.doneColumn.emptyAction`)})]})})]})})]})}),(0,X.jsxs)(Qie,{zIndex:5,dropAnimation:fe?null:void 0,children:[B&&(0,X.jsx)(W3,{ticket:B,allTickets:y,dependencies:x,bundles:C,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:B.worktree_bundle_id?z.get(B.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:(()=>{let e=eI(B,i);return tI(e)&&de(e).length>0})(),availableModels:de(eI(B,i)),runDisabled:Sy(B,mt,pt,_(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:Sy(B,mt,pt,_(`board.errors.runBlockedByActive`)),onDependencyStart:nn,onDeleteDependency:rn,onRegisterOverlayNode:te,onCreateBundle:zn,onDeleteBundle:Jn,onRefreshBundles:M,onUpdate:Xn,onDelete:()=>Zn(B.id),onUndo:()=>Qn(B.id),undoInProgress:ve===B.state&&(B.state===`build`||B.state===`review`),onRetry:()=>$n(B.id),onAdvance:()=>zr(B.id),onPark:()=>Wn(B.id),onUnpark:()=>Gn(B.id),onBuildChain:()=>Br(B.id),onRun:B.worktree_bundle_id===null&&Yy(B)&&B.has_run_config?()=>er(B.id):void 0,onOpenIde:B.worktree_bundle_id===null&&Dn(B)?()=>tr(B.id):void 0,onStop:B.worktree_bundle_id===null?()=>nr(B.id):void 0,onStopBuild:()=>rr(B.id),onStopBuildChain:()=>Vr(B.id),onResumeBuild:()=>ar(B.id),onInterruptReview:()=>void ir(B.id),onFollowUp:e=>hr(B.id,e),onRequestTicketRefresh:j}),!B&&H&&(0,X.jsx)(qF,{group:H,automationStatus:z.get(H.bundle.id),overlay:!0,renderTicket:En})]}),_t&&(0,X.jsx)(hle,{className:`pointer-events-auto fixed left-1/2 top-4 z-20 w-[min(14rem,calc(100vw-2rem))] -translate-x-1/2`})]}),ie&&(()=>{let t=de(i),r=tt&&an.model&&nI(an.model,t),a=r?an.model:``,o=r?an.variant:``;return(0,X.jsx)(mle,{onSubmit:Rn,bundles:C,projectId:e,projectBranchState:n,tool:i,showModelSelector:tt,showSkillsSelector:i===`opencode`,availableModels:t,availableSkills:oe,initialModel:a,initialVariant:o,initialSkills:tt&&i===`opencode`?an.skills:[],initialWorktreeBundleId:ie.initialWorktreeBundleId,initialImportedDraft:ie.initialImportedDraft,onCreateBundle:zn,onDeleteBundle:Jn,onRefreshBundles:M,onClose:()=>ae(null)})})(),me&&(0,X.jsx)(gse,{ticketCount:Ut.length,isDeleting:ge,onCancel:()=>he(!1),onConfirm:()=>{Hr()}}),Se&&(0,X.jsx)(U3,{ticket:Se,allTickets:y,dependencies:x,bundles:C,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:Se.automation_paused_reason?null:Se.worktree_bundle_id?z.get(Se.worktree_bundle_id):null,projectBranchState:n,onClose:()=>{let e=Se.id;xe(null),Ce(null),b(t=>t.map(t=>t.id===e?E8(t):t))},showModelSelector:nt,showSkillsSelector:eI(Se,i)===`opencode`,activeTool:i,availableModels:de(eI(Se,i)),availableSkills:oe,runDisabled:Sy(Se,mt,pt,_(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:Sy(Se,mt,pt,_(`board.errors.runBlockedByActive`)),onDeleteDependency:rn,onCreateBundle:zn,onDeleteBundle:Jn,onRefreshBundles:M,onUpdate:Xn,onAdvance:()=>zr(Se.id),onBuildChain:()=>Br(Se.id),onRun:Yy(Se)&&Se.has_run_config?()=>er(Se.id):void 0,onOpenIde:Dn(Se)?()=>tr(Se.id):void 0,onStop:()=>nr(Se.id),onStopBuild:()=>rr(Se.id),onStopBuildChain:()=>Vr(Se.id),onResumeBuild:()=>ar(Se.id),onInterruptReview:()=>void ir(Se.id),onFollowUp:(e,t)=>hr(Se.id,e,t),onReviewFollowUp:(e,t)=>Se.worktree_bundle_id?Rr(Se.worktree_bundle_id,e,t,`changes`):hr(Se.id,e,t,`changes`),onProjectMemorySuggestionsChanged:()=>{Je(e=>e+1)},onRequestTicketRefresh:e=>{Lt(e)},onViewSourceSpec:c,onNavigateToLifecycleSource:l,onOpenBuildQuestions:e=>{xr(e)},onOpenChecks:Se.worktree_bundle_id&&(xt.length>0||Se.latest_check_gate_evaluation)?()=>{cr(Se.worktree_bundle_id,`checks`)}:void 0,onStopAutomation:Se.worktree_bundle_id?()=>Lr(Se.worktree_bundle_id):void 0}),Fe&&e&&t&&(()=>{let t=y.find(e=>e.id===Fe.ticketId);if(!t)return null;let n=!!t.worktree_bundle_id,r=t.worktree_bundle_id?zt.get(t.worktree_bundle_id)?.required_check_policy??t.bundle?.required_check_policy:void 0,i=r?.required_check_definition_ids??Dt,a=r?.pre_review_check_definition_ids??Ot,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)(z8,{targetLabel:Fe.label,definitions:xt,requiredDefinitionIds:i,preReviewDefinitionIds:a,checksTarget:o,testsTarget:s,onClose:()=>Ie(null),requestedInitialTab:Fe.requestedInitialTab})})})(),Le&&(()=>{let{target:e}=Le,t=y.find(t=>t.id===e.ticketId),n=e.kind===`bundle`,r=n?y.some(t=>t.worktree_bundle_id===e.bundleId):!!t,i=n?y.some(t=>t.worktree_bundle_id===e.bundleId&&t.agent_status===`running`):t?.agent_status===`running`,a=n?r&&!i:!!t&&!i,o=i?_(`board.changes.reviewPromptDisabledReason`):r?!n&&t?B3(t).disabledReason??void 0:void 0:_(`board.changes.targetUnavailableReason`),s=!i&&(n||t?.state===`build`||t?.state===`review`);return(0,X.jsx)(l8,{target:{scope:`ticket`,ticketId:e.ticketId,onTicketUpdate:Xn,onRequestTicketRefresh:j},initialMode:Le.initialMode,enabledModes:[`changes`,`files`],projectId:Le.projectId,reviewCommentsBundleId:n?e.bundleId:null,title:Le.title,bundleTargetName:Le.bundleTargetName,onSubmitReviewPrompt:t=>n?Rr(e.bundleId,t,Le.followUpMode,`changes`):hr(e.ticketId,t,Le.followUpMode,`changes`),canSubmitReviewPrompt:a,reviewSubmitDisabledReason:o,canAddReviewComments:a,canModifyChanges:a,changesDisabledReason:i?_(`board.changes.modifyChangesDisabledReason`):o,mode:Le.followUpMode,onModeChange:e=>Re(t=>t&&{...t,followUpMode:e}),canToggleMode:s,onClose:()=>{if(Re(null),n){yr(e.bundleId);return}Lt(e.ticketId)},onViewSourceSpec:c,originSpecSessionId:t?.origin_spec_session_id??null,originSpecSnapshotId:t?.origin_spec_snapshot_id??null})})(),ze&&e&&t&&(()=>{let t=zt.get(ze.bundleId)?.required_check_policy??ze.requiredCheckPolicy,n=t?.required_check_definition_ids??Dt,r=t?.pre_review_check_definition_ids??Ot;return(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(z8,{targetLabel:ze.label,definitions:xt,requiredDefinitionIds:n,preReviewDefinitionIds:r,checksTarget:{projectId:e,targetKind:`bundle`,targetBundleId:ze.bundleId,gateEvaluationId:ze.gateEvaluationId},testsTarget:kt?{scope:`project`,projectId:e,targetKind:`bundle`,targetBundleId:ze.bundleId}:null,onClose:()=>Be(null),requestedInitialTab:ze.requestedInitialTab})})})(),Te&&Bt&&(0,X.jsx)(Ese,{details:Bt,activeColumn:De,isLoading:Ve||We.bundleRefresh,actionState:We,canOpenIde:kn(Bt),projectMemoryEnabled:!!t?.memory_enabled,memorySuggestionsRefreshKey:qe,automationStatus:Bt.tickets.some(e=>e.automation_paused_reason)?null:z.get(Bt.bundle.id),runDisabled:gt(Bt.bundle.id),showModelSelector:rt,activeTool:i,modelsByTool:ue,availableSkills:oe,onClose:()=>{let e=Bt.bundle.id;Ee(null),Oe(null),Ae(null),Ue(!1),Ke(G8()),b(t=>t.map(t=>t.worktree_bundle_id===e&&t.id!==be?E8(t):t))},onOpenTicketDetails:Rt,onNavigateToLifecycleSource:l,onUpdateTicket:Xn,onOpenIde:()=>{let e=Bt.tickets.find(e=>e.id===Bt.target_ticket_id)??Bt.tickets.find(e=>e.has_worktree);e&&tr(e.id)},onOpenVerification:xt.length>0?()=>{cr(Bt.bundle.id)}:void 0,onOpenChecks:xt.length>0||Bt.tickets.some(e=>e.latest_check_gate_evaluation)?()=>{cr(Bt.bundle.id,`checks`)}:void 0,onRefresh:e=>{Er(`bundleRefresh`,()=>yr(e))},onUpdateBundle:Vn,onBuildBundle:Ar,onStopBuildTicket:Dr,onResumeBuildTicket:kr,onInterruptReviewTicket:Or,onReviewBundle:jr,onUndoBundleReview:Mr,onRunBundle:Ir,onStopBundle:Lr,onFollowUpBundle:Rr,onOpenBuildQuestions:e=>{xr(e)},onResumeBundleAutomation:Nr,onDismissBundleAutomationPause:Pr}),je&&Ne&&(0,X.jsx)(ale,{details:Ne,onClose:()=>{Pe.current+=1,Me(null),q(null)},onRefresh:br,onSubmit:Sr})]})},J8=({count:e,title:t,isDeleting:n,onConfirm:r,onCancel:i,labels:a})=>{let o=e>1;return(0,X.jsxs)(hC,{onClose:i,overlayClassName:`bg-black/60`,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})]})]})},Y8=({label:e})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),X8=({label:e})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),Z8=({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)(bC,{className:`w-full max-w-lg border-dashed border-border/70 bg-card/40`,children:[(0,X.jsxs)(xC,{children:[(0,X.jsx)(SC,{children:e}),(0,X.jsx)(CC,{children:t})]}),(0,X.jsx)(TC,{children:(0,X.jsx)(Q,{type:`button`,onClick:r,disabled:!i,children:n})})]})}),Yle=({className:e})=>(0,X.jsx)(Gg,{"aria-hidden":`true`,className:e}),Xle=({className:e})=>(0,X.jsx)(Ng,{"aria-hidden":`true`,className:e}),Zle=({className:e})=>(0,X.jsx)(Pg,{"aria-hidden":`true`,className:e}),Q8=({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,onSessionSelect:T,onConfirmDeleteSession:E,getSessionId:D,getSessionTitle:O,getDeleteDisabledReason:k,getActivityState:A,getRowAriaLabel:j,renderRowContent:M,labels:N})=>{let P=(0,p.useMemo)(()=>new Set(e.filter(e=>!k(e)&&!y.has(D(e))).map(e=>D(e))),[y,k,D,e]),F=(0,p.useRef)(null),I=(0,p.useRef)(!1),L=(0,p.useRef)(null),R=(0,p.useCallback)(()=>{L.current!==null&&(window.clearTimeout(L.current),L.current=null)},[]),z=(0,p.useCallback)(()=>{R(),L.current=window.setTimeout(()=>{I.current=!1,L.current=null},0)},[R]),B=(0,p.useCallback)(()=>{F.current&&(F.current=null,z())},[z]),V=(0,p.useCallback)(e=>{let t=F.current;!t||t.visitedSessionIds.has(e)||!P.has(e)||(t.visitedSessionIds.add(e),C(e,t.mode===`select`))},[C,P]),H=(0,p.useCallback)(e=>{let t=F.current;!t||e.pointerId!==t.pointerId||B()},[B]);return(0,p.useEffect)(()=>{if(!h){B();return}return window.addEventListener(`pointerup`,H),window.addEventListener(`pointercancel`,H),()=>{window.removeEventListener(`pointerup`,H),window.removeEventListener(`pointercancel`,H),B(),R()}},[R,H,h,B]),(0,X.jsx)(`aside`,{"data-testid":s,"data-state":a?`expanded`:`collapsed`,"aria-label":N.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)(jv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:N.newSession}),f]}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":N.collapseAriaLabel,"aria-expanded":a,className:`ml-auto`,onClick:o,children:(0,X.jsx)(Xle,{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:N.cancelSelection}),(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:N.deleteSelected})]}),(0,X.jsx)(`div`,{className:`flex justify-end text-xs font-medium text-muted-foreground`,children:N.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)(Yle,{className:`h-3.5 w-3.5`}),N.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:N.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:N.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=D(e),i=!r&&t===n,a=k(e),o=y.has(t),s=!!a||o,c=g.has(t),l=A(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(),R(),I.current=!0,F.current={pointerId:e.pointerId,mode:c?`deselect`:`select`,visitedSessionIds:new Set},V(t))},onPointerMove:e=>{let n=F.current;!n||n.pointerId!==e.pointerId||V(t)},children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":j(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(I.current){I.current=!1;return}if(s)return;S(t);return}T(e)},children:M({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??N.selectSessionTitle(O(e)),children:(0,X.jsx)(`input`,{type:`checkbox`,"aria-label":N.selectSessionAriaLabel(O(e)),checked:c,disabled:s,onClick:e=>{e.stopPropagation()},onChange:()=>{I.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":N.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??N.deleteSessionTitle(O(e)),disabled:s,onClick:e=>{e.stopPropagation(),E(t)},children:(0,X.jsx)(OC,{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)(Ov,{content:m,side:`right`,children:(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":N.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,X.jsx)(jv,{className:`h-4 w-4`})})}):(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":N.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,X.jsx)(jv,{className:`h-4 w-4`})}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":N.openAriaLabel,"aria-expanded":a,className:`h-9 w-9`,onClick:o,children:(0,X.jsx)(Zle,{className:`h-4 w-4`})})]})})},$8=({isInterrupting:e,onStop:t,interruptLabel:n,interruptingLabel:r})=>(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:e,onClick:t,children:[e?(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Vv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:e?r:n})]}),e5=4,Qle=5e3,t5=(e,t)=>vC.t(`common:chatChangesPanel.${e}`,t),n5=e=>e.replace(/^[ab]\//,``),r5=e=>{let t=`oldPath`in e&&typeof e.oldPath==`string`?n5(e.oldPath):``,n=`newPath`in e&&typeof e.newPath==`string`?n5(e.newPath):``;return[...new Set([n,t].filter(e=>e&&e!==`/dev/null`))]},i5=e=>{let[t,n]=r5(e);return!t&&!n?t5(`unknownFile`):t&&n&&t!==n?`${n} -> ${t}`:t??n??t5(`unknownFile`)},a5=e=>{let t=zG((()=>{let[t,n]=r5(e);return t??n??null})());if(!t)return null;try{return PM(e.hunks,{highlight:!0,refractor:PK.default,language:t,enhancers:[MM(e.hunks)]})}catch{return null}},o5=(e,t)=>e instanceof Error?e.message:t,$le=(e,t)=>{if(!t)return e;let n=i5(t);return[t,...e.filter(e=>i5(e)!==n)]},eue=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}),tue=({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}))},s5=e=>{let t=e.split(/[\\/]/);return t[t.length-1]||e},nue={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`},rue=e=>t5(`fileStatus.${e}`),iue=({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`?t5(`picker.diff`):s?s5(s.path):t5(`picker.file`):e===`all`?t5(`picker.allChanges`):s?s5(s.path):e;return(0,X.jsxs)(gv,{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":t5(`picker.openChangedFilesAriaLabel`),title:e===`all`?void 0:s?.path??e,children:[(0,X.jsx)(`span`,{className:`truncate`,children:c}),r===`full`&&(0,X.jsx)(yC,{variant:`outline`,className:`shrink-0 text-[10px] uppercase tracking-wide`,children:t5(`picker.fileCount`,{count:t.length})}),(0,X.jsx)(Av,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,X.jsxs)(vv,{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:t5(`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`,w6(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:t5(`picker.allChanges`)}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground transition-colors group-hover:text-foreground/70`,children:t5(`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:t5(`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`,w6(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:s5(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)(yC,{variant:`outline`,className:nue[t.status],children:rue(t.status)}),t.staged&&(0,X.jsx)(yC,{variant:`outline`,children:t5(`fileStatus.staged`)}),t.unstaged&&(0,X.jsx)(yC,{variant:`outline`,children:t5(`fileStatus.unstaged`)}),t.conflicted&&(0,X.jsx)(yC,{variant:`destructive`,children:t5(`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`?t5(`fileStatus.renamedFrom`,{path:t.originalPath}):t.originalPath})]})]})},`${t.path}:${t.originalPath??``}`))]})})]})]})},c5=(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=>[YM(e.filePath,e.changeKey),e])),[a.reviewComments]),F=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await ore(e,t):await Un(e)},[t,e]),I=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await sre(e,t):await Xn(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,i]=await Promise.allSettled([F(),I()]);T.current===t&&(r.status===`fulfilled`?(D.current=r.value,f(r.value),_(null)):_(o5(r.reason,t5(`errors.loadDiff`))),i.status===`fulfilled`&&(O.current=i.value,h(i.value)),E.current===n&&y(!1),b(!1))},[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&&j6(e)}catch(e){if(T.current!==r)return;D.current||_(o5(e,t5(`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 M6(t=>{t===e&&R()})},[e,R]),(0,p.useEffect)(()=>{if(!e)return;let t=rx(()=>{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})},Qle);return()=>{window.clearInterval(t)}},[e,R]);let z=(0,p.useMemo)(()=>{let e=typeof d?.diff==`string`?d.diff:``;return e.trim()?TD(e,{nearbySequences:`zip`}).map(e=>({...e,pathCandidates:r5(e)})):[]},[d]),B=(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]),V=(0,p.useMemo)(()=>tue({diffResponse:d,gitStatus:m}),[d,m]);(0,p.useEffect)(()=>{if(k!==`all`&&!(!d&&!m)){if(V.length===0){o(e=>({...e,selectedDiffPath:`all`}));return}V.some(e=>e.path===k)||o(e=>({...e,selectedDiffPath:`all`}))}},[d,m,o,k,V]);let H=k===`all`?null:B.get(k)??null,U=(0,p.useMemo)(()=>$le(z,H),[z,H]),W=(0,p.useMemo)(()=>k===`all`?z:H?[H]:[],[z,k,H]);(0,p.useEffect)(()=>{S(new Map)},[z]),(0,p.useEffect)(()=>{if(U.length===0)return;let e=!1,t=null,n=0,r=()=>{if(e)return;let i=U.slice(n,n+e5);i.length!==0&&(S(e=>{let t=new Map(e);for(let e of i){let n=i5(e);t.has(n)||t.set(n,a5(e))}return t}),n+=e5,n<U.length&&(t=window.setTimeout(r,0)))};return t=window.setTimeout(r,0),()=>{e=!0,t!==null&&window.clearTimeout(t)}},[U]);let G=(0,p.useMemo)(()=>{let e=new Map;for(let t of U.slice(0,e5))e.set(i5(t),a5(t));return e},[U]),K=(0,p.useMemo)(()=>W.map(e=>({...e,tokens:x.get(i5(e))??G.get(i5(e))??null})),[G,x,W]),ee=(0,p.useMemo)(()=>z.map(e=>({...e,tokens:null})),[z]),te=(0,p.useMemo)(()=>eue(a.reviewComments),[a.reviewComments]),ne=te.length,re=n&&!C&&ne>0,ie=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}))},[o]),ae=(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]),oe=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``}))},[o]),se=(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=>[YM(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:XM(e.hunk,e.change),comment:r}),{...t,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[...n.values()]}})},[n,o,P,N]),ce=(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]),le=(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=>YM(t.filePath,t.changeKey)!==e)}))},[o]),ue=(0,p.useCallback)(async()=>{if(!re)return;w(!0);let e=aN({drafts:te,findings:[],githubComments:[],uncommittedFiles:z});try{await i(e),ie(),$.success(t5(`toasts.sendChangesSuccess`),{id:`chat-diff-review-submit-success`})}catch(e){$.error(o5(e,t5(`errors.sendChanges`)),{id:`chat-diff-review-submit-error`})}finally{w(!1)}},[re,ie,i,z,te]),de=(0,p.useCallback)(e=>(0,X.jsx)(a6,{reviewComments:te,pendingFixCount:ne,triggerMode:e===`wide`?`full`:`compact`,canSendReview:re,isSubmittingReview:C,reviewSubmitDisabledReason:r??void 0,onClearPendingFixes:ie,onSubmitReview:()=>{ue()}}),[re,ie,ue,C,ne,te,r]),fe=c?(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":t5(`closeAriaLabel`),className:`text-muted-foreground hover:text-foreground`,onClick:c,children:(0,X.jsx)(cC,{className:`h-4 w-4`})}):null,pe=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:pe,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)(C6,{selectedDiffPath:k,sidebarFiles:V,diffResponse:d,isDiffLoading:v,diffError:g,allDiffFiles:ee,renderedFiles:K,viewType:`unified`,onViewTypeChange:()=>{},onRetry:()=>{L()},activeReviewTarget:A,editingReviewCommentKey:j,reviewDraftInstanceKey:M,reviewDraftInput:N,reviewComments:te,reviewFindings:[],githubComments:[],selectedReviewFindingIds:[],selectedGitHubCommentIds:[],canSelectReviewTarget:n,canEditActiveReviewDraft:n,reviewFindingsError:null,gitHubCommentsError:null,hasStaleReviewFindings:!1,onSelectReviewTarget:ae,onToggleReviewFindingSelection:()=>{},onToggleGitHubCommentSelection:()=>{},onReviewDraftInputChange:e=>{o(t=>({...t,reviewDraftInput:e}))},onCancelReviewDraft:oe,onEditReviewDraft:ce,onRemoveReviewDraft:le,onSaveReviewDraft:se,diffThemeClassName:T6,resolveFilePath:i5,normalizeDiffPath:n5,emptyStateTitle:t5(`emptyStateTitle`),emptyStateDescription:t5(`emptyStateDescription`),filePickerControl:e=>(0,X.jsx)(iue,{selectedDiffPath:k,sidebarFiles:V,diffStats:d?.stats??null,triggerMode:e===`wide`?`full`:`compact`,onSelectDiffPath:e=>{o(t=>({...t,selectedDiffPath:e}))}}),reviewSummaryControl:de,extraHeaderControl:fe,surfaceVariant:`flat`,showViewTypeToggle:!1,gutterVariant:`compact`,isResizing:s,resizePlaceholderLineThreshold:200})})});c5.displayName=`ChatChangesPanel`;var l5=({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:B,onFollowUpKeyDown:V,onFollowUpPaste:H,onUploadAttachments:U,onRemoveAttachment:W,onFollowUpSubmit:G})=>(0,X.jsx)(aY,{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:B,onFollowUpKeyDown:V,onFollowUpPaste:H,onUploadAttachments:U,onRemoveAttachment:W,onFollowUpSubmit:G}),u5=({disabled:e=!1,onClick:t})=>{let n=vC.t(`chatView.startBuilding.label`);return(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2 border-emerald-400/40 bg-emerald-400/10 text-emerald-100 hover:bg-emerald-400/20 hover:text-white`,"aria-label":vC.t(`chatView.startBuilding.ariaLabel`),disabled:e,onClick:t,children:[(0,X.jsx)(zv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:n})]})},aue=`mt-1 flex min-h-5 flex-wrap items-center gap-2 text-xs text-muted-foreground`,oue=({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}),d5=({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:aue,children:[(0,X.jsx)(rI,{tool:t,className:`text-[11px]`}),n?(0,X.jsx)(`p`,{children:n}):null,r?(0,X.jsx)(oue,{label:i}):null,a?(0,X.jsx)(iI,{totalTokens:a.totalTokens,contextWindow:a.contextWindow,cost:a.cost,tool:a.tool,model:a.model,availableModels:a.availableModels}):null,o]})]}),s]}),c]}),f5=({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})]}),p5=()=>({selectedDiffPath:`all`,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}),sue=[{key:`today`,label:`Today`},{key:`yesterday`,label:`Yesterday`},{key:`last_7_days`,label:`Last 7 Days`},{key:`older`,label:`Older`}],cue=e=>{if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t},m5=e=>e.activity_at??e.last_user_message_at??e.created_at,lue=(e,t)=>{let n=m5(e),r=m5(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)},h5=e=>[...e].sort(lue),uue=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),due=(e,t=new Date)=>{let n=cue(m5(e));if(!n)return`older`;let r=uue(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`},g5=(e,t=new Date)=>{let n=new Map;for(let r of h5(e)){let e=due(r,t);n.set(e,[...n.get(e)??[],r])}return sue.flatMap(e=>{let t=n.get(e.key)??[];return t.length===0?[]:[{key:e.key,label:e.label,sessions:t}]})},_5=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},v5=e=>e===`claude`?vC.t(`chatView.tool.claude`):vC.t(`chatView.tool.opencode`),y5=e=>new Map(e.map(e=>[e.id,e.label])),b5=({availableModelsById:e,model:t})=>t?e.get(t)??t:null,x5=({modelLabel:e,tool:t})=>e??v5(t),S5=()=>vC.t(`chatView.user.you`),C5=`archon.chat-draft`,w5=({projectId:e,tool:t,chatSessionId:n})=>n?`${C5}:${e}:session:${n}`:`${C5}:${e}:draft:${t}`,T5=e=>{if(!e)return``;try{return window.localStorage.getItem(e)??``}catch{return``}},E5=({storageKey:e,value:t})=>{if(e)try{if(t){window.localStorage.setItem(e,t);return}window.localStorage.removeItem(e)}catch{}},D5=(e,t)=>vC.t(`chatView.${e}`,t),fue=1500,pue=`archon.chat-run-config`,mue=`archon.chat-changes-panel-layout`,hue=`archon.chat-session-list-layout`,O5=512,k5=360,gue=.6,_ue=6,A5=`/`,vue=`Slash`,yue=`NumpadDivide`,bue=600,j5=4,M5=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):O5;if(!Number.isFinite(t))return Math.max(k5,n);let r=Math.max(k5,Math.round(t*gue));return Math.max(k5,Math.min(r,n))},xue=e=>D5(e===`plan`?`mode.plan`:`mode.build`),N5=e=>D5(e===`plan`?`placeholders.plan`:`placeholders.build`),P5=e=>D5(`pendingMemorySuggestions`,{count:e}),Sue=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===A5||e.code===vue||e.code===yue),F5=({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)(lX,{"aria-hidden":n,children:e}),t.map(e=>(0,X.jsxs)(`span`,{className:`contents`,children:[(0,X.jsx)(`span`,{children:`+`}),(0,X.jsx)(lX,{"aria-hidden":n,children:e})]},e))]}),Cue=({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)(F5,{modifierLabel:t,keys:n,ariaHidden:!0})]}),I5=({projectId:e,tool:t})=>`${pue}:${e}:${t}`,L5=e=>`${mue}:${e}`,R5=e=>`${hue}:${e}`,z5=e=>{if(!e)return{isOpen:!0,width:O5};try{let t=window.localStorage.getItem(L5(e));if(!t)return{isOpen:!0,width:O5};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(k5,Math.round(n.width)):O5;return{isOpen:n.isOpen!==!1,width:r}}catch{return{isOpen:!0,width:O5}}},B5=e=>{if(!e)return{isOpen:!0};try{let t=window.localStorage.getItem(R5(e));return t?{isOpen:JSON.parse(t).isOpen!==!1}:{isOpen:!0}}catch{return{isOpen:!0}}},wue=({projectId:e,isOpen:t,width:n})=>{if(e)try{window.localStorage.setItem(L5(e),JSON.stringify({isOpen:t,width:n}))}catch{}},Tue=({projectId:e,isOpen:t})=>{if(e)try{window.localStorage.setItem(R5(e),JSON.stringify({isOpen:t}))}catch{}},V5=({projectId:e,tool:t})=>{if(!e||t!==`opencode`&&t!==`claude`)return null;try{let n=window.localStorage.getItem(I5({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}}catch{return null}},H5=({projectId:e,tool:t,model:n,variant:r,mode:i})=>{if(!(!e||t!==`opencode`&&t!==`claude`||!n&&!i))try{window.localStorage.setItem(I5({projectId:e,tool:t}),JSON.stringify({model:n,variant:n?r:null,mode:i}))}catch{}},U5=({projectId:e,tool:t})=>V5({projectId:e,tool:t})?.mode??`plan`,W5=({activeProjectId:e,helperModel:t,helperVariant:n,activeTool:r,availableModels:i})=>{let a=V5({projectId:e,tool:r}),o=t??``,s=a?.model??``,c=nI(s,i)?s:nI(o,i)?o:``,l=c===s?a?.variant??null:c&&c===o?n??null:null,u=i.find(e=>e.id===c)??null;return{model:c,variant:u?u.variants.includes(l??``)?l??``:``:c?l??``:``,mode:a?.mode??`plan`}},G5=e=>e&&e.replace(/\s+/g,` `).trim()||null,Eue=e=>{let t=G5(e.first_user_message_preview);if(t)return t;let n=e.messages?.find(e=>e.role===`user`)?.content;return G5(n)},Due=({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}),Oue=({session:e,instruction:t,attachments:n,createdAt:r})=>({...e,messages:[...e.messages??[],Due({chatSessionId:e.id,instruction:t,attachments:n,createdAt:r})],activity_at:r,last_user_message_at:r,updated_at:r}),kue=e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),K5=({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,Aue=({session:e,activeProject:t,activeProjectBranchState:n})=>e.target_kind===`bundle`?e.target_label_snapshot||D5(`targets.bundleFallback`):!t||t.active_target_kind===`bundle`||n?.status!==`ready`||!n.branch||!e.target_branch_snapshot||n.branch===e.target_branch_snapshot?null:D5(`targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}),jue=e=>e.target_kind===`bundle`?e.target_label_snapshot||D5(`targets.bundleFallback`):e.target_branch_snapshot?D5(`targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}):D5(`targets.repoRoot`),Mue=({activeProject:e,activeProjectBranchState:t})=>e?e.active_target_kind===`bundle`?D5(`targets.selectedBundleTarget`):t?.branch?D5(`targets.repoRootWithBranch`,{branch:t.branch}):D5(`targets.repoRoot`):D5(`targets.currentTarget`),q5=e=>e.agent_status===`running`?D5(`sidebar.deleteDisabledReason`):null,Nue=({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:D5(`ticketProposal.createdTitle`)}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:D5(`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:D5(`ticketProposal.proposedTitle`)}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:D5(`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:D5(`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:D5(t?`ticketProposal.creating`:`ticketProposal.create`)})})]}),Pue=({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,initialChatSessionId:d=null,onInitialChatNavigationConsumed:f,initialDraftOpen:m=!1,onInitialDraftOpenConsumed:h,initialSpecDraft:g=null,onInitialSpecDraftConsumed:_,onViewSourceSpec:v,onNavigateToLifecycleSource:y,onRestoreSessionTarget:b,onReviewCapabilityChange:x,isExternallyResizing:S=!1,showChangesPanel:C=!0})=>{let w=Aq(),[T,E]=(0,p.useState)([]),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(null),j=bJ(k?.post_build_check),[M,N]=(0,p.useState)(null),[P,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(null),[R,z]=(0,p.useState)(()=>U5({projectId:e,tool:u})),[B,V]=(0,p.useState)({}),[H,U]=(0,p.useState)({}),[W,G]=(0,p.useState)({}),[K,ee]=(0,p.useState)([]),[te,ne]=(0,p.useState)(``),[re,ie]=(0,p.useState)(``),[ae,oe]=(0,p.useState)([]),[se,ce]=(0,p.useState)(!1),[le,ue]=(0,p.useState)(!1),[de,fe]=(0,p.useState)(!1),[pe,me]=(0,p.useState)(!1),[he,ge]=(0,p.useState)(!1),[_e,ve]=(0,p.useState)(null),[ye,be]=(0,p.useState)([]),[xe,Se]=(0,p.useState)(()=>new Set),[Ce,we]=(0,p.useState)(!1),[Te,Ee]=(0,p.useState)(()=>new Set),[De,Oe]=(0,p.useState)(!1),[ke,Ae]=(0,p.useState)(!1),[je,Me]=(0,p.useState)(null),[Ne,q]=(0,p.useState)(null),[Pe,Fe]=(0,p.useState)([]),[Ie,Le]=(0,p.useState)(!1),[Re,ze]=(0,p.useState)(!1),[Be,Ve]=(0,p.useState)(0),[He,Ue]=(0,p.useState)(p5),[We,qe]=(0,p.useState)(()=>B5(e).isOpen),[Je,J]=(0,p.useState)(()=>z5(e).isOpen),[Xe,Ze]=(0,p.useState)(!1),[Y,Qe]=(0,p.useState)(!1),[$e,et]=(0,p.useState)(()=>z5(e).width),[tt,nt]=(0,p.useState)(0),[rt,it]=(0,p.useState)(null),[at,ot]=(0,p.useState)(()=>new Set),st=(0,p.useRef)({model:``,variant:``,skills:[],showModelSelector:!1}),ct=(0,p.useRef)(!1),lt=(0,p.useRef)(I),ut=(0,p.useRef)(null),dt=(0,p.useRef)(null),ft=(0,p.useRef)(0),pt=(0,p.useRef)(0),mt=(0,p.useRef)(!1),ht=(0,p.useRef)(null),gt=(0,p.useRef)(null),_t=(0,p.useRef)(null),vt=(0,p.useRef)(null),yt=(0,p.useRef)(null),bt=(0,p.useRef)(null),xt=(0,p.useRef)(!1),St=(0,p.useRef)(!1),Ct=(0,p.useRef)(0),wt=(0,p.useRef)(O5),Tt=(0,p.useRef)(O5),Et=(0,p.useRef)(!1),Dt=(0,p.useRef)(0),Ot=(0,p.useRef)({id:null,status:null}),kt=(0,p.useRef)(new Map),At=(0,p.useRef)({}),jt=(0,p.useRef)({}),Mt=(0,p.useRef)(new Set),Nt=(0,p.useRef)(!1),Pt=e?w5({projectId:e,tool:P?u:k?.tool??u,chatSessionId:P?null:D}):null,Ft=Pt?B[Pt]??``:``,It=P?u:k?.tool??u,Lt=k?H[k.id]??[]:[],Rt=(k?W[k.id]??0:0)>0,{models:zt,isLoading:Bt}=OF(It);(0,p.useEffect)(()=>{ct.current=P},[P]),(0,p.useEffect)(()=>{At.current=B},[B]),(0,p.useEffect)(()=>{jt.current=H},[H]),(0,p.useEffect)(()=>{if(!(!d||T.length===0)&&T.some(e=>e.id===d)){if(D===d){f?.();return}N(null),ve(null),O(d),F(!1),Et.current=!0,f?.()}},[d,T,D,f]),(0,p.useEffect)(()=>{if(!Pt||Mt.current.has(Pt))return;Mt.current.add(Pt);let e=T5(Pt);e&&V(t=>Object.prototype.hasOwnProperty.call(t,Pt)?t:{...t,[Pt]:e})},[Pt]),(0,p.useEffect)(()=>{!Pt||!Object.prototype.hasOwnProperty.call(B,Pt)||E5({storageKey:Pt,value:B[Pt]??``})},[Pt,B]),(0,p.useEffect)(()=>{if(!P){ut.current=null;return}let e=ut.current;!e||!Pt||Ft||V(t=>t[Pt]?t:{...t,[Pt]:e})},[P,Pt,Ft]),(0,p.useEffect)(()=>{dt.current=D},[D]),(0,p.useEffect)(()=>{lt.current=I},[I]);let Vt=(0,p.useCallback)(()=>{pt.current+=1},[]),Ht=(0,p.useCallback)(e=>{Vt(),A(e)},[Vt]);(0,p.useEffect)(()=>{if(!Nt.current){Nt.current=!0;return}let t=z5(e),n=B5(e);ct.current=!1,Et.current=!1,Mt.current=new Set,O(null),Ht(null),F(!1),V({}),U({}),G({}),ve(null),be([]),Se(new Set),we(!1),Ee(new Set),it(null),Fe([]),ze(!1),ue(!1),Ue(p5()),ot(new Set),kt.current=new Map,Tt.current=t.width,qe(n.isOpen),et(t.width),J(t.isOpen)},[e,Ht]),(0,p.useEffect)(()=>{Xe||(Tt.current=$e,_t.current&&(_t.current.style.setProperty(`--chat-changes-panel-width`,`${$e}px`),_t.current.setAttribute(`data-desktop-width`,String($e))))},[$e,Xe]),(0,p.useEffect)(()=>{if(!C||!ht.current)return;let e=ht.current.getBoundingClientRect().width;if(e<=0)return;let t=M5($e,e);t!==$e&&(Tt.current=t,et(t))},[$e,C]),(0,p.useEffect)(()=>{Tue({projectId:e,isOpen:We})},[e,We]),(0,p.useEffect)(()=>{C&&wue({projectId:e,isOpen:Je,width:$e})},[e,$e,Je,C]),(0,p.useEffect)(()=>{ze(!1)},[D,P]);let Ut=(0,p.useCallback)(e=>{let t=_5(e);E(e=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return h5([...e,t]);let r=[...e];return r[n]=t,h5(r)})},[]),Wt=(0,p.useCallback)(t=>{let n=Array.from(new Set(t));if(n.length===0)return;let r=new Set(n),i=dt.current,a=e?n.map(t=>w5({projectId:e,tool:u,chatSessionId:t})):[];V(e=>{let t=a.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}),U(e=>{let t={...e},r=!1;for(let e of n)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],r=!0);return r?t:e}),G(e=>{let t={...e},r=!1;for(let e of n)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],r=!0);return r?t:e});for(let e of a)E5({storageKey:e,value:``});E(e=>{let t=e.filter(e=>!r.has(e.id));if(i&&r.has(i)){let e=t[0]??null;O(e?.id??null),Ht(null),F(e===null),Fe([]),Le(!1),ze(!1)}return t}),ot(e=>{let t=new Set(e),r=!1;for(let e of n)t.delete(e)&&(r=!0);return r?t:e}),it(e=>e&&r.has(e.parentId)?null:e),ve(e=>e&&r.has(e)?null:e),be(e=>e.filter(e=>!r.has(e))),Se(e=>{let t=new Set(e),r=!1;for(let e of n)t.delete(e)&&(r=!0);return r?t:e}),Ee(e=>{let t=new Set(e),r=!1;for(let e of n)t.delete(e)&&(r=!0);return r?t:e})},[e,u,Ht]),Gt=(0,p.useCallback)(e=>{Wt([e])},[Wt]),Kt=(0,p.useCallback)((e,t)=>{e&&V(n=>n[e]===t?n:{...n,[e]:t})},[]),qt=(0,p.useCallback)(e=>{e&&(V(t=>t[e]===``?t:{...t,[e]:``}),E5({storageKey:e,value:``}))},[]),Jt=(0,p.useCallback)((e,t)=>{U(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}})},[]),Yt=(0,p.useCallback)(e=>{U(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),G(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),Xt=(0,p.useCallback)((e,t)=>{G(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}})},[]),Zt=(0,p.useCallback)(({fromStorageKey:e,toStorageKey:t})=>{if(!e||!t||e===t)return;let n=Object.prototype.hasOwnProperty.call(At.current,e)?At.current[e]??``:T5(e);V(r=>{let i={...r,[t]:n};return delete i[e],i}),E5({storageKey:t,value:n}),E5({storageKey:e,value:``})},[]),Qt=(0,p.useCallback)((e,t)=>{E(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}),A(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:(pt.current+=1,{...n,pending_memory_suggestion_count:t}))},[]),$t=(0,p.useCallback)(async r=>{if(!e){E([]),O(null),Ht(null),F(!1),ue(!1);return}ce(!0);try{let i=await LN(e,r);if(r?.aborted)return;let a=h5(i.map(_5)),o=a[0]??null,s=t?.active_target_kind===`bundle`||n?.status!==`loading`;E(a),O(e=>ct.current?null:e&&a.some(t=>t.id===e)?e:e?a[0]?.id??null:Et.current?null:o?s?(Et.current=!0,K5({activeProject:t,activeProjectBranchState:n,session:o})?o.id:null):null:(Et.current=!0,null)),a.length===0&&F(!0)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:D5(`errors.loadSessions`))}finally{r?.aborted||(ce(!1),ue(!0))}},[t,n,e,Ht]),en=(0,p.useCallback)(async(t,n)=>{if(!e){Ht(null);return}fe(!0);let r=ft.current+1;ft.current=r;let i=pt.current;try{let a=await zN(e,t,n);if(n?.aborted)return;let o=pt.current!==i,s=ft.current===r,c=dt.current===t&&!ct.current;if(!s||o||!c)return;Ht(a),Ut(a)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:D5(`errors.loadSession`))}finally{n?.aborted||fe(!1)}},[e,Ht,Ut]),tn=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){Fe([]),Le(!1);return}Le(!0);try{let t=await hr(e,null,r,n);if(r?.aborted)return;Fe(t.suggestions),Qt(n,t.suggestions.length)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:D5(`errors.loadMemorySuggestions`))}finally{r?.aborted||Le(!1)}},[t?.memory_enabled,e,Qt]),nn=(0,p.useCallback)(e=>{Fe(t=>{let n=t.filter(t=>t.id!==e);return D&&Qt(D,n.length),n}),Ve(e=>e+1),$t(),D&&en(D)},[D,en,$t,Qt]);(0,p.useEffect)(()=>{let e=new AbortController;return $t(e.signal),()=>{e.abort()}},[$t]),(0,p.useEffect)(()=>{if(ct.current||P||D||Et.current||T.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;Et.current=!0;let e=T[0]??null;e&&K5({activeProject:t,activeProjectBranchState:n,session:e})&&O(e.id)},[t,n,D,P,T]),(0,p.useEffect)(()=>{if(It!==`opencode`&&It!==`claude`){ee([]),Ae(!1);return}if(It!==`opencode`){ee([]);return}let t=new AbortController;return(async()=>{Ae(!0);try{ee(await kF(It,t.signal,e))}catch(e){Ye(e)||ee(e=>e)}finally{t.signal.aborted||Ae(!1)}})(),()=>{t.abort()}},[e,It]),(0,p.useEffect)(()=>{if(P||!D){Ht(null);return}if(k?.id===D)return;Ht(null);let e=new AbortController;return en(D,e.signal),()=>{e.abort()}},[k,D,P,en,Ht]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||P||!D){Fe([]),Le(!1);return}let e=new AbortController;return tn(D,e.signal),()=>{e.abort()}},[t?.memory_enabled,D,P,tn,Be]),(0,p.useEffect)(()=>{!Re||Ie||Pe.length>0||ze(!1)},[Ie,Re,Pe.length]),(0,p.useEffect)(()=>{if(!D||k?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([$t(e.signal),en(D,e.signal)])},fue);return()=>{e.abort(),window.clearInterval(t)}},[k?.agent_status,D,en,$t]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(t.id===D&&Ht(t),kue(t)&&Ut(t))},n=t=>{!t||t.project_id!==e||Gt(t.id)},r=()=>{$t();let e=dt.current;e&&!ct.current&&en(e)};return w.on(`connect`,r),w.on(`chat-session:created`,t),w.on(`chat-session:updated`,t),w.on(`chat-session:deleted`,n),()=>{w.off(`connect`,r),w.off(`chat-session:created`,t),w.off(`chat-session:updated`,t),w.off(`chat-session:deleted`,n)}},[e,D,en,$t,Gt,Ht,w,Ut]),(0,p.useEffect)(()=>{P&&(lt.current||z(U5({projectId:e,tool:u})))},[e,u,P]),(0,p.useEffect)(()=>{if(It!==`opencode`&&It!==`claude`){ne(``),ie(``),oe([]);return}if(P){let n=W5({activeProjectId:e,helperModel:t?.helper_model??null,helperVariant:t?.helper_variant??null,activeTool:It,availableModels:zt});ne(n.model),ie(n.variant),oe([]);return}ne(k?.model??``),ie(k?.variant??``)},[e,t?.helper_model,t?.helper_variant,k?.id,k?.model,k?.variant,zt,It,P]),(0,p.useEffect)(()=>{if(It!==`opencode`){oe([]);return}if(P){oe([]);return}oe(k?.skills??[])},[k?.skills,It,P]),(0,p.useEffect)(()=>{let e=zt.find(e=>e.id===te)??null;ie(t=>e?e.variants.includes(t)?t:``:t)},[zt,te]),(0,p.useEffect)(()=>{if(It!==`opencode`||!P||!te||re)return;let n=W5({activeProjectId:e,helperModel:t?.helper_model??null,helperVariant:t?.helper_variant??null,activeTool:It,availableModels:zt});n.model===te&&n.variant&&ie(n.variant)},[e,t?.helper_model,t?.helper_variant,It,zt,P,te,re]),(0,p.useEffect)(()=>{if(!_e)return;let e=k?.id===_e?k:T.find(e=>e.id===_e)??null;(!e||e.agent_status!==`running`)&&ve(null)},[k,_e,T]),(0,p.useEffect)(()=>{let e=Ot.current,n=k?.id??null,r=k?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&Ve(e=>e+1),Ot.current={id:n,status:r}},[t?.memory_enabled,e,k?.agent_status,k?.id,k?.title]),(0,p.useEffect)(()=>{D&&ot(e=>{if(!e.has(D))return e;let t=new Set(e);return t.delete(D),t})},[D]),(0,p.useEffect)(()=>{rt&&(rt.parentId===D&&(he||k?.agent_status===`running`)||it(null))},[k?.agent_status,D,he,rt]),(0,p.useEffect)(()=>{let e=kt.current,t=new Map,n=[];for(let r of T){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&a===`done`&&r.id!==D&&n.push(r),t.set(r.id,a)}kt.current=t,ot(e=>{let t=new Set(e),r=!1,i=new Set(T.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of T){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===D||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,D,T]);let rn=(0,p.useMemo)(()=>y5(zt),[zt]),an=(0,p.useMemo)(()=>g5(T),[T]),on=(0,p.useMemo)(()=>ye.length===0?[]:ye.flatMap(e=>{let t=T.find(t=>t.id===e)??(k?.id===e?k:null);return t?[t]:[]}),[k,ye,T]),sn=on.length===1?on[0]?.title??null:null;(0,p.useEffect)(()=>{ye.length>0&&on.length!==ye.length&&be(on.map(e=>e.id))},[ye,on]),(0,p.useEffect)(()=>{let e=new Set(T.filter(e=>!q5(e)&&!xe.has(e.id)).map(e=>e.id));Ee(t=>{let n=new Set(Array.from(t).filter(t=>e.has(t)));return n.size===t.size?t:n})},[xe,T]),(0,p.useEffect)(()=>{!Ce||We||(we(!1),Ee(new Set))},[We,Ce]);let cn=(0,p.useMemo)(()=>k?x5({modelLabel:b5({availableModelsById:rn,model:k.model}),tool:k.tool}):null,[k,rn]),ln=(0,p.useMemo)(()=>k?(k.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?fq(e.response_timing):null,created_at:e.created_at,displayTitle:e.role===`assistant`?cn??v5(k.tool):S5()})):[],[k,cn]),un=(0,p.useMemo)(()=>[...k?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[k]),dn=!!un,fn=(0,p.useCallback)(async(t,n)=>{if(!e||!k||Ne)return;let r=cY({parentType:`chat`,parentId:k.id,setId:n.set_id});q(n.set_id);try{let r=await UN(e,k.id,t,n);Ht(r),Ut(r)}catch(e){if(e instanceof Ge&&e.status===409){uY(r);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?(Ht(t),Ut(t)):await en(k.id)}throw $.error(e instanceof Error?e.message:D5(`errors.resolveQuestions`)),e}finally{q(null)}},[e,k,en,Ht,Ne,Ut]),pn=(0,p.useCallback)(e=>{let t=e.metadata?.ask_question;if(e.role!==`assistant`||!t||!k)return;let n=cY({parentType:`chat`,parentId:k.id,setId:t.id});return(0,X.jsx)(_Y,{messageContent:e.content,questionSet:t,storageKey:n,isActive:t.status===`pending`&&un?.id===e.id,isDisabled:k.agent_status===`running`||Ne===t.id,onResolve:t=>fn(e.id,t)})},[k,un?.id,fn,Ne]),mn=k?.id&&k.agent_status===`running`&&rt?.parentId===k.id?rt.turnKey:null,hn=(It===`opencode`||It===`claude`)&&zt.length>0,gn=(It===`opencode`||It===`claude`)&&!hn&&(ke||Bt);(0,p.useEffect)(()=>{st.current={model:te,variant:re,skills:ae,showModelSelector:hn}},[te,ae,re,hn]);let _n=(0,p.useMemo)(()=>zt.find(e=>e.id===te)??null,[zt,te]),vn=P?R:k?.mode??`build`,yn=P?D5(`composer.newChatTitle`):k?.title??D5(`composer.chatTitle`),bn=P?u:k?.tool??u,xn=(0,p.useMemo)(()=>pX(),[]),Sn=hn?te||null:k?.model??null,Cn=bn===`opencode`||bn===`claude`,wn=b5({availableModelsById:rn,model:Sn}),Tn=P?`draft:${e??`none`}:${u}`:k?.id,En=(0,p.useCallback)(()=>{ct.current=!0,F(!0),z(U5({projectId:e,tool:u})),N(null),O(null),Ht(null),ve(null),we(!1),Ee(new Set),it(null),L(null),ut.current=null},[e,u,Ht]);(0,p.useEffect)(()=>{g&&(En(),z(`build`),L({specSessionId:g.specSessionId,specSnapshotId:g.specSnapshotId}),ut.current=g.text,_?.())},[g,En,_]),(0,p.useEffect)(()=>{m&&(En(),h?.())},[m,En,h]);let Dn=(0,p.useCallback)((e,t=null)=>{ct.current=!1,F(!1),N(null),O(e),Ht(t),L(null)},[Ht]),On=(0,p.useCallback)(async()=>{if(!(!k||!b)){N(k.id);try{await b(k)}catch(e){$.error(e instanceof Error?e.message:D5(`errors.restoreTarget`))}finally{N(e=>e===k.id?null:e)}}},[k,b]),kn=!!(k&&k.target_available!==!1&&!P&&!K5({activeProject:t,activeProjectBranchState:n,session:k})),An=kn&&k?D5(`review.mismatchReason`,{sessionTarget:jue(k),currentTarget:Mue({activeProject:t,activeProjectBranchState:n})}):null,jn=kn&&M===null,Mn=(0,p.useCallback)(async r=>{N(r.id);let i=r;if(e)try{let t=await zN(e,r.id);i=t,Ut(t)}catch(e){$.error(e instanceof Error?e.message:D5(`errors.loadSession`)),N(e=>e===r.id?null:e);return}if(i.target_available===!1){Dn(i.id,i);return}if(!K5({activeProject:t,activeProjectBranchState:n,session:i})&&b)try{if(!await b(i)){N(e=>e===i.id?null:e);return}}catch(e){$.error(e instanceof Error?e.message:D5(`errors.restoreTarget`)),N(e=>e===i.id?null:e);return}Dn(i.id,i)},[t,n,e,b,Dn,Ut]),Nn=(0,p.useCallback)(()=>{nt(e=>e+1)},[]),Pn=(0,p.useCallback)(async t=>{if(P){let n=st.current;return z(t),H5({projectId:e,tool:u,model:n.showModelSelector&&n.model||null,variant:n.showModelSelector&&n.model&&n.variant||null,mode:t}),Nn(),null}if(!e||!k||k.mode===t||De||dn)return null;Oe(!0);try{let n=await VN(e,k.id,{mode:t});return H5({projectId:e,tool:n.tool,model:n.model,variant:n.variant,mode:n.mode}),Ht(n),Ut(n),Nn(),n}catch(e){return $.error(e instanceof Error?e.message:D5(`errors.updateMode`)),null}finally{Oe(!1)}},[e,k,u,Nn,dn,P,De,Ht,Ut]),Fn=(0,p.useCallback)(async({instruction:t,attachments:n,targetSession:r,startedAt:i})=>{if(!e)return null;let a=st.current;Dt.current+=1;let o={parentType:`chat`,parentId:r.id,turnKey:`${r.id}:${Dt.current}`,startedAt:i};it(o);try{let i=await HN(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 H5({projectId:e,tool:i.tool,model:i.model,variant:i.variant,mode:i.mode}),ct.current=!1,Ht(i),O(i.id),F(!1),Ut(i),i}catch(e){throw it(e=>e?.turnKey===o.turnKey?null:e),e}},[e,Ht,Ut]),In=(0,p.useCallback)(async({fromStorageKey:t})=>{if(!e)return null;let n=st.current,r=lt.current,i=await RN(e,{mode:vn,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});ct.current=!1,F(!1),O(i.id),Ht(i),L(null);let a=w5({projectId:e,tool:i.tool,chatSessionId:i.id});return Zt({fromStorageKey:t,toStorageKey:a}),{session:i,storageKey:a}},[e,u,vn,Zt,Ht]),Ln=(0,p.useCallback)(async(t,n={})=>{let r=n.targetSession??k;if(!e||he||pe||Rt||r?.agent_status===`running`||bJ(r?.post_build_check)||r?.target_available===!1||jn||dn)return!1;let i=t.trim(),a=n.preserveComposerDraft===!0,o=a?[]:r?jt.current[r.id]??[]:[];if(!i&&o.length===0)return!1;ge(!0);let s=null,c=r,l=performance.now(),u=e&&r?w5({projectId:e,tool:r.tool,chatSessionId:r.id}):null,d=o;try{let t=r;if(!t){me(!0);let e=await In({fromStorageKey:Pt});s=e?.session??null,t=s,u=e?.storageKey??null,d=s?jt.current[s.id]??[]:[]}if(!t)return!1;a||qt(u??Pt);let n=Oue({session:t,instruction:i,attachments:d,createdAt:new Date().toISOString()});Ht(n),O(n.id),Ut(n);let o=await Fn({instruction:i,attachments:d,targetSession:t,startedAt:l});return a||qt(o&&e?w5({projectId:e,tool:o.tool,chatSessionId:o.id}):u),o&&!a&&Yt(o.id),!0}catch(e){a||Kt(u??Pt,i);let t=Ke(e,`chat_session`);if(t?(ct.current=!1,Ht(t),O(t.id),F(!1),Ut(t)):s?(Ht(s),O(s.id),F(!1),Ut(s)):c&&(Ht(c),Ut(c)),e instanceof Ge&&e.status===409&&!t){let e=s?.id??c?.id;e&&await en(e)}throw e}finally{me(!1),ge(!1)}},[e,k,Yt,qt,In,Pt,dn,pe,he,Rt,en,Ht,Fn,Kt,jn,Ut]),Rn=(0,p.useCallback)(async()=>{if(!(!k||!fX(k,dn)||mt.current)){mt.current=!0;try{let e=await Pn(`build`);if(!e)return;await Ln(dX,{preserveComposerDraft:!0,targetSession:e})}catch(e){$.error(e instanceof Error?e.message:D5(`errors.sendPrompt`))}finally{mt.current=!1}}},[k,Pn,dn,Ln]),zn=(0,p.useCallback)(e=>{ct.current=!0,F(!0),z(e),N(null),O(null),Ht(null),ve(null),it(null)},[Ht]),Bn=(0,p.useCallback)(async t=>{if(!e||t.length===0||It!==`opencode`&&It!==`claude`)return;let n=t.slice(0,j5);if(n.length===0)return;let r=null,i=k;try{if(i||=(me(!0),r=await In({fromStorageKey:Pt}),r?.session??null),!i)return;if((jt.current[i.id]??[]).length+n.length>j5){$.error(`You can attach up to 4 images per turn.`);return}Xt(i.id,1);let t=await WN(e,i.id,n),a=jt.current[i.id]??[];Jt(i.id,[...a,...t.attachments])}catch(t){if(r&&!Ft.trim())try{await GN(e,r.session.id),Gt(r.session.id),zn(r.session.mode)}catch{}$.error(t instanceof Error?t.message:D5(`errors.uploadAttachments`))}finally{i&&Xt(i.id,-1),me(!1)}},[e,k,In,Ft,Pt,Xt,zn,Gt,Jt,It]),Vn=(0,p.useCallback)(async t=>{if(!e||!k)return;let n=(jt.current[k.id]??[]).filter(e=>e.id!==t);try{await ire(e,k.id,t),Jt(k.id,n),n.length===0&&!Ft.trim()&&(k.messages?.length??0)===0&&(await GN(e,k.id),Gt(k.id),zn(k.mode))}catch(e){$.error(e instanceof Error?e.message:D5(`errors.removeAttachment`))}},[e,k,Ft,zn,Gt,Jt]),Hn=(0,p.useCallback)(e=>{if(It!==`opencode`&&It!==`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(),Bn(t))},[It,Bn]),Un=(0,p.useCallback)(async e=>{await Ln(e)},[Ln]),Wn=!!(e&&(P||k&&k.target_available!==!1&&!jn)),Gn=k?.agent_status===`running`,Kn=k?.agent_status===`stopped`,qn=Gn&&_e===k?.id,Jn=Wn&&!dn&&!Gn&&!j&&!he&&!pe&&!Rt,Yn=Wn?k?.target_available===!1?k.target_unavailable_reason??D5(`review.unavailableTarget`):jn?An??D5(`review.restoreTargetFallback`):dn?vC.t(`common:questionSet.waitForResolution`):Gn?D5(`review.waitTurn`):j?vC.t(`common:postBuildChecks.blockedReason`):Rt?D5(`review.waitUpload`):pe||he?D5(`review.waitPrompt`):null:D5(`review.missingTarget`),Xn=(0,p.useCallback)(async()=>{if(!(!e||!k||k.agent_status!==`running`||qn)){ve(k.id);try{await are(e,k.id)}catch(e){ve(e=>e===k.id?null:e),$.error(e instanceof Error?e.message:D5(`errors.interruptResponse`))}}},[e,k,qn]),Zn=(0,p.useCallback)(async()=>{if(!e||ye.length===0||xe.size>0)return;let t=Array.from(new Set(ye)),n=Ce||t.length>1;Se(new Set(t));let r=await Promise.allSettled(t.map(async t=>(await GN(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&&Wt(i),Se(new Set),a.length===0){be([]),n&&(we(!1),Ee(new Set),$.success(D5(`toasts.deleteSelectedSuccess`,{count:i.length})));return}let o=a.map(e=>e.sessionId);if(be(o),n&&Ee(new Set(o)),i.length>0){$.error(D5(`toasts.deleteSelectedPartial`,{count:i.length,deletedCount:i.length,failedCount:a.length}));return}$.error(a[0]?.message??D5(`errors.deleteSession`))},[e,ye,xe,Ce,Wt]),Qn=(0,p.useMemo)(()=>T.some(e=>!q5(e)),[T]),$n=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:e.agent_status===`stopped`?`interrupted`:!t&&at.has(e.id)?`finished`:null,[at]),er=(0,p.useCallback)((e,n)=>[e.title,xue(e.mode),v5(e.tool),t?.memory_enabled&&e.pending_memory_suggestion_count>0?P5(e.pending_memory_suggestion_count):null,n===`running`?D5(`sidebar.running`):n===`interrupted`?D5(`sidebar.interrupted`):n===`finished`?D5(`sidebar.finished`):null].filter(Boolean).join(` `),[t]),tr=(0,p.useCallback)(({session:e,isActive:r,activityState:i})=>{let a=Eue(e),o=Aue({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)(Rw,{tone:r?`default`:`muted`,className:`shrink-0`,"aria-label":P5(e.pending_memory_suggestion_count),title:P5(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??D5(`sidebar.targetUnavailable`)}):null]}),(0,X.jsx)(pb,{state:s,className:`mt-1`})]})},[t,n]),nr=(0,p.useMemo)(()=>({ariaLabel:D5(`sidebar.ariaLabel`),newSession:D5(`sidebar.newSession`),collapseAriaLabel:D5(`sidebar.collapseAriaLabel`),openAriaLabel:D5(`sidebar.openAriaLabel`),cancelSelection:D5(`sidebar.cancelSelection`),deleteSelected:D5(`sidebar.deleteSelected`),selectedCount:e=>D5(`sidebar.selectedCount`,{count:e}),select:D5(`sidebar.select`),loadingSessions:D5(`sidebar.loadingSessions`),noSessions:D5(`sidebar.noSessions`),deleteSessionAriaLabel:D5(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>D5(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>D5(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>D5(`sidebar.deleteSessionTitle`,{title:e})}),[]),rr=(0,p.useMemo)(()=>({title:D5(`deleteSessionModal.title`),bulkTitle:D5(`deleteSessionModal.bulkTitle`),description:D5(`deleteSessionModal.description`),bulkDescription:e=>D5(`deleteSessionModal.bulkDescription`,{count:e}),cancel:D5(`deleteSessionModal.cancel`),delete:D5(`deleteSessionModal.delete`),deleting:D5(`deleteSessionModal.deleting`)}),[]),ir=(0,p.useMemo)(()=>(0,X.jsx)(F5,{modifierLabel:xn,keys:[A5],ariaHidden:!0}),[xn]),ar=(0,p.useMemo)(()=>(0,X.jsx)(Cue,{label:D5(`shortcuts.startNewSession`),modifierLabel:xn,keys:[A5]}),[xn]),or=(0,p.useCallback)((e,t)=>{Ee(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)(()=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(cX,{value:vn,planInactiveTooltip:(0,X.jsx)(vX,{label:D5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(vX,{label:D5(`shortcuts.switchToBuild`)}),disabled:De||dn,onChange:e=>{Pn(e)}}),Gn?(0,X.jsx)($8,{isInterrupting:qn,onStop:()=>{Xn()},interruptLabel:D5(`review.interrupt`),interruptingLabel:D5(`review.interrupting`)}):null]}),[vn,Xn,Pn,dn,qn,Gn,De]),cr=(0,p.useMemo)(()=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(cX,{value:vn,planInactiveTooltip:(0,X.jsx)(vX,{label:D5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(vX,{label:D5(`shortcuts.switchToBuild`)}),disabled:De||dn,onChange:e=>{Pn(e)}}),k&&fX(k,dn)&&(0,X.jsx)(u5,{disabled:he||De,onClick:()=>void Rn()}),P&&t&&(0,X.jsx)(ob,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:vC.t(`common:projectTargetSelector.newChatAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l}),Gn&&(0,X.jsx)($8,{isInterrupting:qn,onStop:()=>{Xn()},interruptLabel:D5(`review.interrupt`),interruptingLabel:D5(`review.interrupting`)})]}),[t,n,k,vn,Xn,Pn,Rn,dn,P,qn,he,Gn,a,o,De,c,l,s,i,r]),lr=(0,p.useMemo)(()=>hn?(0,X.jsx)(LY,{model:te,variant:re,skills:ae,showModelSelector:!0,showSkillsSelector:K.length>0,availableModels:zt,availableSkills:K,selectedModel:_n,onModelChange:e=>{let t=zt.find(t=>t.id===e)??null;ne(e),ie(e=>t&&t.variants.includes(e)?e:``)},onVariantChange:ie,onSkillsChange:oe,modelSelectId:`project-chat-model-selector`,variantSelectId:`project-chat-variant-selector`,skillsSelectId:`project-chat-skills-selector`,disabled:he||pe||k?.agent_status===`running`}):gn?(0,X.jsx)(IY,{dataTestId:`chat-model-selector-skeleton`}):null,[k?.agent_status,zt,K,pe,he,_n,te,ae,re,hn,gn]);(0,p.useEffect)(()=>{if(x)return()=>{x(null)}},[x]),(0,p.useEffect)(()=>{if(x){if(!e||!Wn){x(null);return}x({chatSessionId:k?.id??null,canSubmitReviewPrompt:Jn,reviewSubmitDisabledReason:Yn,mode:vn,onModeChange:async e=>{await Pn(e)},isUpdatingMode:De,promptPlaceholder:N5(vn),promptComposerControls:sr,promptComposerInlineControls:lr,submitPrompt:Un})}},[e,k,Jn,vn,Pn,Un,Wn,De,x,sr,lr,Yn]);let ur=async()=>{if(!(!Ft.trim()&&Lt.length===0||Rt||dn||j))try{if(!await Ln(Ft))return}catch(e){$.error(e instanceof Error?e.message:D5(`errors.sendPrompt`))}},dr=e=>{e.key!==`Enter`||e.shiftKey||k?.agent_status===`running`||j||pe||he||Rt||dn||(e.preventDefault(),ur())};(0,p.useEffect)(()=>{let t=t=>{if(Sue(t)){if(!e||pe||he)return;t.preventDefault(),En(),Nn();return}hX(t)&&(!e||!P&&!k||(t.preventDefault(),Pn(mX(vn))))};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,k,vn,Nn,En,Pn,pe,P,he]);let fr=(0,p.useCallback)(async t=>{if(!(!e||!k)){Me(t);try{let n=await cre(e,k.id,t);Ht(n.chatSession),Ut(n.chatSession),$.success(D5(`ticketProposal.createdFromChat`,{count:n.created_tickets.length}))}catch(e){$.error(e instanceof Error?e.message:D5(`errors.createTickets`))}finally{Me(e=>e===t?null:e)}}},[e,k,Ht,Ut]),pr=(0,p.useCallback)(e=>e.ticket_proposals?(0,X.jsx)(Nue,{proposals:e.ticket_proposals,isApplying:je===e.id,onApply:()=>{fr(e.id)}}):null,[je,fr]),mr=(0,p.useCallback)(e=>{if(!ht.current)return;let t=ht.current.getBoundingClientRect().width,n=M5(e,t);Tt.current=n,_t.current&&(_t.current.style.setProperty(`--chat-changes-panel-width`,`${n}px`),_t.current.setAttribute(`data-desktop-width`,String(n)))},[]),gr=(0,p.useCallback)(()=>{bt.current?.(),bt.current=null},[]),_r=(0,p.useCallback)(e=>{let t=vt.current,n=yt.current,r=xt.current;if(t!==null){if(vt.current=null,yt.current=null,xt.current=!1,Ze(!1),Qe(!1),gr(),e!==null&&typeof gt.current?.hasPointerCapture==`function`&&gt.current.hasPointerCapture(e)&&typeof gt.current.releasePointerCapture==`function`&&gt.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;et(Tt.current),J(!0);return}et(Tt.current)}},[gr]),vr=(0,p.useCallback)((e,t)=>{if(vt.current!==e)return;let n=t-Ct.current,r=wt.current-n;if(yt.current===`collapsed`){if(!xt.current&&r<_ue)return;xt.current||(xt.current=!0,St.current=!0,Qe(!0),Ze(!0))}mr(r)},[mr]),yr=(0,p.useCallback)((e,t)=>{if(vt.current===e){if(t!==null&&(yt.current===`inline`||xt.current)){let e=t-Ct.current;mr(wt.current-e)}_r(e)}},[_r,mr]),br=(0,p.useCallback)(e=>{if(!C)return;e.preventDefault(),vt.current=e.pointerId,yt.current=Je?`inline`:`collapsed`,xt.current=!1,St.current=!1,Ct.current=e.clientX,wt.current=Je?Tt.current:0,Ze(Je),gr(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{vr(e.pointerId,e.clientX)},n=e=>{yr(e.pointerId,e.clientX)},r=e=>{yr(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),bt.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[yr,vr,Je,C,gr]),xr=(0,p.useCallback)(e=>{vr(e.pointerId,e.clientX)},[vr]),Sr=(0,p.useCallback)(e=>{yr(e.pointerId,e.clientX)},[yr]),Cr=(0,p.useCallback)(e=>{yr(e.pointerId,e.clientX)},[yr]),wr=(0,p.useCallback)(e=>{vt.current===e.pointerId&&_r(e.pointerId)},[_r]),Tr=(0,p.useCallback)(()=>{if(St.current){St.current=!1;return}J(!0)},[]),Er=(0,p.useCallback)(()=>{J(!1)},[]),Dr=(0,p.useCallback)(e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),Tr())},[Tr]);(0,p.useEffect)(()=>{C||(vt.current=null,yt.current=null,xt.current=!1,St.current=!1,Ze(!1),Qe(!1),gr())},[C,gr]),(0,p.useEffect)(()=>()=>{gr()},[gr]);let Or=!!D,kr=k?.target_available===!1,Ar=kr?k?.target_unavailable_reason??D5(`review.unavailableTarget`):null,jr=P||!!(k&&k.target_available!==!1&&!jn),Mr=!!(t?.memory_enabled&&k&&(Pe.length>0||Ie)),Nr=C&&(P||Or)&&!kr&&!jn,Pr=Nr&&!Je&&!Y,Fr=Nr&&(Je||Y),Ir=`${Tn??`none`}:${Nr?`changes-enabled`:`changes-disabled`}:${Fr?`panel-visible`:`panel-hidden`}`,Lr=(0,p.useCallback)(e=>{ut.current=null,Kt(Pt,e)},[Pt,Kt]),Rr=k||P?(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(l5,{projectId:e,agentRunParentType:k?`chat`:null,agentRunParentId:k?.id??null,messages:k?ln:[],internalLog:k?.agent_log??null,currentThinkingMessageId:k?.agent_message_id??null,previousThinkingLog:k?.previous_agent_log??null,previousThinkingMessageId:k?.previous_agent_message_id??null,pendingAgentTitle:cn,streamingResponse:k?.streaming_response??null,isRunning:k?.agent_status===`running`,isLoading:!P&&de,canShowComposer:jr,cardClassName:`border-t-0`,isExternallyResizing:S||Xe,pendingAgentRevealKey:mn,pendingAgentRevealDelayMs:bue,liveResponseTiming:rt,composerFocusNonce:tt,header:(0,X.jsx)(d5,{title:yn,tool:P?null:k?.tool??null,modelLabel:wn,interrupted:Kn,interruptedLabel:D5(`sidebar.interrupted`),usage:{totalTokens:k?.usage_snapshot_total_tokens??null,contextWindow:k?.usage_snapshot_context_window??null,cost:k?.usage_snapshot_cost??null,tool:bn,model:Sn,availableModels:zt},metadataExtra:(0,X.jsxs)(X.Fragment,{children:[k?.external_source?(0,X.jsx)(sI,{externalSource:k.external_source}):null,k?.origin_spec_session_id&&k.origin_spec_snapshot_id&&v?(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:()=>{v(k.origin_spec_session_id,k.origin_spec_snapshot_id)},children:vC.t(`common:specView.provenance.viewSourceSpec`)}):null]}),actions:k&&e?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Mr&&(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>ze(!0),children:Ie?D5(`composer.loadingMemory`):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:D5(`composer.memorySuggestions`)}),(0,X.jsx)(Rw,{children:Pe.length})]})}),(0,X.jsx)(L3,{projectId:e,scope:{type:`chat`,id:k.id},size:`xs`,onNavigateToLifecycleSource:y})]}):null,warnings:jn&&An?(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:An}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{On()},children:D5(`composer.switchBack`)}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:En,children:D5(`composer.startNewSession`)})]})]})}):kr&&Ar?(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:Ar}):null}),composerControls:cr,composerInlineControls:lr,composerTheme:vn,layoutKey:Tn,scrollLayoutKey:Ir,followUpPrompt:Ft,draftAttachments:Lt,followUpPlaceholder:N5(vn),emptyStateText:null,renderMessageFooter:pr,renderMessageBody:pn,isSendingFollowUp:he||pe,isComposerSubmitDisabled:dn||j,postBuildCheck:k?.post_build_check,isUploadingAttachments:Rt,canAttachImages:Cn,followUpDisabledReason:kr?Ar??void 0:k?.agent_status===`running`?D5(`review.waitTurnShort`):j?vC.t(`common:postBuildChecks.blockedReason`):Rt?D5(`review.waitUpload`):dn?vC.t(`common:questionSet.waitForResolution`):void 0,onFollowUpPromptChange:Lr,onFollowUpKeyDown:dr,onFollowUpPaste:Hn,onUploadAttachments:e=>{Bn(e)},onRemoveAttachment:e=>{Vn(e)},onFollowUpSubmit:()=>{ur()}})}):Or?(0,X.jsx)(Y8,{label:D5(`composer.loadingSession`)}):!le||se?(0,X.jsx)(X8,{label:D5(`sidebar.loadingSessions`)}):(0,X.jsx)(Z8,{title:D5(`composer.noSessionSelectedTitle`),description:D5(`composer.noSessionSelectedDescription`),startNewSessionLabel:D5(`composer.startNewSession`),onStartNewSession:En,canStartNewSession:!!e&&!pe&&!he}),zr=Nr?(0,X.jsx)(`div`,{ref:gt,"aria-label":D5(Pr?`composer.openDiff`:`composer.resizeDiffPanel`),"aria-orientation":Pr?void 0:`vertical`,className:Z(Pr?`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`,Xe&&!Pr&&`bg-background`),"data-testid":Pr?`collapsed-changes-rail`:void 0,onLostPointerCapture:wr,onPointerCancel:Cr,onPointerDown:br,onPointerMove:xr,onPointerUp:Sr,onClick:Pr?Tr:void 0,onKeyDown:Pr?Dr:void 0,role:Pr?`button`:`separator`,tabIndex:Pr?0:void 0,children:Pr?(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)(Iv,{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)(Iv,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:D5(`composer.diff`)})]})]}):(0,X.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,Xe?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})}):null,Br=Re&&e&&t?.memory_enabled?(0,X.jsx)(hC,{onClose:()=>ze(!1),overlayClassName:`bg-background/45 p-4 backdrop-blur-sm`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,X.jsxs)(bC,{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)(xC,{className:`border-b border-border/80 pb-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(SC,{children:D5(`composer.memorySuggestionsTitle`)}),(0,X.jsx)(CC,{children:D5(`composer.memorySuggestionsDescription`)})]}),(0,X.jsx)(wC,{children:t})]}),(0,X.jsx)(TC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,X.jsx)(f5,{projectId:e,suggestions:Pe,emptyState:D5(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:nn})})]}),closeButtonLabel:D5(`composer.closeMemorySuggestions`)}):null,Vr=on.length>0?(0,X.jsx)(J8,{count:on.length,title:sn,isDeleting:xe.size>0,onConfirm:()=>{Zn()},onCancel:()=>{xe.size>0||be([])},labels:rr}):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)(Q8,{sessions:T,sessionGroups:an,activeSessionId:D,isDraftOpen:P,isLoadingSessions:se,isOpen:We,onToggleOpen:()=>{qe(e=>!e)},testId:`chat-sessions-sidebar`,railTestId:`chat-sessions-rail`,onDraftOpen:En,isCreatingSession:pe||!e,isSendingPrompt:he,newSessionShortcutHint:ir,newSessionTooltip:ar,isSelectionMode:Ce,selectedSessionIds:Te,selectedSessionCount:Te.size,hasDeletableSessions:Qn,deletingSessionIds:xe,onEnterSelectionMode:()=>{we(!0),Ee(new Set)},onExitSelectionMode:()=>{we(!1),Ee(new Set)},onToggleSessionSelection:e=>{Ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:or,onConfirmDeleteSelectedSessions:()=>{be(Array.from(Te))},onSessionSelect:e=>{Mn(e)},onConfirmDeleteSession:e=>{be([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:q5,getActivityState:$n,getRowAriaLabel:er,renderRowContent:tr,labels:nr}),(0,X.jsxs)(`div`,{ref:ht,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:Rr}),Nr?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ov,{content:D5(`composer.openDiff`),disabled:!Pr,side:`left`,children:zr}),Fr?(0,X.jsx)(c5,{projectId:e,chatSessionId:P?null:D,canSubmitReviewPrompt:Jn,reviewSubmitDisabledReason:Yn,onSubmitReviewPrompt:Un,state:He,onStateChange:Ue,isResizing:Xe,onClose:Er,desktopWidth:$e,panelElementRef:_t}):null]}):null]}),Br,Vr]})},Fue=({className:e})=>(0,X.jsx)(Mg,{"aria-hidden":`true`,className:e}),Iue=({activeProject:e,onNavigateToSource:t})=>{let{t:n}=He(`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)($T,{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`)})},Lue=(e,t,n,r)=>Y(qe(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{method:`POST`,body:r,fallbackErrorMessage:`Unable to start the spec review right now.`}),Rue=(e,t,n)=>Y(qe(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the spec review right now.`}),J5=(e,t,n,r)=>Y(qe(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{signal:r,fallbackErrorMessage:`Unable to load the spec review right now.`}),zue=(e,t,n,r)=>Y(qe(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review-runs/${r}/revision-draft`),{method:`POST`,fallbackErrorMessage:`Unable to build the revision draft right now.`}),Bue=(e,t)=>!!t&&e===t,Vue=({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]}),Hue=({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]}),Y5=({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&&$E(s.current)},[a]),!t)return(0,X.jsx)(Hue,{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)(bb,{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)(Vue,{suggestion:e,isRecommended:Bue(e.id,l),recommendedLabel:i.recommendedSuggestionLabel,onPick:u},e.id))})]}):null,(0,X.jsx)(nv,{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})})]})},Uue=({className:e})=>(0,X.jsx)(hg,{"aria-hidden":`true`,className:e}),Wue=[`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(` `),Gue=[`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(` `),X5=({on:e,disabled:t=!1,onToggle:n,tooltipContent:r,ariaLabelOn:i,ariaLabelOff:a,className:o})=>(0,X.jsx)(Ov,{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?Wue:Gue,o),onClick:()=>{t||n(!e)},children:(0,X.jsx)(Uue,{className:`h-5 w-5`})})})}),Kue=({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:B,onUploadAttachments:V,onRemoveAttachment:H,onFollowUpSubmit:U})=>(0,X.jsx)(aY,{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:B,onUploadAttachments:V,onRemoveAttachment:H,onFollowUpSubmit:U}),Z5=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},Q5=({className:e})=>(0,X.jsx)(Wg,{"aria-hidden":`true`,className:e}),que=({className:e})=>(0,X.jsx)(tg,{"aria-hidden":`true`,className:e}),$5=({className:e})=>(0,X.jsx)(cg,{"aria-hidden":`true`,className:e}),e7=({heading:e,open:t,onOpenChange:n,children:r})=>(0,X.jsxs)(RC,{open:t,onOpenChange:n,children:[(0,X.jsx)(zC,{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)(Av,{className:`h-3 w-3 shrink-0 transition-transform ${t?``:`-rotate-90`}`}),e]})}),(0,X.jsx)(BC,{children:r})]}),Jue=({actions:e})=>{let{t}=He(`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)(xb,{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.isCreatingTickets||e.isImplementingInChat||e.isExporting,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)(Q5,{className:`h-3.5 w-3.5`}),e.isCreatingTickets?t(`specView.actions.creatingTickets`):t(`specView.actions.createTickets`)]})},t7={high:0,medium:1,low:2},Yue=e=>[...e].sort((e,t)=>{let n=t7[e.severity]??99,r=t7[t.severity]??99;return n===r?e.ordinal-t.ordinal:n-r}),Xue=e=>{let t={high:0,medium:0,low:0};for(let n of e)t[n.severity]+=1;return t},Zue=({run:e})=>{let{t}=He(`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})},Que=({review:e})=>{let{t}=He(`common`),[n,r]=(0,p.useState)(!0),i=e.review?.run??null,a=e.review?.findings??[],o=Yue(a),s=Xue(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?b5({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)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)($5,{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)(Zue,{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 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:`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)(Vv,{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.isSendingToPlanner,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(HE,{className:`h-3.5 w-3.5`}),e.isSendingToPlanner?t(`specView.review.sendingToPlanner`):t(`specView.review.sendToPlanner`)]})})]})})},$ue=({review:e})=>{let{t}=He(`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)(gv,{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,"aria-label":o,className:`gap-1.5 text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)($5,{className:`h-4 w-4`}),t(`specView.review.heading`)]})}),(0,X.jsx)(vv,{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)(Ev,{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)($5,{className:`h-3.5 w-3.5`}),t(`specView.review.launchAction`)]})]})})]})},ede=(0,p.memo)((0,p.forwardRef)(({snapshot:e,isLoading:t,desktopWidth:n,onClose:r,actions:i,review:a,className:o},s)=>{let{t:c}=He(`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=(0,p.useCallback)(e=>{u(e)},[]),j=(0,p.useCallback)(()=>{f(!0)},[]),M=`flex shrink-0 flex-col border-l border-border/70 bg-surface ${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)] ${M}`:M,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)(cC,{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)] ${M}`:M,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)(cC,{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 N=e.likely_files.length>0,P=!!e.file_relation_graph,F=e.tickets.length>0,I=e.dependencies.length>0,L=e.open_questions.length>0,R=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)] ${M}`:M,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)($ue,{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)(cC,{className:`h-4 w-4`})})]})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4`,children:[a&&(a.review?.run||a.isRunning)&&(0,X.jsx)(Que,{review:a}),(0,X.jsx)(e7,{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)(e7,{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)(jG,{mermaid:e.mermaid,onClick:()=>{A(e.mermaid)}})})}),e.mockup&&(0,X.jsx)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(que,{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)(IG,{html:e.mockup,onClick:j})})}),(N||P)&&(0,X.jsx)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Fv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.likelyFiles`)]}),open:b,onOpenChange:x,children:(0,X.jsxs)(`section`,{children:[N&&(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:e.likely_files.map((e,t)=>(0,X.jsxs)(`li`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`min-w-0 break-all text-xs text-foreground`,children:e.path}),e.is_new&&(0,X.jsx)(yC,{variant:`success`,className:`shrink-0 px-1.5 py-0 text-[10px]`,children:c(`specView.artifactPanel.newFile`)})]}),e.reason&&(0,X.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.reason})]},t))}),P&&(0,X.jsxs)(`div`,{className:`mt-3`,children:[(0,X.jsx)(`p`,{className:`mb-1.5 text-[0.65rem] font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`specView.artifactPanel.fileRelationGraph`)}),(0,X.jsx)(`div`,{className:`overflow-auto rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,X.jsx)(jG,{mermaid:e.file_relation_graph,onClick:()=>{A(e.file_relation_graph)}})})]})]})}),F&&(0,X.jsx)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Q5,{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,t)=>(0,X.jsxs)(`li`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.title}),e.key&&(0,X.jsx)(`div`,{className:`mt-0.5 text-xs text-violet-400`,children:e.key})]},t))})})}),I&&(0,X.jsx)(e7,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(bw,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.dependencies`)]}),open:w,onOpenChange:T,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 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.blocker_key}),(0,X.jsx)(`span`,{children:`→`}),(0,X.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.dependent_key})]},t))})})}),L&&(0,X.jsx)(e7,{heading:c(`specView.artifactPanel.openQuestions`),open:E,onOpenChange:D,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`,{children:e})]},t))})})}),R&&(0,X.jsx)(e7,{heading:c(`specView.artifactPanel.assumptions`),open:O,onOpenChange:k,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`,{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)(Jue,{actions:i}),(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onImplementInChat,disabled:i.isCreatingTickets||i.isImplementingInChat||i.isExporting,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(HE,{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.isCreatingTickets||i.isImplementingInChat||i.isExporting,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(Cb,{className:`h-3.5 w-3.5`}),i.isExporting?c(`specView.actions.exportingSpec`):c(`specView.actions.exportSpec`)]})]}),l&&(0,X.jsx)(NG,{mermaid:l,open:!0,onClose:()=>{u(null)}}),e.mockup&&(0,X.jsx)(LG,{html:e.mockup,open:d,onClose:()=>{f(!1)}})]})})),n7=({className:e})=>(0,X.jsx)(gg,{"aria-hidden":`true`,className:e}),r7=(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},i7=(e,t)=>vC.t(`specView.${e}`,t),a7=e=>i7(`pendingMemorySuggestions`,{count:e}),tde=1500,o7=`archon.spec-draft`,s7=`archon.spec-run-config`,c7=`archon.spec-review-run-config`,l7=`archon.spec-session-list-layout`,u7=`archon.spec-artifact-panel-layout`,nde=`archon.spec-import-notice`,d7=420,f7=320,p7=.5,m7=6,h7=`/`,rde=`Slash`,ide=`NumpadDivide`,ade=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===h7||e.code===rde||e.code===ide),g7=({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)(lX,{"aria-hidden":n,children:e}),t.map(e=>(0,X.jsxs)(`span`,{className:`contents`,children:[(0,X.jsx)(`span`,{children:`+`}),(0,X.jsx)(lX,{"aria-hidden":n,children:e})]},e))]}),ode=({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)(g7,{modifierLabel:t,keys:n,ariaHidden:!0})]}),_7=({projectId:e,tool:t,sessionId:n=null})=>e?n?`${o7}/${e}/sessions/${n}`:`${o7}/${e}/draft/${t}`:null,v7=({projectId:e,sessionId:t})=>e&&t?`${nde}/${e}/${t}`:null,y7=({projectId:e,tool:t})=>{if(e)try{localStorage.setItem(`${o7}/${e}/tool`,t)}catch{}},b7=e=>{if(!e)return{isOpen:!0};try{let t=localStorage.getItem(`${l7}/${e}`);return{isOpen:(t?JSON.parse(t):null)?.isOpen??!0}}catch{return{isOpen:!0}}},sde=({projectId:e,isOpen:t})=>{if(e)try{localStorage.setItem(`${l7}/${e}`,JSON.stringify({isOpen:t}))}catch{}},cde=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):d7;if(!Number.isFinite(t))return Math.max(f7,n);let r=Math.max(f7,Math.round(t*p7));return Math.max(f7,Math.min(r,n))},x7=e=>{if(!e)return{isOpen:!1,width:d7};try{let t=localStorage.getItem(`${u7}/${e}`);if(!t)return{isOpen:!1,width:d7};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(f7,Math.round(n.width)):d7;return{isOpen:n.isOpen===!0,width:r}}catch{return{isOpen:!1,width:d7}}},lde=({projectId:e,isOpen:t,width:n})=>{if(e)try{localStorage.setItem(`${u7}/${e}`,JSON.stringify({isOpen:t,width:n}))}catch{}},ude=e=>{if(!e)return null;try{return localStorage.getItem(e)}catch{return null}},S7=({storageKey:e,value:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,t)}catch{}},dde=e=>{if(!e)return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},C7=({storageKey:e,notice:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(t))}catch{}},fde=e=>{if(!e)return null;let t=e.skipped.reduce((e,t)=>e+t.count,0),n=e.skipped.map(e=>i7(`importNotice.skipReasons.${e.code}`,{count:e.count})).join(`, `);return e.imported_count>0&&t>0?i7(`importNotice.importedWithSkips`,{importedCount:e.imported_count,skippedCount:t,skippedSummary:n}):e.imported_count>0?i7(`importNotice.importedOnly`,{importedCount:e.imported_count}):t>0?i7(`importNotice.skippedOnly`,{skippedCount:t,skippedSummary:n}):null},w7=({keyPrefix:e,projectId:t,tool:n})=>`${e}:${t}:${n}`,T7=({keyPrefix:e,projectId:t,tool:n})=>{if(!t||n!==`opencode`&&n!==`claude`)return null;try{let r=window.localStorage.getItem(w7({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}:null}catch{return null}},E7=({keyPrefix:e,projectId:t,tool:n,model:r,variant:i})=>{if(!(!t||n!==`opencode`&&n!==`claude`||!r))try{window.localStorage.setItem(w7({keyPrefix:e,projectId:t,tool:n}),JSON.stringify({model:r,variant:r?i:null}))}catch{}},pde=({projectId:e,tool:t})=>T7({keyPrefix:s7,projectId:e,tool:t}),mde=({projectId:e,tool:t,model:n,variant:r})=>E7({keyPrefix:s7,projectId:e,tool:t,model:n,variant:r}),hde=({projectId:e,tool:t})=>T7({keyPrefix:c7,projectId:e,tool:t}),gde=({projectId:e,tool:t,model:n,variant:r})=>E7({keyPrefix:c7,projectId:e,tool:t,model:n,variant:r}),_de=`archon.spec-draft-grill`,D7=e=>e?`${_de}/${e}`:null,O7=e=>{let t=D7(e);if(!t)return!1;try{return window.localStorage.getItem(t)===`true`}catch{return!1}},k7=({projectId:e,grillOn:t})=>{let n=D7(e);if(n)try{t?window.localStorage.setItem(n,`true`):window.localStorage.removeItem(n)}catch{}},vde=({activeProjectId:e,activeProject:t=null,activeTool:n,initialSpecSessionId:r=null,initialSpecSnapshotId:i=null,initialIssueDraft:a=null,onInitialSpecNavigationConsumed:o,onInitialIssueDraftConsumed:s,onImplementInChat:c,onNavigateToLifecycleSource:l})=>{let u=Aq(),{t:d}=He(`common`),{jiraImportState:f,prepareSpecImportFromJira:m}=Ew(e),{gitHubImportState:h,prepareSpecImportFromGitHub:g}=QC(e),[_,v]=(0,p.useState)([]),[y,b]=(0,p.useState)(null),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)({}),[j,M]=(0,p.useState)({}),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)({}),[L,R]=(0,p.useState)({}),[z,B]=(0,p.useState)([]),[V,H]=(0,p.useState)(``),[U,W]=(0,p.useState)(``),[G,K]=(0,p.useState)([]),[ee,te]=(0,p.useState)(!1),[ne,re]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(!1),[oe,se]=(0,p.useState)(!1),[ce,le]=(0,p.useState)(!1),[ue,de]=(0,p.useState)(null),[fe,pe]=(0,p.useState)([]),[me,he]=(0,p.useState)(()=>new Set),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(()=>new Set),[be,xe]=(0,p.useState)(!1),[Se,Ce]=(0,p.useState)(()=>b7(e).isOpen),[we,Te]=(0,p.useState)(0),[Ee,De]=(0,p.useState)(null),[Oe,ke]=(0,p.useState)(()=>new Set),[Ae,je]=(0,p.useState)(null),[Me,Ne]=(0,p.useState)(null),[q,Pe]=(0,p.useState)(!1),[Fe,Ie]=(0,p.useState)(()=>x7(e).isOpen),[Le,Re]=(0,p.useState)(()=>x7(e).width),[ze,Be]=(0,p.useState)(!1),[Ve,Ue]=(0,p.useState)(!1),[We,qe]=(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)(null),[tt,nt]=(0,p.useState)(()=>O7(e)),[rt,it]=(0,p.useState)(!1),[at,ot]=(0,p.useState)([]),[st,ct]=(0,p.useState)(!1),[lt,ut]=(0,p.useState)(!1),[dt,ft]=(0,p.useState)(0),[pt,mt]=(0,p.useState)(null),[ht,gt]=(0,p.useState)(!1),[_t,vt]=(0,p.useState)(!1),[yt,bt]=(0,p.useState)(!1),[xt,St]=(0,p.useState)(!1),[Ct,wt]=(0,p.useState)(``),[Tt,Et]=(0,p.useState)(``),Dt=(0,p.useRef)(null),Ot=(0,p.useRef)(null),kt=(0,p.useRef)(null),At=(0,p.useRef)(null),jt=(0,p.useRef)(null),Mt=(0,p.useRef)(null),Nt=(0,p.useRef)(!1),Pt=(0,p.useRef)(!1),Ft=(0,p.useRef)(0),It=(0,p.useRef)(d7),Lt=(0,p.useRef)(d7),Rt=(0,p.useRef)(null),zt=(0,p.useRef)(0),Bt=(0,p.useRef)(0),Vt=(0,p.useRef)(!1),Ht=(0,p.useRef)(!1),Ut=(0,p.useRef)(!1),Wt=(0,p.useRef)({}),Gt=(0,p.useRef)({}),Kt=(0,p.useRef)({}),qt=(0,p.useRef)(new Set),Jt=(0,p.useRef)(new Set),Yt=(0,p.useRef)(0),Xt=(0,p.useRef)({id:null,status:null}),Zt=(0,p.useRef)(new Map),Qt=(0,p.useRef)(!1),$t=(0,p.useRef)(!1),en=e?_7({projectId:e,tool:T?n:x?.tool??n,sessionId:x?.id??null}):null,tn=v7({projectId:e,sessionId:x?.id??null}),nn=en?k[en]??``:``,rn=x?j[tn??``]??null:N,an=T?n:x?.tool??n,on=(0,p.useMemo)(()=>x?F[x.id]??[]:[],[x,F]),sn=(0,p.useMemo)(()=>x?L[x.id]??0:0,[x,L])>0,{models:cn,isLoading:ln}=OF(an);(0,p.useEffect)(()=>{Vt.current=T},[T]),(0,p.useEffect)(()=>{Wt.current=k},[k]),(0,p.useEffect)(()=>{Gt.current=j},[j]),(0,p.useEffect)(()=>{Kt.current=F},[F]),(0,p.useEffect)(()=>{if(!en||qt.current.has(en))return;qt.current.add(en);let e=ude(en);e&&A(t=>Object.prototype.hasOwnProperty.call(t,en)?t:{...t,[en]:e})},[en]),(0,p.useEffect)(()=>{if(!tn||Jt.current.has(tn))return;Jt.current.add(tn);let e=dde(tn);e&&M(t=>({...t,[tn]:e}))},[tn]),(0,p.useEffect)(()=>{!en||!Object.prototype.hasOwnProperty.call(k,en)||S7({storageKey:en,value:k[en]??``})},[en,k]),(0,p.useEffect)(()=>{!tn||!Object.prototype.hasOwnProperty.call(j,tn)||C7({storageKey:tn,notice:j[tn]??null})},[tn,j]),(0,p.useEffect)(()=>{Rt.current=y},[y]),(0,p.useEffect)(()=>{let t=Me??x?.latest_snapshot_id;if(!x?.id||!t||!e){je(null),Qe(!1),Ie(!1);return}let n=!1;return Pe(!0),gre(e,x.id,t).then(e=>{n||(je(e),Qe((e.created_ticket_ids?.length??0)>0),Ie(!0))}).catch(()=>{n||(je(null),Qe(!1))}).finally(()=>{n||Pe(!1)}),()=>{n=!0}},[x?.latest_snapshot_id,x?.id,e,Me]);let un=Ae?.id??null,dn=x?.id??null;(0,p.useEffect)(()=>{if(!e||!dn||!un){mt(null);return}let t=!1;return gt(!0),J5(e,dn,un).then(e=>{t||mt(e)}).catch(()=>{t||mt(null)}).finally(()=>{t||gt(!1)}),()=>{t=!0}},[e,dn,un]);let fn=(0,p.useCallback)(()=>{!e||!dn||!un||J5(e,dn,un).then(mt).catch(()=>{})},[e,dn,un]);(0,p.useEffect)(()=>{lde({projectId:e,isOpen:Fe,width:Le})},[e,Fe,Le]),(0,p.useEffect)(()=>{if(!(!r||_.length===0)){if(!_.some(e=>e.id===r)){$.error(i7(`errors.initialSessionMissing`)),Ht.current=!0,o?.();return}if(y===r){Ne(i??null),o?.();return}de(null),b(r),Ne(i??null),E(!1),Ht.current=!0,o?.()}},[r,i,_,y,o]),(0,p.useEffect)(()=>{ze||(Lt.current=Le,kt.current&&(kt.current.style.setProperty(`--spec-artifact-panel-width`,`${Le}px`),kt.current.setAttribute(`data-desktop-width`,String(Le))))},[Le,ze]);let pn=(0,p.useCallback)(async t=>{if(!e){v([]),te(!1);return}te(!ne);try{let n=await KN(e,t);if(t?.aborted)return;v(h5(n)),re(!0);let r=new Set(n.map(e=>e.id));ke(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:i7(`errors.loadSessions`))}finally{t?.aborted||te(!1)}},[e,ne]);(0,p.useEffect)(()=>{let e=Zt.current,t=new Map,n=[];for(let r of _){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&(a===`done`||a===`error`)&&r.id!==y&&n.push(r),t.set(r.id,a)}Zt.current=t,ke(e=>{let t=new Set(e),r=!1,i=new Set(_.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of _){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===y||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,y,_]);let mn=(0,p.useCallback)(async(t,n)=>{if(!e)return;ae(!0);let r=zt.current+1;zt.current=r;let i=Bt.current;try{let a=await JN(e,t,n);if(n?.aborted)return;let o=Bt.current!==i,s=zt.current===r,c=Rt.current===t&&!Vt.current;if(!s||o||!c)return;S(a)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.loadSession`))}finally{n?.aborted||ae(!1)}},[e]),hn=(0,p.useCallback)(e=>{v(t=>{let n=t.findIndex(t=>t.id===e.id);if(n===-1)return h5([...t,Z5(e)]);let r=t.slice();return r[n]=Z5(e),h5(r)})},[]),gn=(0,p.useCallback)((e,t)=>{v(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}),S(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:{...n,pending_memory_suggestion_count:t})},[]),_n=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){ot([]),ct(!1);return}ct(!0);try{let t=await hr(e,null,r,void 0,n);if(r?.aborted)return;ot(t.suggestions),gn(n,t.suggestions.length)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.loadMemorySuggestions`))}finally{r?.aborted||ct(!1)}},[t?.memory_enabled,e,gn]),vn=(0,p.useCallback)(e=>{ot(t=>{let n=t.filter(t=>t.id!==e);return y&&gn(y,n.length),n}),ft(e=>e+1),pn(),y&&mn(y)},[y,mn,pn,gn]),yn=(0,p.useCallback)(t=>t.project_id===e,[e]),bn=(0,p.useCallback)(()=>({tool:n,mode:tt?`grill`:`standard`,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[]}),[n,tt,cn.length,V,U,z.length,G]),xn=(0,p.useCallback)(()=>{oe||ce||(Rt.current=null,E(!0),b(null),Ne(null),S(null),P(null))},[oe,ce]),Sn=(0,p.useMemo)(()=>pX(),[]),Cn=(0,p.useMemo)(()=>(0,X.jsx)(g7,{modifierLabel:Sn,keys:[h7],ariaHidden:!0}),[Sn]),wn=(0,p.useMemo)(()=>(0,X.jsx)(ode,{label:i7(`sidebar.newSessionTooltip`),modifierLabel:Sn,keys:[h7]}),[Sn]);(0,p.useEffect)(()=>{let t=t=>{if(ade(t)){if(!e||oe||ce)return;t.preventDefault(),xn(),Te(e=>e+1);return}};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,oe,ce,xn]);let Tn=(0,p.useCallback)(e=>{ce||(de(null),b(e.id),Ne(null),E(!1),O(null),P(null),Yt.current+=1)},[ce]),En=(0,p.useCallback)(async t=>{if(e){de(t);try{await mre(e,t)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.stopSession`))}}},[e]),Dn=(0,p.useCallback)(async()=>{if(!(!e||!x||!Ae)){qe(!0);try{let t=await vre(e,x.id,Ae.id);Qe(!0),$.success(i7(`actions.createTicketsSuccess`,{count:t.tickets.length})),pn()}catch(e){if(Ye(e))return;if(e.status===409){Qe(!0);return}$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{qe(!1)}}},[e,x,Ae,pn]),On=(0,p.useCallback)(()=>{Dn()},[Dn]),kn=(0,p.useCallback)(async()=>{if(!(!e||!x||!Ae)&&c){J(!0);try{let t=await yre(e,x.id,Ae.id);c(t.draft_text,t.spec_session_id,t.spec_snapshot_id)}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{J(!1)}}},[e,x,Ae,c]),An=(0,p.useCallback)(async t=>{let n=t?.projectId??e,r=t?.sessionId??x?.id,i=t?.snapshotId??Ae?.id;if(!(!n||!r||!i)){Ze(!0);try{await _re(n,r,i,{overwrite:t?.overwrite}),et(null),$.success(i7(`actions.exportSuccess`))}catch(e){if(Ye(e))return;if(e instanceof XN){et({path:e.conflictingPath,projectId:n,sessionId:r,snapshotId:i});return}$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{Ze(!1)}}},[e,x,Ae]),jn=(0,p.useCallback)(()=>{Mt.current?.(),Mt.current=null},[]),Mn=(0,p.useCallback)(e=>{if(!Dt.current)return;let t=Dt.current.getBoundingClientRect().width,n=cde(e,t);Lt.current=n,kt.current&&(kt.current.style.setProperty(`--spec-artifact-panel-width`,`${n}px`),kt.current.setAttribute(`data-desktop-width`,String(n)))},[]),Nn=(0,p.useCallback)(e=>{let t=At.current,n=jt.current,r=Nt.current;if(t!==null){if(At.current=null,jt.current=null,Nt.current=!1,Be(!1),Ue(!1),jn(),e!==null&&typeof Ot.current?.hasPointerCapture==`function`&&Ot.current.hasPointerCapture(e)&&typeof Ot.current.releasePointerCapture==`function`&&Ot.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;Re(Lt.current),Ie(!0);return}Re(Lt.current)}},[jn]),Pn=(0,p.useCallback)((e,t)=>{if(At.current!==e)return;let n=t-Ft.current,r=It.current-n;if(jt.current===`collapsed`){if(!Nt.current&&r<m7)return;Nt.current||(Nt.current=!0,Pt.current=!0,Ue(!0),Be(!0))}Mn(r)},[Mn]),Fn=(0,p.useCallback)((e,t)=>{if(At.current===e){if(t!==null&&(jt.current===`inline`||Nt.current)){let e=t-Ft.current;Mn(It.current-e)}Nn(e)}},[Nn,Mn]),In=(0,p.useCallback)(e=>{e.preventDefault(),At.current=e.pointerId,jt.current=Fe?`inline`:`collapsed`,Nt.current=!1,Pt.current=!1,Ft.current=e.clientX,It.current=Fe?Lt.current:0,Be(Fe),jn(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{Pn(e.pointerId,e.clientX)},n=e=>{Fn(e.pointerId,e.clientX)},r=e=>{Fn(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Mt.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[Fn,Pn,Fe,jn]),Ln=(0,p.useCallback)(e=>{Pn(e.pointerId,e.clientX)},[Pn]),Rn=(0,p.useCallback)(e=>{Fn(e.pointerId,e.clientX)},[Fn]),zn=(0,p.useCallback)(e=>{Fn(e.pointerId,e.clientX)},[Fn]),Bn=(0,p.useCallback)(e=>{At.current===e.pointerId&&Nn(e.pointerId)},[Nn]),Vn=(0,p.useCallback)(()=>{Ie(!1)},[]),Hn=(0,p.useCallback)(async()=>{if(!e||fe.length===0)return;let t=fe;he(e=>{let n=new Set(e);for(let e of t)n.add(e);return n});let n=[];for(let r of t)try{await hre(e,r)}catch(e){Ye(e)||n.push(e instanceof Error?e.message:i7(`errors.deleteSession`))}if(he(e=>{let n=new Set(e);for(let e of t)n.delete(e);return n}),pe([]),n.length>0){$.error(n.join(`
274
+ `));return}ge&&(_e(!1),ye(new Set),$.success(i7(`specView.toasts.deleteSelectedSuccess`,{count:t.length})))},[e,fe,ge]),Un=(0,p.useCallback)(t=>{let r=new Set(t),i=Rt.current;for(let t of r)S7({storageKey:_7({projectId:e,tool:n,sessionId:t}),value:``}),C7({storageKey:v7({projectId:e,sessionId:t}),notice:null});I(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}),M(t=>{let n={...t},i=!1;for(let t of r){let r=v7({projectId:e,sessionId:t});r&&Object.prototype.hasOwnProperty.call(n,r)&&(delete n[r],i=!0)}return i?n:t}),v(e=>{let t=e.filter(e=>!r.has(e.id));if(i&&r.has(i)){let e=t[0]??null;b(e?.id??null),S(null),E(e===null)}return t}),ke(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),De(e=>e&&r.has(e.parentId)?null:e),de(e=>e&&r.has(e)?null:e),pe(e=>e.filter(e=>!r.has(e))),he(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),ye(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,n]),Wn=(0,p.useCallback)(e=>{Un([e])},[Un]),Gn=(0,p.useCallback)((e,t)=>{e&&A(n=>n[e]===t?n:{...n,[e]:t})},[]),Kn=(0,p.useCallback)((e,t)=>{I(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}})},[]),qn=(0,p.useCallback)(e=>{I(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),R(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),Jn=(0,p.useCallback)((e,t)=>{e&&M(n=>(n[e]??null)===t?n:{...n,[e]:t})},[]),Yn=(0,p.useCallback)(e=>{e&&(M(t=>!Object.prototype.hasOwnProperty.call(t,e)||t[e]===null?t:{...t,[e]:null}),C7({storageKey:e,notice:null}))},[]),Xn=(0,p.useCallback)(t=>{if(e){if(t.spec_session){let n=_7({projectId:e,tool:t.spec_session.tool,sessionId:t.spec_session.id}),r=v7({projectId:e,sessionId:t.spec_session.id});Gn(n,t.prompt_text),Jn(r,t.import_notice),Kn(t.spec_session.id,t.imported_attachments),hn(t.spec_session),S(t.spec_session),b(t.spec_session.id),E(!1),O(null),P(null),Te(e=>e+1);return}O(t.external_source),P(t.import_notice),E(!0),b(null),S(null),Ne(null),Gn(_7({projectId:e,tool:n}),t.prompt_text),Te(e=>e+1)}},[e,n,Gn,Jn,Kn,hn]),Zn=(0,p.useCallback)(async({provider:e,issueReference:t})=>{let n=$.loading(i7(`toasts.importPreparing`));try{let r=e===`jira`?await m?.({issueReference:t,...bn()}):await g?.({issueReference:t,...bn()});if(!r)throw Error(i7(`toasts.importError`));return(r.import_notice?.skipped.reduce((e,t)=>e+t.count,0)??0)>0?$.warning(i7(`toasts.importPartialSuccess`),{id:n}):$.success(i7(`toasts.importSuccess`),{id:n}),r}catch(e){if(Ye(e))$.dismiss(n);else{let t=e instanceof Error&&e.message?e.message:i7(`toasts.importError`);$.error(t,{id:n})}throw e}},[bn,g,m]),Qn=(0,p.useMemo)(()=>[{key:`jira`,label:d(`jiraImportField.label`),placeholder:d(`jiraImportField.placeholder`),state:f,onImport:e=>Zn({provider:`jira`,issueReference:e})},{key:`github`,label:d(`githubImportField.label`),placeholder:d(`githubImportField.placeholder`),state:h,onImport:e=>Zn({provider:`github`,issueReference:e})}],[d,f,h,Zn]),$n=Qn.some(e=>e.state===`enabled`);(0,p.useEffect)(()=>{a&&(Zn({provider:a.external_source.provider,issueReference:a.external_source.external_key}).then(Xn).catch(()=>void 0),s?.())},[a,Zn,Xn,s]);let er=(0,p.useCallback)(async()=>{if(!(!e||!x||!Ae)){vt(!0);try{let t=Ct||x.model,n=Tt||x.variant;await Lue(e,x.id,Ae.id,{tool:x.tool,model:t,variant:n,skills:x.skills}),gde({projectId:e,tool:x.tool,model:t,variant:n}),fn()}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{vt(!1)}}},[e,x,Ae,Ct,Tt,fn]),tr=(0,p.useCallback)(async()=>{if(!(!e||!x||!Ae)){bt(!0);try{await Rue(e,x.id,Ae.id),fn()}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{bt(!1)}}},[e,x,Ae,fn]),nr=(0,p.useCallback)(async()=>{if(!e||!x||!Ae)return;let t=pt?.run;if(t){St(!0);try{Gn(en,(await zue(e,x.id,Ae.id,t.id)).draft_text),Te(e=>e+1)}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{St(!1)}}},[e,x,Ae,pt,Gn,en]),rr=(0,p.useCallback)(e=>{e&&(A(t=>t[e]===``?t:{...t,[e]:``}),S7({storageKey:e,value:``}))},[]),ir=(0,p.useCallback)((e,t)=>{R(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||rt||$t.current)&&!(x&&x.agent_status===`running`)){if(!y||!x){nt(t),k7({projectId:e,grillOn:t});return}if(x.mode===(t?`grill`:`standard`)){nt(t);return}it(!0);try{let n=await ure(e,x.id,{mode:t?`grill`:`standard`});S(n),hn(n),nt(t),t||r7(n.messages,n.latest_snapshot_created_at)&&await YN(e,n.id,{instruction:i7(`grill.finalizePrompt`),tool:n.tool,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[]})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`grill.updateModeError`))}finally{it(!1)}}},[e,x,y,rt,hn,cn,V,U,z,G]),or=(0,p.useCallback)(async()=>{if(!e||oe||ce||Qt.current||$t.current)return;let t=nn.trim();if(!t&&on.length===0)return;le(!0);let r=en,i=performance.now();Yt.current+=1;let a=`spec:${Yt.current}`;try{let o=y,s=!o;if(o&&!x&&(await JN(e,o)||(s=!0,o=null)),s&&(se(!0),o=(await qN(e,{tool:n,mode:tt?`grill`:`standard`,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[],external_source:D??null})).id,b(o),E(!1),O(null),nt(!1),k7({projectId:e,grillOn:!1}),y7({projectId:e,tool:n}),se(!1)),!o)throw Error(`Unable to resolve the spec session.`);De({parentType:`spec`,parentId:o,turnKey:a,startedAt:i});let c=on.map(e=>e.id),l=await YN(e,o,{instruction:t,tool:n,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[],attachment_ids:c.length>0?c:void 0});S(l),mde({projectId:e,tool:l.tool,model:l.model,variant:l.variant}),Te(e=>e+1),qn(o),rr(r),Yn(v7({projectId:e,sessionId:o})),P(null)}catch(e){De(e=>e?.turnKey===a?null:e);let t=Ke(e,`spec_session`);t?(S(t),hn(t)):e instanceof Ge&&e.status===409&&Rt.current&&await mn(Rt.current),Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{le(!1),se(!1)}},[e,oe,ce,nn,on,en,y,x,n,tt,cn,V,U,z,G,D,mn,hn,qn,rr,Yn]),sr=(0,p.useCallback)(async t=>{if(!e||an!==`opencode`&&an!==`claude`)return;let r=y;if(!r&&t.length>0)try{se(!0),r=(await qN(e,{tool:n,mode:tt?`grill`:`standard`,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[],external_source:D??null})).id,b(r),E(!1),y7({projectId:e,tool:n})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.upload`));return}finally{se(!1)}if(r){ir(r,t.length);try{let n=await fre(e,r,t),i=[...Kt.current[r]??[],...n.attachments];Kn(r,i)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.upload`))}finally{ir(r,-t.length)}}},[e,y,n,an,cn,V,U,z,G,tt,D,ir,Kn]),cr=(0,p.useCallback)(async t=>{if(!(!e||!y))try{await pre(e,y,t),Kn(y,(Kt.current[y]??[]).filter(e=>e.id!==t))}catch(e){Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.removeAttachment`))}},[e,y,Kn]);(0,p.useEffect)(()=>{Ee&&(Ee.parentId===y&&(ce||x?.agent_status===`running`)||De(null))},[x?.agent_status,y,ce,Ee]),(0,p.useEffect)(()=>{if(!Ut.current){Ut.current=!0;return}let t=b7(e),n=x7(e);Vt.current=!1,Ht.current=!1,qt.current=new Set,Jt.current=new Set,b(null),S(null),E(!1),O(null),A({}),M({}),P(null),I({}),R({}),de(null),pe([]),he(new Set),_e(!1),ye(new Set),De(null),ot([]),ct(!1),ut(!1),re(!1),ke(new Set),Zt.current=new Map,Lt.current=n.width,Ce(t.isOpen),Re(n.width),Ie(n.isOpen),nt(O7(e)),it(!1)},[e]);let lr=(0,p.useCallback)((e,t)=>{ye(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 pn(e.signal),()=>{e.abort()}},[pn]),(0,p.useEffect)(()=>{if(Vt.current||T||y||Ht.current||_.length===0)return;Ht.current=!0;let e=_[0]??null;e&&b(e.id)},[y,T,_]),(0,p.useEffect)(()=>{if(an!==`opencode`&&an!==`claude`){B([]),xe(!1);return}if(an!==`opencode`){B([]);return}let t=new AbortController;return(async()=>{xe(!0);try{B(await kF(an,t.signal,e))}catch(e){Ye(e)||B(e=>e)}finally{t.signal.aborted||xe(!1)}})(),()=>{t.abort()}},[e,an]),(0,p.useEffect)(()=>{if(an!==`opencode`&&an!==`claude`){H(``),W(``),K([]);return}if(T){let t=pde({projectId:e,tool:an}),n=new Set(cn.map(e=>e.id)),r=t?.model??``,i=r&&(n.size===0||n.has(r));H(i?r:``),W(e=>i?t?.variant??e:``),K([]);return}H(x?.model??``),W(x?.variant??``),K(x?.skills??[])},[e,x?.id,x?.model,x?.skills,x?.variant,cn,an,T]),(0,p.useEffect)(()=>{if(T||!y){S(null);return}if(x?.id===y)return;S(null);let e=new AbortController;return mn(y,e.signal),()=>{e.abort()}},[x,y,T,mn]),(0,p.useEffect)(()=>{ut(!1)},[y,T]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||T||!y){ot([]),ct(!1);return}let e=new AbortController;return _n(y,e.signal),()=>{e.abort()}},[t?.memory_enabled,y,T,_n,dt]),(0,p.useEffect)(()=>{!lt||st||at.length>0||ut(!1)},[st,lt,at.length]),(0,p.useEffect)(()=>{let e=Xt.current,n=x?.id??null,r=x?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&ft(e=>e+1),Xt.current={id:n,status:r}},[t?.memory_enabled,x?.agent_status,x?.id]),(0,p.useEffect)(()=>{if(!y||x?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([pn(e.signal),mn(y,e.signal)])},tde);return()=>{e.abort(),window.clearInterval(t)}},[x?.agent_status,y,mn,pn]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(!T&&t.id===Rt.current&&(Bt.current+=1,S(t)),yn(t)&&hn(t))},n=t=>{!t||t.project_id!==e||Wn(t.id)},r=()=>{pn();let e=Rt.current;e&&!Vt.current&&mn(e)};return u.on(`connect`,r),u.on(`spec-session:created`,t),u.on(`spec-session:updated`,t),u.on(`spec-session:deleted`,n),()=>{u.off(`connect`,r),u.off(`spec-session:created`,t),u.off(`spec-session:updated`,t),u.off(`spec-session:deleted`,n)}},[e,T,mn,pn,yn,hn,Wn,u]),(0,p.useEffect)(()=>{if(!e||!un)return;let t=e=>{!e||e.spec_snapshot_id!==un||fn()};return u.on(`spec-review:updated`,t),()=>{u.off(`spec-review:updated`,t)}},[e,un,fn,u]);let ur=(0,p.useMemo)(()=>g5(_),[_]),dr=(0,p.useCallback)(e=>{e.key!==`Enter`||e.shiftKey||x?.agent_status===`running`||oe||ce||sn||Qt.current||$t.current||(e.preventDefault(),or())},[or,x?.agent_status,oe,ce,sn]),fr=(0,p.useCallback)(t=>{if(!e||an!==`opencode`&&an!==`claude`)return;let n=Array.from(t.clipboardData.files).filter(e=>e.type.startsWith(`image/`));n.length!==0&&(t.preventDefault(),sr(n))},[e,an,sr]),pr=(0,p.useMemo)(()=>y5(cn),[cn]),mr=(0,p.useMemo)(()=>x?x5({modelLabel:b5({availableModelsById:pr,model:x.model}),tool:x.tool}):null,[x,pr]),gr=(0,p.useMemo)(()=>x?.messages?x.messages.map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],responseTiming:e.response_timing?fq(e.response_timing):null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,created_at:e.created_at,displayTitle:e.role===`assistant`?mr??v5(x.tool):S5()})):[],[x,mr]),_r=y!==null||T,vr=T?null:x,yr=vr?.streaming_response??null,br=vr?.agent_status===`running`,xr=!!(ce&&Ee?.parentType===`spec`&&Ee.parentId===y),Sr=br||xr,Cr=Sr?mr:null,wr=ue!==null,Tr=!!e&&!oe&&(T||y!==null),Er=!!(t?.memory_enabled&&x&&!T&&(x.pending_memory_suggestion_count>0||st)),Dr=(an===`opencode`||an===`claude`)&&(T||y!==null)&&vr?.agent_status!==`running`,Or=(0,p.useMemo)(()=>{if(!x?.messages)return null;for(let e=x.messages.length-1;e>=0;--e){let t=x.messages[e];if(t.kind===`grill-question`)return t.id}return null},[x]),kr=(0,p.useMemo)(()=>!x||x.mode!==`grill`?!1:r7(x.messages,x.latest_snapshot_created_at),[x]),Ar=(0,p.useMemo)(()=>[...x?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[x]),jr=!!Ar,Mr=(0,p.useCallback)(async t=>{if(!e||!y||!x)return;le(!0),Yt.current+=1;let n={parentType:`spec`,parentId:y,turnKey:`spec:${Yt.current}`,startedAt:performance.now()};De(n);try{S(await YN(e,y,{instruction:t,tool:x.tool,model:cn.length>0&&V||null,variant:cn.length>0&&U||null,skills:z.length>0?G:[]})),Te(e=>e+1)}catch(e){De(e=>e?.turnKey===n.turnKey?null:e),Ye(e)||$.error(e instanceof Error?e.message:i7(`errors.sendPrompt`))}finally{le(!1)}},[e,y,x,cn,V,U,z,G]),Nr=(0,p.useCallback)(async(t,n)=>{if(!e||!x||C)return;let r=cY({parentType:`spec`,parentId:x.id,setId:n.set_id});w(n.set_id),le(!0),Yt.current+=1;let i={parentType:`spec`,parentId:x.id,turnKey:`spec:${Yt.current}`,startedAt:performance.now()};De(i);try{let r=await dre(e,x.id,t,n);S(r),hn(r)}catch(e){if(e instanceof Ge&&e.status===409){uY(r);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?(S(t),hn(t)):await mn(x.id)}throw De(e=>e?.turnKey===i.turnKey?null:e),$.error(e instanceof Error?e.message:i7(`errors.resolveQuestions`)),e}finally{w(null),le(!1)}},[e,x,mn,C,hn]),Pr=(0,p.useCallback)(e=>{if(e.role!==`assistant`)return;let t=e.metadata,n=t?.ask_question;if(n&&x)return(0,X.jsx)(_Y,{messageContent:e.content,questionSet:n,storageKey:cY({parentType:`spec`,parentId:x.id,setId:n.id}),isActive:n.status===`pending`&&Ar?.id===e.id,isDisabled:x.agent_status===`running`||C===n.id,onResolve:t=>Nr(e.id,t)});if(e.kind!==`grill-question`)return;let r=t?.grill_question;if(r)return(0,X.jsx)(Y5,{question:r,isActive:Sr?!1:e.id===Or&&x?.agent_status!==`running`&&x?.mode===`grill`,isDisabled:ce||oe||rt,labels:{rationaleLabel:i7(`grill.rationaleLabel`),suggestionsLabel:i7(`grill.suggestionsLabel`),recommendedSuggestionLabel:i7(`grill.recommendedSuggestionLabel`),answerPlaceholder:i7(`grill.answerPlaceholder`),submitLabel:i7(`grill.submitLabel`),submittingLabel:i7(`grill.submittingLabel`)},onSubmitAnswer:e=>{Mr(e)}})},[x,Sr,ce,oe,rt,Or,Ar?.id,Nr,C,Mr]),Fr=(an===`opencode`||an===`claude`)&&cn.length>0,Ir=an,Lr=T?i7(`composer.newSpecTitle`):x?.title??i7(`composer.specTitle`),Rr=Fr?V||null:x?.model??null,zr=b5({availableModelsById:pr,model:Rr}),Br=x?.agent_status===`stopped`,Vr=i7(`composer.placeholderSpec`),Hr=_.some(e=>e.agent_status!==`running`),Ur=(0,p.useMemo)(()=>({ariaLabel:i7(`sidebar.ariaLabel`),newSession:i7(`sidebar.newSession`),collapseAriaLabel:i7(`sidebar.collapseAriaLabel`),openAriaLabel:i7(`sidebar.openAriaLabel`),cancelSelection:i7(`sidebar.cancelSelection`),deleteSelected:i7(`sidebar.deleteSelected`),selectedCount:e=>`${e} selected`,select:i7(`sidebar.select`),loadingSessions:i7(`sidebar.loadingSessions`),noSessions:i7(`sidebar.noSessions`),deleteSessionAriaLabel:i7(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>i7(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>i7(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>i7(`sidebar.deleteSessionTitle`,{title:e})}),[]),Wr=(0,p.useMemo)(()=>({title:i7(`deleteModal.title`),bulkTitle:i7(`deleteModal.bulkTitle`),description:i7(`deleteModal.description`),bulkDescription:e=>i7(`deleteModal.bulkDescription`,{count:e}),cancel:i7(`deleteModal.cancel`),delete:i7(`deleteModal.delete`),deleting:i7(`deleteModal.deleting`)}),[]),Gr=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:!t&&Oe.has(e.id)?`finished`:null,[Oe]),Kr=(0,p.useCallback)(e=>e.agent_status===`running`?i7(`sidebar.cannotDeleteRunning`):null,[]),qr=!!(t?.memory_enabled&&y&&!T),Jr=(0,p.useCallback)(e=>{let t=qr&&e.pending_memory_suggestion_count>0?a7(e.pending_memory_suggestion_count):null,n=(e.linked_ticket_count??0)+(e.linked_chat_count??0);return n>0?[e.title,t,i7(`sidebar.linkedImplementationsAriaLabel`,{itemCount:n})].filter(Boolean).join(` `):e.has_completed_work===1?[e.title,t,i7(`sidebar.linkedImplementationsAriaLabelHistorical`)].filter(Boolean).join(` `):[e.title,t].filter(Boolean).join(` `)},[qr]),Yr=e=>{let t=e.first_user_message_preview??e.messages?.find(e=>e.role===`user`)?.content;return t&&t.replace(/\s+/g,` `).trim()||null},Xr=(0,p.useCallback)(({session:e,activityState:t})=>{let n=Yr(e),r=e.linked_ticket_count??0,i=e.linked_chat_count??0,a=r+i,o=e.has_completed_work===1||a>0,s=a>0,c=s?i7(`sidebar.linkedImplementationsTooltip`,{ticketCount:r,chatCount:i}):i7(`sidebar.linkedImplementationsTooltipHistorical`),l=qr&&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:[(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}),l?(0,X.jsx)(Rw,{tone:`muted`,className:`shrink-0`,"aria-label":a7(e.pending_memory_suggestion_count),title:a7(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null,o&&(0,X.jsx)(Ov,{content:c,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)(JF,{className:`size-3`}),s&&(0,X.jsx)(`span`,{children:a})]})})]}),n?(0,X.jsx)(`div`,{className:`mt-0.5 line-clamp-1 text-xs leading-4 text-muted-foreground`,children:n}):null]}),(0,X.jsx)(pb,{state:t,className:`mt-1`})]})},[qr]),Zr=br?(0,X.jsx)($8,{isInterrupting:wr,onStop:()=>{y&&En(y)},interruptLabel:i7(`composer.interrupt`),interruptingLabel:i7(`composer.interrupting`)}):null,Qr=(0,p.useMemo)(()=>cn.find(e=>e.id===V)??null,[cn,V]),$r=an===`opencode`||an===`claude`?be||ln?(0,X.jsx)(IY,{}):cn.length>0?(0,X.jsx)(LY,{model:V,variant:U,skills:G,showModelSelector:!0,showSkillsSelector:z.length>0,availableModels:cn,availableSkills:z,selectedModel:Qr,onModelChange:e=>{let t=cn.find(t=>t.id===e)??null;H(e),W(e=>t&&t.variants.includes(e)?e:``)},onVariantChange:W,onSkillsChange:K,modelSelectId:`spec-model-select`,variantSelectId:`spec-variant-select`,skillsSelectId:`spec-skills-select`}):null:null,ei=(0,p.useMemo)(()=>fe.length===1?_.find(e=>e.id===fe[0])?.title??``:``,[fe,_]),ti=(0,p.useMemo)(()=>_.filter(e=>fe.includes(e.id)),[_,fe]),ni=_r&&x!==null,ri=ni&&!Fe&&!Ve,ii=ni&&(Fe||Ve),ai=x?.tool??n,oi=ai===`opencode`&&cn.length>0,si=(0,p.useMemo)(()=>cn.find(e=>e.id===Ct)??null,[cn,Ct]),ci=Ae&&ni?{review:pt,isRunning:_t||yt,isLoading:ht,availableModels:cn,showModelSelector:oi,runConfigTool:ai,runConfigModel:Ct,runConfigVariant:Tt,selectedDiscoveredModel:si,onRunConfigModelChange:e=>{let t=cn.find(t=>t.id===e)??null;wt(e),Et(e=>t&&t.variants.includes(e)?e:``)},onRunConfigVariantChange:Et,onLaunchReview:()=>{er()},onStopReview:()=>{tr()},onSendToPlanner:()=>{nr()},isSendingToPlanner:xt}:void 0;(0,p.useEffect)(()=>{if(ai!==`opencode`){wt(``),Et(``);return}let t=hde({projectId:e,tool:ai}),n=new Set(cn.map(e=>e.id)),r=t?.model??``,i=!!r&&(n.size===0||n.has(r)),a=x?.model??``,o=i?r:a&&(n.size===0||n.has(a))?a:``;wt(o),Et(e=>o?i&&t?.variant?t.variant:e||(o===a?x?.variant??``:``):``)},[e,x?.model,x?.variant,cn,ai]),(0,p.useEffect)(()=>{ni||(At.current=null,jt.current=null,Nt.current=!1,Pt.current=!1,Be(!1),Ue(!1),jn())},[ni,jn]),(0,p.useEffect)(()=>()=>{jn()},[jn]);let li=(0,X.jsx)(Ov,{content:i7(`artifactPanel.open`),disabled:!ri,side:`left`,children:(0,X.jsx)(`div`,{ref:Ot,className:Z(ri?`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`,ze&&!ri&&`bg-background`),role:ri?`button`:`separator`,tabIndex:ri?0:void 0,"aria-label":i7(ri?`artifactPanel.open`:`artifactPanel.resize`),"aria-valuemin":ri?void 0:f7,"aria-valuemax":ri?void 0:Dt.current?Math.round(Dt.current.clientWidth*p7):800,"aria-valuenow":ri?void 0:Le,onClick:ri?()=>{if(Pt.current){Pt.current=!1;return}Ie(!0)}:void 0,onPointerDown:In,onPointerMove:Ln,onPointerUp:Rn,onPointerCancel:zn,onLostPointerCapture:Bn,children:ri?(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)(n7,{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)(n7,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:i7(`artifactPanel.title`)})]})]}):(0,X.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,ze?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})})}),ui=T&&$n?(0,X.jsx)(YY,{providers:Qn,onImported:Xn,inputId:`spec-draft-external-import`,className:`max-w-md`,showImportSpinner:!0,showImportErrorToast:!1}):null,di=x?x.mode===`grill`:tt,fi=kr;Qt.current=fi,$t.current=jr;let pi=(0,X.jsx)(X5,{on:di,disabled:rt||br||oe||ce||jr,tooltipContent:i7(`grill.toggleTooltip`),ariaLabelOn:i7(`grill.toggleAriaLabelOn`),ariaLabelOff:i7(`grill.toggleAriaLabelOff`),onToggle:e=>{ar(e)}}),mi=fde(rn),hi=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[mi?(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:i7(`importNotice.title`)}),(0,X.jsx)(`div`,{children:mi})]}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[pi,ui,Zr]})]}),gi=$r,_i=(0,p.useCallback)(t=>{x?Yn(v7({projectId:e,sessionId:x.id})):P(null),Gn(en,t)},[x,e,en,Gn,Yn]),vi=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Kue,{projectId:e,specSessionId:T?null:y,messages:gr,internalLog:vr?.agent_log??null,currentThinkingMessageId:vr?.agent_message_id??null,previousThinkingLog:vr?.previous_agent_log??null,previousThinkingMessageId:vr?.previous_agent_message_id??null,pendingAgentTitle:Cr,streamingResponse:yr,isRunning:Sr,isLoading:ie,canShowComposer:Tr,isExternallyResizing:ze,layoutKey:x?.id??`spec-draft`,scrollLayoutKey:ni?ii?`artifact-visible`:`artifact-hidden`:`artifact-disabled`,header:(0,X.jsx)(d5,{title:Lr,tool:T?null:x?.tool??null,modelLabel:zr,interrupted:Br,interruptedLabel:i7(`sidebar.interrupted`),usage:{totalTokens:x?.usage_snapshot_total_tokens??null,contextWindow:x?.usage_snapshot_context_window??null,cost:x?.usage_snapshot_cost??null,tool:Ir,model:Rr,availableModels:cn},metadataExtra:x?.external_source?(0,X.jsx)(sI,{externalSource:x.external_source}):null,actions:x&&e?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Er&&(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>ut(!0),children:st?i7(`composer.loadingMemory`):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:i7(`composer.memorySuggestions`)}),(0,X.jsx)(Rw,{children:at.length})]})}),(0,X.jsx)(L3,{projectId:e,scope:{type:`spec`,id:x.id},size:`xs`,onNavigateToLifecycleSource:l})]}):null}),composerControls:hi,composerInlineControls:gi,composerTheme:`default`,composerFocusNonce:we,pendingAgentRevealKey:Sr&&Ee?.parentId===y?Ee?.turnKey??null:null,pendingAgentRevealDelayMs:Sr&&Ee?.parentId===y?400:0,liveResponseTiming:Ee,followUpPrompt:nn,draftAttachments:on,followUpPlaceholder:Vr,emptyStateText:T?i7(`composer.describeFeature`):null,isSendingFollowUp:ce||oe,isComposerSubmitDisabled:fi||jr,isUploadingAttachments:sn,canAttachImages:Dr,followUpDisabledReason:vr?.agent_status===`running`?i7(`composer.waitTurn`):sn?i7(`composer.waitUpload`):fi?i7(`composer.waitGrill`):jr?vC.t(`common:questionSet.waitForResolution`):void 0,renderMessageBody:Pr,onFollowUpPromptChange:_i,onFollowUpKeyDown:dr,onFollowUpPaste:fr,onUploadAttachments:e=>{sr(e)},onRemoveAttachment:e=>{cr(e)},onFollowUpSubmit:()=>{or()}})}),yi=!_r&&ne&&!ee?(0,X.jsx)(Z8,{title:i7(`composer.noSessionSelectedTitle`),description:i7(`composer.noSessionSelectedDescription`),startNewSessionLabel:i7(`composer.startNewSession`),onStartNewSession:xn,canStartNewSession:!!e&&!oe&&!ce}):_r&&!T&&!ie&&!x?(0,X.jsx)(Y8,{label:i7(`composer.loadingSession`)}):!ne||ee?(0,X.jsx)(X8,{label:i7(`sidebar.loadingSessions`)}):vi,bi=lt&&e&&t?.memory_enabled?(0,X.jsx)(hC,{onClose:()=>ut(!1),overlayClassName:`bg-background/45 p-4 backdrop-blur-sm`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,X.jsxs)(bC,{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)(xC,{className:`border-b border-border/80 pb-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(SC,{children:i7(`composer.memorySuggestionsTitle`)}),(0,X.jsx)(CC,{children:i7(`composer.memorySuggestionsDescription`)})]}),(0,X.jsx)(wC,{children:t})]}),(0,X.jsx)(TC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,X.jsx)(f5,{projectId:e,suggestions:at,emptyState:i7(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:vn})})]}),closeButtonLabel:i7(`composer.closeMemorySuggestions`)}):null,xi=ti.length>0?(0,X.jsx)(J8,{count:ti.length,title:ei,isDeleting:me.size>0,onConfirm:()=>{Hn()},onCancel:()=>{me.size>0||pe([])},labels:Wr}):null,Si=$e===null?null:(0,X.jsx)(gC,{title:i7(`actions.exportConflictTitle`),description:i7(`actions.exportConflictDescription`,{path:$e.path}),confirmLabel:i7(`actions.exportConflictConfirm`),cancelLabel:i7(`actions.exportConflictCancel`),confirmVariant:`destructive`,onConfirm:()=>{et(null),An({projectId:$e.projectId,sessionId:$e.sessionId,snapshotId:$e.snapshotId,overwrite:!0})},onCancel:()=>{et(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)(Q8,{sessions:_,sessionGroups:ur,activeSessionId:y,isDraftOpen:T,isLoadingSessions:ee,isOpen:Se,onToggleOpen:()=>{Ce(t=>{let n=!t;return sde({projectId:e,isOpen:n}),n})},testId:`spec-sessions-sidebar`,railTestId:`spec-sessions-rail`,onDraftOpen:xn,isCreatingSession:oe||!e,isSendingPrompt:ce,newSessionShortcutHint:Cn,newSessionTooltip:wn,isSelectionMode:ge,selectedSessionIds:ve,selectedSessionCount:ve.size,hasDeletableSessions:Hr,deletingSessionIds:me,onEnterSelectionMode:()=>{_e(!0),ye(new Set)},onExitSelectionMode:()=>{_e(!1),ye(new Set)},onToggleSessionSelection:e=>{ye(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:lr,onConfirmDeleteSelectedSessions:()=>{pe(Array.from(ve))},onSessionSelect:e=>{Tn(e)},onConfirmDeleteSession:e=>{pe([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:Kr,getActivityState:Gr,getRowAriaLabel:Jr,renderRowContent:Xr,labels:Ur}),(0,X.jsxs)(`div`,{ref:Dt,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:yi}),ni?(0,X.jsxs)(X.Fragment,{children:[li,ii?(0,X.jsx)(ede,{snapshot:Ae,isLoading:q,desktopWidth:Le,onClose:Vn,ref:kt,actions:Ae?{onCreateTickets:On,onImplementInChat:()=>{kn()},onExport:()=>{An()},isCreatingTickets:We,isImplementingInChat:Je,isExporting:Xe,hasExistingTicketsFromSnapshot:Y}:void 0,review:ci}):null]}):null]}),bi,xi,Si]})},A7=()=>({hasRunning:!1,hasFinishedUnseen:!1,hasErrorUnseen:!1}),j7=()=>({board:A7(),chat:A7(),spec:A7(),memory:A7()}),M7=(e,t)=>{let n=e[t];return!n.hasFinishedUnseen&&!n.hasErrorUnseen?e:{...e,[t]:{...n,hasFinishedUnseen:!1,hasErrorUnseen:!1}}},yde=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}),N7=e=>e.hasErrorUnseen?`error`:e.hasRunning?`running`:e.hasFinishedUnseen?`finished`:null,bde=(e,t)=>t?null:N7(e),P7=320,xde=.7,Sde=28,Cde=6,wde=(e,t)=>{let n=Math.max(P7,Math.round(t*xde));return Math.max(P7,Math.min(n,Math.round(e)))},Tde=(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},Ede=(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},Dde=(e,t)=>{if(t.type===`reset`)return j7();if(t.type===`mark-workspace-visible`)return M7(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}},Ode=({activeProjectId:e,onActivity:t})=>{let{tickets:n}=R8(),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;n===`running`&&r===`done`&&(a=!0),n===`running`&&r===`error`&&(o=!0),i.set(t.id,r)}r.current=i,t({hasRunning:n.some(e=>e.agent_status===`running`),didFinish:a,didError:o})},[t,n]),null},kde=({activeProjectId:e,onActivity:t})=>{let n=Aq(),[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 LN(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=rx(()=>{document.visibilityState===`visible`&&LN(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=>Tde(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)e.title&&F8(`Chat response ready`,e.title);o.length>0&&e&&j6(e),t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:o.length>0,didError:s})},[e,t,r]),null},Ade=({activeProjectId:e,onActivity:t})=>{let n=Aq(),[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 KN(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=rx(()=>{document.visibilityState===`visible`&&KN(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=>Ede(e,t))},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)e.title&&F8(`Spec response ready`,e.title);t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:i.length>0,didError:o})},[e,t,r]),null},jde=({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,onRestoreChatSessionTarget:f,onChatReviewCapabilityChange:m,onPreviewReviewCapabilityChange:h,previewDisplayMode:g=`hidden`,previewPane:_=null,previewPaneWidth:v=480,isPreviewButtonDisabled:y=!1,previewButtonTitle:b,visibleWorkspace:x,onProjectUsageChange:S,onBundlesChange:C,onBundlesLoadingChange:w,onBoardLoadedProjectIdChange:T,onPreviewToggle:E,onPreviewPaneWidthChange:D,onRunStopped:O,onRunStatusChange:k,onWorkspaceActivityChange:A,onWorkspaceActivityEvent:j,pendingWorkspaceNavigation:M=null,onPendingWorkspaceNavigationConsumed:N,onSpecImplementationChatReady:P,onViewSourceSpec:F,onNavigateToLifecycleSource:I,onViewMemorySource:L,onStartChatFromBundle:R,refreshKey:z=0})=>{let B=(0,p.useRef)(null),V=(0,p.useRef)(null),H=(0,p.useRef)(null),U=(0,p.useRef)(null),W=(0,p.useRef)(!1),G=(0,p.useRef)(!1),K=(0,p.useRef)(0),ee=(0,p.useRef)(v),te=(0,p.useRef)(v),ne=x===`board`||x===`chat`,re=_!==null,[ie,ae]=(0,p.useState)(!1),[oe,se]=(0,p.useState)(!1),[ce,le]=(0,p.useState)(v),[ue,de]=(0,p.useReducer)(Dde,void 0,j7),fe=ne&&re&&g===`expanded`,pe=ne&&re&&g===`inline`,me=ne&&re&&g===`hidden`&&!oe,he=(pe||oe)&&!fe,ge=fe||he,_e=ne&&re&&!fe,ve=ie?ce:v,ye=x!==`chat`||!he,be=e=>{let t=H.current,n=U.current,r=W.current;if(t!==null){if(H.current=null,U.current=null,W.current=!1,ae(!1),se(!1),e!==null&&V.current?.hasPointerCapture(e)&&V.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;D?.(te.current),E?.();return}D?.(te.current)}},xe=e=>{if(!B.current)return;let t=B.current.getBoundingClientRect().width,n=wde(e,t);te.current=n,le(n)},Se=e=>{D&&(me&&y||(e.preventDefault(),H.current=e.pointerId,U.current=me?`collapsed`:`inline`,W.current=!1,G.current=!1,K.current=e.clientX,ee.current=me?0:te.current,ae(!me),e.currentTarget.setPointerCapture(e.pointerId)))},Ce=e=>{if(H.current!==e.pointerId)return;let t=e.clientX-K.current,n=ee.current-t;if(U.current===`collapsed`){if(!W.current&&n<Cde)return;W.current||(W.current=!0,G.current=!0,se(!0),ae(!0))}xe(n)},we=e=>{if(H.current===e.pointerId){if(U.current===`inline`||W.current){let t=e.clientX-K.current;xe(ee.current-t)}be(e.pointerId)}},Te=e=>{H.current===e.pointerId&&be(e.pointerId)},Ee=(0,p.useCallback)((e,t)=>{j?.(e,t),de({type:`update-workspace`,workspace:e,activity:t,visibleWorkspace:x})},[j,x]);(0,p.useEffect)(()=>{de({type:`reset`})},[e]),(0,p.useEffect)(()=>{x!==`memory`&&de({type:`mark-workspace-visible`,workspace:x})},[x]),(0,p.useEffect)(()=>{A?.(ue)},[A,ue]),(0,p.useEffect)(()=>{ie||(te.current=v),!re&&(H.current=null,U.current=null,W.current=!1,G.current=!1,te.current=v)},[re,ie,v]);let De=()=>{if(G.current){G.current=!1;return}y||E?.()};return(0,X.jsx)(Wle,{activeProjectId:e,refreshKey:z,onLoadedProjectIdChange:T,onProjectUsageChange:S,onBundlesChange:C,onBundlesLoadingChange:w,children:(0,X.jsxs)(`div`,{ref:B,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(Ode,{activeProjectId:e,onActivity:e=>{Ee(`board`,e)}}),(0,X.jsx)(kde,{activeProjectId:e,onActivity:e=>{Ee(`chat`,e)}}),(0,X.jsx)(Ade,{activeProjectId:e,onActivity:e=>{Ee(`spec`,e)}}),x===`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)(vde,{activeProjectId:e,activeProject:t,activeTool:d,initialSpecSessionId:M?.workspace===`spec`&&`specSessionId`in M?M.specSessionId:null,initialSpecSnapshotId:M?.workspace===`spec`&&`specSnapshotId`in M?M.specSnapshotId??null:null,initialIssueDraft:M?.workspace===`spec`&&`issueDraft`in M?M.draft:null,onInitialSpecNavigationConsumed:N,onInitialIssueDraftConsumed:N,onImplementInChat:P,onNavigateToLifecycleSource:I})}):x===`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)(Iue,{activeProject:t,onNavigateToSource:L})}):(0,X.jsxs)(`div`,{id:x===`chat`?`project-workspace-panel-chat`:`project-workspace-panel-board`,role:`tabpanel`,"aria-labelledby":x===`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:x===`chat`?(0,X.jsx)(Pue,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeTool:d,initialChatSessionId:M?.workspace===`chat`&&`chatSessionId`in M?M.chatSessionId:null,initialDraftOpen:M?.workspace===`chat`&&`startNewDraft`in M,onInitialDraftOpenConsumed:N,initialSpecDraft:M?.workspace===`chat`&&`draft`in M?{text:M.draftText,specSessionId:M.specSessionId,specSnapshotId:M.specSnapshotId}:null,onInitialSpecDraftConsumed:N,onInitialChatNavigationConsumed:N,onViewSourceSpec:F,onNavigateToLifecycleSource:I,isExternallyResizing:ie,onRestoreSessionTarget:f,onReviewCapabilityChange:m,showChangesPanel:ye}):(0,X.jsx)(Jle,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,activeRun:u,activeTool:d,onPreviewReviewCapabilityChange:h,onRunStopped:O,onRunStatusChange:k,onViewSourceSpec:F,onNavigateToLifecycleSource:I,onStartChatFromBundle:R,refreshKey:z,initialTicketId:M?.workspace===`board`&&`ticketId`in M?M.ticketId:null,onInitialTicketNavigationConsumed:N,initialImportedDraft:M?.workspace===`board`&&`issueDraft`in M?M.draft:null,onInitialImportedDraftConsumed:N})}),[_e?(0,X.jsx)(Ov,{content:y?b??`Preview unavailable`:`Open preview`,disabled:!me,side:`left`,children:(0,X.jsx)(`div`,{"aria-label":me?b??`Show preview`:`Resize preview pane`,"aria-orientation":me?void 0:`vertical`,className:me?`group flex shrink-0 touch-none select-none items-center justify-center border-l border-border/70 bg-background/90 transition-colors ${y?`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 ${ie?`bg-background`:``}`,"data-preview-divider":`true`,"data-testid":me?`collapsed-preview-rail`:void 0,onLostPointerCapture:Te,onPointerCancel:we,onPointerDown:Se,onPointerMove:Ce,onPointerUp:we,onClick:me?De:void 0,onKeyDown:me?e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),De())}:void 0,ref:V,role:me?`button`:`separator`,style:me?{width:`${Sde}px`}:void 0,tabIndex:me?y?-1:0:void 0,children:me?(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)(Fue,{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 ${ie?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`}`})})},`preview-divider`):null,ge?(0,X.jsx)(`div`,{className:fe?`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:fe?void 0:{width:`${ve}px`},children:(0,X.jsx)(`div`,{className:`h-full w-full`,children:_})},`preview-container`):null]]})]})})},Mde=({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)(b3,{createSession:()=>gae(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})}),Nde=({activeWorkspace:e,activityByWorkspace:t,className:n,memoryEnabled:r=!1,onWorkspaceChange:i})=>{let{t:a}=He(`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=bde(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)(pb,{state:a,className:`mt-0`})]})},n)})})})},F7=32,Pde=5.5,Fde=2,Ide=24,Lde=8,I7=new Map,Rde={running:{fill:`#fcd34d`,stroke:`#f59e0b`},finished:{fill:`#34d399`,stroke:`#059669`},error:{fill:`#fb7185`,stroke:`#e11d48`}},L7=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),R7=e=>{if(!e)return null;let t=e.trim().match(/^([0-9]+(?:\.[0-9]+)?)/);return t?Number(t[1]):null},z7=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=R7(n.getAttribute(`width`)),a=R7(n.getAttribute(`height`)),o=r??(i&&a?`0 0 ${i} ${a}`:`0 0 ${F7} ${F7}`);return`<svg ${[Array.from(n.attributes).filter(e=>![`width`,`height`,`viewBox`,`x`,`y`,`preserveAspectRatio`].includes(e.name)).map(e=>`${e.name}="${L7(e.value)}"`).join(` `),`x="0"`,`y="0"`,`width="${F7}"`,`height="${F7}"`,`viewBox="${L7(o)}"`,`preserveAspectRatio="xMidYMid meet"`].filter(e=>e.length>0).join(` `)}>${n.innerHTML}</svg>`},zde=async e=>{if(!e)return null;let t=I7.get(e);if(t)return t;let n=(async()=>{try{if(e.startsWith(`data:image/svg+xml,`))return z7(decodeURIComponent(e.slice(19)));if(e.startsWith(`data:image/svg+xml;base64,`))return z7(atob(e.slice(26)));let t=await fetch(e);return t.ok?z7(await t.text()):null}catch{return null}})();return I7.set(e,n),n},Bde=async(e,t)=>{let{fill:n,stroke:r}=Rde[e],i=await zde(t);return i?[`<svg xmlns="http://www.w3.org/2000/svg" width="${F7}" height="${F7}" viewBox="0 0 ${F7} ${F7}">`,i,`<circle cx="${Ide}" cy="${Lde}" r="${Pde}" fill="${n}" stroke="${r}" stroke-width="${Fde}"/>`,`</svg>`].join(``):null},Vde=async(e,t)=>{if(!e)return t;let n=await Bde(e,t);return n?`data:image/svg+xml,${encodeURIComponent(n)}`:t},Hde=()=>{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},B7=({defaultHref:e,state:t})=>{let n=Hde(),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}Vde(t,e).then(e=>{if(n.dataset.browserTabActivityRequestId===String(r)){if(e){n.href=e;return}n.removeAttribute(`href`)}})},V7=(e,t)=>vC.t(`common:projectFooter.${e}`,t),Ude=1e3,H7=`archon.active-project-id`,U7=`archon.workspace-by-project`,W7=`archon.preview-mode-by-project`,G7=`archon.dismissed-preview-run-context-by-project`,K7=5e3,q7=`archon.preview-pane-width`,J7=`archon.preview-viewport-preset`,Y7=`archon.preview-zoom`,Wde=480,Gde=`responsive`,Kde=1,X7={hasMounted:!1,isOpen:!1,isExpanded:!1},Z7=`hidden`,qde=(0,p.lazy)(()=>kG(()=>Promise.resolve().then(()=>s8).then(e=>({default:e.WorkspaceReviewModal})),void 0)),Jde=(0,p.lazy)(()=>kG(()=>import(`./VerificationDialog-BgEDRfgP.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),Yde=(0,p.lazy)(()=>kG(()=>import(`./GitHubActionsDialog-Ckb99-ve.js`).then(e=>({default:e.GitHubActionsDialog})),__vite__mapDeps([20,3]))),Xde=(0,p.lazy)(()=>kG(()=>import(`./ActivityView-CF8punHV.js`).then(e=>({default:e.ActivityView})),[])),Q7=e=>{if(!e)return null;try{return JSON.parse(e)}catch{return null}},$7=e=>{let t=Q7(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]},e9=e=>{let t=Q7(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}]}):[]},Zde=e=>{let t=Q7(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}]}):[]},Qde=e=>{let t=new Set(lw(e)),n=new Set(uw(e)),r=new Set(jne(e));return{name:e.name,repoPath:e.repo_path,linkedProjectIds:e.linked_project_ids,runSetup:$7(e.run_setup),runServices:e9(e.run_services),checkDefinitions:cw(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`,required:t.has(e.id),preReview:t.has(e.id)&&n.has(e.id),postBuild:r.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_model??``,helperVariant:e.helper_variant??``,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:Zde(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}},t9=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,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),runner:e.runner}:{id:e.id,name:e.name,category:e.category,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs)}),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)),run_ide:e.runIde||null,preview_service_name:t,preview_path:r,preview_capability_mode:i,helper_model:e.helperModel||null,helper_variant:e.helperModel&&e.helperVariant||null,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}},$de=e=>e?$7(e.run_setup).length>0||e9(e.run_services).length>0||(e.run_ide?.trim().length??0)>0:!1,n9=(e,t,n)=>`${e} ${e===1?t:n}`,efe=e=>{if(!e.repo_path_locked)return null;let t=[];return e.ticket_count>0&&t.push(n9(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&t.push(n9(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 `)}.`},tfe=(e,t)=>{if(t.length<=1)return`Keep at least one project in Archon.`;let n=[];e.ticket_count>0&&n.push(n9(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&n.push(n9(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(n9(r,`project links to it`,`projects link to it`)),n.length===0?null:`This project can't be deleted while ${n.join(` and `)}.`},nfe=(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},rfe=(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}),r9=e=>({projectId:e,branch:null,status:`loading`,ahead:0,behind:0,hasUpstream:!1,canPull:!1,diffStats:null}),i9=(e,t)=>t?e[t]??X7:X7,a9=(e,t)=>t?e[t]??Z7:Z7,ife=()=>{let e=window.localStorage.getItem(q7),t=Number(e);return Number.isFinite(t)&&t>=320?t:Wde},afe=()=>{let e=window.localStorage.getItem(J7);return e===`phone`||e===`tablet`||e===`laptop`||e===`responsive`?e:Gde},ofe=()=>{let e=Number(window.localStorage.getItem(Y7));return Number.isFinite(e)&&e>0?e:Kde},sfe=()=>{let e=Q7(window.localStorage.getItem(U7));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]]:[]))},cfe=()=>{let e=Q7(window.localStorage.getItem(W7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>e===`hidden`||e===`inline`||e===`expanded`))},lfe=()=>{let e=Q7(window.localStorage.getItem(G7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`||e===null))},o9=e=>!!e?.preview_service_name?.trim()&&e?.preview_capability_mode!==`force_disabled`,ufe=({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)},dfe=({activeRun:e,project:t,projectId:n})=>!e||!n?null:e.kind===`ticket`?e.project_id===n?e:null:ufe({activeRun:e,project:t})?e:null,s9=`Project root has uncommitted changes. Confirm branch switch to continue.`,ffe=({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,pfe=()=>{let[e,t]=(0,p.useState)(`opencode`),[n,r]=(0,p.useState)(!1),[i,a]=(0,p.useState)([]),[o,s]=(0,p.useState)(()=>window.localStorage.getItem(H7)),[c,l]=(0,p.useState)(null),[u,d]=(0,p.useState)(null),[f,m]=(0,p.useState)(null),[h,g]=(0,p.useState)({}),[_,v]=(0,p.useState)({}),[y,b]=(0,p.useState)({}),[x,S]=(0,p.useState)({}),[C,w]=(0,p.useState)({}),[T,E]=(0,p.useState)(cfe),[D,O]=(0,p.useState)(lfe),[k,A]=(0,p.useState)(ife),[j,M]=(0,p.useState)(afe),[N,P]=(0,p.useState)(ofe),[F,I]=(0,p.useState)(null),[L,R]=(0,p.useState)([]),[z,B]=(0,p.useState)(!1),[V,H]=(0,p.useState)(``),[U,W]=(0,p.useState)(``),[G,K]=(0,p.useState)(!1),[ee,te]=(0,p.useState)(null),[ne,re]=(0,p.useState)(null),[ie,ae]=(0,p.useState)(null),[oe,se]=(0,p.useState)(!1),[ce,le]=(0,p.useState)({}),[ue,de]=(0,p.useState)(sfe),[fe,pe]=(0,p.useState)(null),[me,he]=(0,p.useState)(()=>j7()),[ge,_e]=(0,p.useState)(()=>A7()),[ve,ye]=(0,p.useState)(0),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)(null),[we,Te]=(0,p.useState)({}),[Ee,De]=(0,p.useState)({}),[Oe,ke]=(0,p.useState)({}),[Ae,je]=(0,p.useState)({}),[Me,Ne]=(0,p.useState)(!1),[q,Pe]=(0,p.useState)(!1),[Fe,Ie]=(0,p.useState)(!1),[Le,Re]=(0,p.useState)(!1),[ze,Be]=(0,p.useState)(!1),{isGitHubConnected:Ve,defaultBaseBranch:He}=QC(o),[Ue,We]=(0,p.useState)(null),Ke=(0,p.useRef)(null),qe=(0,p.useRef)(null),Je=(0,p.useRef)(null),J=i.find(e=>e.id===o)??null,Xe=!!J?.memory_enabled,Ze=o?ue[o]??`board`:`board`,Y=Ze===`memory`?Xe?`memory`:`board`:Ze,Qe=(0,p.useCallback)(e=>{o&&(de(t=>({...t,[o]:e.workspace})),he(t=>M7(t,e.workspace)),pe(e))},[o]),$e=(0,p.useCallback)((e,t,n)=>{o&&Qe({workspace:`chat`,draft:!0,draftText:e,specSessionId:t,specSnapshotId:n})},[o,Qe]),et=(0,p.useCallback)((e,t)=>{Qe({workspace:`spec`,specSessionId:e,specSnapshotId:t})},[Qe]),tt=(0,p.useCallback)(e=>{if(e.source_available){if(e.ticket_id){Qe({workspace:`board`,ticketId:e.ticket_id});return}if(e.chat_session_id){Qe({workspace:`chat`,chatSessionId:e.chat_session_id});return}e.spec_session_id&&Qe({workspace:`spec`,specSessionId:e.spec_session_id})}},[Qe]),nt=(0,p.useCallback)(e=>{if(e.available){if(e.kind===`ticket`){Qe({workspace:`board`,ticketId:e.id});return}if(e.kind===`chat_session`){Qe({workspace:`chat`,chatSessionId:e.id});return}e.kind===`spec_session`&&Qe({workspace:`spec`,specSessionId:e.id})}},[Qe]),it=(0,p.useCallback)(e=>{Qe({workspace:`spec`,issueDraft:!0,draft:e})},[Qe]),at=(0,p.useCallback)(e=>{Qe({workspace:`board`,issueDraft:!0,draft:e})},[Qe]),ot=(0,p.useCallback)(()=>{pe(null)},[]),st=J!==null,ct=$de(J),lt=!!J?.run_ide?.trim(),ut=o!==null&&u===o,dt=o!==null&&(!ct||f===o),ft=o?h[o]??r9(o):null,pt=o?_[o]??null:null,mt=o?!!y[o]:!1,gt=o?x[o]??null:null,_t=(0,p.useMemo)(()=>o?we[o]??[]:[],[o,we]),vt=o?!!Ee[o]:!1,yt=o?Oe[o]??{current_branch:null,default_branch:null,previous_branch:null}:{current_branch:null,default_branch:null,previous_branch:null},bt=o?!!Ae[o]:!1,xt=o?C[o]??null:null,St=a9(T,o),Ct=St!==`hidden`,wt=dfe({activeRun:c,project:J,projectId:o}),Tt=wt?.context_key??null,Et=o?D[o]??null:null,Dt=o9(J),Ot=Tt===F,kt=(0,p.useMemo)(()=>yde(me),[me]),At=(0,p.useMemo)(()=>N7({hasRunning:kt.hasRunning,hasFinishedUnseen:ge.hasFinishedUnseen,hasErrorUnseen:ge.hasErrorUnseen}),[kt.hasRunning,ge.hasErrorUnseen,ge.hasFinishedUnseen]);(0,p.useEffect)(()=>{xe(null),Ce(null),qe.current=null},[o]),(0,p.useEffect)(()=>{Ce(null)},[Y]),(0,p.useEffect)(()=>{Ct||(qe.current=null)},[Ct]),(0,p.useEffect)(()=>{let e=be?.target?.kind??null;if(e===`ticket`||e===`bundle`){qe.current=be;return}(Y===`board`||!Ct)&&(qe.current=be)},[Ct,be,Y]),(0,p.useEffect)(()=>{he(j7())},[o]),(0,p.useEffect)(()=>{_e(A7())},[o]),(0,p.useEffect)(()=>{if(!o||lx(o))return;let e=new AbortController;return rt(o,e.signal).then(e=>{cx(o,e.connections)}).catch(e=>{Ye(e)}),()=>{e.abort()}},[o]);let jt=(0,p.useCallback)((e,t)=>{document.visibilityState!==`visible`&&(!t.didFinish&&!t.didError||_e(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`&&_e(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)(()=>(Ke.current===null&&(Ke.current=document.querySelector(`link[rel="icon"]`)?.getAttribute(`href`)??`/favicon.svg`),B7({defaultHref:Ke.current,state:At}),()=>{B7({defaultHref:Ke.current,state:null})}),[At]);let Nt=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r}=t;try{let t=await zn(e,r,{refreshRemote:n});if(r?.aborted)return;g(n=>({...n,[e]:rfe(e,t)}))}catch(t){if(Ye(t))return;if(t instanceof Ge&&t.status===404){g(t=>({...t,[e]:{...r9(e),status:`unknown`}}));return}g(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}}))}},[]),Pt=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r,suppressLoading:i=!1}=t;i||b(t=>({...t,[e]:!0}));try{let t=await Xn(e,{refreshRemote:n,signal:r});if(r?.aborted)return;v(n=>({...n,[e]:t}))}catch(t){if(Ye(t))return;t instanceof Ge&&t.status===404&&v(t=>({...t,[e]:null}))}finally{!r?.aborted&&!i&&b(t=>({...t,[e]:!1}))}},[]),Ft=(0,p.useCallback)((e,t)=>{S(n=>({...n,[e]:t}))},[]),Lt=(0,p.useCallback)(async(e,t)=>{v(n=>({...n,[e.id]:t})),e.active_target_kind!==`bundle`&&await Nt(e.id),j6(e.id)},[Nt]);(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let{tool:n}=await wr(e.signal);t(n)}catch(e){Ye(e)}finally{e.signal.aborted||r(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!G||i.length>0&&ee===null||z)return;let e=new AbortController;return(async()=>{try{R(await Cr(`opencode`,e.signal))}catch(e){Ye(e)||R(e=>e)}finally{e.signal.aborted||B(!0)}})(),()=>{e.abort()}},[z,ee,i.length,G]),(0,p.useEffect)(()=>{let e=new AbortController,t=window.localStorage.getItem(H7);return(async()=>{try{let n=await Dn(e.signal);if(e.signal.aborted)return;a(n);let r=n[0]?.id??null;s(n.some(e=>e.id===t)?t:r)}catch(e){Ye(e)||a([])}finally{e.signal.aborted||K(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(Be(!1),!o||!Ve||Le)return;let e=new AbortController,t=async()=>{try{let t=await Vt(o,e.signal);e.signal.aborted||Be(t.activeCount>0)}catch(e){Ye(e)}};t();let n=window.setInterval(()=>{t()},K7);return()=>{e.abort(),window.clearInterval(n)}},[o,Le,Ve]),(0,p.useEffect)(()=>{if(G){if(o){window.localStorage.setItem(H7,o);return}window.localStorage.removeItem(H7)}},[o,G]),(0,p.useEffect)(()=>{window.localStorage.setItem(U7,JSON.stringify(ue))},[ue]),(0,p.useEffect)(()=>{window.localStorage.setItem(W7,JSON.stringify(T))},[T]),(0,p.useEffect)(()=>{window.localStorage.setItem(G7,JSON.stringify(D))},[D]),(0,p.useEffect)(()=>{g(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),v(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),b(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[i]),(0,p.useEffect)(()=>{le(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[i]),(0,p.useEffect)(()=>{let e=new Set(i.map(e=>e.id));Te(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),De(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),ke(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),je(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t))))},[i]),(0,p.useEffect)(()=>{G&&(w(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),E(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),O(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}))},[i,G]),(0,p.useEffect)(()=>{G&&de(e=>{let t=new Set(i.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[i,G]),(0,p.useEffect)(()=>{if(!G||!o||!st)return;let e=!1,t=null,n=null;g(e=>e[o]?e:{...e,[o]:r9(o)});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([Nt(o,{refreshRemote:r,signal:a.signal}),Pt(o,{refreshRemote:r,signal:a.signal})])}catch{if(e||a.signal.aborted)return}finally{t===a&&(t=null,n=null)}};r(!1);let i=rx(()=>{document.visibilityState===`visible`&&r(!1)});return()=>{e=!0,t?.abort(),i()}},[o,st,G,Nt,Pt]),(0,p.useEffect)(()=>{if(o)return M6(e=>{e===o&&(Nt(e),Pt(e))})},[o,Nt,Pt]),(0,p.useEffect)(()=>{if(!o||!st)return;let e=pt?.operation_state??`idle`;if(!(gt===`rebase`||e!==`idle`))return;let t=!1,n=null,r=null,i=async()=>{r?.abort(),r=new AbortController;try{await Pt(o,{signal:r.signal,suppressLoading:!0})}catch{}finally{t||(n=window.setTimeout(()=>{i()},Ude))}};return i(),()=>{t=!0,r?.abort(),n!==null&&window.clearTimeout(n)}},[gt,o,pt?.operation_state,st,Pt]);let Rt=(0,p.useCallback)(async e=>{let t=o;if(!t){l(null),m(null);return}try{let n=await Ht(t,e);e?.aborted||(l(n.active_run),m(t))}catch(e){Ye(e)}},[o]),zt=(0,p.useCallback)(async e=>{let t=o;if(t)try{let n=await It(t,e);e?.aborted||w(e=>({...e,[t]:n}))}catch(e){Ye(e)}},[o]);(0,p.useEffect)(()=>{if(!G)return;if(!ct){l(null),m(null);return}if(!ut)return;let e=new AbortController;m(null),Rt(e.signal);let t=window.setInterval(()=>{Rt(e.signal)},K7),n=rx(()=>{document.visibilityState===`visible`&&Rt(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[ut,ct,G,Rt]),(0,p.useEffect)(()=>{if(!G||!o||!ut||!Dt)return;let e=new AbortController;zt(e.signal);let t=window.setInterval(()=>{zt(e.signal)},K7),n=rx(()=>{document.visibilityState===`visible`&&zt(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[o,ut,Dt,G,zt]),(0,p.useEffect)(()=>{window.localStorage.setItem(q7,String(k))},[k]),(0,p.useEffect)(()=>{window.localStorage.setItem(J7,j)},[j]),(0,p.useEffect)(()=>{window.localStorage.setItem(Y7,String(N))},[N]),(0,p.useEffect)(()=>{o&&Tt&&O(e=>{let t=e[o]??null;return!t||t===Tt?e:{...e,[o]:null}})},[o,Tt]),(0,p.useEffect)(()=>{!o||!wt||!o9(J)||Et!==wt.context_key&&E(e=>a9(e,o)===`hidden`?{...e,[o]:`inline`}:e)},[J,o,Et,wt]);let Bt=async e=>{try{t((await Tr(e)).tool)}catch{}},Gt=(0,p.useCallback)(e=>{a(t=>t.map(t=>t.id===e.id?e:t))},[]),Kt=(0,p.useCallback)((e,t)=>{Te(n=>{let r=[t,...(n[e]??[]).filter(e=>e.id!==t.id)];return{...n,[e]:r}})},[]),qt=(0,p.useCallback)(async e=>{je(t=>({...t,[e]:!0}));try{let t=await Nn(e);ke(n=>({...n,[e]:t}))}catch(e){$.error(e instanceof Ge?e.message:`Unable to load the project target options right now.`,{id:`project-target-selector-load-error`})}finally{je(t=>({...t,[e]:!1}))}},[]),Jt=async e=>{try{let t=await On(t9(e));return a(e=>[...e,t]),s(t.id),te(null),null}catch(e){return e instanceof Ge?e.message:`Unable to create the project right now.`}},Yt=async e=>{if(!J)return`Select a project before editing settings.`;try{let t=await kn(J.id,t9(e));return a(e=>e.map(e=>e.id===t.id?t:e)),ye(e=>e+1),te(null),null}catch(e){return e instanceof Ge?e.message:`Unable to update the project right now.`}},Xt=async()=>{if(!J)return`Select a project before deleting it.`;try{await jn(J.id);let e=i.filter(e=>e.id!==J.id);return a(e),s(e[0]?.id??null),te(null),null}catch(e){return e instanceof Ge?e.message:`Unable to delete the project right now.`}},Zt=(0,p.useCallback)(e=>{a(t=>t.map(t=>nfe(t,e)))},[]),Qt=(0,p.useCallback)((e,t)=>{e&&Te(n=>({...n,[e]:t}))},[]),$t=(0,p.useCallback)((e,t)=>{e&&De(n=>({...n,[e]:t}))},[]),en=async(e,t,n)=>await Fn({repo_path:e,helper_model:t||null,helper_variant:t&&n||null}),tn=async()=>(await In()).repo_path,nn=(0,p.useCallback)(async e=>{let t=await Ln({repo_path:e});return{valid:t.valid,repoRoot:t.repo_root,error:t.error,willInitialize:t.will_initialize,hasInitialCommit:t.has_initial_commit}},[]),rn=(0,p.useCallback)(async()=>{if(!(!J||oe)){se(!0);try{let e=await An(J.id);a(t=>t.map(t=>t.id===e.id?e:t)),$.success(`Initial commit created.`,{id:`project-initial-commit-success`}),Nt(e.id),Pt(e.id)}catch(e){$.error(e instanceof Ge?e.message:`Unable to create the initial commit right now.`,{id:`project-initial-commit-error`})}finally{se(!1)}}},[J,oe,Nt,Pt]),an=(0,p.useCallback)((e,t)=>{E(t=>({...t,[e]:`hidden`})),t&&O(n=>({...n,[e]:t}))},[]),on=(0,p.useCallback)(()=>{o&&an(o,Tt)},[o,an,Tt]),sn=(0,p.useCallback)(e=>{o&&(E(e=>({...e,[o]:`hidden`})),e&&l(t=>t?.context_key===e?null:t))},[o]),cn=(0,p.useCallback)(async()=>{if(!wt||F===wt.context_key)return;let{context_key:e}=wt;I(e);try{wt.kind===`ticket`?await gn(wt.ticket_id,wt.project_id):l((await Wt(wt.project_id)).active_run),sn(e),await Promise.all([Rt(),zt()])}catch(e){$.error(e instanceof Ge?e.message:`Unable to stop the preview run right now.`,{id:`app-preview-run-stop-error`})}finally{I(t=>t===e?null:t)}},[sn,wt,zt,Rt,F]),ln=(0,p.useCallback)(e=>{!e||!o||qt(o)},[o,qt]),un=(0,p.useCallback)(e=>new Promise(t=>{Je.current=t,We(e)}),[]),dn=(0,p.useCallback)(e=>{let t=Je.current;Je.current=null,We(null),t?.(e)},[]),fn=(0,p.useCallback)(async e=>{if(!J||!o)throw Error(`Select a project first.`);if(!ffe({activeProject:J,activeProjectBranchState:ft,nextTarget:e})||!c||c.kind!==`project`||c.project_id!==J.id)return!0;if(!await un({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=c.context_key,t=await Wt(J.id);return sn(e),l(t.active_run),await zt(),!0}catch(e){return $.error(e instanceof Ge?e.message:`Unable to stop the project run right now.`,{id:`project-target-switch-stop-run-error`}),!1}},[J,ft,o,c,sn,zt,un]),pn=(0,p.useCallback)(async e=>{if(!o)throw Error(`Select a project first.`);return await fn({kind:`bundle`,bundleId:e})?(Gt(await Pn(o,{kind:`bundle`,bundle_id:e})),v(e=>({...e,[o]:null})),await Promise.all([Nt(o),Pt(o)]),!0):!1},[o,fn,Nt,Pt,Gt]),mn=(0,p.useCallback)(async(e,t={})=>{if(!o)throw Error(`Select a project first.`);if(!await fn({kind:`repo_root`,branch:e}))return!1;let n=n=>Pn(o,{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 Ge&&e.status===409&&e.message===s9){if(!await un({title:`Switch repo root branch?`,description:`${s9}\n\nSwitch anyway?`,confirmLabel:`Switch anyway`,cancelLabel:`Keep current branch`}))return!1;r=await n(!0)}else throw e}return Gt(r),v(e=>({...e,[o]:null})),await Promise.all([Nt(o),Pt(o),qt(o)]),!0},[o,fn,qt,Nt,Pt,Gt,un]),hn=(0,p.useCallback)(async e=>!e.target_kind||e.target_available===!1?!0:e.target_kind===`bundle`?e.target_bundle_id?await pn(e.target_bundle_id):!1:await mn(e.target_branch_snapshot??null,{createBranch:!1}),[pn,mn]),_n=(0,p.useCallback)(async e=>{o&&await pn(e)&&Qe({workspace:`chat`,startNewDraft:!0})},[o,pn,Qe]),vn=(0,p.useCallback)(()=>{Ne(!0)},[]),yn=(0,p.useCallback)(()=>{Ne(!1)},[]),bn=(0,p.useCallback)(e=>{if(e){pn(e);return}mn(null)},[pn,mn]),xn=(0,p.useCallback)(async e=>{if(!o)throw Error(`Select a project first.`);let t=await ht(o,{name:e,prepare:!0});return Kt(o,t),ye(e=>e+1),t},[o,Kt]),Sn=(0,p.useCallback)(async e=>{if(!o)throw Error(`Select a project first.`);await Mt(o,e),Te(t=>({...t,[o]:(t[o]??[]).filter(t=>t.id!==e)})),ye(e=>e+1)},[o]),Cn=(0,p.useCallback)(async()=>{if(!J)return;let e=J.active_target_kind??`repo_root`,t=J.active_target_bundle_id??null,n=c?.kind===`project`&&c.project_id===J.id&&(c.target_kind??`repo_root`)===e&&((c.target_kind??`repo_root`)!==`bundle`||c.target_bundle_id===t),r=n?c?.context_key??null:null,i=!n&&o9(J)&&St===`hidden`;i&&(E(e=>({...e,[J.id]:`inline`})),O(e=>({...e,[J.id]:null})));try{let e=n?await Wt(J.id):await Ut(J.id);n&&sn(r),l(e.active_run),zt()}catch(e){i&&E(e=>({...e,[J.id]:`hidden`})),$.error(e instanceof Ge?e.message:`Unable to update the project run right now.`,{id:`app-project-run-error`})}},[St,J,c,sn,zt]),wn=(0,p.useCallback)(async()=>{if(!(!J||!lt))try{await Mn(J.id)}catch(e){$.error(e instanceof Error?e.message:`Unable to open the IDE right now.`,{id:`app-project-open-ide-error`})}},[J,lt]),Tn=(0,p.useCallback)(async()=>{if(J){Ft(J.id,`pull`);try{let e=await Bn(J.id);await Lt(J,e),$.success(e.behind===0?V7(`branchSynced`):V7(`branchUpdated`),{id:`app-project-pull-success`})}catch(e){$.error(e instanceof Ge?e.message:V7(`syncFallbackError`),{id:`app-project-pull-error`})}finally{Ft(J.id,null)}}},[J,Lt,Ft]),En=(0,p.useCallback)(async()=>{if(!J)return;let e=pt?.base_branch??null;Ft(J.id,`rebase`);try{let t=await Vn(J.id);await Lt(J,t);let n=t.base_branch??e;$.success(n?V7(`branchRebasedOnto`,{branch:n}):V7(`branchRebased`),{id:`app-project-rebase-success`})}catch(e){await Promise.allSettled([Nt(J.id),Pt(J.id,{suppressLoading:!0})]),$.error(e instanceof Ge?e.message:V7(`rebaseFallbackError`),{id:`app-project-rebase-error`})}finally{Ft(J.id,null)}},[J,pt?.base_branch,Lt,Nt,Pt,Ft]),Rn=(0,p.useCallback)(async()=>{if(J){Ft(J.id,`abort`);try{await Lt(J,await Hn(J.id)),$.success(V7(`gitOperationAborted`),{id:`app-project-abort-success`})}catch(e){$.error(e instanceof Ge?e.message:V7(`abortFallbackError`),{id:`app-project-abort-error`})}finally{Ft(J.id,null)}}},[J,Lt,Ft]),Un=(0,p.useCallback)(e=>{if(!J)return;let t=J.active_target_kind??`repo_root`,n=J.active_target_bundle_id??null,r=t===`bundle`?_t.find(e=>e.id===n):null;re({projectId:J.id,title:J.name,initialMode:e,targetKind:t,targetBundleId:n,bundleTargetName:r&&rb(r)||null,hasHelperModel:!!J.helper_model,repoRootDefaultBranch:yt.default_branch})},[J,yt.default_branch,_t]),Wn=(0,p.useCallback)(()=>{if(!ne)return;let{projectId:e}=ne;re(null),Nt(e),Pt(e)},[Nt,Pt,ne]),Gn=(0,p.useCallback)(()=>{if(!J)return;let e=J.active_target_kind??`repo_root`,t=J.active_target_bundle_id??null,n=e===`bundle`?_t.find(e=>e.id===t):null,r=n?.required_check_policy;ae({projectId:J.id,targetKind:e,targetBundleId:t,targetLabel:n?rb(n):J.name,definitions:cw(J),requiredDefinitionIds:r?.required_check_definition_ids??lw(J),preReviewDefinitionIds:r?.pre_review_check_definition_ids??uw(J)})},[J,_t]),Kn=(0,p.useCallback)(()=>{ae(null)},[]),qn=i9(ce,o),Jn=J?fw(J).length>0:!1,Yn=J?cw(J).length>0:!1,Zn=Y===`chat`?Se:null,Qn=qe.current,$n=Qn?.target?.kind??null,er=Y===`chat`?$n===`ticket`||$n===`bundle`?{target:Qn?.target??null,canSelect:!1,disabledReason:`This preview belongs to a ticket run. Return to Board to send preview comments.`,promptMode:Qn?.promptMode??null,onPromptModeChange:Qn?.onPromptModeChange??null,isUpdatingPromptMode:Qn?.isUpdatingPromptMode??!1,promptPlaceholder:Qn?.promptPlaceholder??null,promptComposerControls:Qn?.promptComposerControls,promptComposerInlineControls:Qn?.promptComposerInlineControls,submitPrompt:null}:Zn?{target:{kind:`chat_session`,id:Zn.chatSessionId??`draft:${o}`},canSelect:Zn.canSubmitReviewPrompt,disabledReason:Zn.canSubmitReviewPrompt?null:Zn.reviewSubmitDisabledReason??`Wait for the current chat turn to finish before sending preview comments.`,promptMode:Zn.mode,onPromptModeChange:Zn.onModeChange,isUpdatingPromptMode:Zn.isUpdatingMode,promptPlaceholder:Zn.promptPlaceholder,promptComposerControls:Zn.promptComposerControls,promptComposerInlineControls:Zn.promptComposerInlineControls,submitPrompt:Zn.canSubmitReviewPrompt?Zn.submitPrompt:null}:{target:null,canSelect:!1,disabledReason:`Select a chat session to send preview comments.`,submitPrompt:null}:be,tr=Zn?.canSubmitReviewPrompt??!1,nr=Y===`chat`?Zn?Zn.reviewSubmitDisabledReason:`Select a chat session to send review comments.`:vC.t(`common:workspaceReviewModal.chatRequired`),rr=(0,p.useCallback)(()=>{o&&le(e=>{let t=e[o]??X7;return{...e,[o]:{hasMounted:!0,isOpen:!t.isOpen,isExpanded:t.isExpanded}}})},[o]),ir=(0,p.useCallback)(e=>{le(t=>{let n=t[e]??X7;return!n.hasMounted||!n.isOpen?t:{...t,[e]:X7}})},[]),ar=(0,p.useCallback)(e=>{le(t=>{let n=t[e]??X7;return{...t,[e]:{hasMounted:!0,isOpen:n.isOpen,isExpanded:!n.isExpanded}}})},[]),or=(0,p.useCallback)(()=>{te(`create`)},[]),sr=(0,p.useCallback)(()=>{if(o){if(Ct){on();return}E(e=>({...e,[o]:`inline`})),O(e=>({...e,[o]:null}))}},[o,on,Ct]),cr=(0,p.useCallback)(()=>{o&&E(e=>{let t=a9(e,o);return{...e,[o]:t===`expanded`?`inline`:`expanded`}})},[o]),lr=J?J.preview_service_name?.trim()?J.preview_capability_mode===`force_disabled`?`Preview is disabled for this project.`:xt?.state===`unsupported`?xt.message??`Preview is unavailable for this project.`:Ct?`Hide preview`:`Show preview`:`Choose a named preview service in project settings first.`:`Select a project first.`,ur=!J||!J.preview_service_name?.trim()||J.preview_capability_mode===`force_disabled`||xt?.state===`unsupported`,dr=J&&J.preview_service_name?.trim()?(0,X.jsx)(IN,{project:J,mode:St===`expanded`?`expanded`:`inline`,status:xt,viewportPreset:j,zoom:N,activeRun:wt,reviewCapability:er,isStoppingActiveRun:Ot,onHide:on,onStopActiveRun:()=>{cn()},onToggleExpanded:cr,onViewportPresetChange:M,onZoomChange:P}):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)(tx,{}),i.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)(ote,{activeProjectId:o,onCreateProject:or,projects:i,onEditProject:()=>te(`edit`),onProjectChange:s})}),o&&(0,X.jsx)(sC,{projectId:o,onStartSpecFromDraft:it,onCreateTicketFromDraft:at})]})}),(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)(Qb,{activeTool:e,onMobileAccessOpen:()=>Pe(!0),onOpenActivity:()=>Ie(!0),onToolChange:Bt,...Ve?{hasActiveGitHubRuns:ze,onOpenGitHubActions:()=>Re(!0)}:{}})}),o&&(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)(Nde,{activeWorkspace:Y,activityByWorkspace:me,className:`w-fit max-w-full`,memoryEnabled:Xe,onWorkspaceChange:e=>{o&&(de(t=>({...t,[o]:e})),he(t=>M7(t,e)))}})})]})}),G?i.length===0?(0,X.jsx)(ite,{activeTool:e,availableHelperModels:L,helperModel:V,helperVariant:U,isHelperModelsLoaded:z,isToolLoaded:n,onCreateProject:or,onHelperModelChange:e=>{H(e),W(``)},onHelperVariantChange:W,onToolChange:Bt}):(0,X.jsxs)(X.Fragment,{children:[J?.has_initial_commit===!1&&(0,X.jsx)(Mte,{isSubmitting:oe,onCreateInitialCommit:()=>{rn()}}),(0,X.jsx)(jde,{activeProjectId:o,activeProject:J,activeProjectBranchState:ft,targetBundles:_t,targetBranchSuggestions:yt,isTargetBundleLoading:vt,isTargetSelectorLoading:bt,onTargetSelectorOpenChange:ln,onSelectBundleTarget:pn,onSelectRepoRootTarget:mn,activeRun:c,activeTool:e,onRestoreChatSessionTarget:hn,onChatReviewCapabilityChange:Ce,isPreviewButtonDisabled:ur,onPreviewReviewCapabilityChange:xe,onPreviewToggle:sr,onRunStopped:sn,onWorkspaceActivityChange:he,onWorkspaceActivityEvent:jt,pendingWorkspaceNavigation:fe,onPendingWorkspaceNavigationConsumed:ot,onSpecImplementationChatReady:$e,onViewSourceSpec:et,onNavigateToLifecycleSource:nt,onViewMemorySource:tt,onStartChatFromBundle:_n,previewDisplayMode:St,previewPane:dr,previewPaneWidth:k,previewButtonTitle:lr,visibleWorkspace:Y,refreshKey:ve,onBoardLoadedProjectIdChange:d,onBundlesChange:Qt,onBundlesLoadingChange:$t,onPreviewPaneWidthChange:A,onProjectUsageChange:Zt,onRunStatusChange:()=>{Rt(),zt()}},o??`no-project`)]}):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Loading projects...`}),i.length>0&&(0,X.jsx)(cb,{activeProject:J,activeRun:c,branchState:ft,targetGitStatus:pt,isBoardLoadedForActiveProject:ut,activeProjectBranchAction:gt,isProjectIdeAvailable:lt,isProjectRunAvailable:ct,isRunStatusLoadedForActiveProject:dt,isTerminalOpen:qn.isOpen,targetBundles:_t,targetBranchSuggestions:yt,isTargetBundleLoading:vt,isTargetSelectorLoading:bt,isTargetGitStatusLoading:mt,hasConfiguredTests:Jn,hasConfiguredChecks:Yn,onProjectIdeOpen:()=>{wn()},onProjectPull:()=>{Tn()},onProjectRebase:En,onProjectAbortGitOperation:Rn,onProjectRunToggle:()=>{Cn()},onProjectFilesOpen:()=>Un(`files`),onProjectChangesOpen:()=>Un(`changes`),onProjectVerificationOpen:Gn,onTerminalToggle:rr,onTargetSelectorOpenChange:ln,onSelectBundleTarget:pn,onSelectRepoRootTarget:mn,onManageBundles:vn}),(0,X.jsx)(wne,{activeProjectId:o,open:q,onOpenChange:Pe}),Fe&&o&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(Xde,{projectId:o,onClose:()=>Ie(!1),onNavigateToLifecycleSource:nt})}),Le&&o&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(Yde,{projectId:o,defaultBranch:He,onClose:()=>Re(!1)})}),Me&&J&&(0,X.jsx)(AC,{bundles:_t,selectedBundleId:J.active_target_kind===`bundle`?J.active_target_bundle_id??null:null,activeTargetBundleId:J.active_target_kind===`bundle`?J.active_target_bundle_id??null:null,onSelectBundle:bn,onCreateBundle:xn,onDeleteBundle:Sn,onClose:yn}),Ue&&(0,X.jsx)(gC,{title:Ue.title,description:Ue.description,confirmLabel:Ue.confirmLabel,cancelLabel:Ue.cancelLabel,confirmVariant:Ue.confirmVariant,onConfirm:()=>dn(!0),onCancel:()=>dn(!1)}),i.map(e=>{let t=i9(ce,e.id);return t.hasMounted?(0,X.jsx)(Mde,{project:e,isExpanded:t.isExpanded,isVisible:e.id===o&&t.isOpen,onClose:()=>ir(e.id),onToggleExpanded:()=>ar(e.id)},e.id):null}),ee&&(0,X.jsx)(wE,{mode:ee,projectId:ee===`edit`&&J?J.id:null,availableHelperModels:L,isLoadingHelperModels:!z,isAutoConfigReady:n,initialValues:ee===`edit`&&J?Qde(J):i.length===0?{name:``,repoPath:``,linkedProjectIds:[],runSetup:[],runServices:[],checkDefinitions:[],runIde:``,previewServiceName:``,previewPath:``,previewCapabilityMode:`auto`,helperModel:V,helperVariant:U,commitMessageRules:``,commitAfterEachTicket:!1,autoParkStaleTickets:!1,memoryEnabled:!1,worktreeSync:[],specAwareCodeReviewEnabled:!1,automationDepth:`manual`,automationReviewFixEnabled:!1,automationPauseOnOpenQuestions:!1,automationReviewSeverity:`medium`,automationReviewMaxIterations:3}:void 0,linkedProjectOptions:i.filter(e=>e.id!==J?.id).map(e=>({id:e.id,name:e.name})),repoPathLocked:ee===`edit`&&J?J.repo_path_locked:!1,repoPathLockedMessage:ee===`edit`&&J?efe(J):null,deleteBlockedMessage:ee===`edit`&&J?tfe(J,i):null,onDelete:ee===`edit`?Xt:void 0,onAutoConfig:en,onBrowseRepoPath:tn,onValidateRepoPath:nn,onClose:()=>te(null),onSubmit:ee===`edit`?Yt:Jt}),ne&&ne.projectId===o&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(qde,{target:{scope:`project_root`},initialMode:ne.initialMode,enabledModes:[`changes`,`files`],projectId:ne.projectId,targetKind:ne.targetKind,reviewCommentsBundleId:ne.targetKind===`bundle`?ne.targetBundleId:null,title:ne.title,bundleTargetName:ne.bundleTargetName,hasHelperModel:ne.hasHelperModel,repoRootDefaultBranch:ne.repoRootDefaultBranch,onSubmitReviewPrompt:Zn?.submitPrompt,canSubmitReviewPrompt:tr,reviewSubmitDisabledReason:nr??void 0,canAddReviewComments:tr,canModifyChanges:!0,mode:Zn?.mode,onModeChange:Zn?.onModeChange,canToggleMode:!!Zn?.canSubmitReviewPrompt,isUpdatingMode:Zn?.isUpdatingMode??!1,onClose:Wn})}),ie&&ie.projectId===o&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(Jde,{targetLabel:ie.targetLabel,definitions:ie.definitions,requiredDefinitionIds:ie.requiredDefinitionIds,preReviewDefinitionIds:ie.preReviewDefinitionIds,checksTarget:{projectId:ie.projectId,targetKind:ie.targetKind,targetBundleId:ie.targetBundleId},testsTarget:{scope:`project`,projectId:ie.projectId,targetKind:ie.targetKind,targetBundleId:ie.targetBundleId},onClose:Kn,onOpenActivity:()=>{ae(null),Ie(!0)}})})]})},mfe=({className:e})=>(0,X.jsx)(Og,{"aria-hidden":`true`,className:e}),c9=`X-Archon-Mobile-CSRF`,hfe=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 Ge(await Xe(n,`Mobile request failed.`),n.status,e)}return n},l9=async(e,t={})=>await(await hfe(e,t)).json(),gfe=e=>l9(`/mobile/projects`,{signal:e}),_fe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/summary`,{signal:t}),vfe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/target-options`,{signal:t}),yfe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,{signal:t}),bfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,{signal:n}),xfe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets`,{signal:t}),Sfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,{signal:n}),Cfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/agent-runs`,{signal:n}),wfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),Tfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),Efe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}`,{signal:n}),Dfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/build`,u9(n)),Ofe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/review`,u9(n)),u9=(e,t,n=`POST`)=>({method:n,headers:{"Content-Type":`application/json`,[c9]:e},body:t===void 0?void 0:JSON.stringify(t)}),kfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,u9(t,n)),Afe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/messages`,u9(n,r)),jfe=(e,t,n,r,i)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Mfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),Nfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/stop`,u9(n)),Pfe=(e,t)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,{signal:t}),Ffe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,{signal:n}),Ife=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,u9(t,n)),d9=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/messages`,u9(n,r)),Lfe=(e,t,n,r,i)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Rfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),zfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/stop`,u9(n)),f9=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/state`,u9(n,{state:r},`PATCH`)),Bfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/run`,u9(n)),Vfe=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop`,u9(n)),p9=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop-build`,u9(n)),m9=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/resume-build`,u9(n)),Hfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),Ufe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-follow-up`,u9(n,{instruction:r})),Wfe=(e,t,n,r,i)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Gfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/follow-up`,u9(n,{instruction:r})),Kfe=(e,t,n,r)=>l9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/follow-up`,u9(n,{instruction:r})),h9=(e,t,n)=>l9(`/mobile/projects/${encodeURIComponent(e)}/target`,u9(t,n)),qfe=(e,t)=>l9(`/mobile/models?tool=${encodeURIComponent(e)}`,{signal:t}),Jfe=(e,t,n)=>{let r=new URLSearchParams({tool:e});return t&&r.set(`project_id`,t),l9(`/mobile/skills?${r.toString()}`,{signal:n})},Yfe=({className:e})=>(0,X.jsx)(Cg,{"aria-hidden":`true`,className:e}),g9=e=>vC.t(`common:mobileApp.${e}`),Xfe={key:`overview`,label:g9(`navigation.overview`),Icon:Yfe},_9={key:`tickets`,label:g9(`navigation.tickets`),Icon:Q5,ctaAriaLabel:g9(`overviewActions.ticketsAriaLabel`)},v9={key:`chats`,label:g9(`navigation.chats`),Icon:HE,ctaAriaLabel:g9(`overviewActions.chatsAriaLabel`)},y9={key:`spec`,label:g9(`navigation.spec`),Icon:iC,ctaAriaLabel:g9(`overviewActions.specAriaLabel`)},Zfe=[Xfe,_9,v9,y9],Qfe=({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})})}),b9=({title:e,description:t,children:n})=>(0,X.jsx)(Qfe,{children:(0,X.jsxs)(bC,{className:`w-full border-border/80 bg-card/90 shadow-2xl shadow-black/20`,children:[(0,X.jsxs)(xC,{children:[(0,X.jsx)(SC,{children:e}),(0,X.jsx)(CC,{children:t})]}),n&&(0,X.jsx)(TC,{className:`space-y-4`,children:n})]})}),$fe=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`},epe=({status:e})=>{let t=$fe(e);return(0,X.jsxs)(yC,{variant:t.variant,className:`gap-1.5 px-2.5 py-1 text-[11px] uppercase tracking-[0.14em]`,children:[(0,X.jsx)(pb,{state:t.indicatorState,className:`mt-0`}),t.label]})},tpe=({status:e,onRetry:t})=>e===`connected`?null:e===`unavailable`?(0,X.jsx)(bC,{className:`border-red-500/25 bg-destructive/10 shadow-none`,children:(0,X.jsxs)(TC,{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)(bC,{className:`border-amber-500/25 bg-amber-500/10 shadow-none`,children:(0,X.jsx)(TC,{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.`})}),npe=({selectedProject:e,targetLabel:t,isTargetLoading:n,isTargetDisabled:r,connectionState:i,onOpenProjects:a,onOpenTargetSelector:o})=>(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:a,children:[(0,X.jsx)(`div`,{className:`truncate text-base font-medium text-foreground`,children:e?.name??`Choose a project`}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e?.repo_path??`Select a desktop project to continue`})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(epe,{status:i}),(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:r,onClick:o,children:[(0,X.jsx)(Yv,{className:`h-3.5 w-3.5 shrink-0`}),n?(0,X.jsx)(Mv,{className:`h-3.5 w-16`}):(0,X.jsx)(`span`,{className:`truncate text-xs sm:text-sm`,children:t})]}),(0,X.jsx)(Q,{variant:`outline`,size:`icon-sm`,"aria-label":`Choose project`,onClick:a,children:(0,X.jsx)(Fv,{className:`h-4 w-4`})})]})]})}),rpe=({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:Zfe.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)})})}),x9=({title:e,description:t,action:n})=>(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsxs)(xC,{children:[(0,X.jsx)(SC,{children:e}),(0,X.jsx)(CC,{children:t})]}),n&&(0,X.jsx)(TC,{children:n})]}),S9=({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)(Rv,{className:`h-4 w-4 animate-spin`}),(0,X.jsx)(`span`,{children:e})]}),ipe=e=>e?`Repo root (${e})`:`Repo root`,ape=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)}...`},C9=(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?rb(n):`Selected bundle`}return ape(t?.current_branch??null)},w9=({title:e,description:t,children:n})=>(0,X.jsxs)(`div`,{className:`flex max-h-[80vh] flex-col overflow-hidden`,children:[(0,X.jsxs)(Z_,{className:`border-b border-border/70 px-4 py-4`,children:[(0,X.jsx)($_,{children:e}),t&&(0,X.jsx)(ev,{children:t})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:n})]}),ope=({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)(yC,{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...`}),spe=({open:e,projects:t,selectedProjectId:n,error:r,onOpenChange:i,onSelectProject:a,onRetry:o})=>(0,X.jsx)(K_,{open:e,onOpenChange:i,children:(0,X.jsx)(X_,{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)(w9,{title:`Projects`,children:(0,X.jsx)(ope,{projects:t,selectedProjectId:n,error:r,onSelectProject:e=>{a(e),i(!1)},onRetry:o})})})}),cpe=({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=Ky(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)(hv,{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:ipe(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)(Rv,{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:rb(e)})},e.id))})]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(hv,{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)(hv,{htmlFor:`mobile-project-target-branch-input`,className:`text-xs text-muted-foreground`,children:`Switch or create branch`}),(0,X.jsx)(tv,{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)(S9,{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)(K_,{open:e,onOpenChange:o,children:(0,X.jsx)(X_,{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)(w9,{title:`Target`,description:t?C9(t,n):void 0,children:g})})})},T9=e=>e.parked_at?`parked`:e.state,E9=e=>{let t=T9(e);return t===`parked`?`Done`:`${t.slice(0,1).toUpperCase()}${t.slice(1)}`},D9=e=>e===`plan`?`info`:e===`build`?`success`:e===`review`?`warning`:`outline`,O9=({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)(yC,{variant:D9(T9(e)),children:E9(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})]})]}),lpe=({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=rb(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)(RC,{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)(yC,{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)(zC,{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)(Av,{className:Z(`h-4 w-4 transition-transform`,s&&`rotate-180`)})})})]}),(0,X.jsx)(BC,{className:`pt-2`,children:(0,X.jsx)(`div`,{className:`space-y-2 pl-3`,children:e.tickets.map(t=>(0,X.jsx)(O9,{ticket:t,isSelected:t.id===n,onSelectTicket:t=>i(t,e.bundle.id),className:`rounded-xl`},t.id))})})]})},k9=(e,t)=>Zy(e,[],t),upe=e=>[{key:`plan`,label:`Plan`,tickets:e.filter(e=>!e.parked_at&&e.state===`plan`),items:k9(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:k9(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:k9(e.filter(e=>!e.parked_at&&e.state===`review`),`review`)},{key:`parked`,label:`Done`,tickets:e.filter(e=>e.parked_at),items:k9(e.filter(e=>e.parked_at),`done`)}].filter(e=>e.tickets.length>0),A9=({selectedProjectId:e,tickets:t,selectedBundleId:n,selectedTicketId:r,error:i,onRetry:a,onSelectBundle:o,onSelectTicket:s})=>{if(!e)return(0,X.jsx)(x9,{title:`Choose a project`,description:`Select a project before browsing tickets from this phone.`});if(i)return(0,X.jsx)(x9,{title:`Tickets unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:a,children:`Retry tickets`})});if(!t)return(0,X.jsx)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,X.jsx)(TC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading tickets...`})});if(t.length===0)return(0,X.jsx)(x9,{title:`No tickets`,description:`This project does not have any tickets yet.`});let c=upe(t);return(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(xC,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(SC,{children:`Tickets`}),(0,X.jsxs)(CC,{children:[t.length,` total`]})]}),(0,X.jsx)(TC,{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)(lpe,{group:e.group,selectedBundleId:n,selectedTicketId:r,onSelectBundle:o,onSelectTicket:s},e.group.id):(0,X.jsx)(O9,{ticket:e.ticket,isSelected:e.ticket.id===r,onSelectTicket:e=>s(e,null)},e.ticket.id))})]},e.key))})]})},dpe=e=>l9(`/mobile-auth/status`,{signal:e}),fpe=(e,t)=>l9(`/mobile-auth/pair/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t}),ppe=e=>l9(`/mobile-auth/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),mpe=e=>l9(`/mobile-auth/logout`,{method:`POST`,headers:{[c9]:e}}),hpe=()=>eC(window.location.origin,{withCredentials:!0}),j9=e=>vC.t(`common:mobileApp.${e}`),M9=`Project root has uncommitted changes. Confirm branch switch to continue.`,gpe=()=>{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},N9=({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})]}),_pe=()=>(0,X.jsxs)(`div`,{className:`space-y-3`,"data-testid":`mobile-overview-skeleton`,children:[(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(xC,{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)(Mv,{className:`h-6 w-28`}),(0,X.jsx)(Mv,{className:`h-6 w-28 rounded-full`})]})}),(0,X.jsxs)(TC,{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)(Mv,{className:`h-6 w-10`}),(0,X.jsx)(Mv,{className:`mt-2 h-3 w-16`})]},t))}),(0,X.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,X.jsx)(Mv,{className:`h-10 w-full rounded-xl`}),(0,X.jsx)(Mv,{className:`h-10 w-full rounded-xl`})]})]})]}),(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(xC,{children:(0,X.jsx)(Mv,{className:`h-6 w-20`})}),(0,X.jsx)(TC,{children:(0,X.jsx)(Mv,{className:`h-10 w-40 rounded-xl`})})]})]}),vpe=({isLoggingOut:e,onLogout:t})=>(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(xC,{children:(0,X.jsx)(SC,{children:`Session`})}),(0,X.jsx)(TC,{children:(0,X.jsxs)(Q,{variant:`destructive`,className:`gap-2`,disabled:e,onClick:t,children:[(0,X.jsx)(mfe,{className:`h-4 w-4`}),e?`Logging out...`:`Log out this phone`]})})]}),ype=({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=WF(a.filter(e=>e.state===`review`));return o===`building`?{label:vC.t(`common:statusBadge.building`),variant:`success`}:o===`reviewing`?{label:vC.t(`common:statusBadge.reviewing`),variant:`warning`}:a.some(e=>e.state===`build`)?{label:vC.t(`common:statusBadge.building`),variant:`success`}:a.some(e=>e.state===`plan`)?{label:`Planning`,variant:`info`}:{label:`Idle`,variant:`outline`}},bpe=({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r})=>{let i=ype({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r});return(0,X.jsx)(yC,{variant:i.variant,children:i.label})},xpe=({selectedProjectId:e,summary:t,tickets:n,error:r,chatSessions:i,chatSessionDetail:a,onRetry:o,onOpenTickets:s,onOpenChats:c,onOpenSpec:l})=>{let u=_9.Icon,d=v9.Icon,f=y9.Icon;return r?(0,X.jsx)(x9,{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)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,X.jsx)(TC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading project summary...`})}):(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsxs)(xC,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(SC,{children:`Overview`}),(0,X.jsx)(wC,{children:(0,X.jsx)(bpe,{activeRun:t.active_run,tickets:n,chatSessions:i,chatSessionDetail:a})})]}),(0,X.jsxs)(TC,{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)(N9,{label:`Tickets`,value:t.tickets.total}),(0,X.jsx)(N9,{label:`Plan`,value:t.tickets.plan,accentClassName:`text-sky-200`}),(0,X.jsx)(N9,{label:`Build`,value:t.tickets.build,accentClassName:`text-emerald-200`}),(0,X.jsx)(N9,{label:`Review`,value:t.tickets.review,accentClassName:`text-amber-200`}),(0,X.jsx)(N9,{label:`Done`,value:t.tickets.parked}),(0,X.jsx)(N9,{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":_9.ctaAriaLabel,onClick:s,children:[(0,X.jsx)(u,{className:`h-4 w-4`}),_9.label]}),(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":v9.ctaAriaLabel,onClick:c,children:[(0,X.jsx)(d,{className:`h-4 w-4`}),v9.label]}),(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2 sm:col-span-2`,"aria-label":y9.ctaAriaLabel,onClick:l,children:[(0,X.jsx)(f,{className:`h-4 w-4`}),y9.label]})]})]})]}):(0,X.jsx)(x9,{title:`Choose a project`,description:`Select a desktop project before opening tickets or chats from this phone.`})},P9=(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)},F9=({selectedProjectId:e,chatSessions:t,selectedChatSessionId:n,error:r,onRetry:i,onOpenNewChat:a,onSelectChat:o})=>e?r?(0,X.jsx)(x9,{title:`Chats unavailable`,description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry chats`})}):(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(xC,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(SC,{children:`Chats`}),(0,X.jsx)(CC,{children:t?`${t.length} recent`:`Loading chats...`}),(0,X.jsx)(wC,{children:(0,X.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:`New chat`})})]}),(0,X.jsx)(TC,{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)(x9,{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)(yC,{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)(x9,{title:`Choose a project`,description:`Select a project before browsing chats from this phone.`}),I9=({label:e,disabled:t,onClick:n})=>(0,X.jsx)(Q,{type:`button`,variant:`outline`,disabled:t,onClick:n,children:e}),L9=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=>Ty(e)&&e.agent_status===`running`&&!!e.session_id)??null,s=t.find(e=>Ty(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}},Spe=({ticket:e,actionState:t,actionError:n,onAction:r})=>{let i=z3(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)(x3,{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)(I9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},Cpe=({bundleDetail:e,actionState:t,actionError:n,onAction:r})=>{let{actions:i}=L9(e);return i.length===0?null:(0,X.jsx)(x3,{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)(I9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},R9=(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?fq(e.response_timing):null,transcript_runs:e.transcript_runs??null})),z9=e=>[...e??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,B9=({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)(RF,{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]}),wpe=({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)(RF,{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})]}),V9=({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)(wpe,{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})]}),H9=({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`})]}),U9=({controls:e})=>{let[t,n]=(0,p.useState)(!1);return(0,X.jsxs)(RC,{open:t,onOpenChange:n,children:[(0,X.jsx)(`div`,{className:`px-1 pb-1`,children:(0,X.jsx)(zC,{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)(Av,{className:Z(`h-3.5 w-3.5 transition-transform`,t&&`rotate-180`)})]})})}),(0,X.jsx)(BC,{className:`px-1 pb-1`,children:(0,X.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-background/35 p-2`,children:e})})]})},Tpe=({ticket:e})=>{let t=[{label:`State`,value:E9(e)},{label:`Tool`,value:eI(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))})]})},W9=({ticket:e,badges:t,actionState:n,actionError:r,onAction:i,className:a})=>(0,X.jsxs)(bC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,a),children:[(0,X.jsx)(xC,{className:`min-w-0 pb-3`,children:(0,X.jsx)(B9,{title:e.title,badges:t})}),(0,X.jsxs)(TC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,X.jsx)(Spe,{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)(dq,{content:e.description,className:`min-w-0 text-foreground`})]}):null,(0,X.jsx)(Tpe,{ticket:e})]})]}),G9=({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)(bC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,f),children:[(0,X.jsx)(xC,{className:`min-w-0 pb-3`,children:(0,X.jsx)(B9,{title:t,subtitle:n,badges:r})}),(0,X.jsxs)(TC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,X.jsx)(Cpe,{bundleDetail:e,actionState:i,actionError:a,onAction:o}),(0,X.jsxs)(RC,{open:l,onOpenChange:u,children:[(0,X.jsx)(zC,{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)(Av,{className:Z(`h-3.5 w-3.5 transition-transform`,l&&`rotate-180`)})]})}),(0,X.jsx)(BC,{className:`pt-2`,children:(0,X.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-background/35 p-3`,children:(0,X.jsx)(q3,{tickets:s,highlightedTicketId:c,onOpenTicketDetails:e=>d(e.id,e.worktree_bundle_id),availableModels:p})})})]})]})]}),K9=({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)(x9,{title:`Choose a project`,description:`Select a project before opening bundle details from this phone.`});if(!t)return(0,X.jsx)(x9,{title:`Choose a bundle`,description:`Open a bundle to review its transcript and grouped ticket progress.`});if(a)return(0,X.jsx)(V9,{title:`Bundle unavailable`,backLabel:`Back to tickets`,onBack:f,children:(0,X.jsx)(x9,{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)(V9,{title:`Loading bundle`,backLabel:`Back to tickets`,onBack:f,children:(0,X.jsx)(S9,{text:`Loading bundle details...`})});let w=rb(n.bundle)||n.bundle.branch||n.bundle.name||`Bundle`,T=new Map(d.map(e=>[e.id,e.label])),E=Z3(n.tickets,T),D=e6(n),O=Q3(n.tickets,n.execution_order_ticket_ids),k=$3(n.tickets,T,E,n.execution_order_ticket_ids),A=KF(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`&&Yy(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)(BF,{status:A}),(0,X.jsx)(yC,{variant:`outline`,children:L}),M?(0,X.jsxs)(yC,{variant:`outline`,children:[`Target: `,M.title]}):null]});return(0,X.jsx)(V9,{title:w,backLabel:`Back to tickets`,onBack:f,subheader:x?void 0:(0,X.jsx)(H9,{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)(G9,{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)(K3,{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:vy(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)(G9,{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)(K3,{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:vy(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]})})},q9=({selectedProjectId:e,chatSession:t,chatSessionId:n,openNonce:r,error:i,isStopping:a,composerMode:o,composerTool:s,prompt:c,selectedModel:l,selectedVariant:u,selectedSkills:d,availableModels:f,availableSkills:p,isLoadingAgentSettings:m,isSending:h,isUpdatingMode:g,showStartBuilding:_,composerDisabledReason:v,onBack:y,onRetry:b,onStop:x,onModeChange:S,onStartBuilding:C,onPromptChange:w,onModelChange:T,onVariantChange:E,onSkillsChange:D,onPromptKeyDown:O,onSubmit:k,onResolveQuestionSet:A,liveResponseTiming:j,isLargeScreen:M})=>{if(!e)return(0,X.jsx)(x9,{title:`Choose a project`,description:`Select a project before opening the chat workspace.`});if(n&&i)return(0,X.jsx)(x9,{title:`Chat unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:b,children:`Retry chat`})});if(n&&(!t||t.id!==n))return(0,X.jsx)(V9,{title:`Loading chat`,backLabel:`Back to chats`,onBack:y,children:(0,X.jsx)(S9,{text:`Loading chat transcript...`})});let N=t?.mode??o,P=s===`opencode`&&f.length>0,F=f.find(e=>e.id===l)??null,I=R9(t?.messages),L=z9(t?.messages),R=!!L,z=bJ(t?.post_build_check),B=z?vC.t(`common:postBuildChecks.blockedReason`):R?vC.t(`common:questionSet.waitForResolution`):v,V=t?.agent_status===`running`?(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:a,onClick:x,children:[a?(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Vv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:a?`Interrupting...`:`Interrupt`})]}):null,H=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yC,{variant:N===`plan`?`info`:`success`,children:N}),(0,X.jsx)(yC,{variant:`outline`,children:t?.tool??s}),t?.agent_status?(0,X.jsx)(yC,{variant:`outline`,children:t.agent_status}):null]}),U=P?(0,X.jsx)(LY,{model:l,variant:u,skills:d,showModelSelector:!0,showSkillsSelector:!0,availableModels:f,availableSkills:p,selectedModel:F,onModelChange:T,onVariantChange:E,onSkillsChange:D,modelSelectId:`mobile-chat-model-selector`,variantSelectId:`mobile-chat-variant-selector`,skillsSelectId:`mobile-chat-skills-selector`,disabled:!!B||h}):s===`opencode`&&m?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,W=!M&&U?(0,X.jsx)(U9,{controls:U}):U,G=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(cX,{value:N,disabled:!!B||h||g,onChange:S}),_&&(0,X.jsx)(u5,{disabled:h||g,onClick:C})]}),K=M?void 0:({showThinkingControl:e})=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[G,(0,X.jsx)(`div`,{className:`ml-auto`,children:e})]}),ee=`mobile-chat:${n??`new`}:${r}`;return(0,X.jsx)(V9,{title:t?.title??`New chat`,backLabel:`Back to chats`,onBack:y,action:V,children:(0,X.jsx)(l5,{projectId:e,agentRunParentType:t?`chat`:null,agentRunParentId:t?.id??null,messages:I,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:j?.turnKey??null,liveResponseTiming:j,canShowComposer:!0,header:M?(0,X.jsx)(B9,{title:t?.title??`New chat`,subtitle:t?.target_label_snapshot??`Project root`,badges:H}):K,composerControls:M?G:void 0,composerInlineControls:W,composerTheme:N,forceScrollToBottomKey:ee,layoutKey:ee,scrollLayoutKey:ee,composerFocusNonce:r,blurComposerOnSendStart:!M,followUpPrompt:c,followUpPlaceholder:n?`Continue this chat`:N===`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)(_Y,{messageContent:e.content,questionSet:n,storageKey:cY({parentType:`chat`,parentId:t.id,setId:n.id}),isActive:n.status===`pending`&&L?.id===e.id,isDisabled:t.agent_status===`running`||h||g,onResolve:t=>A(e.id,t)})},isSendingFollowUp:h,isComposerSubmitDisabled:R||z,postBuildCheck:t?.post_build_check,followUpDisabledReason:B??void 0,hidePendingAgentTitle:!M,onFollowUpPromptChange:w,onFollowUpKeyDown:O,onFollowUpSubmit:k},ee)})},Epe=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?fq(e.response_timing):null,transcript_runs:e.transcript_runs??null})),Dpe=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},J9=({selectedProjectId:e,specSessions:t,selectedSpecSessionId:n,error:r,onRetry:i,onOpenNewSpec:a,onSelectSpec:o})=>e?r?(0,X.jsx)(x9,{title:j9(`specList.listError`),description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:j9(`specList.retry`)})}):(0,X.jsxs)(bC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(xC,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(SC,{children:j9(`specList.title`)}),(0,X.jsx)(CC,{children:t?`${t.length} recent`:j9(`specList.loading`)}),(0,X.jsx)(wC,{children:(0,X.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:j9(`specList.newSpec`)})})]}),(0,X.jsx)(TC,{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)(x9,{title:j9(`specList.emptyTitle`),description:j9(`specList.emptyDescription`),action:(0,X.jsx)(Q,{onClick:a,children:j9(`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)(yC,{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:j9(`specList.loading`)})})]}):(0,X.jsx)(x9,{title:j9(`specList.emptyTitle`),description:`Select a project before browsing specs from this phone.`}),Y9=({selectedProjectId:e,specSession:t,specSessionId:n,openNonce:r,error:i,isStopping:a,composerMode:o,composerTool:s,prompt:c,selectedModel:l,selectedVariant:u,selectedSkills:d,availableModels:f,availableSkills:p,isLoadingAgentSettings:m,isSending:h,isUpdatingMode:g,composerDisabledReason:_,onBack:v,onRetry:y,onStop:b,onModeChange:x,onPromptChange:S,onModelChange:C,onVariantChange:w,onSkillsChange:T,onPromptKeyDown:E,onSubmit:D,onSubmitAnswer:O,onResolveQuestionSet:k,liveResponseTiming:A,isLargeScreen:j})=>{if(!e)return(0,X.jsx)(x9,{title:j9(`specList.emptyTitle`),description:`Select a project before opening the spec workspace.`});if(n&&i)return(0,X.jsx)(x9,{title:j9(`specDetail.unavailableTitle`),description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:y,children:j9(`specDetail.retry`)})});if(n&&(!t||t.id!==n))return(0,X.jsx)(V9,{title:j9(`specDetail.loadingTitle`),backLabel:j9(`specDetail.back`),onBack:v,children:(0,X.jsx)(S9,{text:j9(`specDetail.loading`)})});let M=t?.mode??o,N=s===`opencode`&&f.length>0,P=f.find(e=>e.id===l)??null,F=Epe(t?.messages),I=Dpe(t?.messages),L=z9(t?.messages),R=!!L,z=R?vC.t(`common:questionSet.waitForResolution`):_,B=t?.agent_status===`running`,V=B?(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:a,onClick:b,children:[a?(0,X.jsx)(Rv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Vv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:j9(a?`specDetail.interrupting`:`specDetail.interrupt`)})]}):null,H=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yC,{variant:M===`grill`?`info`:`success`,children:M}),(0,X.jsx)(yC,{variant:`outline`,children:t?.tool??s}),t?.agent_status?(0,X.jsx)(yC,{variant:`outline`,children:t.agent_status}):null]}),U=N?(0,X.jsx)(LY,{model:l,variant:u,skills:d,showModelSelector:!0,showSkillsSelector:!0,availableModels:f,availableSkills:p,selectedModel:P,onModelChange:C,onVariantChange:w,onSkillsChange:T,modelSelectId:`mobile-spec-model-selector`,variantSelectId:`mobile-spec-variant-selector`,skillsSelectId:`mobile-spec-skills-selector`,disabled:!!z||h}):s===`opencode`&&m?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,W=!j&&U?(0,X.jsx)(U9,{controls:U}):U,G={rationaleLabel:vC.t(`common:specView.grill.rationaleLabel`),suggestionsLabel:vC.t(`common:specView.grill.suggestionsLabel`),recommendedSuggestionLabel:vC.t(`common:specView.grill.recommendedSuggestionLabel`),answerPlaceholder:vC.t(`common:specView.grill.answerPlaceholder`),submitLabel:vC.t(`common:specView.grill.submitLabel`),submittingLabel:vC.t(`common:specView.grill.submittingLabel`)},K=e=>{if(e.role!==`assistant`)return;let n=e.metadata,r=n?.ask_question;if(r&&t)return(0,X.jsx)(_Y,{messageContent:e.content,questionSet:r,storageKey:cY({parentType:`spec`,parentId:t.id,setId:r.id}),isActive:r.status===`pending`&&L?.id===e.id,isDisabled:B||h||g,onResolve:t=>k(e.id,t)});if(e.kind!==`grill-question`)return;let i=n?.grill_question;if(i)return(0,X.jsx)(Y5,{question:i,isActive:B?!1:e.id===I&&t?.agent_status!==`running`&&t?.mode===`grill`,isDisabled:h||g,labels:G,onSubmitAnswer:O})},ee=(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,X.jsx)(X5,{on:M===`grill`,disabled:!!z||h||g,onToggle:e=>x(e?`grill`:`standard`),tooltipContent:vC.t(`common:specView.grill.toggleTooltip`),ariaLabelOn:vC.t(`common:specView.grill.toggleAriaLabelOn`),ariaLabelOff:vC.t(`common:specView.grill.toggleAriaLabelOff`)})}),te=j?void 0:({showThinkingControl:e})=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[ee,(0,X.jsx)(`div`,{className:`ml-auto`,children:e})]}),ne=`mobile-spec:${n??`new`}:${r}`;return(0,X.jsx)(V9,{title:t?.title??j9(`specDetail.newSpecTitle`),backLabel:j9(`specDetail.back`),onBack:v,action:V,children:(0,X.jsx)(l5,{projectId:e,agentRunParentType:n?`spec`:null,agentRunParentId:n,messages:F,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??j9(`specDetail.newSpecTitle`),streamingResponse:t?.streaming_response??null,isRunning:B,pendingAgentRevealKey:A?.turnKey??null,liveResponseTiming:A,canShowComposer:!0,header:j?(0,X.jsx)(B9,{title:t?.title??j9(`specDetail.newSpecTitle`),subtitle:t?.first_user_message_preview??null,badges:H}):te,composerControls:j?ee:void 0,composerInlineControls:W,composerTheme:`default`,forceScrollToBottomKey:ne,layoutKey:ne,scrollLayoutKey:ne,composerFocusNonce:r,blurComposerOnSendStart:!j,followUpPrompt:c,followUpPlaceholder:j9(n?`specDetail.composerPlaceholder`:`specDetail.composerPlaceholderDraft`),emptyStateText:j9(n?`specDetail.emptyMessages`:`specDetail.emptyDraft`),renderMessageBody:K,isSendingFollowUp:h,isComposerSubmitDisabled:R,followUpDisabledReason:z??void 0,hidePendingAgentTitle:!j,onFollowUpPromptChange:S,onFollowUpKeyDown:E,onFollowUpSubmit:D},ne)})},X9=({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)(x9,{title:`Choose a project`,description:`Select a project before opening ticket details from this phone.`});if(!t)return(0,X.jsx)(x9,{title:`Choose a ticket`,description:`Open a ticket to review its transcript and continue the workflow.`});if(i)return(0,X.jsx)(x9,{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)(V9,{title:`Loading ticket`,backLabel:`Back to tickets`,onBack:_,children:(0,X.jsx)(S9,{text:`Loading ticket details...`})});let j=B3(n,{requireWorktree:!0}),M=R9(n.messages,n.id),N=z9(n.messages),P=!!N,F=bJ(n.post_build_check),I=F?vC.t(`common:postBuildChecks.blockedReason`):P?vC.t(`common:questionSet.waitForResolution`):j.disabledReason,L=d.find(e=>e.id===c)??null,R=eI(n,`opencode`)===`opencode`&&d.length>0?(0,X.jsx)(LY,{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}):eI(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)(U9,{controls:R}):R,B=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yC,{variant:D9(T9(n)),children:E9(n)}),n.tool?(0,X.jsx)(yC,{variant:`outline`,children:n.tool}):null,n.agent_status?(0,X.jsx)(yC,{variant:`outline`,children:n.agent_status}):null,n.branch?(0,X.jsx)(yC,{variant:`outline`,children:n.branch}):null,n.bundle?.name?(0,X.jsx)(yC,{variant:`outline`,children:n.bundle.name}):null]}),V=`mobile-ticket:${n.id}:${r}`,H=e=>{let t=e.metadata?.ask_question;if(!(e.role!==`assistant`||!t))return(0,X.jsx)(_Y,{messageContent:e.content,questionSet:t,storageKey:cY({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)})},U=(0,X.jsx)(H9,{value:k,onTranscript:()=>A(`transcript`),onDetails:()=>A(`details`)});return(0,X.jsx)(V9,{title:n.title,backLabel:`Back to tickets`,onBack:_,subheader:O?void 0:U,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)(W9,{ticket:n,badges:B,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)(TY,{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:vy(n.state),forceScrollToBottomKey:V,layoutKey:V,scrollLayoutKey:V,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:H,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},V)}),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)(W9,{ticket:n,badges:B,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)(TY,{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:vy(n.state),surfaceVariant:`chat`,composerSize:`compact-on-laptop`,forceScrollToBottomKey:V,layoutKey:V,scrollLayoutKey:V,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:H,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},V),g?(0,X.jsx)(`p`,{className:`shrink-0 px-1 pt-2 text-sm text-red-200`,children:g}):null]})})},Ope=()=>{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}},kpe=()=>{window.history.replaceState({},``,`/mobile`)},Ape=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Z9=(e,t)=>e instanceof Ge&&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}),jpe=e=>e instanceof Ge&&(e.status===401||e.status===403),Mpe=()=>{let[e,t]=(0,p.useState)({status:`checking`}),[n,r]=(0,p.useState)(`connecting`),[i,a]=(0,p.useState)(null),[o,s]=(0,p.useState)(`overview`),[c,l]=(0,p.useState)(!1),[u,d]=(0,p.useState)(!1),[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)(``),[C,w]=(0,p.useState)(`build`),[T,E]=(0,p.useState)(``),[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)(!1),[L,R]=(0,p.useState)(!1),[z,B]=(0,p.useState)(!1),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(null),[G,K]=(0,p.useState)(null),[ee,te]=(0,p.useState)(!1),[ne,re]=(0,p.useState)(``),[ie,ae]=(0,p.useState)(`standard`),[oe,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)(null),[ve,ye]=(0,p.useState)(null),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)(0),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)(null),[Oe,ke]=(0,p.useState)(null),[Ae,je]=(0,p.useState)(null),[Me,Ne]=(0,p.useState)(``),[q,Pe]=(0,p.useState)(``),[Fe,Ie]=(0,p.useState)(``),[Le,Re]=(0,p.useState)([]),[ze,Be]=(0,p.useState)(!1),[Ve,He]=(0,p.useState)(null),[Ue,We]=(0,p.useState)(null),[qe,Je]=(0,p.useState)(``),[J,Xe]=(0,p.useState)(!1),[Ze,Y]=(0,p.useState)(null),[Qe,$e]=(0,p.useState)(0),[et,tt]=(0,p.useState)(0),[nt,rt]=(0,p.useState)(0),[it,at]=(0,p.useState)(`transcript`),[ot,st]=(0,p.useState)(null),[ct,lt]=(0,p.useState)(null),[ut,dt]=(0,p.useState)(!1),[ft,pt]=(0,p.useState)(!1),[mt,ht]=(0,p.useState)(!1),[gt,_t]=(0,p.useState)(null),[vt,yt]=(0,p.useState)(null),bt=(0,p.useRef)(null),xt=(0,p.useRef)(null),St=(0,p.useRef)(null),Ct=(0,p.useRef)(null),wt=(0,p.useRef)(null),Tt=(0,p.useRef)(0),Et=(0,p.useRef)(!1),Dt=(0,p.useCallback)(e=>jpe(e)?(t($9(`session_revoked`)),r(`unavailable`),l(!1),d(!1),m(!1),g(!1),te(!1),!0):!1,[]),Ot=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await Sfe(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(Dt(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.`)})}}},[Dt]),kt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await Efe(n,r,i);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedBundleId!==r?t:{...t,bundleDetail:a,bundleDetailError:null,tickets:P9(t.tickets,a)})}catch(i){if(!Ye(i)){if(Dt(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.`)})}}},[Dt]),At=(0,p.useCallback)(async(e,n,r)=>{try{let i=await xfe(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(Dt(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})}}},[Dt]),jt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await bfe(n,r,i);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(Dt(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.`)})}}},[Dt]),Mt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await yfe(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(Dt(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})}}},[Dt]),Nt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await Ffe(n,r,i);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(Dt(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`))})}}},[Dt]),Pt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await Pfe(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(Dt(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})}}},[Dt]),Ft=(0,p.useCallback)(async(e,n,r)=>{try{let i=await _fe(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(Dt(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.`)})}}},[Dt]),It=(0,p.useCallback)(async(e,t)=>{pt(!0);try{let n=await vfe(e,t),r=bt.current;if(r&&r!==e)return;st(n),lt(null),_t(null)}catch(t){if(!Ye(t)){if(Dt(t))return;let n=bt.current;if(n&&n!==e)return;st(null),lt(Z9(t,`Unable to load project target options.`))}}finally{t?.aborted||pt(!1)}},[Dt]),Lt=(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)},[]),Rt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await gfe(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&&(Ft(e,a,n),o?.active_target_kind===`bundle`&&It(a,n),Mt(e,a,n),Pt(e,a,n),At(e,a,n))}catch(n){if(!Ye(n)){if(Dt(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.`)})}}},[Dt,Mt,Ft,It,Pt,At]),zt=(0,p.useCallback)(async e=>{t({status:`checking`}),r(`connecting`);try{let n=await dpe(e);if(n.authenticated&&n.csrf_token){r(`connecting`),t(Q9(n.csrf_token)),Rt(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.`)})}},[Rt]),Bt=(0,p.useCallback)((e,n,i)=>{r(`connecting`),t(Q9(e)),Rt(e,i,n)},[Rt]);(0,p.useEffect)(()=>{let e=new AbortController;if(window.location.pathname===`/mobile/pair`){let n=Ope();return kpe(),n?(t({status:`pairing`}),fpe(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 zt(e.signal),()=>e.abort()},[Bt,zt]);let Vt=e.status===`authenticated`?e.csrfToken:null,Ht=e.status===`authenticated`?e.selectedProjectId:null,Ut=e.status===`authenticated`?e.selectedChatSessionId:null,Wt=e.status===`authenticated`?e.selectedBundleId:null,Gt=e.status===`authenticated`?e.selectedTicketId:null,Kt=e.status===`authenticated`?e.selectedSpecSessionId:null,qt=e.status===`authenticated`?e.projects?.find(t=>t.id===e.selectedProjectId)??null:null,Jt=e.status===`authenticated`?e.chatSessionDetail:null,Yt=e.status===`authenticated`?e.bundleDetail:null,Xt=e.status===`authenticated`?e.ticketDetail:null,Zt=e.status===`authenticated`?e.specSessionDetail:null,Qt=C9(qt,ot),$t=ft&&(!qt||qt.active_target_kind===`bundle`),en=gpe(),tn=Jt?.tool??`opencode`,nn=Zt?.tool??`opencode`,rn=!!z9(Jt?.messages),an=!!z9(Zt?.messages),on=!!z9(Xt?.messages),sn=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:z?`Wait for the chat mode change before sending another prompt.`:Jt?.agent_status===`running`?`Stop or wait for the current response before sending another prompt.`:rn?vC.t(`common:questionSet.waitForResolution`):null,cn=!!(Jt&&fX(Jt,rn)),ln=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:me?`Wait for the spec mode change before sending another prompt.`:Zt?.agent_status===`running`?`Stop or wait for the current response before sending another prompt.`:an?vC.t(`common:questionSet.waitForResolution`):null,un=!en&&(o===`tickets`&&(f&&!!Gt||u&&!!Wt)||o===`chats`&&h||o===`spec`&&ee);(0,p.useEffect)(()=>{bt.current=Ht},[Ht]),(0,p.useEffect)(()=>{Ht||(st(null),lt(null),_t(null),dt(!1),pt(!1),ht(!1))},[Ht]),(0,p.useEffect)(()=>{xt.current=Ut},[Ut]),(0,p.useEffect)(()=>{St.current=Wt},[Wt]),(0,p.useEffect)(()=>{Ct.current=Gt},[Gt]),(0,p.useEffect)(()=>{wt.current=Kt},[Kt]),(0,p.useEffect)(()=>{if(!Vt||!Ht){M([]),P([]),I(!1);return}if(!(tn===`opencode`||Xt?.tool===`opencode`||nn===`opencode`)){M([]),P([]),I(!1);return}let e=new AbortController;return I(!0),Promise.all([qfe(`opencode`,e.signal),Jfe(`opencode`,Ht,e.signal)]).then(([e,t])=>{M(e),P(t)}).catch(e=>{Dt(e)||Ye(e)||(M([]),P([]))}).finally(()=>{e.signal.aborted||I(!1)}),()=>e.abort()},[Vt,tn,Dt,Ht,Xt?.tool,nn]),(0,p.useEffect)(()=>{if(tn!==`opencode`){E(``),O(``),A([]);return}E(Jt?.model??qt?.helper_model??``),O(Jt?.variant??qt?.helper_variant??``),A(Jt?.skills??[])},[tn,Jt?.id,Jt?.model,Jt?.skills,Jt?.variant,qt?.helper_model,qt?.helper_variant]),(0,p.useEffect)(()=>{Jt?.mode&&w(Jt.mode)},[Jt?.id,Jt?.mode]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===T)??null;O(t=>e?e.variants.includes(t)?t:``:t)},[j,T]),(0,p.useEffect)(()=>{Ne(``),He(null),Pe(Xt?.model??``),Ie(Xt?.variant??``),Re(Xt?.skills??[])},[Xt?.id,Xt?.model,Xt?.skills,Xt?.variant]),(0,p.useEffect)(()=>{Je(``),Y(null)},[Yt?.bundle.id]),(0,p.useEffect)(()=>{if(nn!==`opencode`){se(``),le(``),de([]);return}se(Zt?.model??qt?.helper_model??``),le(Zt?.variant??qt?.helper_variant??``),de(Zt?.skills??[])},[nn,qt?.helper_model,qt?.helper_variant,Zt?.id,Zt?.model,Zt?.skills,Zt?.variant]),(0,p.useEffect)(()=>{Zt?.mode&&ae(Zt.mode)},[Zt?.id,Zt?.mode]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===oe)??null;le(t=>e?e.variants.includes(t)?t:``:t)},[j,oe]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===q)??null;Ie(t=>e?e.variants.includes(t)?t:``:t)},[j,q]),(0,p.useEffect)(()=>{if(!Vt)return;let e=hpe();a(e),r(`connecting`);let t=()=>{let e=bt.current,t=xt.current,n=St.current,r=Ct.current,i=wt.current;Rt(Vt,void 0,e),e&&(Ft(Vt,e),Mt(Vt,e),Pt(Vt,e),At(Vt,e)),e&&t&&jt(Vt,e,t),e&&n&&kt(Vt,e,n),e&&r&&Ot(Vt,e,r),e&&i&&Nt(Vt,e,i)},n=()=>{r(`connected`),t()},i=()=>{r(`reconnecting`)},o=()=>{r(`unavailable`)},s=()=>{Rt(Vt,void 0,bt.current)},c=(e=null)=>{let t=bt.current;t&&(e?.project_id&&e.project_id!==t||Ft(Vt,t))},l=(e=null)=>{let t=bt.current;t&&(e?.project_id&&e.project_id!==t||Mt(Vt,t))},u=(e=null)=>{let t=bt.current;t&&(e?.project_id&&e.project_id!==t||At(Vt,t))},d=(e=null)=>{let t=bt.current,n=xt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||jt(Vt,t,n)},f=(e=null)=>{let t=bt.current,n=Ct.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Ot(Vt,t,n)},p=(e=null)=>{let t=bt.current,n=St.current;!t||!n||e?.project_id&&e.project_id!==t||kt(Vt,t,n)},m=(e=null)=>{let t=bt.current;t&&(e?.project_id&&e.project_id!==t||Pt(Vt,t))},h=(e=null)=>{let t=bt.current,n=wt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Nt(Vt,t,n)};return e.on(`connect`,n),e.on(`disconnect`,i),e.on(`connect_error`,o),e.on(`ticket:created`,c),e.on(`ticket:created`,u),e.on(`ticket:updated`,c),e.on(`ticket:updated`,u),e.on(`ticket:updated`,p),e.on(`ticket:updated`,f),e.on(`ticket:deleted`,s),e.on(`ticket:deleted`,u),e.on(`ticket:deleted`,p),e.on(`ticket-dependency:created`,c),e.on(`ticket-dependency:deleted`,c),e.on(`chat-session:created`,l),e.on(`chat-session:updated`,l),e.on(`chat-session:updated`,d),e.on(`chat-session:deleted`,l),e.on(`spec-session:created`,m),e.on(`spec-session:updated`,m),e.on(`spec-session:updated`,h),e.on(`spec-session:deleted`,m),()=>{e.off(`connect`,n),e.off(`disconnect`,i),e.off(`connect_error`,o),e.off(`ticket:created`,c),e.off(`ticket:created`,u),e.off(`ticket:updated`,c),e.off(`ticket:updated`,u),e.off(`ticket:updated`,p),e.off(`ticket:updated`,f),e.off(`ticket:deleted`,s),e.off(`ticket:deleted`,u),e.off(`ticket:deleted`,p),e.off(`ticket-dependency:created`,c),e.off(`ticket-dependency:deleted`,c),e.off(`chat-session:created`,l),e.off(`chat-session:updated`,l),e.off(`chat-session:updated`,d),e.off(`chat-session:deleted`,l),e.off(`spec-session:created`,m),e.off(`spec-session:updated`,m),e.off(`spec-session:updated`,h),e.off(`spec-session:deleted`,m),e.disconnect(),a(null)}},[Vt,kt,jt,Mt,Ft,Rt,Nt,Pt,Ot,At]),(0,p.useEffect)(()=>{Wt||d(!1)},[Wt]),(0,p.useEffect)(()=>{Gt||m(!1)},[Gt]);let dn=()=>{zt()},fn=e=>{s(e),d(!1),m(!1),g(!1),te(!1),yt(null)},pn=()=>{l(!0)},mn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(_t(null),dt(!0),!ot&&!ft&&It(e.selectedProjectId))},hn=()=>{e.status===`authenticated`&&(v(!0),mpe(e.csrfToken).then(()=>t($9())).catch(e=>{Dt(e)||t({status:`error`,message:Z9(e,`Logout failed. Mobile access may have already been revoked from desktop Archon.`)})}).finally(()=>v(!1)))},gn=()=>{if(e.status!==`pairing_confirmation`||y)return;let n=e.payload;b(!0),t({...e,error:null}),ppe(n).then(e=>{if(e.authenticated&&e.csrf_token){window.history.replaceState({},``,`/mobile`),Bt(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(()=>b(!1))},_n=()=>{window.history.replaceState({},``,`/mobile`),t($9())},vn=()=>{e.status===`authenticated`&&(t({...e,projects:null,projectError:null}),Rt(e.csrfToken))},yn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,projectSummary:null,projectSummaryError:null}),Ft(e.csrfToken,e.selectedProjectId))},bn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(st(null),lt(null),_t(null),It(e.selectedProjectId))},xn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),Mt(e.csrfToken,e.selectedProjectId))},Sn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||(t({...e,chatSessionDetail:null,chatSessionDetailError:null}),jt(e.csrfToken,e.selectedProjectId,e.selectedChatSessionId))},Cn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),At(e.csrfToken,e.selectedProjectId))},wn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||(t({...e,ticketDetail:null,ticketDetailError:null}),Ot(e.csrfToken,e.selectedProjectId,e.selectedTicketId))},Tn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||(t({...e,bundleDetail:null,bundleDetailError:null}),kt(e.csrfToken,e.selectedProjectId,e.selectedBundleId))},En=n=>{if(e.status!==`authenticated`)return;let r=e.projects?.find(e=>e.id===n)??null;bt.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}),Te(null),De(null),ke(null),je(null),W(null),je(null),ye(null),Y(null),st(null),lt(null),_t(null),l(!1),dt(!1),d(!1),m(!1),g(!1),te(!1),at(`transcript`),yt(null),s(`overview`),Ft(e.csrfToken,n),r?.active_target_kind===`bundle`&&It(n),Mt(e.csrfToken,n),Pt(e.csrfToken,n),At(e.csrfToken,n)},Dn=async t=>{if(!(e.status!==`authenticated`||!e.selectedProjectId)){ht(!0),_t(null);try{Lt(await h9(e.selectedProjectId,e.csrfToken,{kind:`bundle`,bundle_id:t})),dt(!1),Ft(e.csrfToken,e.selectedProjectId),It(e.selectedProjectId)}catch(e){if(Dt(e))return;_t(Z9(e,`Unable to update the project target right now.`))}finally{ht(!1)}}},On=async(t,n={})=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;ht(!0),_t(null);let r=r=>h9(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 Ge&&e.status===409&&e.message===M9){if(!window.confirm(`${M9}\n\nSwitch anyway?`))return;t=await r(!0)}else throw e}Lt(t),dt(!1),Ft(e.csrfToken,e.selectedProjectId),It(e.selectedProjectId)}catch(e){if(Dt(e))return;_t(Z9(e,`Unable to update the project target right now.`))}finally{ht(!1)}},kn=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:n,chatSessionDetail:null,chatSessionDetailError:null}),W(null),$e(e=>e+1),g(!0),s(`chats`),jt(e.csrfToken,e.selectedProjectId,n))},An=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),W(null),S(``),$e(e=>e+1),g(!0),s(`chats`))},jn=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedBundleId:n,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),Te(null),De(null),je(null),Y(null),yt(null),at(`transcript`),tt(e=>e+1),d(!0),m(!1),s(`tickets`),kt(e.csrfToken,e.selectedProjectId,n))},Mn=(n,r)=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedTicketId:n,ticketDetail:null,ticketDetailError:null}),yt(r),rt(e=>e+1),d(r!==null),m(!0),s(`tickets`),Ot(e.csrfToken,e.selectedProjectId,n))},Nn=()=>{g(!1)},Pn=async n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return null;if(!e.chatSessionDetail||!e.selectedChatSessionId)return w(n),null;if(e.chatSessionDetail.mode===n||z||rn)return null;let r=e.selectedProjectId,i=e.selectedChatSessionId,a=e.csrfToken;B(!0),W(null);try{let e=await Mfe(r,i,a,{mode:n});return w(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 Dt(e)||W(Z9(e,`Unable to update the chat mode right now.`)),null}finally{B(!1)}},Fn=()=>{if(e.status===`authenticated`&&vt&&e.selectedBundleId===vt){t({...e,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),m(!1),d(!0),yt(null);return}yt(null),m(!1)},In=()=>{d(!1)},Ln=e=>{let t=j.find(t=>t.id===e)??null;E(e),O(e=>t&&t.variants.includes(e)?e:``)},Rn=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Vn())},zn=(e,n,r)=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==e||t.selectedChatSessionId!==n?t:{...t,chatSessions:t.chatSessions?.map(e=>e.id===r.id?r:e)??t.chatSessions,chatSessionDetail:r,chatSessionDetailError:null})},Bn=(n,r,i=e.status===`authenticated`?e.chatSessionDetail:null)=>{if(e.status!==`authenticated`||!e.selectedProjectId||L||sn)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=tn===`opencode`&&T?T:null,u=tn===`opencode`&&T&&D?D:null,d=tn===`opencode`?k:[],f=performance.now();Tt.current+=1;let p=`mobile-chat:${Tt.current}`;i&&K({parentType:`chat`,parentId:i.id,turnKey:p,startedAt:f}),W(null),R(!0);let m=e=>Afe(o,e.id,c,{instruction:a,tool:e.tool,model:l,variant:u,skills:d});return(i?m(i):kfe(o,c,{mode:C,tool:tn,model:l,variant:u,skills:d}).then(m)).then(e=>(K({parentType:`chat`,parentId:e.id,turnKey:p,startedAt:f}),r&&S(``),g(!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}}),Mt(c,o),!0)).catch(async e=>{K(e=>e?.turnKey===p?null:e);let t=Ke(e,`chat_session`);return t&&s?zn(o,s,t):e instanceof Ge&&e.status===409&&s&&await jt(c,o,s),Dt(e)||W(Z9(e,`Unable to send the chat prompt.`)),!1}).finally(()=>{R(!1)})},Vn=()=>{x.trim()&&Bn(x,!0)},Hn=async()=>{let t=e.status===`authenticated`?e.chatSessionDetail:null;if(!(!t||!fX(t,rn)||Et.current||L||sn)){Et.current=!0;try{let e=await Pn(`build`);if(!e)return;await Bn(dX,!1,e)}finally{Et.current=!1}}},Un=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=cY({parentType:`chat`,parentId:a,setId:r.set_id});W(null);try{let e=await jfe(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 Ge&&e.status===409){uY(s);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?zn(i,a,t):await jt(o,i,a)}throw Dt(e)||W(Z9(e,`Unable to resolve the chat questions.`)),e}},Wn=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||V)return;let t=e.selectedProjectId,n=e.selectedChatSessionId;W(null),H(n),K(e=>e?.parentId===n?null:e),Nfe(t,n,e.csrfToken).then(()=>jt(e.csrfToken,t,n)).catch(e=>{Dt(e)||W(Z9(e,`Unable to stop the chat response.`))}).finally(()=>H(null))},Gn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),Pt(e.csrfToken,e.selectedProjectId))},Kn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||(t({...e,specSessionDetail:null,specSessionDetailError:null}),Nt(e.csrfToken,e.selectedProjectId,e.selectedSpecSessionId))},qn=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:n,specSessionDetail:null,specSessionDetailError:null}),ye(null),Ce(e=>e+1),te(!0),s(`spec`),Nt(e.csrfToken,e.selectedProjectId,n))},Jn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),ye(null),re(``),Ce(e=>e+1),te(!0),s(`spec`))},Yn=()=>{te(!1)},Xn=n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;if(!e.specSessionDetail||!e.selectedSpecSessionId){ae(n);return}if(e.specSessionDetail.mode===n||me||an)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken;he(!0),ye(null),Rfe(r,i,a,{mode:n}).then(e=>{ae(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=>{Dt(e)||ye(Z9(e,j9(`specDetail.modeError`)))}).finally(()=>he(!1))},Zn=e=>{let t=j.find(t=>t.id===e)??null;se(e),le(e=>t&&t.variants.includes(e)?e:``)},Qn=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),er())},$n=(e,n,r)=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==e||t.selectedSpecSessionId!==n?t:{...t,specSessions:t.specSessions?.map(e=>e.id===r.id?r:e)??t.specSessions,specSessionDetail:r,specSessionDetailError:null})},er=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||fe||ln)return;let n=ne.trim();if(!n)return;let r=e.selectedProjectId,i=e.specSessionDetail?.id??null,a=e.csrfToken,o=nn===`opencode`&&oe?oe:null,s=nn===`opencode`&&oe&&ce?ce:null,c=nn===`opencode`?ue:[],l=performance.now();Tt.current+=1;let u=`mobile-spec:${Tt.current}`;e.specSessionDetail&&xe({parentType:`spec`,parentId:e.specSessionDetail.id,turnKey:u,startedAt:l}),ye(null),pe(!0);let d=e=>d9(r,e.id,a,{instruction:n,tool:e.tool,model:o,variant:s,skills:c});(e.specSessionDetail?d(e.specSessionDetail):Ife(r,a,{mode:ie,tool:nn,model:o,variant:s,skills:c}).then(d)).then(e=>{xe({parentType:`spec`,parentId:e.id,turnKey:u,startedAt:l}),re(``),te(!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}}),Pt(a,r)}).catch(e=>{xe(e=>e?.turnKey===u?null:e);let t=e instanceof Ge&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&i&&$n(r,i,t),!Dt(e)&&ye(Z9(e,j9(`specDetail.sendError`)))}).finally(()=>pe(!1))},tr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||fe)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken,o=e.specSessionDetail?.tool??nn,s=nn===`opencode`&&oe?oe:null,c=nn===`opencode`&&oe&&ce?ce:null,l=nn===`opencode`?ue:[],u=performance.now();Tt.current+=1;let d=`mobile-spec:${Tt.current}`;xe({parentType:`spec`,parentId:i,turnKey:d,startedAt:u}),ye(null),pe(!0),d9(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=>{xe(e=>e?.turnKey===d?null:e);let t=e instanceof Ge&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&$n(r,i,t),!Dt(e)&&ye(Z9(e,j9(`specDetail.sendError`)))}).finally(()=>pe(!1))},nr=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=cY({parentType:`spec`,parentId:a,setId:r.set_id});ye(null);try{let e=await Lfe(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 Ge&&e.status===409){uY(s);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?$n(i,a,t):await Nt(o,i,a)}throw Dt(e)||ye(Z9(e,`Unable to resolve the spec questions.`)),e}},rr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||ge)return;let t=e.selectedProjectId,n=e.selectedSpecSessionId;ye(null),_e(n),xe(e=>e?.parentId===n?null:e),zfe(t,n,e.csrfToken).then(()=>Nt(e.csrfToken,t,n)).catch(e=>{Dt(e)||ye(Z9(e,j9(`specDetail.stopError`)))}).finally(()=>_e(null))},ir=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||Oe||(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`?f9(r,i,a,`build`):n===`review`?f9(r,i,a,`review`):n===`run`?Bfe(r,i,a):n===`stop-run`?Vfe(r,i,a):n===`pause-build`?p9(r,i,a):m9(r,i,a);ke(n),je(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}}),Ft(a,r),At(a,r),Ot(a,r,i)}).catch(e=>{Dt(e)||je(Z9(e,`Unable to update this ticket from mobile.`))}).finally(()=>ke(null))},ar=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||we)return;let r=e.selectedProjectId,i=e.selectedBundleId,a=e.csrfToken,o=e.bundleDetail,{runningBuildTicketId:s,resumableBuildTicketId:c}=L9(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:P9(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`?Dfe(r,i,a):n===`review`?Ofe(r,i,a):n===`pause-build`?s?p9(r,s,a):null:c?m9(r,c,a):null;d&&(Te(n),De(null),d.then(e=>{`tickets`in e?l(e):u(e),Ft(a,r),At(a,r),kt(a,r,i)}).catch(e=>{Dt(e)||De(Z9(e,`Unable to update this bundle from mobile.`))}).finally(()=>Te(null)))},or=e=>{let t=j.find(t=>t.id===e)??null;Pe(e),Ie(e=>t&&t.variants.includes(e)?e:``)},sr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),cr())},cr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||!e.ticketDetail||ze||on)return;let n=Me.trim();if(!n)return;let r=e.selectedProjectId,i=e.ticketDetail,a=e.csrfToken,o=V3(i,{model:q||null,variant:Fe||null,skills:Le});Tt.current+=1;let s={parentType:`ticket`,parentId:i.id,turnKey:`mobile-ticket:${Tt.current}`,startedAt:performance.now()};We(s);let c=()=>i.state===`plan`?Ufe(r,i.id,a,n):Gfe(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}})};Be(!0),He(null),(async()=>{o.shouldPersist&&l(await Hfe(r,i.id,a,{model:o.model,variant:o.variant,skills:o.skills})),l(await c()),Ne(``),At(a,r),Ot(a,r,i.id)})().catch(async e=>{We(e=>e?.turnKey===s.turnKey?null:e);let t=Ke(e,`ticket`);t?l(t):e instanceof Ge&&e.status===409&&await Ot(a,r,i.id),!Dt(e)&&He(Z9(e,`Unable to send the ticket follow-up.`))}).finally(()=>Be(!1))},lr=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=cY({parentType:`ticket`,parentId:a,setId:r.set_id});He(null);try{let e=await Wfe(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 Ge&&e.status===409){uY(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 Ot(o,i,a)}throw Dt(e)||He(Z9(e,`Unable to resolve the ticket questions.`)),e}},ur=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),dr())},dr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||J)return;let n=qe.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:P9(t.tickets,e),bundleDetail:e,bundleDetailError:null})};Xe(!0),Y(null),Kfe(r,i,a,n).then(e=>{o(e),Je(``),At(a,r),kt(a,r,i)}).catch(e=>{Dt(e)||Y(Z9(e,`Unable to send the bundle follow-up.`))}).finally(()=>Xe(!1))},fr=(0,p.useCallback)(async(e,t,n)=>{try{return await Cfe(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]),pr=(0,p.useCallback)(async(e,t,n)=>{try{return await wfe(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]),mr=(0,p.useCallback)(async(e,t,n)=>{try{return await Tfe(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]);return e.status===`checking`?(0,X.jsx)(b9,{title:`Checking mobile session`,description:`Archon is validating this browser before showing project controls.`}):e.status===`pairing`?(0,X.jsx)(b9,{title:`Checking pairing link`,description:`Keep this page open while Archon verifies the one-time pairing link.`}):e.status===`pairing_confirmation`?(0,X.jsxs)(b9,{title:`Compare pairing code`,description:`Confirm this code matches the desktop dialog before pairing this phone.`,children:[(0,X.jsx)(bC,{className:`border-primary/25 bg-primary/10 shadow-none`,children:(0,X.jsxs)(TC,{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 `,Ape(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:y,onClick:gn,children:y?`Pairing...`:`Pair this phone`}),(0,X.jsx)(Q,{variant:`outline`,size:`lg`,disabled:y,onClick:_n,children:`Cancel`})]})]}):e.status===`unauthenticated`?(0,X.jsx)(b9,{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:dn,children:`Retry`})}):e.status===`error`?(0,X.jsx)(b9,{title:`Mobile access unavailable`,description:e.message,children:(0,X.jsx)(Q,{onClick:dn,children:`Retry`})}):(0,X.jsx)(Iq,{socket:i??void 0,fetchTicketRuns:fr,fetchChatRuns:pr,fetchSpecRuns:mr,children:(0,X.jsxs)(`main`,{className:Z(`bg-background text-foreground`,un?`flex h-[100dvh] flex-col overflow-hidden`:`min-h-screen`),children:[(0,X.jsx)(spe,{open:c,projects:e.projects,selectedProjectId:e.selectedProjectId,error:e.projectError,onOpenChange:l,onSelectProject:En,onRetry:vn}),(0,X.jsx)(cpe,{open:ut,project:qt,targetOptions:ot,error:gt??ct,isLoading:ft,isSubmitting:mt,onOpenChange:dt,onRetry:bn,onSelectBundle:e=>{Dn(e)},onSelectRepoRoot:(e,t)=>{On(e,t)}}),(0,X.jsx)(npe,{selectedProject:qt,targetLabel:Qt,isTargetLoading:$t,isTargetDisabled:!Ht,connectionState:n,onOpenProjects:pn,onOpenTargetSelector:mn}),un?(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:[o===`tickets`?(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:f&&e.selectedTicketId?(0,X.jsx)(X9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:nt,error:e.ticketDetailError,actionState:Oe,actionError:Ae,followUpPrompt:Me,followUpSelectedModel:q,followUpSelectedVariant:Fe,followUpSelectedSkills:Le,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSendingFollowUp:ze,liveResponseTiming:Xt?.agent_status===`running`&&Ue?.parentId===Xt.id?Ue:null,followUpError:Ve,onBack:Fn,onRetry:wn,onAction:ir,onFollowUpPromptChange:Ne,onFollowUpModelChange:or,onFollowUpVariantChange:Ie,onFollowUpSkillsChange:Re,onFollowUpKeyDown:sr,onFollowUpSubmit:cr,onResolveQuestionSet:lr,isLargeScreen:!1}):(0,X.jsx)(K9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:et,mobileDetailView:it,error:e.bundleDetailError,actionState:we,actionError:Ee,followUpPrompt:qe,isSendingFollowUp:J,followUpError:Ze,availableModels:j,onBack:In,onRetry:Tn,onAction:ar,onDetailViewChange:at,onSelectTicket:Mn,onFollowUpPromptChange:Je,onFollowUpKeyDown:ur,onFollowUpSubmit:dr,isLargeScreen:!1})}):null,o===`chats`?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(q9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:Qe,error:e.chatSessionDetailError,isStopping:V===e.selectedChatSessionId,composerMode:e.chatSessionDetail?.mode??C,composerTool:tn,prompt:x,selectedModel:T,selectedVariant:D,selectedSkills:k,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:L,liveResponseTiming:Jt?.agent_status===`running`&&G?.parentId===Jt.id?G:null,isUpdatingMode:z,showStartBuilding:cn,composerDisabledReason:sn,onBack:Nn,onRetry:Sn,onStop:Wn,onModeChange:Pn,onStartBuilding:Hn,onPromptChange:S,onModelChange:Ln,onVariantChange:O,onSkillsChange:A,onPromptKeyDown:Rn,onSubmit:Vn,onResolveQuestionSet:Un,isLargeScreen:!1}),U?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:U}):null]}):null,o===`spec`?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(Y9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:Se,error:e.specSessionDetailError,isStopping:ge===e.selectedSpecSessionId,composerMode:e.specSessionDetail?.mode??ie,composerTool:nn,prompt:ne,selectedModel:oe,selectedVariant:ce,selectedSkills:ue,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:fe,liveResponseTiming:Zt?.agent_status===`running`&&be?.parentId===Zt.id?be:null,isUpdatingMode:me,composerDisabledReason:ln,onBack:Yn,onRetry:Kn,onStop:rr,onModeChange:Xn,onPromptChange:re,onModelChange:Zn,onVariantChange:le,onSkillsChange:de,onPromptKeyDown:Qn,onSubmit:er,onSubmitAnswer:tr,onResolveQuestionSet:nr,isLargeScreen:!1}),ve?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:ve}):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)(tpe,{status:n,onRetry:dn}),o===`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)(x9,{title:`Projects unavailable`,description:e.projectError,action:(0,X.jsx)(Q,{variant:`warning`,onClick:vn,children:`Retry projects`})}):e.selectedProjectId&&!e.projectSummary&&!e.projectSummaryError?(0,X.jsx)(_pe,{}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(xpe,{selectedProjectId:e.selectedProjectId,summary:e.projectSummary,tickets:e.tickets,error:e.projectSummaryError,chatSessions:e.chatSessions,chatSessionDetail:e.chatSessionDetail,onRetry:yn,onOpenTickets:()=>fn(`tickets`),onOpenChats:()=>fn(`chats`),onOpenSpec:()=>fn(`spec`)}),(0,X.jsx)(vpe,{isLoggingOut:_,onLogout:hn})]})}):null,o===`tickets`?en?(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,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:Cn,onSelectBundle:jn,onSelectTicket:Mn})}),(0,X.jsx)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:f&&e.selectedTicketId?(0,X.jsx)(X9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:nt,error:e.ticketDetailError,actionState:Oe,actionError:Ae,followUpPrompt:Me,followUpSelectedModel:q,followUpSelectedVariant:Fe,followUpSelectedSkills:Le,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSendingFollowUp:ze,liveResponseTiming:Xt?.agent_status===`running`&&Ue?.parentId===Xt.id?Ue:null,followUpError:Ve,onBack:Fn,onRetry:wn,onAction:ir,onFollowUpPromptChange:Ne,onFollowUpModelChange:or,onFollowUpVariantChange:Ie,onFollowUpSkillsChange:Re,onFollowUpKeyDown:sr,onFollowUpSubmit:cr,onResolveQuestionSet:lr,isLargeScreen:!0}):(0,X.jsx)(K9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:et,mobileDetailView:it,error:e.bundleDetailError,actionState:we,actionError:Ee,followUpPrompt:qe,isSendingFollowUp:J,followUpError:Ze,availableModels:j,onBack:In,onRetry:Tn,onAction:ar,onDetailViewChange:at,onSelectTicket:Mn,onFollowUpPromptChange:Je,onFollowUpKeyDown:ur,onFollowUpSubmit:dr,isLargeScreen:!0})})]}):(0,X.jsx)(A9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:Cn,onSelectBundle:jn,onSelectTicket:Mn}):null,o===`chats`?en?(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)(F9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:xn,onOpenNewChat:An,onSelectChat:kn})}),(0,X.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,X.jsx)(q9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:Qe,error:e.chatSessionDetailError,isStopping:V===e.selectedChatSessionId,composerMode:e.chatSessionDetail?.mode??C,composerTool:tn,prompt:x,selectedModel:T,selectedVariant:D,selectedSkills:k,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:L,liveResponseTiming:Jt?.agent_status===`running`&&G?.parentId===Jt.id?G:null,isUpdatingMode:z,showStartBuilding:cn,composerDisabledReason:sn,onBack:Nn,onRetry:Sn,onStop:Wn,onModeChange:Pn,onStartBuilding:Hn,onPromptChange:S,onModelChange:Ln,onVariantChange:O,onSkillsChange:A,onPromptKeyDown:Rn,onSubmit:Vn,onResolveQuestionSet:Un,isLargeScreen:!0}),U?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:U}):null]})]}):(0,X.jsx)(F9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:xn,onOpenNewChat:An,onSelectChat:kn}):null,o===`spec`?en?(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:Gn,onOpenNewSpec:Jn,onSelectSpec:qn})}),(0,X.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,X.jsx)(Y9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:Se,error:e.specSessionDetailError,isStopping:ge===e.selectedSpecSessionId,composerMode:e.specSessionDetail?.mode??ie,composerTool:nn,prompt:ne,selectedModel:oe,selectedVariant:ce,selectedSkills:ue,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:fe,liveResponseTiming:Zt?.agent_status===`running`&&be?.parentId===Zt.id?be:null,isUpdatingMode:me,composerDisabledReason:ln,onBack:Yn,onRetry:Kn,onStop:rr,onModeChange:Xn,onPromptChange:re,onModelChange:Zn,onVariantChange:le,onSkillsChange:de,onPromptKeyDown:Qn,onSubmit:er,onSubmitAnswer:tr,onResolveQuestionSet:nr,isLargeScreen:!0}),ve?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:ve}):null]})]}):(0,X.jsx)(J9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:Gn,onOpenNewSpec:Jn,onSelectSpec:qn}):null]})}),un?null:(0,X.jsx)(rpe,{activeSection:o,onChange:fn})]})})},Npe=({socket:e=tC,children:t})=>(0,X.jsx)(kq.Provider,{value:e,children:t}),Ppe=()=>typeof window<`u`&&window.location.pathname.startsWith(`/mobile`),Fpe=()=>{let e=Ppe();return zb(e?null:tC),(0,X.jsx)(Ue,{i18n:vC,children:(0,X.jsx)(nt,{children:(0,X.jsxs)(Npe,{children:[e&&(0,X.jsx)(Mpe,{}),!e&&(0,X.jsx)(Iq,{children:(0,X.jsx)(Rle,{children:(0,X.jsx)(pfe,{})})})]})})})};document.documentElement.classList.add(`dark`),document.documentElement.style.colorScheme=`dark`,(0,f.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(Fpe,{}));export{Lt as $,ub as A,K_ as B,tC as C,lb as D,pb as E,Fv as F,Z_ as G,X_ as H,Pv as I,Z as J,$_ as K,Av as L,Vv as M,zv as N,db as O,Rv as P,Bt as Q,hv as R,rC as S,Sb as T,ev as U,J_ as V,Q_ as W,zt as X,Dn as Y,Rt as Z,BC as _,T3 as a,Y as at,vC as b,kG as c,dw as d,tt as et,$C as f,RC as g,tw as h,D3 as i,Ze as it,$ as j,fb as k,gw as l,ew as m,T8 as n,qe as nt,E3 as o,He as ot,nw as p,Q as q,I3 as r,Ye as rt,Aq as s,c as st,n7 as t,Ge as tt,fw as u,zC as v,rx as w,cC as x,yC as y,tv as z};