@straiffi/archon 1.8.18 → 1.8.19

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 (68) hide show
  1. package/dist/client/assets/{ActivityView-nPkZZ0JB.js → ActivityView-BaoAJ8JM.js} +1 -1
  2. package/dist/client/assets/{GitHubActionsDialog-Bo-6r-yS.js → GitHubActionsDialog-D7iT7xTt.js} +1 -1
  3. package/dist/client/assets/{VerificationDialog-DXoUeYip.js → VerificationDialog-ayyiyvGt.js} +1 -1
  4. package/dist/client/assets/{architectureDiagram-3BPJPVTR-DCkl8h2Z.js → architectureDiagram-3BPJPVTR-8hDT9YFW.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-GPEHLZMM-CyiRWLEs.js → blockDiagram-GPEHLZMM-DrSgZhh1.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-AAUBKEIU-DXvU6VXI.js → c4Diagram-AAUBKEIU-BjowoLmV.js} +1 -1
  7. package/dist/client/assets/channel-CGc3oFdr.js +1 -0
  8. package/dist/client/assets/{chunk-2J33WTMH-BKgS-yt3.js → chunk-2J33WTMH-BwZDhXTf.js} +1 -1
  9. package/dist/client/assets/{chunk-3OPIFGDE-QtuCD2Q2.js → chunk-3OPIFGDE-CVc43Ukf.js} +1 -1
  10. package/dist/client/assets/{chunk-5ZQYHXKU-D39gTBWf.js → chunk-5ZQYHXKU-D5FDCGhy.js} +1 -1
  11. package/dist/client/assets/{chunk-727SXJPM-CrROa9vl.js → chunk-727SXJPM-CJSR5Mh2.js} +1 -1
  12. package/dist/client/assets/{chunk-AQP2D5EJ-CzCE7Ly-.js → chunk-AQP2D5EJ-B6kTsClX.js} +1 -1
  13. package/dist/client/assets/{chunk-CSCIHK7Q-8GC-E83m.js → chunk-CSCIHK7Q-C5UH_dAR.js} +1 -1
  14. package/dist/client/assets/{chunk-KSCS5N6A--w54oW-H.js → chunk-KSCS5N6A-D_rzcB2b.js} +1 -1
  15. package/dist/client/assets/{chunk-L5ZTLDWV-As7Y7CIE.js → chunk-L5ZTLDWV-CztP7jdd.js} +1 -1
  16. package/dist/client/assets/{chunk-LZXEDZCA-nQ3OKGDG.js → chunk-LZXEDZCA-wTLCL7Pg.js} +2 -2
  17. package/dist/client/assets/{chunk-ND2GUHAM-BXYfWf_t.js → chunk-ND2GUHAM-B5AHIrUy.js} +1 -1
  18. package/dist/client/assets/{chunk-NZK2D7GU-D8ju9Sx9.js → chunk-NZK2D7GU-D3MtrIk4.js} +1 -1
  19. package/dist/client/assets/{chunk-O5CBEL6O-BVLHEQ1H.js → chunk-O5CBEL6O-iIPXNV3t.js} +1 -1
  20. package/dist/client/assets/{chunk-WU5MYG2G-CngTiTFp.js → chunk-WU5MYG2G-Cwu-Oylq.js} +1 -1
  21. package/dist/client/assets/classDiagram-4FO5ZUOK-CBhybRSO.js +1 -0
  22. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-C9ErMU7v.js +1 -0
  23. package/dist/client/assets/{dagre-BM42HDAG-CQSaAIdi.js → dagre-BM42HDAG-D3wiIOnk.js} +1 -1
  24. package/dist/client/assets/{diagram-2AECGRRQ-BETIcP-k.js → diagram-2AECGRRQ-Bysb-ntU.js} +1 -1
  25. package/dist/client/assets/{diagram-5GNKFQAL-DkxvZt8V.js → diagram-5GNKFQAL-CtS_bpE5.js} +1 -1
  26. package/dist/client/assets/{diagram-KO2AKTUF-t-6dpc03.js → diagram-KO2AKTUF-_PI56fZq.js} +1 -1
  27. package/dist/client/assets/{diagram-LMA3HP47-CmB4LwSG.js → diagram-LMA3HP47-BNgWnFoz.js} +1 -1
  28. package/dist/client/assets/{diagram-OG6HWLK6-WJPdO1hb.js → diagram-OG6HWLK6-BM-wG_lJ.js} +1 -1
  29. package/dist/client/assets/{erDiagram-TEJ5UH35-Dazbp1kL.js → erDiagram-TEJ5UH35-BPqNBsVc.js} +1 -1
  30. package/dist/client/assets/{flowDiagram-I6XJVG4X-XkWw21cY.js → flowDiagram-I6XJVG4X-BgA6MiBD.js} +1 -1
  31. package/dist/client/assets/{ganttDiagram-6RSMTGT7-B95LBden.js → ganttDiagram-6RSMTGT7-BMDzgC7L.js} +1 -1
  32. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-E-ram2aT.js → gitGraphDiagram-PVQCEYII-C0cZUYmG.js} +1 -1
  33. package/dist/client/assets/{index-DBzMRUJD.js → index-Ci2Or91O.js} +6 -6
  34. package/dist/client/assets/{infoDiagram-5YYISTIA-Dg4XUTE_.js → infoDiagram-5YYISTIA-DelAWwhC.js} +1 -1
  35. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-fIaaz0nX.js → ishikawaDiagram-YF4QCWOH-D62h0NJG.js} +1 -1
  36. package/dist/client/assets/{journeyDiagram-JHISSGLW-BNhbQ3Fr.js → journeyDiagram-JHISSGLW-BXwYQf_j.js} +1 -1
  37. package/dist/client/assets/{kanban-definition-UN3LZRKU-UwtJCm6I.js → kanban-definition-UN3LZRKU-x5KfcIYo.js} +1 -1
  38. package/dist/client/assets/{line-Dhxm5enf.js → line-Blzshjst.js} +1 -1
  39. package/dist/client/assets/{mermaid-parser.core-CfSmOhjh.js → mermaid-parser.core-Dnu-fpL9.js} +1 -1
  40. package/dist/client/assets/{mermaid.core-C_NlQFLU.js → mermaid.core-BngDHztH.js} +3 -3
  41. package/dist/client/assets/{mindmap-definition-RKZ34NQL-DQtb9AMZ.js → mindmap-definition-RKZ34NQL-BRB9WnNL.js} +1 -1
  42. package/dist/client/assets/{pieDiagram-4H26LBE5-CK-pLy3h.js → pieDiagram-4H26LBE5-Ddzhxmp2.js} +1 -1
  43. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-DAyEK3JC.js → quadrantDiagram-W4KKPZXB-CWKRt2y6.js} +1 -1
  44. package/dist/client/assets/{requirementDiagram-4Y6WPE33-Ed6F4ODv.js → requirementDiagram-4Y6WPE33-D309qLEz.js} +1 -1
  45. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BO-89QCT.js → sankeyDiagram-5OEKKPKP-0Ukkluzd.js} +1 -1
  46. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-BS6h9l_o.js → sequenceDiagram-3UESZ5HK-DkvDbOkQ.js} +1 -1
  47. package/dist/client/assets/{stateDiagram-AJRCARHV-DsKt8LXj.js → stateDiagram-AJRCARHV-LRTZRjK3.js} +1 -1
  48. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BDLRoPbQ.js +1 -0
  49. package/dist/client/assets/{timeline-definition-PNZ67QCA-XCwwiASE.js → timeline-definition-PNZ67QCA-CTwwDhpg.js} +1 -1
  50. package/dist/client/assets/{vennDiagram-CIIHVFJN-ByKqNvGe.js → vennDiagram-CIIHVFJN-BqldUpJn.js} +1 -1
  51. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-CcBrW5Lm.js → wardleyDiagram-YWT4CUSO-DPCPZAsx.js} +1 -1
  52. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DWyh6Upq.js → xychartDiagram-2RQKCTM6-DWkIjgNu.js} +1 -1
  53. package/dist/client/index.html +1 -1
  54. package/dist/server/lib/agent.js +3 -0
  55. package/dist/server/lib/agent.js.map +1 -1
  56. package/dist/server/lib/claudeValidationOutput.js +62 -0
  57. package/dist/server/lib/claudeValidationOutput.js.map +1 -0
  58. package/dist/server/lib/executionEnvironmentRoutes.js +2 -0
  59. package/dist/server/lib/executionEnvironmentRoutes.js.map +1 -1
  60. package/dist/server/lib/executionEnvironmentValidation.js +68 -81
  61. package/dist/server/lib/executionEnvironmentValidation.js.map +1 -1
  62. package/dist/server/lib/parseJsonLines.js +25 -0
  63. package/dist/server/lib/parseJsonLines.js.map +1 -0
  64. package/package.json +1 -1
  65. package/dist/client/assets/channel-CIqVfhIu.js +0 -1
  66. package/dist/client/assets/classDiagram-4FO5ZUOK-B7Zu7Okr.js +0 -1
  67. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Co7nwA_j.js +0 -1
  68. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BkWiZIXx.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-C_NlQFLU.js","assets/chunk-O5CBEL6O-BVLHEQ1H.js","assets/src-BRjoYtUW.js","assets/chunk-BNv3lrIs.js","assets/chunk-5ZQYHXKU-D39gTBWf.js","assets/dist-CERhmQhR.js","assets/chunk-CSCIHK7Q-8GC-E83m.js","assets/chunk-3OPIFGDE-QtuCD2Q2.js","assets/chunk-L5ZTLDWV-As7Y7CIE.js","assets/chunk-NZK2D7GU-D8ju9Sx9.js","assets/rough.esm-BoTisKeL.js","assets/chunk-BSJP7CBP-DJ57XcV5.js","assets/chunk-KSCS5N6A--w54oW-H.js","assets/line-Dhxm5enf.js","assets/path-sMK4d_s9.js","assets/array-BNor45A1.js","assets/chunk-LZXEDZCA-nQ3OKGDG.js","assets/chunk-WU5MYG2G-CngTiTFp.js","assets/chunk-XPW4576I-DObFPxjB.js","assets/VerificationDialog-DXoUeYip.js","assets/GitHubActionsDialog-Bo-6r-yS.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BngDHztH.js","assets/chunk-O5CBEL6O-iIPXNV3t.js","assets/src-BRjoYtUW.js","assets/chunk-BNv3lrIs.js","assets/chunk-5ZQYHXKU-D5FDCGhy.js","assets/dist-CERhmQhR.js","assets/chunk-CSCIHK7Q-C5UH_dAR.js","assets/chunk-3OPIFGDE-CVc43Ukf.js","assets/chunk-L5ZTLDWV-CztP7jdd.js","assets/chunk-NZK2D7GU-D3MtrIk4.js","assets/rough.esm-BoTisKeL.js","assets/chunk-BSJP7CBP-DJ57XcV5.js","assets/chunk-KSCS5N6A-D_rzcB2b.js","assets/line-Blzshjst.js","assets/path-sMK4d_s9.js","assets/array-BNor45A1.js","assets/chunk-LZXEDZCA-wTLCL7Pg.js","assets/chunk-WU5MYG2G-Cwu-Oylq.js","assets/chunk-XPW4576I-DObFPxjB.js","assets/VerificationDialog-ayyiyvGt.js","assets/GitHubActionsDialog-D7iT7xTt.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},ee=[],te=-1;function z(e){return{current:e}}function B(e){0>te||(e.current=ee[te],ee[te]=null,te--)}function V(e,t){te++,ee[te]=e.current,e.current=t}var H=z(null),U=z(null),ne=z(null),re=z(null);function ie(e,t){switch(V(ne,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wd(t),e=Gd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function ae(){B(H),B(U),B(ne)}function oe(e){e.memoizedState!==null&&V(re,e);var t=H.current,n=Gd(t,e.type);t!==n&&(V(U,e),V(H,n))}function W(e){U.current===e&&(B(H),B(U)),re.current===e&&(B(re),tp._currentValue=R)}var se,ce;function le(e){if(se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);se=t&&t[1]||``,ce=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+se+e+ce}var ue=!1;function de(e,t){if(!e||ue)return``;ue=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -51,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`,ws=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xs(Cs).contentName}}.`;return p.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ts=Xo,Es=ns,Ds=is,Os=cs,ks=ps,As=hs,js=_s;function Ms(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 Ns(e){let[t,n]=p.useState(void 0);return mi(()=>{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 Ps=[`top`,`right`,`bottom`,`left`],Fs=Math.min,Is=Math.max,Ls=Math.round,Rs=Math.floor,zs=e=>({x:e,y:e}),Bs={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Vs(e,t,n){return Is(e,Fs(t,n))}function Hs(e,t){return typeof e==`function`?e(t):e}function Us(e){return e.split(`-`)[0]}function Ws(e){return e.split(`-`)[1]}function Gs(e){return e===`x`?`y`:`x`}function Ks(e){return e===`y`?`height`:`width`}function qs(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Js(e){return Gs(qs(e))}function Ys(e,t,n){n===void 0&&(n=!1);let r=Ws(e),i=Js(e),a=Ks(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ic(o)),[o,ic(o)]}function Xs(e){let t=ic(e);return[Zs(e),t,Zs(t)]}function Zs(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Qs=[`left`,`right`],$s=[`right`,`left`],ec=[`top`,`bottom`],tc=[`bottom`,`top`];function nc(e,t,n){switch(e){case`top`:case`bottom`:return n?t?$s:Qs:t?Qs:$s;case`left`:case`right`:return t?ec:tc;default:return[]}}function rc(e,t,n,r){let i=Ws(e),a=nc(Us(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Zs)))),a}function ic(e){let t=Us(e);return Bs[t]+e.slice(t.length)}function ac(e){return{top:0,right:0,bottom:0,left:0,...e}}function oc(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ac(e)}function sc(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 cc(e,t,n){let{reference:r,floating:i}=e,a=qs(t),o=Js(t),s=Ks(o),c=Us(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(Ws(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 lc(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}=Hs(t,e),p=oc(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=sc(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=sc(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 uc=50,dc=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:lc},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=cc(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<uc&&(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}=cc(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},fc=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}=Hs(e,t)||{};if(l==null)return{};let d=oc(u),f={x:n,y:r},p=Js(i),m=Ks(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=Fs(d[_],T),D=Fs(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Vs(O,A,k),M=!c.arrow&&Ws(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}}}),pc=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}=Hs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Us(r),_=qs(o),v=Us(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ic(o)]:Xs(o)),x=p!==`none`;!d&&x&&b.push(...rc(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=Ys(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==qs(t))||T.every(e=>qs(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=qs(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function mc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hc(e){return Ps.some(t=>e[t]>=0)}var gc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Hs(e,t);switch(i){case`referenceHidden`:{let e=mc(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:hc(e)}}}case`escaped`:{let e=mc(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:hc(e)}}}default:return{}}}}},_c=new Set([`left`,`top`]);async function vc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Us(n),s=Ws(n),c=qs(n)===`y`,l=_c.has(o)?-1:1,u=a&&c?-1:1,d=Hs(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 yc=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 vc(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}}}}},bc=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}=Hs(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=qs(Us(i)),p=Gs(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=Vs(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=Vs(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}}}}}},xc=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}=Hs(e,t),u={x:n,y:r},d=qs(i),f=Gs(d),p=u[f],m=u[d],h=Hs(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=_c.has(Us(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}=Hs(e,t),u=await o.detectOverflow(t,l),d=Us(i),f=Ws(i),p=qs(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Fs(h-u[g],v),x=Fs(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=Is(u.left,0),t=Is(u.right,0),n=Is(u.top,0),r=Is(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Is(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Is(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 wc(e){return Dc(e)?(e.nodeName||``).toLowerCase():`#document`}function Tc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ec(e){return((Dc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Dc(e){return Cc()?e instanceof Node||e instanceof Tc(e).Node:!1}function Oc(e){return Cc()?e instanceof Element||e instanceof Tc(e).Element:!1}function kc(e){return Cc()?e instanceof HTMLElement||e instanceof Tc(e).HTMLElement:!1}function Ac(e){return!Cc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Tc(e).ShadowRoot}function jc(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Hc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Mc(e){return/^(table|td|th)$/.test(wc(e))}function Nc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Pc=/transform|translate|scale|rotate|perspective|filter/,Fc=/paint|layout|strict|content/,Ic=e=>!!e&&e!==`none`,Lc;function Rc(e){let t=Oc(e)?Hc(e):e;return Ic(t.transform)||Ic(t.translate)||Ic(t.scale)||Ic(t.rotate)||Ic(t.perspective)||!Bc()&&(Ic(t.backdropFilter)||Ic(t.filter))||Pc.test(t.willChange||``)||Fc.test(t.contain||``)}function zc(e){let t=Wc(e);for(;kc(t)&&!Vc(t);){if(Rc(t))return t;if(Nc(t))return null;t=Wc(t)}return null}function Bc(){return Lc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Lc}function Vc(e){return/^(html|body|#document)$/.test(wc(e))}function Hc(e){return Tc(e).getComputedStyle(e)}function Uc(e){return Oc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wc(e){if(wc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ac(e)&&e.host||Ec(e);return Ac(t)?t.host:t}function Gc(e){let t=Wc(e);return Vc(t)?e.ownerDocument?e.ownerDocument.body:e.body:kc(t)&&jc(t)?t:Gc(t)}function Kc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Gc(e),i=r===e.ownerDocument?.body,a=Tc(r);if(i){let e=qc(a);return t.concat(a,a.visualViewport||[],jc(r)?r:[],e&&n?Kc(e):[])}else return t.concat(r,Kc(r,[],n))}function qc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jc(e){let t=Hc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=kc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ls(n)!==a||Ls(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Yc(e){return Oc(e)?e:e.contextElement}function Xc(e){let t=Yc(e);if(!kc(t))return zs(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Jc(t),o=(a?Ls(n.width):n.width)/r,s=(a?Ls(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Zc=zs(0);function Qc(e){let t=Tc(e);return!Bc()||!t.visualViewport?Zc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $c(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tc(e)?!1:t}function el(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Yc(e),o=zs(1);t&&(r?Oc(r)&&(o=Xc(r)):o=Xc(e));let s=$c(a,n,r)?Qc(a):zs(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=Tc(a),t=r&&Oc(r)?Tc(r):r,n=e,i=qc(n);for(;i&&r&&t!==n;){let e=Xc(i),t=i.getBoundingClientRect(),r=Hc(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=Tc(i),i=qc(n)}}return sc({width:u,height:d,x:c,y:l})}function tl(e,t){let n=Uc(e).scrollLeft;return t?t.left+n:el(Ec(e)).left+n}function nl(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-tl(e,n),y:n.top+t.scrollTop}}function rl(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ec(r),s=t?Nc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=zs(1),u=zs(0),d=kc(r);if((d||!d&&!a)&&((wc(r)!==`body`||jc(o))&&(c=Uc(r)),d)){let e=el(r);l=Xc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?nl(o,c):zs(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 il(e){return Array.from(e.getClientRects())}function al(e){let t=Ec(e),n=Uc(e),r=e.ownerDocument.body,i=Is(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Is(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+tl(e),s=-n.scrollTop;return Hc(r).direction===`rtl`&&(o+=Is(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ol=25;function sl(e,t){let n=Tc(e),r=Ec(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Bc();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=tl(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<=ol&&(a-=o)}else l<=ol&&(a+=l);return{width:a,height:o,x:s,y:c}}function cl(e,t){let n=el(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=kc(e)?Xc(e):zs(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ll(e,t,n){let r;if(t===`viewport`)r=sl(e,n);else if(t===`document`)r=al(Ec(e));else if(Oc(t))r=cl(t,n);else{let n=Qc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return sc(r)}function ul(e,t){let n=Wc(e);return n===t||!Oc(n)||Vc(n)?!1:Hc(n).position===`fixed`||ul(n,t)}function dl(e,t){let n=t.get(e);if(n)return n;let r=Kc(e,[],!1).filter(e=>Oc(e)&&wc(e)!==`body`),i=null,a=Hc(e).position===`fixed`,o=a?Wc(e):e;for(;Oc(o)&&!Vc(o);){let t=Hc(o),n=Rc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||jc(o)&&!n&&ul(e,o))?r=r.filter(e=>e!==o):i=t,o=Wc(o)}return t.set(e,r),r}function fl(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Nc(t)?[]:dl(t,this._c):[].concat(n),r],o=ll(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=ll(t,a[e],i);s=Is(n.top,s),c=Fs(n.right,c),l=Fs(n.bottom,l),u=Is(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function pl(e){let{width:t,height:n}=Jc(e);return{width:t,height:n}}function ml(e,t,n){let r=kc(t),i=Ec(t),a=n===`fixed`,o=el(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=zs(0);function l(){c.x=tl(i)}if(r||!r&&!a)if((wc(t)!==`body`||jc(i))&&(s=Uc(t)),r){let e=el(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?nl(i,s):zs(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 hl(e){return Hc(e).position===`static`}function gl(e,t){if(!kc(e)||Hc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ec(e)===n&&(n=n.ownerDocument.body),n}function _l(e,t){let n=Tc(e);if(Nc(e))return n;if(!kc(e)){let t=Wc(e);for(;t&&!Vc(t);){if(Oc(t)&&!hl(t))return t;t=Wc(t)}return n}let r=gl(e,t);for(;r&&Mc(r)&&hl(r);)r=gl(r,t);return r&&Vc(r)&&hl(r)&&!Rc(r)?n:r||zc(e)||n}var vl=async function(e){let t=this.getOffsetParent||_l,n=this.getDimensions,r=await n(e.floating);return{reference:ml(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yl(e){return Hc(e).direction===`rtl`}var bl={convertOffsetParentRelativeRectToViewportRelativeRect:rl,getDocumentElement:Ec,getClippingRect:fl,getOffsetParent:_l,getElementRects:vl,getClientRects:il,getDimensions:pl,getScale:Xc,isElement:Oc,isRTL:yl};function xl(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=Ec(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=Rs(d),h=Rs(i.clientWidth-(u+f)),g=Rs(i.clientHeight-(d+p)),_=Rs(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Is(0,Fs(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&&!xl(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=Yc(e),u=i||a?[...l?Kc(l):[],...t?Kc(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?el(e):null;c&&g();function g(){let t=el(e);h&&!xl(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 wl=yc,Tl=bc,El=pc,Dl=Sc,Ol=gc,kl=fc,Al=xc,jl=(e,t,n)=>{let r=new Map,i={platform:bl,...n},a={...i.platform,_c:r};return dc(e,t,{...i,platform:a})},Ml=typeof document<`u`?p.useLayoutEffect:function(){};function Nl(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(!Nl(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)&&!Nl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Pl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fl(e,t){let n=Pl(e);return Math.round(t*n)/n}function Il(e){let t=p.useRef(e);return Ml(()=>{t.current=e}),t}function Ll(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);Nl(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=Il(c),k=Il(i),A=Il(l),j=p.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),jl(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Nl(E.current,t)&&(E.current=t,m.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Ml(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=p.useRef(!1);Ml(()=>(M.current=!0,()=>{M.current=!1}),[]),Ml(()=>{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=Fl(P.floating,u.x),r=Fl(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Pl(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 Rl=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?{}:kl({element:r.current,padding:i}).fn(n):r?kl({element:r,padding:i}).fn(n):{}}}},zl=(e,t)=>{let n=wl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bl=(e,t)=>{let n=Tl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vl=(e,t)=>({fn:Al(e).fn,options:[e,t]}),Hl=(e,t)=>{let n=El(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ul=(e,t)=>{let n=Dl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wl=(e,t)=>{let n=Ol(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gl=(e,t)=>{let n=Rl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kl=`Arrow`,ql=p.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Y.jsx)(ri.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Y.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});ql.displayName=Kl;var Jl=ql,Yl=`Popper`,[Xl,Zl]=ui(Yl),[Ql,$l]=Xl(Yl),eu=e=>{let{__scopePopper:t,children:n}=e,[r,i]=p.useState(null);return(0,Y.jsx)(Ql,{scope:t,anchor:r,onAnchorChange:i,children:n})};eu.displayName=Yl;var tu=`PopperAnchor`,nu=p.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=$l(tu,n),o=p.useRef(null),s=Jr(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,Y.jsx)(ri.div,{...i,ref:s})});nu.displayName=tu;var ru=`PopperContent`,[iu,au]=Xl(ru),ou=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,_=$l(ru,n),[v,y]=p.useState(null),b=Jr(t,e=>y(e)),[x,S]=p.useState(null),C=Ns(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(uu),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Ll({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Cl(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[zl({mainAxis:i+T,alignmentAxis:o}),c&&Bl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Vl():void 0,...A}),c&&Hl({...A}),Ul({...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&&Gl({element:x,padding:s}),du({arrowWidth:w,arrowHeight:T}),f&&Wl({strategy:`referenceHidden`,...A})]}),[I,L]=fu(N),R=Wi(h);mi(()=>{P&&R?.()},[P,R]);let ee=F.arrow?.x,te=F.arrow?.y,z=F.arrow?.centerOffset!==0,[B,V]=p.useState();return mi(()=>{v&&V(window.getComputedStyle(v).zIndex)},[v]),(0,Y.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:B,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Y.jsx)(iu,{scope:n,placedSide:I,onArrowChange:S,arrowX:ee,arrowY:te,shouldHideArrow:z,children:(0,Y.jsx)(ri.div,{"data-side":I,"data-align":L,...g,ref:b,style:{...g.style,animation:P?void 0:`none`}})})})});ou.displayName=ru;var su=`PopperArrow`,cu={top:`bottom`,right:`left`,bottom:`top`,left:`right`},lu=p.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=au(su,n),a=cu[i.placedSide];return(0,Y.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,Y.jsx)(Jl,{...r,ref:t,style:{...r.style,display:`block`}})})});lu.displayName=su;function uu(e){return e!==null}var du=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]=fu(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 fu(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var pu=eu,mu=nu,hu=ou,gu=lu,_u=`rovingFocusGroup.onEntryFocus`,vu={bubbles:!1,cancelable:!0},yu=`RovingFocusGroup`,[bu,xu,Su]=fi(yu),[Cu,wu]=ui(yu,[Su]),[Tu,Eu]=Cu(yu),Du=p.forwardRef((e,t)=>(0,Y.jsx)(bu.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,Y.jsx)(bu.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,Y.jsx)(Ou,{...e,ref:t})})}));Du.displayName=yu;var Ou=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=Jr(t,f),h=Ui(a),[g,_]=gi({prop:o,defaultProp:s??null,onChange:c,caller:yu}),[v,y]=p.useState(!1),b=Wi(l),x=xu(n),S=p.useRef(!1),[C,w]=p.useState(0);return p.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(_u,b),()=>e.removeEventListener(_u,b)},[b]),(0,Y.jsx)(Tu,{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,Y.jsx)(ri.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:`none`,...e.style},onMouseDown:pi(e.onMouseDown,()=>{S.current=!0}),onFocus:pi(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(_u,vu);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Pu([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:pi(e.onBlur,()=>y(!1))})})}),ku=`RovingFocusGroupItem`,Au=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ei(),l=a||c,u=Eu(ku,n),d=u.currentTabStopId===l,f=xu(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u;return p.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,Y.jsx)(bu.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,Y.jsx)(ri.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:pi(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:pi(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:pi(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Nu(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?Fu(n,r+1):n.slice(r+1)}setTimeout(()=>Pu(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});Au.displayName=ku;var ju={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Mu(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Nu(e,t,n){let r=Mu(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return ju[r]}function Pu(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Fu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Iu=Du,Lu=Au,Ru=[`Enter`,` `],zu=[`ArrowDown`,`PageUp`,`Home`],Bu=[`ArrowUp`,`PageDown`,`End`],Vu=[...zu,...Bu],Hu={ltr:[...Ru,`ArrowRight`],rtl:[...Ru,`ArrowLeft`]},Uu={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Wu=`Menu`,[Gu,Ku,qu]=fi(Wu),[Ju,Yu]=ui(Wu,[qu,Zl,wu]),Xu=Zl(),Zu=wu(),[Qu,$u]=Ju(Wu),[ed,td]=Ju(Wu),nd=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Xu(t),[c,l]=p.useState(null),u=p.useRef(!1),d=Wi(a),f=Ui(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,Y.jsx)(pu,{...s,children:(0,Y.jsx)(Qu,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,Y.jsx)(ed,{scope:t,onClose:p.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};nd.displayName=Wu;var rd=`MenuAnchor`,id=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Xu(n);return(0,Y.jsx)(mu,{...i,...r,ref:t})});id.displayName=rd;var ad=`MenuPortal`,[od,sd]=Ju(ad,{forceMount:void 0}),cd=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=$u(ad,t);return(0,Y.jsx)(od,{scope:t,forceMount:n,children:(0,Y.jsx)(bi,{present:n||a.open,children:(0,Y.jsx)(Sa,{asChild:!0,container:i,children:r})})})};cd.displayName=ad;var ld=`MenuContent`,[ud,dd]=Ju(ld),fd=p.forwardRef((e,t)=>{let n=sd(ld,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$u(ld,e.__scopeMenu),o=td(ld,e.__scopeMenu);return(0,Y.jsx)(Gu.Provider,{scope:e.__scopeMenu,children:(0,Y.jsx)(bi,{present:r||a.open,children:(0,Y.jsx)(Gu.Slot,{scope:e.__scopeMenu,children:o.modal?(0,Y.jsx)(pd,{...i,ref:t}):(0,Y.jsx)(md,{...i,ref:t})})})})}),pd=p.forwardRef((e,t)=>{let n=$u(ld,e.__scopeMenu),r=p.useRef(null),i=Jr(t,r);return p.useEffect(()=>{let e=r.current;if(e)return Wo(e)},[]),(0,Y.jsx)(gd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:pi(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),md=p.forwardRef((e,t)=>{let n=$u(ld,e.__scopeMenu);return(0,Y.jsx)(gd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),hd=Yr(`MenuContent.ScrollLock`),gd=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,_=$u(ld,n),v=td(ld,n),y=Xu(n),b=Zu(n),x=Ku(n),[S,C]=p.useState(null),w=p.useRef(null),T=Jr(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?Fo:p.Fragment,N=h?{as:hd,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=ef(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),[]),wa();let F=p.useCallback(e=>A.current===k.current?.side&&nf(e,k.current?.area),[]);return(0,Y.jsx)(ud,{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,Y.jsx)(M,{...N,children:(0,Y.jsx)(la,{asChild:!0,trapped:i,onMountAutoFocus:pi(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,Y.jsx)(Qi,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:m,children:(0,Y.jsx)(Iu,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:pi(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Y.jsx)(hu,{role:`menu`,"aria-orientation":`vertical`,"data-state":Yd(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:pi(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||!Vu.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Bu.includes(e.key)&&a.reverse(),Qd(a)}),onBlur:pi(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:pi(e.onPointerMove,rf(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)}))})})})})})})});fd.displayName=ld;var _d=`MenuGroup`,vd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ri.div,{role:`group`,...r,ref:t})});vd.displayName=_d;var yd=`MenuLabel`,bd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ri.div,{...r,ref:t})});bd.displayName=yd;var xd=`MenuItem`,Sd=`menu.itemSelect`,Cd=p.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=p.useRef(null),o=td(xd,e.__scopeMenu),s=dd(xd,e.__scopeMenu),c=Jr(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}),ii(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,Y.jsx)(wd,{...i,ref:c,disabled:n,onClick:pi(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:pi(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:pi(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Ru.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Cd.displayName=xd;var wd=p.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=dd(xd,n),s=Zu(n),c=p.useRef(null),l=Jr(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,Y.jsx)(Gu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,Y.jsx)(Lu,{asChild:!0,...s,focusable:!r,children:(0,Y.jsx)(ri.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:pi(e.onPointerMove,rf(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:pi(e.onPointerLeave,rf(e=>o.onItemLeave(e))),onFocus:pi(e.onFocus,()=>d(!0)),onBlur:pi(e.onBlur,()=>d(!1))})})})}),Td=`MenuCheckboxItem`,Ed=p.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,Y.jsx)(Pd,{scope:e.__scopeMenu,checked:n,children:(0,Y.jsx)(Cd,{role:`menuitemcheckbox`,"aria-checked":Xd(n)?`mixed`:n,...i,ref:t,"data-state":Zd(n),onSelect:pi(i.onSelect,()=>r?.(Xd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ed.displayName=Td;var Dd=`MenuRadioGroup`,[Od,kd]=Ju(Dd,{value:void 0,onValueChange:()=>{}}),Ad=p.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Wi(r);return(0,Y.jsx)(Od,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,Y.jsx)(vd,{...i,ref:t})})});Ad.displayName=Dd;var jd=`MenuRadioItem`,Md=p.forwardRef((e,t)=>{let{value:n,...r}=e,i=kd(jd,e.__scopeMenu),a=n===i.value;return(0,Y.jsx)(Pd,{scope:e.__scopeMenu,checked:a,children:(0,Y.jsx)(Cd,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Zd(a),onSelect:pi(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Md.displayName=jd;var Nd=`MenuItemIndicator`,[Pd,Fd]=Ju(Nd,{checked:!1}),Id=p.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Fd(Nd,n);return(0,Y.jsx)(bi,{present:r||Xd(a.checked)||a.checked===!0,children:(0,Y.jsx)(ri.span,{...i,ref:t,"data-state":Zd(a.checked)})})});Id.displayName=Nd;var Ld=`MenuSeparator`,Rd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ri.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Rd.displayName=Ld;var zd=`MenuArrow`,Bd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Xu(n);return(0,Y.jsx)(gu,{...i,...r,ref:t})});Bd.displayName=zd;var Vd=`MenuSub`,[Hd,Ud]=Ju(Vd),Wd=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=$u(Vd,t),o=Xu(t),[s,c]=p.useState(null),[l,u]=p.useState(null),d=Wi(i);return p.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,Y.jsx)(pu,{...o,children:(0,Y.jsx)(Qu,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,Y.jsx)(Hd,{scope:t,contentId:Ei(),triggerId:Ei(),trigger:s,onTriggerChange:c,children:n})})})};Wd.displayName=Vd;var Gd=`MenuSubTrigger`,Kd=p.forwardRef((e,t)=>{let n=$u(Gd,e.__scopeMenu),r=td(Gd,e.__scopeMenu),i=Ud(Gd,e.__scopeMenu),a=dd(Gd,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,Y.jsx)(id,{asChild:!0,...l,children:(0,Y.jsx)(wd,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Yd(n.open),...e,ref:qr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:pi(e.onPointerMove,rf(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:pi(e.onPointerLeave,rf(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:pi(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Hu[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Kd.displayName=Gd;var qd=`MenuSubContent`,Jd=p.forwardRef((e,t)=>{let n=sd(ld,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$u(ld,e.__scopeMenu),o=td(ld,e.__scopeMenu),s=Ud(qd,e.__scopeMenu),c=p.useRef(null),l=Jr(t,c);return(0,Y.jsx)(Gu.Provider,{scope:e.__scopeMenu,children:(0,Y.jsx)(bi,{present:r||a.open,children:(0,Y.jsx)(Gu.Slot,{scope:e.__scopeMenu,children:(0,Y.jsx)(gd,{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:pi(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:pi(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:pi(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Uu[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Jd.displayName=qd;function Yd(e){return e?`open`:`closed`}function Xd(e){return e===`indeterminate`}function Zd(e){return Xd(e)?`indeterminate`:e?`checked`:`unchecked`}function Qd(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $d(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ef(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=$d(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 tf(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 nf(e,t){return t?tf({x:e.clientX,y:e.clientY},t):!1}function rf(e){return t=>t.pointerType===`mouse`?e(t):void 0}var af=nd,of=id,sf=cd,cf=fd,lf=vd,uf=bd,df=Cd,ff=Ed,pf=Ad,mf=Md,hf=Id,gf=Rd,_f=Bd,vf=Kd,yf=Jd,bf=`DropdownMenu`,[xf,Sf]=ui(bf,[Yu]),Cf=Yu(),[wf,Tf]=xf(bf),Ef=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]=gi({prop:i,defaultProp:a??!1,onChange:o,caller:bf});return(0,Y.jsx)(wf,{scope:t,triggerId:Ei(),triggerRef:l,contentId:Ei(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,Y.jsx)(af,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Ef.displayName=bf;var Df=`DropdownMenuTrigger`,Of=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Tf(Df,n),o=Cf(n);return(0,Y.jsx)(of,{asChild:!0,...o,children:(0,Y.jsx)(ri.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:qr(t,a.triggerRef),onPointerDown:pi(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:pi(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Of.displayName=Df;var kf=`DropdownMenuPortal`,Af=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Cf(t);return(0,Y.jsx)(sf,{...r,...n})};Af.displayName=kf;var jf=`DropdownMenuContent`,Mf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Tf(jf,n),a=Cf(n),o=p.useRef(!1);return(0,Y.jsx)(cf,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:pi(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:pi(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)`}})});Mf.displayName=jf;var Nf=`DropdownMenuGroup`,Pf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(lf,{...i,...r,ref:t})});Pf.displayName=Nf;var Ff=`DropdownMenuLabel`,If=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(uf,{...i,...r,ref:t})});If.displayName=Ff;var Lf=`DropdownMenuItem`,Rf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(df,{...i,...r,ref:t})});Rf.displayName=Lf;var zf=`DropdownMenuCheckboxItem`,Bf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(ff,{...i,...r,ref:t})});Bf.displayName=zf;var Vf=`DropdownMenuRadioGroup`,Hf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(pf,{...i,...r,ref:t})});Hf.displayName=Vf;var Uf=`DropdownMenuRadioItem`,Wf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(mf,{...i,...r,ref:t})});Wf.displayName=Uf;var Gf=`DropdownMenuItemIndicator`,Kf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(hf,{...i,...r,ref:t})});Kf.displayName=Gf;var qf=`DropdownMenuSeparator`,Jf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(gf,{...i,...r,ref:t})});Jf.displayName=qf;var Yf=`DropdownMenuArrow`,Xf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(_f,{...i,...r,ref:t})});Xf.displayName=Yf;var Zf=`DropdownMenuSubTrigger`,Qf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(vf,{...i,...r,ref:t})});Qf.displayName=Zf;var $f=`DropdownMenuSubContent`,ep=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(yf,{...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)`}})});ep.displayName=$f;var tp=Ef,np=Of,rp=Af,ip=Mf,ap=Rf,op=`Label`,sp=p.forwardRef((e,t)=>(0,Y.jsx)(ri.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));sp.displayName=op;var cp=sp,lp=`Popover`,[up,dp]=ui(lp,[Zl]),fp=Zl(),[pp,mp]=up(lp),hp=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=fp(t),c=p.useRef(null),[l,u]=p.useState(!1),[d,f]=gi({prop:r,defaultProp:i??!1,onChange:a,caller:lp});return(0,Y.jsx)(pu,{...s,children:(0,Y.jsx)(pp,{scope:t,contentId:Ei(),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})})};hp.displayName=lp;var gp=`PopoverAnchor`,_p=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mp(gp,n),a=fp(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return p.useEffect(()=>(o(),()=>s()),[o,s]),(0,Y.jsx)(mu,{...a,...r,ref:t})});_p.displayName=gp;var vp=`PopoverTrigger`,yp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mp(vp,n),a=fp(n),o=Jr(t,i.triggerRef),s=(0,Y.jsx)(ri.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Pp(i.open),...r,ref:o,onClick:pi(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,Y.jsx)(mu,{asChild:!0,...a,children:s})});yp.displayName=vp;var bp=`PopoverPortal`,[xp,Sp]=up(bp,{forceMount:void 0}),Cp=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=mp(bp,t);return(0,Y.jsx)(xp,{scope:t,forceMount:n,children:(0,Y.jsx)(bi,{present:n||a.open,children:(0,Y.jsx)(Sa,{asChild:!0,container:i,children:r})})})};Cp.displayName=bp;var wp=`PopoverContent`,Tp=p.forwardRef((e,t)=>{let n=Sp(wp,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=mp(wp,e.__scopePopover);return(0,Y.jsx)(bi,{present:r||a.open,children:a.modal?(0,Y.jsx)(Dp,{...i,ref:t}):(0,Y.jsx)(Op,{...i,ref:t})})});Tp.displayName=wp;var Ep=Yr(`PopoverContent.RemoveScroll`),Dp=p.forwardRef((e,t)=>{let n=mp(wp,e.__scopePopover),r=p.useRef(null),i=Jr(t,r),a=p.useRef(!1);return p.useEffect(()=>{let e=r.current;if(e)return Wo(e)},[]),(0,Y.jsx)(Fo,{as:Ep,allowPinchZoom:!0,children:(0,Y.jsx)(kp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:pi(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:pi(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:pi(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Op=p.forwardRef((e,t)=>{let n=mp(wp,e.__scopePopover),r=p.useRef(!1),i=p.useRef(!1);return(0,Y.jsx)(kp,{...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()}})}),kp=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=mp(wp,n),p=fp(n);return wa(),(0,Y.jsx)(la,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Y.jsx)(Qi,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Y.jsx)(hu,{"data-state":Pp(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)`}})})})}),Ap=`PopoverClose`,jp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mp(Ap,n);return(0,Y.jsx)(ri.button,{type:`button`,...r,ref:t,onClick:pi(e.onClick,()=>i.onOpenChange(!1))})});jp.displayName=Ap;var Mp=`PopoverArrow`,Np=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fp(n);return(0,Y.jsx)(gu,{...i,...r,ref:t})});Np.displayName=Mp;function Pp(e){return e?`open`:`closed`}var Fp=hp,Ip=yp,Lp=Cp,Rp=Tp,zp=`Switch`,[Bp,eee]=ui(zp),[Vp,tee]=Bp(zp),Hp=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=Jr(t,e=>m(e)),g=p.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=gi({prop:i,defaultProp:a??!1,onChange:l,caller:zp});return(0,Y.jsxs)(Vp,{scope:n,checked:v,disabled:s,children:[(0,Y.jsx)(ri.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Kp(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:h,onClick:pi(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,Y.jsx)(Gp,{control:f,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Hp.displayName=zp;var Up=`SwitchThumb`,Wp=p.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=tee(Up,n);return(0,Y.jsx)(ri.span,{"data-state":Kp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Wp.displayName=Up;var nee=`SwitchBubbleInput`,Gp=p.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=p.useRef(null),s=Jr(o,a),c=Ms(n),l=Ns(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,Y.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}})});Gp.displayName=nee;function Kp(e){return e?`checked`:`unchecked`}var qp=Hp,Jp=Wp,Yp=`Tabs`,[Xp,ree]=ui(Yp,[wu]),Zp=wu(),[iee,Qp]=Xp(Yp),$p=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Ui(s),[d,f]=gi({prop:r,onChange:i,defaultProp:a??``,caller:Yp});return(0,Y.jsx)(iee,{scope:n,baseId:Ei(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Y.jsx)(ri.div,{dir:u,"data-orientation":o,...l,ref:t})})});$p.displayName=Yp;var em=`TabsList`,tm=p.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Qp(em,n),o=Zp(n);return(0,Y.jsx)(Iu,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Y.jsx)(ri.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});tm.displayName=em;var nm=`TabsTrigger`,rm=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Qp(nm,n),s=Zp(n),c=om(o.baseId,r),l=sm(o.baseId,r),u=r===o.value;return(0,Y.jsx)(Lu,{asChild:!0,...s,focusable:!i,active:u,children:(0,Y.jsx)(ri.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:pi(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:pi(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:pi(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});rm.displayName=nm;var im=`TabsContent`,am=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Qp(im,n),c=om(s.baseId,r),l=sm(s.baseId,r),u=r===s.value,d=p.useRef(u);return p.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Y.jsx)(bi,{present:i||u,children:({present:n})=>(0,Y.jsx)(ri.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})})});am.displayName=im;function om(e,t){return`${e}-trigger-${t}`}function sm(e,t){return`${e}-content-${t}`}var cm=$p,lm=tm,um=rm,dm=am,fm=`Toggle`,pm=p.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=gi({prop:n,onChange:i,defaultProp:r??!1,caller:fm});return(0,Y.jsx)(ri.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:pi(e.onClick,()=>{e.disabled||s(!o)})})});pm.displayName=fm;var mm=`ToggleGroup`,[hm,aee]=ui(mm,[wu]),gm=wu(),_m=p.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,Y.jsx)(bm,{...r,ref:t});if(n===`multiple`)return(0,Y.jsx)(xm,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${mm}\``)});_m.displayName=mm;var[vm,ym]=hm(mm),bm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=gi({prop:n,defaultProp:r??``,onChange:i,caller:mm});return(0,Y.jsx)(vm,{scope:e.__scopeToggleGroup,type:`single`,value:p.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:p.useCallback(()=>s(``),[s]),children:(0,Y.jsx)(wm,{...a,ref:t})})}),xm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=gi({prop:n,defaultProp:r??[],onChange:i,caller:mm}),c=p.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=p.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,Y.jsx)(vm,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,Y.jsx)(wm,{...a,ref:t})})});_m.displayName=mm;var[Sm,Cm]=hm(mm),wm=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=gm(n),u=Ui(o),d={role:`group`,dir:u,...c};return(0,Y.jsx)(Sm,{scope:n,rovingFocus:i,disabled:r,children:i?(0,Y.jsx)(Iu,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,Y.jsx)(ri.div,{...d,ref:t})}):(0,Y.jsx)(ri.div,{...d,ref:t})})}),Tm=`ToggleGroupItem`,Em=p.forwardRef((e,t)=>{let n=ym(Tm,e.__scopeToggleGroup),r=Cm(Tm,e.__scopeToggleGroup),i=gm(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,Y.jsx)(Lu,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,Y.jsx)(Dm,{...s,ref:t})}):(0,Y.jsx)(Dm,{...s,ref:t})});Em.displayName=Tm;var Dm=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=ym(Tm,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,Y.jsx)(pm,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),Om=_m,km=Em,[Am,oee]=ui(`Tooltip`,[Zl]),jm=Zl(),Mm=`TooltipProvider`,Nm=700,Pm=`tooltip.open`,[Fm,Im]=Am(Mm),Lm=e=>{let{__scopeTooltip:t,delayDuration:n=Nm,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,Y.jsx)(Fm,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Lm.displayName=Mm;var Rm=`Tooltip`,[see,zm]=Am(Rm),Bm=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Im(Rm,e.__scopeTooltip),l=jm(t),[u,d]=p.useState(null),f=Ei(),m=p.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=p.useRef(!1),[v,y]=gi({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Pm))):c.onClose(),a?.(e)},caller:Rm}),b=p.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),S=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return p.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,Y.jsx)(pu,{...l,children:(0,Y.jsx)(see,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:p.useCallback(()=>{h?S():(window.clearTimeout(m.current),m.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};Bm.displayName=Rm;var Vm=`TooltipTrigger`,Hm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=zm(Vm,n),a=Im(Vm,n),o=jm(n),s=Jr(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,Y.jsx)(mu,{asChild:!0,...o,children:(0,Y.jsx)(ri.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:pi(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:pi(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:pi(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:pi(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:pi(e.onBlur,i.onClose),onClick:pi(e.onClick,i.onClose)})})});Hm.displayName=Vm;var Um=`TooltipPortal`,[cee,lee]=Am(Um,{forceMount:void 0}),Wm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=zm(Um,t);return(0,Y.jsx)(cee,{scope:t,forceMount:n,children:(0,Y.jsx)(bi,{present:n||a.open,children:(0,Y.jsx)(Sa,{asChild:!0,container:i,children:r})})})};Wm.displayName=Um;var Gm=`TooltipContent`,Km=p.forwardRef((e,t)=>{let n=lee(Gm,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=zm(Gm,e.__scopeTooltip);return(0,Y.jsx)(bi,{present:r||o.open,children:o.disableHoverableContent?(0,Y.jsx)(qm,{side:i,...a,ref:t}):(0,Y.jsx)(uee,{side:i,...a,ref:t})})}),uee=p.forwardRef((e,t)=>{let n=zm(Gm,e.__scopeTooltip),r=Im(Gm,e.__scopeTooltip),i=p.useRef(null),a=Jr(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=hee(r,mee(r,n.getBoundingClientRect())),a=gee(t.getBoundingClientRect());s(Xm([...i,...a])),d(!0)},[d]);return p.useEffect(()=>()=>f(),[f]),p.useEffect(()=>{if(c&&u){let e=e=>m(e,u),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,m,f]),p.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!_ee(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,Y.jsx)(qm,{...e,ref:a})}),[dee,fee]=Am(Rm,{isInside:!1}),pee=$r(`TooltipContent`),qm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=zm(Gm,n),l=jm(n),{onClose:u}=c;return p.useEffect(()=>(document.addEventListener(Pm,u),()=>document.removeEventListener(Pm,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,Y.jsx)(Qi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Y.jsxs)(hu,{"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,Y.jsx)(pee,{children:r}),(0,Y.jsx)(dee,{scope:n,isInside:!0,children:(0,Y.jsx)(ci,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Km.displayName=Gm;var Jm=`TooltipArrow`,Ym=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=jm(n);return fee(Jm,n).isInside?null:(0,Y.jsx)(gu,{...i,...r,ref:t})});Ym.displayName=Jm;function mee(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 hee(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 gee(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 _ee(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Xm(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Zm(t)}function Zm(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Qm=Lm,$m=Bm,eh=Hm,th=Wm,nh=Km,rh=Ym,ih=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ah=(e,t)=>({classGroupId:e,validator:t}),oh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),sh=`-`,ch=[],lh=`arbitrary..`,uh=e=>{let t=ph(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return fh(e);let n=e.split(sh);return dh(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ih(i,t):t:i||ch}return n[e]||ch}}},dh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=dh(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(sh):e.slice(t).join(sh),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},fh=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?lh+r:void 0})(),ph=e=>{let{theme:t,classGroups:n}=e;return mh(n,t)},mh=(e,t)=>{let n=oh();for(let r in e){let i=e[r];hh(i,n,r,t)}return n},hh=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];gh(i,t,n,r)}},gh=(e,t,n,r)=>{if(typeof e==`string`){_h(e,t,n);return}if(typeof e==`function`){vh(e,t,n,r);return}yh(e,t,n,r)},_h=(e,t,n)=>{let r=e===``?t:bh(t,e);r.classGroupId=n},vh=(e,t,n,r)=>{if(xh(e)){hh(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ah(n,e))},yh=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];hh(o,bh(t,a),n,r)}},bh=(e,t)=>{let n=e,r=t.split(sh),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=oh(),n.nextPart.set(t,i)),n=i}return n},xh=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Sh=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ch=`!`,wh=`:`,Th=[],Eh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Dh=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===wh){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ch)?(c=s.slice(0,-1),l=!0):s.startsWith(Ch)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Eh(t,l,c,u)};if(t){let e=t+wh,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Eh(Th,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Oh=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},kh=e=>({cache:Sh(e.cacheSize),parseClassName:Dh(e),sortModifiers:Oh(e),...uh(e)}),Ah=/\s+/,jh=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Ah),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Ch:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Mh=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Nh(n))&&(i&&(i+=` `),i+=r);return i},Nh=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Nh(e[r]))&&(n&&(n+=` `),n+=t);return n},Ph=(e,...t)=>{let n,r,i,a,o=o=>(n=kh(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=jh(e,n);return i(e,a),a};return a=o,(...e)=>a(Mh(...e))},Fh=[],Ih=e=>{let t=t=>t[e]||Fh;return t.isThemeGetter=!0,t},Lh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Bh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Uh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gh=e=>zh.test(e),Kh=e=>!!e&&!Number.isNaN(Number(e)),qh=e=>!!e&&Number.isInteger(Number(e)),Jh=e=>e.endsWith(`%`)&&Kh(e.slice(0,-1)),Yh=e=>Bh.test(e),Xh=()=>!0,Zh=e=>Vh.test(e)&&!Hh.test(e),Qh=()=>!1,$h=e=>Uh.test(e),eg=e=>Wh.test(e),tg=e=>!rg(e)&&!dg(e),ng=e=>yg(e,Cg,Qh),rg=e=>Lh.test(e),ig=e=>yg(e,wg,Zh),ag=e=>yg(e,Tg,Kh),og=e=>yg(e,Dg,Xh),sg=e=>yg(e,Eg,Qh),cg=e=>yg(e,xg,Qh),lg=e=>yg(e,Sg,eg),ug=e=>yg(e,Og,$h),dg=e=>Rh.test(e),fg=e=>bg(e,wg),pg=e=>bg(e,Eg),mg=e=>bg(e,xg),hg=e=>bg(e,Cg),gg=e=>bg(e,Sg),_g=e=>bg(e,Og,!0),vg=e=>bg(e,Dg,!0),yg=(e,t,n)=>{let r=Lh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bg=(e,t,n=!1)=>{let r=Rh.exec(e);return r?r[1]?t(r[1]):n:!1},xg=e=>e===`position`||e===`percentage`,Sg=e=>e===`image`||e===`url`,Cg=e=>e===`length`||e===`size`||e===`bg-size`,wg=e=>e===`length`,Tg=e=>e===`number`,Eg=e=>e===`family-name`,Dg=e=>e===`number`||e===`weight`,Og=e=>e===`shadow`,vee=Ph(()=>{let e=Ih(`color`),t=Ih(`font`),n=Ih(`text`),r=Ih(`font-weight`),i=Ih(`tracking`),a=Ih(`leading`),o=Ih(`breakpoint`),s=Ih(`container`),c=Ih(`spacing`),l=Ih(`radius`),u=Ih(`shadow`),d=Ih(`inset-shadow`),f=Ih(`text-shadow`),p=Ih(`drop-shadow`),m=Ih(`blur`),h=Ih(`perspective`),g=Ih(`aspect`),_=Ih(`ease`),v=Ih(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),dg,rg],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[dg,rg,c],T=()=>[Gh,`full`,`auto`,...w()],E=()=>[qh,`none`,`subgrid`,dg,rg],D=()=>[`auto`,{span:[`full`,qh,dg,rg]},qh,dg,rg],O=()=>[qh,`auto`,dg,rg],k=()=>[`auto`,`min`,`max`,`fr`,dg,rg],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Gh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Gh,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Gh,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,dg,rg],L=()=>[...b(),mg,cg,{position:[dg,rg]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,hg,ng,{size:[dg,rg]}],te=()=>[Jh,fg,ig],z=()=>[``,`none`,`full`,l,dg,rg],B=()=>[``,Kh,fg,ig],V=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],U=()=>[Kh,Jh,mg,cg],ne=()=>[``,`none`,m,dg,rg],re=()=>[`none`,Kh,dg,rg],ie=()=>[`none`,Kh,dg,rg],ae=()=>[Kh,dg,rg],oe=()=>[Gh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Yh],breakpoint:[Yh],color:[Xh],container:[Yh],"drop-shadow":[Yh],ease:[`in`,`out`,`in-out`],font:[tg],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Yh],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Yh],shadow:[Yh],spacing:[`px`,Kh],text:[Yh],"text-shadow":[Yh],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Gh,rg,dg,g]}],container:[`container`],columns:[{columns:[Kh,rg,dg,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[qh,`auto`,dg,rg]}],basis:[{basis:[Gh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Kh,Gh,`auto`,`initial`,`none`,rg]}],grow:[{grow:[``,Kh,dg,rg]}],shrink:[{shrink:[``,Kh,dg,rg]}],order:[{order:[qh,`first`,`last`,`none`,dg,rg]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,fg,ig]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,vg,og]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Jh,rg]}],"font-family":[{font:[pg,sg,t]}],"font-features":[{"font-features":[rg]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,dg,rg]}],"line-clamp":[{"line-clamp":[Kh,`none`,dg,ag]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,dg,rg]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,dg,rg]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[Kh,`from-font`,`auto`,dg,ig]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Kh,`auto`,dg,rg]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,dg,rg]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,dg,rg]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},qh,dg,rg],radial:[``,dg,rg],conic:[qh,dg,rg]},gg,lg]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`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:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Kh,dg,rg]}],"outline-w":[{outline:[``,Kh,fg,ig]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,_g,ug]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,_g,ug]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Kh,ig]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,_g,ug]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Kh,dg,rg]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Kh]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[dg,rg]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Kh]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,dg,rg]}],filter:[{filter:[``,`none`,dg,rg]}],blur:[{blur:ne()}],brightness:[{brightness:[Kh,dg,rg]}],contrast:[{contrast:[Kh,dg,rg]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,_g,ug]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Kh,dg,rg]}],"hue-rotate":[{"hue-rotate":[Kh,dg,rg]}],invert:[{invert:[``,Kh,dg,rg]}],saturate:[{saturate:[Kh,dg,rg]}],sepia:[{sepia:[``,Kh,dg,rg]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,dg,rg]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Kh,dg,rg]}],"backdrop-contrast":[{"backdrop-contrast":[Kh,dg,rg]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Kh,dg,rg]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Kh,dg,rg]}],"backdrop-invert":[{"backdrop-invert":[``,Kh,dg,rg]}],"backdrop-opacity":[{"backdrop-opacity":[Kh,dg,rg]}],"backdrop-saturate":[{"backdrop-saturate":[Kh,dg,rg]}],"backdrop-sepia":[{"backdrop-sepia":[``,Kh,dg,rg]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,dg,rg]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Kh,`initial`,dg,rg]}],ease:[{ease:[`linear`,`initial`,_,dg,rg]}],delay:[{delay:[Kh,dg,rg]}],animate:[{animate:[`none`,v,dg,rg]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,dg,rg]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[dg,rg,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,dg,rg]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,dg,rg]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Kh,fg,ig,ag]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}}),Z=(...e)=>vee(Hr(e)),yee=Gr(`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,Y.jsx)(r?Xr:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Z(yee({variant:t,size:n,className:e})),...i}),kg=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),xee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ag=e=>{let t=xee(e);return t.charAt(0).toUpperCase()+t.slice(1)},jg={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`},See=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Cee=(0,p.createContext)({}),wee=()=>(0,p.useContext)(Cee),Tee=(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=``}=wee()??{},h=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,p.createElement)(`svg`,{ref:c,...jg,width:t??l??jg.width,height:t??l??jg.height,stroke:e??f,strokeWidth:h,className:kg(`lucide`,m,i),...!a&&!See(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Mg=(e,t)=>{let n=(0,p.forwardRef)(({className:n,...r},i)=>(0,p.createElement)(Tee,{ref:i,iconNode:t,className:kg(`lucide-${bee(Ag(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ag(e),n},Ng=Mg(`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`}]]),Eee=Mg(`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`}]]),Dee=Mg(`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`}]]),Oee=Mg(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),kee=Mg(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Aee=Mg(`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`}]]),jee=Mg(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Mee=Mg(`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`}]]),Pg=Mg(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Fg=Mg(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Nee=Mg(`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`}]]),Pee=Mg(`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`}]]),Fee=Mg(`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`}]]),Iee=Mg(`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`}]]),Lee=Mg(`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`}]]),Ree=Mg(`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`}]]),zee=Mg(`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`}]]),Bee=Mg(`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`}]]),Vee=Mg(`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`}]]),Hee=Mg(`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`}]]),Uee=Mg(`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`}]]),Wee=Mg(`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`}]]),Gee=Mg(`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`}]]),Ig=Mg(`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`}]]),Kee=Mg(`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`}]]),qee=Mg(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Jee=Mg(`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`}]]),Yee=Mg(`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`}]]),Xee=Mg(`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`}]]),Zee=Mg(`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`}]]),Qee=Mg(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),$ee=Mg(`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`}]]),ete=Mg(`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`}]]),tte=Mg(`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`}]]),nte=Mg(`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`}]]),rte=Mg(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ite=Mg(`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`}]]),ate=Mg(`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`}]]),ote=Mg(`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`}]]),ste=Mg(`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`}]]),cte=Mg(`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`}]]),lte=Mg(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ute=Mg(`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`}]]),dte=Mg(`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`}]]),fte=Mg(`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`}]]),pte=Mg(`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`}]]),Lg=Mg(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),mte=Mg(`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`}]]),Rg=Mg(`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`}]]),zg=Mg(`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`}]]),Bg=Mg(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Vg=Mg(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Hg=Mg(`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`}]]),Ug=Mg(`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`}]]),Wg=Mg(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Gg=1,hte=.9,gte=.8,_te=.17,Kg=.1,qg=.999,vte=.9999,yte=.99,bte=/[\\\/_+.#"@\[\(\{&]/,xte=/[\\\/_+.#"@\[\(\{&]/g,Ste=/[\s-]/,Jg=/[\s-]/g;function Yg(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Gg:yte;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=Yg(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Gg:bte.test(e.charAt(l-1))?(d*=gte,p=e.slice(i,l-1).match(xte),p&&i>0&&(d*=qg**+p.length)):Ste.test(e.charAt(l-1))?(d*=hte,m=e.slice(i,l-1).match(Jg),m&&i>0&&(d*=qg**+m.length)):(d*=_te,i>0&&(d*=qg**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=vte)),(d<Kg&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Yg(e,t,n,r,l+1,a+2,o),f*Kg>d&&(d=f*Kg)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Xg(e){return e.toLowerCase().replace(Jg,` `)}function Cte(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Yg(e,t,Xg(e),Xg(t),0,0,{})}var Zg=`[cmdk-group=""]`,Qg=`[cmdk-group-items=""]`,$g=`[cmdk-group-heading=""]`,e_=`[cmdk-item=""]`,t_=`${e_}:not([aria-disabled="true"])`,n_=`cmdk-item-select`,r_=`data-value`,i_=(e,t,n)=>Cte(e,t,n),a_=p.createContext(void 0),o_=()=>p.useContext(a_),s_=p.createContext(void 0),c_=()=>p.useContext(s_),l_=p.createContext(void 0),u_=p.forwardRef((e,t)=>{let n=w_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=w_(()=>new Set),i=w_(()=>new Map),a=w_(()=>new Map),o=w_(()=>new Set),s=S_(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=Ei(),b=Ei(),x=Ei(),S=p.useRef(null),C=wte();C_(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),C_(()=>{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??i_;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Qg);t?t.appendChild(e.parentElement===t?e:e.closest(`${Qg} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Qg} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${Zg}[${r_}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(r_);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(Zg)?.querySelector($g))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${e_}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(t_)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(r_))}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(r_))}function F(e){let t=j()?.closest(Zg),n;for(;t&&!n;)t=e>0?b_(t,Zg):x_(t,Zg),n=t?.querySelector(t_);n?w.setState(`value`,n.getAttribute(r_)):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(ri.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(n_);t.dispatchEvent(e)}}}}},p.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Ete},c),D_(e,e=>p.createElement(s_.Provider,{value:w},p.createElement(a_.Provider,{value:T},e))))}),d_=p.forwardRef((e,t)=>{let n=Ei(),r=p.useRef(null),i=p.useContext(l_),a=o_(),o=S_(e),s=o.current?.forceMount??i?.forceMount;C_(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=E_(n,r,[e.value,e.children,r],e.keywords),l=c_(),u=T_(e=>e.value&&e.value===c.current),d=T_(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(n_,f),()=>t.removeEventListener(n_,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(ri.div,{ref:qr(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:f},e.children)}),f_=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ei(),s=p.useRef(null),c=p.useRef(null),l=Ei(),u=o_(),d=T_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);C_(()=>u.group(o),[]),E_(o,s,[e.value,e.heading,c]);let f=p.useMemo(()=>({id:o,forceMount:i}),[i]);return p.createElement(ri.div,{ref:qr(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&p.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),D_(e,e=>p.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},p.createElement(l_.Provider,{value:f},e))))}),p_=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=p.useRef(null),a=T_(e=>!e.search);return!n&&!a?null:p.createElement(ri.div,{ref:qr(i,t),...r,"cmdk-separator":``,role:`separator`})}),m_=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=c_(),o=T_(e=>e.search),s=T_(e=>e.selectedItemId),c=o_();return p.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),p.createElement(ri.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)}})}),h_=p.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=p.useRef(null),o=p.useRef(null),s=T_(e=>e.selectedItemId),c=o_();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(ri.div,{ref:qr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},D_(e,e=>p.createElement(`div`,{ref:qr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),g_=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return p.createElement(Ts,{open:n,onOpenChange:r},p.createElement(Es,{container:o},p.createElement(Ds,{"cmdk-overlay":``,className:i}),p.createElement(Os,{"aria-label":e.label,"cmdk-dialog":``,className:a},p.createElement(u_,{ref:t,...s}))))}),__=p.forwardRef((e,t)=>T_(e=>e.filtered.count===0)?p.createElement(ri.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),v_=p.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return p.createElement(ri.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},D_(e,e=>p.createElement(`div`,{"aria-hidden":!0},e)))}),y_=Object.assign(u_,{List:h_,Item:d_,Input:m_,Group:f_,Separator:p_,Dialog:g_,Empty:__,Loading:v_});function b_(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function x_(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function S_(e){let t=p.useRef(e);return C_(()=>{t.current=e}),t}var C_=typeof window>`u`?p.useEffect:p.useLayoutEffect;function w_(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function T_(e){let t=c_(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function E_(e,t,n,r=[]){let i=p.useRef(),a=o_();return C_(()=>{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(r_,s),i.current=s}),i}var wte=()=>{let[e,t]=p.useState(),n=w_(()=>new Map);return C_(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Tte(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function D_({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Tte(t),{ref:t.ref},n(t.props.children)):n(t)}var Ete={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},O_=e=>(0,Y.jsx)(Ts,{"data-slot":`dialog`,...e}),Dte=e=>(0,Y.jsx)(Es,{"data-slot":`dialog-portal`,...e}),k_=e=>(0,Y.jsx)(js,{"data-slot":`dialog-close`,...e}),Ote=({className:e,...t})=>(0,Y.jsx)(Ds,{"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}),A_=({className:e,children:t,showCloseButton:n=!0,overlayClassName:r,...i})=>(0,Y.jsxs)(Dte,{children:[(0,Y.jsx)(Ote,{className:r}),(0,Y.jsxs)(Os,{"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,Y.jsx)(js,{"data-slot":`dialog-close`,asChild:!0,children:(0,Y.jsxs)(Q,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`,children:[(0,Y.jsx)(Wg,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]}),j_=({className:e,...t})=>(0,Y.jsx)(`div`,{"data-slot":`dialog-header`,className:Z(`flex flex-col gap-1.5`,e),...t}),M_=({className:e,showCloseButton:t=!1,children:n,...r})=>(0,Y.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,Y.jsx)(js,{asChild:!0,children:(0,Y.jsx)(Q,{variant:`outline`,children:`Close`})})]}),N_=({className:e,...t})=>(0,Y.jsx)(ks,{"data-slot":`dialog-title`,className:Z(`font-heading text-base leading-none font-medium`,e),...t}),P_=({className:e,...t})=>(0,Y.jsx)(As,{"data-slot":`dialog-description`,className:Z(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t}),F_=(0,p.forwardRef)(({className:e,type:t,...n},r)=>(0,Y.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})),I_=(0,p.forwardRef)(({className:e,...t},n)=>(0,Y.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}));I_.displayName=`Textarea`;function L_({className:e,...t}){return(0,Y.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 kte=Gr(`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 R_({className:e,align:t=`inline-start`,...n}){return(0,Y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Z(kte({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var z_=Gr(`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 B_({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,Y.jsx)(Q,{type:t,"data-size":r,variant:n,className:Z(z_({size:r}),e),...i})}function V_({className:e,...t}){return(0,Y.jsx)(F_,{"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 H_({className:e,...t}){return(0,Y.jsx)(y_,{"data-slot":`command`,className:Z(`flex size-full flex-col overflow-hidden rounded-4xl bg-popover p-1 text-popover-foreground`,e),...t})}function U_({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,Y.jsxs)(L_,{className:`h-9 bg-input/50`,children:[(0,Y.jsx)(y_.Input,{"data-slot":`command-input`,className:Z(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,Y.jsx)(R_,{children:(0,Y.jsx)(Lg,{className:`size-4 shrink-0 opacity-50`})})]})})}function W_({className:e,...t}){return(0,Y.jsx)(y_.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 G_({className:e,...t}){return(0,Y.jsx)(y_.Empty,{"data-slot":`command-empty`,className:Z(`py-6 text-center text-sm`,e),...t})}function K_({className:e,...t}){return(0,Y.jsx)(y_.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 q_({className:e,children:t,...n}){return(0,Y.jsxs)(y_.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,Y.jsx)(Pg,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function J_({className:e,...t}){return(0,Y.jsx)(cp,{"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 Y_=e=>(0,Y.jsx)(Fp,{"data-slot":`popover`,...e}),X_=e=>(0,Y.jsx)(Ip,{"data-slot":`popover-trigger`,...e}),Z_=({className:e,align:t=`center`,sideOffset:n=4,...r})=>(0,Y.jsx)(Lp,{children:(0,Y.jsx)(Rp,{"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})}),Q_=({className:e,...t})=>(0,Y.jsx)(`div`,{"data-slot":`popover-header`,className:Z(`flex flex-col gap-1 text-sm`,e),...t}),$_=({className:e,...t})=>(0,Y.jsx)(`div`,{"data-slot":`popover-title`,className:Z(`font-heading text-base font-medium`,e),...t}),ev=/[\s\-_/.:]+/,tv=/\d(?:[._:-]*\d)+/g,nv=e=>e.toLowerCase().trim().split(ev).filter(Boolean),rv=(e,t)=>t===e?300:t.startsWith(e)?200:e.length>=3&&t.includes(e)?100:0,iv=e=>(e.toLowerCase().match(tv)??[]).map(e=>e.replace(/\D/g,``)).filter(e=>e.length>=2),av=e=>/^\d+$/.test(e),ov=(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=nv(e);if(n.length===0)return 1;let r=t.flatMap(e=>nv(e??``)),i=[...new Set(t.flatMap(e=>iv(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=rv(e,n);r>t&&(t=r)}if(t===0&&av(e)&&(t=ov(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,Y.jsxs)(`div`,{className:Z(`flex flex-col gap-1.5`,o),children:[e&&(0,Y.jsx)(J_,{className:Z(`text-xs font-medium text-muted-foreground`,s),htmlFor:r,children:e}),(0,Y.jsxs)(Y_,{open:m,onOpenChange:e=>{e&&_(b()),h(e)},children:[(0,Y.jsx)(`div`,{className:`relative`,ref:v,children:(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.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,Y.jsx)(`span`,{className:`truncate`,children:t}),(0,Y.jsx)(Fg,{className:`h-4 w-4 text-muted-foreground`})]})})}),(0,Y.jsx)(Z_,{side:g?`top`:`bottom`,align:`start`,className:Z(`w-[var(--radix-popover-trigger-width)] p-0`,c),children:(0,Y.jsxs)(H_,{filter:(e,t,n)=>sv(t,[e,...n??[]]),children:[y&&(0,Y.jsx)(U_,{placeholder:`Filter...`}),(0,Y.jsxs)(W_,{className:`max-h-72`,children:[(0,Y.jsx)(G_,{children:`No matches`}),i.map((e,t)=>e.options.length===0?null:(0,Y.jsx)(K_,{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,Y.jsx)(q_,{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,Y.jsx)(`span`,{className:`truncate`,children:t.label})},t.value))},e.label||`group-${t}`))]})]})})]})]})},lv=({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,Y.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}),uv=({model:e,showModelSelector:t,availableModels:n,onModelChange:r,selectId:i,label:a=`Model`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l,defaultModelLabel:u=`Use default model`,notice:d})=>{let f=(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]),m=e||u;return!t&&!d?null:(0,Y.jsxs)(`div`,{className:Z(c),children:[t&&(0,Y.jsx)(lv,{label:a,triggerLabel:m,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:u}]},...f.map(e=>({label:e.provider,options:e.models}))]}),d]})},dv=({variant:e,selectedModel:t,showVariantSelector:n,onVariantChange:r,selectId:i,label:a=`Variant`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l,defaultVariantLabel:u=`Use model default`,availableVariantsLabel:d=`Available levels`})=>{if(!n||!t)return null;let f=e||u;return(0,Y.jsx)(`div`,{className:Z(c),children:(0,Y.jsx)(lv,{label:a,triggerLabel:f,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:u}]},{label:d,options:t.variants.map(e=>({value:e,label:e}))}]})})},fv=({model:e,variant:t,availableModels:n,isLoadingModels:r,onModelChange:i,onVariantChange:a,modelSelectId:o,variantSelectId:s,title:c,description:l,loadingDescription:u,unavailableDescription:d,modelLabel:f,variantLabel:p,defaultModelLabel:m,defaultVariantLabel:h,availableVariantsLabel:g,className:_,compact:v=!1,showHeader:y=!0,disabled:b=!1})=>{let x=n.find(t=>t.id===e)??null,S=n.length>0,C=x!==null&&x.variants.length>0;return(0,Y.jsxs)(`div`,{className:Z(`rounded-2xl border border-border/70 bg-background/25 p-4`,_),children:[y&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:c}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:l})]}),r?(0,Y.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,y&&`mt-4`),children:u}):S?(0,Y.jsxs)(`div`,{className:Z(y&&`mt-4`,`gap-3`,v?`flex flex-col`:`flex flex-wrap`),children:[(0,Y.jsx)(uv,{model:e,showModelSelector:!0,availableModels:n,onModelChange:i,selectId:o,label:f,defaultModelLabel:m,disabled:b,className:v?`min-w-0`:`min-w-[10rem] flex-[1.35_1_10rem]`}),C&&(0,Y.jsx)(dv,{variant:t,selectedModel:x,showVariantSelector:!0,onVariantChange:a,selectId:s,label:p,defaultVariantLabel:h,availableVariantsLabel:g,disabled:b,className:v?`min-w-0`:`min-w-[7rem] flex-[0.7_1_7rem]`})]}):(0,Y.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,y&&`mt-4`),children:d})]})},pv=({helperModel:e,helperVariant:t,availableModels:n,isLoadingModels:r,onHelperModelChange:i,onHelperVariantChange:a,modelSelectId:o,variantSelectId:s,className:c,compact:l=!1,showHeader:u=!0})=>{let{t:d}=K(`projects`);return(0,Y.jsx)(fv,{model:e,variant:t,availableModels:n,isLoadingModels:r,onModelChange:i,onVariantChange:a,modelSelectId:o,variantSelectId:s,title:d(`advanced.helperModel.title`),description:d(`advanced.helperModel.panelDescription`),loadingDescription:d(`advanced.modelSelection.loading`),unavailableDescription:d(`advanced.helperModel.unavailable`),modelLabel:d(`advanced.modelSelection.modelLabel`),variantLabel:d(`advanced.modelSelection.variantLabel`),defaultModelLabel:d(`advanced.modelSelection.defaultModel`),defaultVariantLabel:d(`advanced.modelSelection.defaultVariant`),availableVariantsLabel:d(`advanced.modelSelection.availableVariants`),className:c,compact:l,showHeader:u})},mv=({delayDuration:e=0,...t})=>(0,Y.jsx)(Qm,{"data-slot":`tooltip-provider`,delayDuration:e,...t}),hv=e=>(0,Y.jsx)($m,{"data-slot":`tooltip`,...e}),gv=e=>(0,Y.jsx)(eh,{"data-slot":`tooltip-trigger`,...e}),_v=({className:e,sideOffset:t=8,children:n,...r})=>(0,Y.jsx)(th,{children:(0,Y.jsxs)(nh,{"data-slot":`tooltip-content`,sideOffset:t,className:Z(`pointer-events-none z-[100] inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) select-none items-center gap-1.5 rounded-md border border-sky-500/20 bg-popover px-2.5 py-1.5 text-xs font-medium text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,Y.jsx)(rh,{className:`fill-popover`})]})}),vv=({content:e,children:t,align:n,side:r,sideOffset:i,disabled:a=!1,contentClassName:o,delayDuration:s=0})=>(0,Y.jsx)(mv,{delayDuration:s,disableHoverableContent:!0,children:(0,Y.jsxs)(hv,{children:[(0,Y.jsx)(gv,{asChild:!0,children:t}),a?null:(0,Y.jsx)(_v,{className:o,align:n,side:r,sideOffset:i??8,children:e})]})}),yv=({value:e,items:t,onChange:n,disabled:r=!1,className:i})=>(0,Y.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,Y.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,Y.jsx)(vv,{content:t.inactiveTooltip,children:a},t.value)})}),bv=({activeTool:e,onChange:t})=>(0,Y.jsx)(yv,{value:e,items:[{value:`opencode`,label:`OpenCode`},{value:`claude`,label:`Claude`}],onChange:t}),xv=({activeTool:e,availableHelperModels:t,helperModel:n,helperVariant:r,isHelperModelsLoaded:i,isToolLoaded:a,onCreateProject:o,onHelperModelChange:s,onHelperVariantChange:c,onToolChange:l})=>{let{t:u}=K(`common`);return(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-10`,children:(0,Y.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,Y.jsx)(`h2`,{className:`max-w-xl text-3xl font-semibold tracking-tight text-foreground sm:text-4xl`,children:u(`emptyState.title`)}),(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u(`emptyState.description`)}),a?(0,Y.jsx)(`div`,{className:`w-fit`,children:(0,Y.jsx)(bv,{activeTool:e,onChange:l})}):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u(`emptyState.loadingToolPreference`)}),(0,Y.jsx)(pv,{helperModel:n,helperVariant:r,availableModels:t,isLoadingModels:!i,onHelperModelChange:s,onHelperVariantChange:c,modelSelectId:`welcome-helper-model`,variantSelectId:`welcome-helper-variant`,compact:!0})]}),(0,Y.jsx)(`div`,{className:`mt-8 flex flex-col gap-3 sm:flex-row sm:items-center`,children:(0,Y.jsx)(Q,{type:`button`,onClick:o,variant:`success`,size:`lg`,children:u(`emptyState.createFirstProject`)})})]})})},Sv=({isTransientError:e=!1,requestedProjectExists:t,retainedProject:n,defaultProject:r,onCreateProject:i,onOpenProject:a,onOpenWorkspace:o,onRetry:s})=>{let{t:c}=K(`common`);return(0,Y.jsx)(`main`,{className:`flex flex-1 items-center justify-center px-6 py-10`,children:(0,Y.jsxs)(`section`,{"aria-labelledby":`destination-unavailable-title`,className:`w-full max-w-2xl rounded-2xl border border-border bg-card p-8 shadow-xl shadow-black/20`,children:[(0,Y.jsx)(`h2`,{id:`destination-unavailable-title`,className:`text-2xl font-semibold tracking-tight`,children:c(e?`destinationUnavailable.errorTitle`:t?`destinationUnavailable.destinationTitle`:`destinationUnavailable.projectTitle`)}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:c(e?`destinationUnavailable.errorDescription`:t?`destinationUnavailable.destinationDescription`:`destinationUnavailable.projectDescription`)}),(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[e&&s&&(0,Y.jsx)(Q,{type:`button`,onClick:s,children:c(`destinationUnavailable.retry`)}),t&&!e&&(0,Y.jsx)(Q,{type:`button`,onClick:o,children:c(`destinationUnavailable.openWorkspace`)}),n&&(0,Y.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>a(n),children:c(`destinationUnavailable.openRetainedProject`,{project:n.name})}),!n&&r&&(0,Y.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>a(r),children:c(`destinationUnavailable.openDefaultProject`,{project:r.name})}),!r&&(0,Y.jsx)(Q,{type:`button`,onClick:i,children:c(`destinationUnavailable.createProject`)})]})]})})},Cv=({className:e})=>(0,Y.jsx)(Fg,{"aria-hidden":`true`,className:e}),wv=({className:e})=>(0,Y.jsx)(lte,{"aria-hidden":`true`,className:e}),Tv=({className:e})=>(0,Y.jsx)(mte,{"aria-hidden":`true`,className:e}),Ev=({activeProjectId:e,onCreateProject:t,projects:n,onEditProject:r,onProjectChange:i})=>{let{t:a}=K(`projects`),[o,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(!1),u=(0,p.useRef)(null),d=n.find(t=>t.id===e)??null,f=n.length>4,m=(0,p.useCallback)(()=>{let e=u.current?.getBoundingClientRect();if(!e)return!1;let t=window.innerHeight-e.bottom-16,n=e.top-16;return t<320&&n>t},[]);return(0,p.useEffect)(()=>{if(!o)return;let e=()=>{l(m())};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[m,o]),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-stretch`,children:[(0,Y.jsxs)(Y_,{open:o,onOpenChange:e=>{e&&l(m()),s(e)},children:[(0,Y.jsx)(`div`,{className:`relative min-w-0 flex-1`,ref:u,children:(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.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,Y.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:d?.name??a(`identity.emptyLabel`)})}),(0,Y.jsx)(`span`,{className:`flex h-6 w-6 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground`,children:(0,Y.jsx)(Cv,{className:`h-4 w-4`})})]})})}),(0,Y.jsxs)(Z_,{side:c?`top`:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:[(0,Y.jsxs)(H_,{filter:(e,t,n)=>sv(t,[e,...n??[]]),children:[f&&(0,Y.jsx)(U_,{placeholder:a(`identity.filterPlaceholder`)}),(0,Y.jsxs)(W_,{className:`max-h-72`,children:[(0,Y.jsx)(G_,{children:a(`identity.emptySearch`)}),(0,Y.jsx)(K_,{children:n.map(t=>(0,Y.jsx)(q_,{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,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:t.name}),(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t.repo_path})]})},t.id))})]})]}),(0,Y.jsx)(`div`,{className:`border-t border-border/70 p-1.5`,children:(0,Y.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,Y.jsx)(wv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:a(`identity.newProject`)})]})})]})]}),(0,Y.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,Y.jsx)(Tv,{className:`h-4 w-4`})})]})};function Dv({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:Z(`animate-pulse rounded-2xl bg-muted`,e),...t})}var Ov=({className:e=``})=>(0,Y.jsx)(Dv,{"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)}),kv=({stats:e=null,isLoading:t=!1,showFiles:n=!1,className:r=``})=>{if(t)return(0,Y.jsx)(`div`,{"data-testid":`ticket-diff-stats-skeleton`,className:`flex items-center gap-2 text-[11px] font-medium ${r}`.trim(),children:(0,Y.jsx)(Ov,{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,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium ${r}`.trim(),children:[n&&(0,Y.jsx)(`span`,{className:`text-muted-foreground text-nowrap`,children:i}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,e.additions]}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,e.deletions]})]})},Av=({className:e})=>(0,Y.jsx)(Zee,{"aria-hidden":`true`,className:e}),jv=({className:e})=>(0,Y.jsx)(Uee,{"aria-hidden":`true`,className:e}),Mv=({className:e})=>(0,Y.jsx)(Ig,{"aria-hidden":`true`,className:e}),Nv=({className:e})=>(0,Y.jsx)(Ng,{"aria-hidden":`true`,className:e}),Pv=({className:e})=>(0,Y.jsx)(Qee,{"aria-hidden":`true`,className:e}),Fv=({className:e})=>(0,Y.jsx)(cte,{"aria-hidden":`true`,className:e}),Iv=({className:e})=>(0,Y.jsx)(Ig,{"aria-hidden":`true`,className:e}),Lv=({className:e})=>(0,Y.jsx)(Bg,{"aria-hidden":`true`,className:e}),Rv=({className:e})=>(0,Y.jsx)(Vg,{"aria-hidden":`true`,className:e});function zv(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 Bv=e=>{switch(e){case`success`:return Ate;case`info`:return Mte;case`warning`:return jte;case`error`:return Nte;default:return null}},Vv=Array(12).fill(0),Hv=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},Vv.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Ate=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`})),jte=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`})),Nte=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`})),Pte=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`})),Fte=()=>{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(Lte(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}},Ite=(e,t)=>{let n=t?.id||Uv++;return Wv.addToast({title:e,...t,id:n}),n},Lte=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,$=Object.assign(Ite,{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()});zv(`[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 Rte=3,zte=`24px`,Bte=`16px`,Kv=4e3,Vte=356,Hte=14,Ute=45,Wte=200;function qv(...e){return e.filter(Boolean).join(` `)}function Gte(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Kte=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),[ee,te]=p.useState(!1),[z,B]=p.useState(0),[V,H]=p.useState(0),U=p.useRef(n.duration||b||Kv),ne=p.useRef(null),re=p.useRef(null),ie=c===0,ae=c+1<=o,oe=n.type,W=n.dismissible!==!1,se=n.className||``,ce=n.descriptionClassName||``,le=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ue=p.useMemo(()=>n.closeButton??m,[n.closeButton,m]),de=p.useMemo(()=>n.duration||b||Kv,[n.duration,b]),fe=p.useRef(0),pe=p.useRef(0),me=p.useRef(0),he=p.useRef(null),[ge,_e]=x.split(`-`),ve=p.useMemo(()=>s.reduce((e,t,n)=>n>=le?e:e+t.height,0),[s,le]),ye=Fte(),be=n.invert||t,xe=oe===`loading`;pe.current=p.useMemo(()=>le*S+ve,[le,ve]),p.useEffect(()=>{U.current=de},[de]),p.useEffect(()=>{M(!0)},[]),p.useEffect(()=>{let e=re.current;if(e){let t=e.getBoundingClientRect().height;return H(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),p.useLayoutEffect(()=>{if(!j)return;let e=re.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,H(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Se=p.useCallback(()=>{P(!0),B(pe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Wte)},[n,d,a,pe]);p.useEffect(()=>{if(n.promise&&oe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||ye?(()=>{if(me.current<fe.current){let e=new Date().getTime()-fe.current;U.current-=e}me.current=new Date().getTime()})():U.current!==1/0&&(fe.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Se()},U.current)),()=>clearTimeout(e)},[u,i,n,oe,ye,Se]),p.useEffect(()=>{n.delete&&(Se(),n.onDismiss==null||n.onDismiss.call(n,n))},[Se,n.delete]);function Ce(){return T?.loading?p.createElement(`div`,{className:qv(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},T.loading):p.createElement(Hv,{className:qv(w?.loader,n?.classNames?.loader),visible:oe===`loading`})}let we=n.icon||T?.[oe]||Bv(oe);return p.createElement(`li`,{tabIndex:0,ref:re,className:qv(v,se,w?.toast,n?.classNames?.toast,w?.default,w?.[oe],n?.classNames?.[oe]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":ee,"data-removed":N,"data-visible":ae,"data-y-position":ge,"data-x-position":_e,"data-index":c,"data-front":ie,"data-swiping":F,"data-dismissible":W,"data-type":oe,"data-invert":be,"data-swipe-out":L,"data-swipe-direction":k,"data-expanded":!!(u||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${N?z:pe.current}px`,"--initial-height":C?`auto`:`${V}px`,...h,...n.style},onDragEnd:()=>{I(!1),O(null),he.current=null},onPointerDown:e=>{e.button!==2&&(xe||!W||(ne.current=new Date,B(pe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),he.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!W)return;he.current=null;let e=Number(re.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(re.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ne.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Ute||a>.11){B(pe.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Se(),R(!0);return}else{var o,s;(o=re.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=re.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}te(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!he.current||!W||window.getSelection()?.toString().length>0)return;let i=t.clientY-he.current.y,a=t.clientX-he.current.x,o=e.swipeDirections??Gte(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)&&te(!0),(n=re.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=re.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ue&&!n.jsx&&oe!==`loading`?p.createElement(`button`,{"aria-label":E,"data-disabled":xe,"data-close-button":!0,onClick:xe||!W?()=>{}:()=>{Se(),n.onDismiss==null||n.onDismiss.call(n,n)},className:qv(w?.closeButton,n?.classNames?.closeButton)},T?.close??Pte):null,(oe||n.icon||n.promise)&&n.icon!==null&&(T?.[oe]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:qv(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ce():null,n.type===`loading`?null:we):null,p.createElement(`div`,{"data-content":``,className: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,ce,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)&&W&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Se())},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&&Se())},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 qte(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Bte:zte;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 Jte=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:_=Rte,toastOptions:v,dir:y=Jv(),gap:b=Hte,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),ee=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":`${Vte}px`,"--gap":`${b}px`,...g,...qte(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(Kte,{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:ee,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,Y.jsx)(Gee,{"aria-hidden":`true`,className:e}),Yte=(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)),Xte=(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},ny=(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`}:Xte(e,t,n)?{valid:!1,reason:`cycle`}:{valid:!0},Zte=e=>e===`self`?`A ticket cannot depend on itself.`:e===`duplicate`?`This dependency already exists.`:`This dependency would create a cycle.`,ry=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,iy=e=>!e||e.has_worktree===!1?!1:e.run_setup_status===`ready`?!0:ry(e),ay=e=>{if(!(!e||e.has_worktree===!1)){if(e.run_setup_status===`preparing`)return`Setting up worktree...`;if(!iy(e))return`Run unlocks after setup finishes.`}},Qte=(e,t,n)=>n.filter(t=>t.dependent_ticket_id===e.id).map(e=>t.get(e.blocker_ticket_id)).filter(e=>!!e&&!ry(e)),$te=(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},oy=(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&&Yte(r,o)<0){e.splice(a,0,t),i=!0;break}}i||e.push(t)},ene=(e,t,n)=>{if(!t.get(e))return[];let r=$te(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&&oy(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&&oy(c,n,t)}}}return l.map(e=>t.get(e)).filter(e=>!!e)},sy=(e,t,n)=>{let r=ene(e.id,t,n),i=r.filter(e=>!ry(e)),a=r.length>1,o=Qte(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}},cy=(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}}},tne=(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)}},ly={plan:0,build:1,review:2},nne={plan:`build`,build:`review`},uy=e=>nne[e]??null,dy=e=>e===`plan`?`plan`:e===`build`||e===`review`||e===`done`?`build`:`default`,fy=e=>e.worktree_bundle_id??e.id,rne=(e,t)=>{if(!e)return null;let n=t.find(t=>t.id===e.ticket_id);return n?fy(n):e.ticket_id},ine=({bundleId:e,activeRunContextKey:t,isProjectRootRunActive:n})=>n?!0:t!==null&&t!==e,py=(e,t,n,r)=>n||t!==null&&t!==fy(e)?r:ay(e),my=(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,ane=(e,t)=>t.map(t=>{let n=e.find(e=>e.id===t.id);return!n||n.agent_status!==`running`||t.agent_status===`running`||n.updated_at<t.updated_at?t:my(t,n)}),one=(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)))},hy=e=>e.state===`build`||e.state===`review`&&e.review_follow_up_active===!0,gy=e=>e.state===`review`&&e.review_follow_up_active!==!0,_y=e=>e.parked_at!==null,vy=e=>_y(e)?`done`:e.state,yy=e=>e.is_stale===!0,sne=e=>e?e.files_changed===0&&e.additions===0&&e.deletions===0:!1,by=(e,t)=>!t||e===`plan`?!1:!(e===`done`&&sne(t)),xy=e=>_y(e)||e.agent_status===`running`?!1:e.state===`build`?e.agent_status===`done`:e.state===`review`,cne=(e,t)=>_y(e)&&e.state===t,Sy=e=>e.tickets.length>0&&e.tickets.every(e=>Dy(e,`trash`)),lne=e=>e.tickets.length>0&&e.tickets.every(e=>Dy(e,`done`)),Cy=e=>e.column===`done`&&e.tickets.length>0&&e.tickets.every(e=>e.state!==`plan`),wy=(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}:{},Ty=(e,t)=>e===`plan`&&t===`build`?`build`:e===`build`&&t===`review`?`review`:e===`review`&&t===`build`?`undoReview`:null,Ey=(e,t,n)=>t===`review`&&n===`build`?{}:wy(e,n),Dy=(e,t)=>e.agent_status===`running`?!1:t===`done`?xy(e):!(t!==`trash`&&ly[t]<=ly[e.state]||t===`review`&&(e.state!==`build`||e.agent_status!==`done`&&e.agent_status!==`stopped`)),Oy=e=>{let t=uy(e.state);return!t||Dy(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},ky=[...[`plan`,`build`,`review`],`done`],Ay=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}),jy=(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},My=e=>e.kind===`project_root`?!0:e.has_prepared_worktree!==!1,Ny=e=>e.filter(e=>e.kind!==`project_root`&&My(e)),Py=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,Fy=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,Iy=e=>e.has_worktree??!!(e.bundle?.branch??e.branch),Ly=(e,t)=>My(e)||t.some(t=>t.worktree_bundle_id===e.id&&Iy(t)),Ry=(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=Fy(e),a=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId&&e.session_id)??null:Py(e),o=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId)??null:null;return n??r??i??a??o??e.find(e=>Iy(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=jy(t[0],r);return i?[{kind:`bundle`,group:{id:`${i.id}:${n}`,bundle:i,column:n,tickets:Ay(t)}}]:t.map(e=>({kind:`ticket`,ticket:e}))})},By=e=>`bundle-group:${e.id}`,Vy=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(vy(n));continue}t.set(n.worktree_bundle_id,new Set([vy(n)]))}let n=new Set;for(let[e,r]of t)r.size>=2&&n.add(e);return n},Hy=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 ky.includes(i)?{bundleId:r,column:i}:null},Uy=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()},Wy=(e,t)=>{let n=Uy(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},Gy=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?e.name??``:e.branch??``;let t=Uy(e.name||e.branch||``);return e.branch?Wy(t,e.branch):t},Ky=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?`Project root`:`Project root (${e.branch})`;let t=Gy(e),n=e.branch??``,r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return t===``||n===``?t||n:r===i?t:`${t} (${n})`},qy=(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`,Jy=({activeProject:e,branchState:t,bundles:n,branchSuggestions:r,activeTargetCanPull:i=null,isBundleLoading:a=!1,isLoading:o,presentation:s=`footer`,closeAfterSelection:c=!0,triggerAriaLabel:l,onOpenChange:u,onSelectBundle:d,onSelectRepoRoot:f,targetGitStatus:m=null,activeBranchAction:h=null,onRebase:g,onManageBundles:_})=>{let{t:v}=K(`common`),[y,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(!1),T=s===`composer`,E=e.active_target_kind!==`bundle`,D=(0,p.useMemo)(()=>Ny(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?Ky(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)(()=>qy(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`),ee=m?.operation_state===`idle`,te=!g||!ee||!!m?.rebase_disabled_reason||h!==null||C;(0,p.useEffect)(()=>{y&&S(t?.branch??``)},[t?.branch,y]);let z=e=>{b(e),u?.(e)},B=()=>{c&&z(!1)},V=async e=>{w(!0);try{await d(e)&&B()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.bundleSwitch`))}finally{w(!1)}},H=async(e,t)=>{w(!0);try{await f(e,t)&&B()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.repoRootSwitch`))}finally{w(!1)}},U=async()=>{if(g){w(!0);try{await g(),z(!1)}catch(e){$.error(e instanceof Error?e.message:v(`projectFooter.rebaseFallbackError`))}finally{w(!1)}}};return(0,Y.jsxs)(Y_,{open:y,onOpenChange:z,children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.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,Y.jsx)(Ov,{className:`h-3.5 w-20`}):(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 ${M}`,children:[(0,Y.jsx)(Yv,{className:`h-3.5 w-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate font-medium`,children:A})]})})}),(0,Y.jsx)(Z_,{align:`start`,className:T?`w-[22rem] max-w-[calc(100vw-2rem)] p-3`:`w-[28rem] max-w-[calc(100vw-2rem)] p-4`,children:(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:v(`projectTargetSelector.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:v(`projectTargetSelector.description`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.targetLabel`)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:I})]}),(0,Y.jsxs)(H_,{className:`rounded-xl border border-border/70 bg-background/40 p-0`,label:v(`projectTargetSelector.searchAriaLabel`),shouldFilter:!0,children:[(0,Y.jsx)(U_,{placeholder:v(`projectTargetSelector.searchPlaceholder`),"aria-label":v(`projectTargetSelector.searchAriaLabel`)}),(0,Y.jsxs)(W_,{className:`max-h-56 p-1`,"data-testid":`project-target-options`,children:[(0,Y.jsx)(G_,{children:v(N?`projectTargetSelector.loadingTargets`:`projectTargetSelector.noSearchResults`)}),(0,Y.jsxs)(q_,{value:`${v(`projectTargetSelector.repoRoot`)} ${k??``}`,"data-checked":E,disabled:N||C,"aria-label":`${j}. ${E?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{H(null)},className:`min-h-12`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:v(`projectTargetSelector.repoRoot`)}),(0,Y.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:k??v(`projectTargetSelector.loadingTarget`)})]}),E&&(0,Y.jsx)(`span`,{className:`mr-6 text-xs text-muted-foreground`,children:v(`projectTargetSelector.status.selected`)})]}),D.map(t=>{let n=Gy(t),r=Ky(t),i=e.active_target_kind===`bundle`&&e.active_target_bundle_id===t.id;return(0,Y.jsxs)(q_,{value:r,"data-checked":i,disabled:N||C,"aria-label":`${r}. ${i?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{V(t.id)},className:`min-h-12`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:n}),t.branch&&n.toLowerCase()!==t.branch.toLowerCase()&&(0,Y.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:t.branch})]}),i&&(0,Y.jsx)(`span`,{className:`mr-6 text-xs text-muted-foreground`,children:v(`projectTargetSelector.status.selected`)})]},t.id)}),N&&(0,Y.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,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin`}),(0,Y.jsx)(`span`,{children:v(`projectTargetSelector.loadingTargets`)})]}),!N&&D.length===0&&(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:v(`projectTargetSelector.noBundles`)})]})]}),!T&&_&&(0,Y.jsx)(Q,{type:`button`,variant:`outline`,className:`w-full justify-start`,disabled:C,onClick:()=>{z(!1),_?.()},children:v(`projectTargetSelector.manageBundles`)})]}),!T&&(0,Y.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 pt-4`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.repoRootBranch`)}),(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-3`,children:[(0,Y.jsx)(`div`,{className:`space-y-2`,children:L.length>0?L.map(({key:e,label:t,branch:n})=>(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between`,disabled:!E||C||!n,onClick:()=>{H(n)},children:[(0,Y.jsx)(`span`,{children:t}),(0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n})]},e)):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v(o?`projectTargetSelector.loadingBranches`:`projectTargetSelector.noSuggestedBranches`)})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 sm:flex-nowrap`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56 space-y-1`,children:[(0,Y.jsx)(J_,{htmlFor:`project-target-branch-input`,className:`text-xs text-muted-foreground`,children:v(`projectTargetSelector.switchOrCreateBranch`)}),(0,Y.jsx)(F_,{id:`project-target-branch-input`,value:x,disabled:!E||C,onChange:e=>S(e.target.value),placeholder:v(`projectTargetSelector.branchPlaceholder`)})]}),(0,Y.jsx)(Q,{type:`button`,disabled:!E||!x.trim()||C,onClick:()=>{H(x)},children:v(`projectTargetSelector.switchBranch`)})]})]})]}),!T&&ee&&(0,Y.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 pt-4`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.actions`)}),(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between`,disabled:te,title:m?.rebase_disabled_reason??void 0,onClick:()=>{U()},children:[(0,Y.jsx)(`span`,{children:R}),h===`rebase`&&(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`})]})]})]})})]})},Yy=(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,Xy=({activeProject:e,activeRun:t,branchState:n,targetGitStatus:r,isBoardLoadedForActiveProject:i,activeProjectBranchAction:a,isProjectIdeAvailable:o,isProjectRunAvailable:s,isRunStatusLoadedForActiveProject:c,isTerminalOpen:l,hasConfiguredTests:u,hasConfiguredChecks:d,targetBundles:f,targetBranchSuggestions:p,isTargetBundleLoading:m,isTargetSelectorLoading:h,isTargetGitStatusLoading:g,onProjectFilesOpen:_,onProjectChangesOpen:v,onProjectVerificationOpen:y,onProjectPull:b,onProjectRebase:x,onProjectAbortGitOperation:S,onProjectRunToggle:C,onTerminalToggle:w,onProjectIdeOpen:T,onTargetSelectorOpenChange:E,onSelectBundleTarget:D,onSelectRepoRootTarget:O,onManageBundles:k})=>{let{t:A}=K(`common`),j=r?.operation_state??`idle`,M=!!(e&&r&&r.behind>0&&j===`idle`),N=(()=>{let e=Yy(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`),ee=j===`merge`||j===`rebase`,te=A(j===`merge`?`projectFooter.abortMerge`:`projectFooter.abortRebase`),z=!!e,B=!!(e&&n?.diffStats?.is_dirty),V=A(l?`workspaceControls.hideTerminalAriaLabel`:`workspaceControls.openTerminalAriaLabel`),H=e?.active_target_kind??`repo_root`,U=e?.active_target_bundle_id??null,ne=H!==`bundle`||f.some(e=>e.id===U&&e.has_prepared_worktree===!0),re=e!==null&&t?.kind===`project`&&t.project_id===e.id&&(t.target_kind??`repo_root`)===H&&((t.target_kind??`repo_root`)!==`bundle`||t.target_bundle_id===U),ie=e!==null&&!re&&(!i||!c),ae=!e||!re&&(!s||t!==null||ie),oe=A(re?`projectFooter.stop`:`projectFooter.run`),W=(()=>{if(!e)return A(`projectFooter.selectProjectFirst`);if(!re){if(!s)return A(`projectFooter.addRunConfig`);if(ie)return A(`projectFooter.loadingProjectStatus`);if(t?.kind===`project`)return A(`projectFooter.stopSelectedTargetRun`);if(t?.kind===`ticket`)return A(`projectFooter.stopTicketBeforeSelectedTargetRun`)}})();return(0,Y.jsx)(`footer`,{className:`border-t border-border bg-background/95 px-6 py-3 backdrop-blur`,"data-testid":`project-footer`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Y.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,Y.jsx)(`div`,{className:`flex max-w-full items-center gap-2 overflow-hidden`,children:(0,Y.jsx)(Jy,{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})}),ee&&(0,Y.jsxs)(Q,{type:`button`,onClick:()=>{S()},disabled:a!==null,variant:`outline`,className:`h-8 gap-2 px-3 text-xs`,children:[I?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:I?A(`projectFooter.aborting`):te})]}),M&&(0,Y.jsxs)(Q,{type:`button`,onClick:b,disabled:!L,variant:`outline`,className:`h-8 gap-2 px-3 text-xs`,children:[F?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Iv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:F?R===A(`projectFooter.sync`)?A(`projectFooter.syncing`):A(`projectFooter.pulling`):R})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3 sm:gap-4`,children:[B&&n?.diffStats&&(0,Y.jsx)(kv,{stats:n.diffStats,showFiles:!0,className:`text-xs`}),z&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.changes`),onClick:v,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(Mv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.changes`)})]}),(0,Y.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.files`),onClick:_,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(jv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.files`)})]})]}),(d||u)&&ne&&(0,Y.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.verification`),onClick:y,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(Av,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.verification`)})]}),(0,Y.jsxs)(Q,{type:`button`,"aria-label":V,"aria-pressed":l,onClick:w,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(Rv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.terminal`)})]}),e&&o&&(0,Y.jsxs)(Q,{type:`button`,onClick:T,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(Nv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.openIde`)})]}),(0,Y.jsxs)(Q,{type:`button`,"data-testid":`project-root-run-button`,disabled:ae,title:W,onClick:C,variant:re?`destructive`:`secondary`,className:[`gap-2`,re?``:`bg-sky-700 text-sky-100 hover:bg-sky-600 hover:text-white`,ae?`bg-slate-700 text-slate-400 hover:bg-slate-700 hover:text-slate-400`:``].join(` `),children:[re&&(0,Y.jsx)(`span`,{className:`h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400 animate-pulse`,"data-testid":`project-root-run-indicator`}),re?(0,Y.jsx)(Lv,{className:`h-4 w-4`}):(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:oe})]})]})]})})},Zy=e=>(0,Y.jsx)(tp,{"data-slot":`dropdown-menu`,...e}),Qy=e=>(0,Y.jsx)(np,{"data-slot":`dropdown-menu-trigger`,...e}),$y=({className:e,align:t=`end`,sideOffset:n=6,...r})=>(0,Y.jsx)(rp,{children:(0,Y.jsx)(ip,{"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})}),eb=({className:e,inset:t=!1,...n})=>(0,Y.jsx)(ap,{"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}),tb=({state:e,className:t})=>e?(0,Y.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,nb=({className:e})=>(0,Y.jsx)(Ug,{"aria-hidden":`true`,className:e}),rb=({className:e})=>(0,Y.jsx)(ute,{"aria-hidden":`true`,className:e}),ib=class extends Error{constructor(e){super(e),this.name=`UpgradeInProgressError`}},ab=async e=>{let t=await fetch(q(`/tools/upgrade`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tool:e})});if(t.status===409)throw new ib(await Ze(t,`upgrade already running`));if(!t.ok)throw new Ke(await Ze(t,`Upgrade failed.`),t.status);return await t.json()},ob=({onUpgrade:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)({opencode:`idle`,claude:`idle`}),i=e=>({opencode:{success:t(`toolsMenu.openCodeSuccess`),successWithVersion:t(`toolsMenu.openCodeSuccessWithVersion`),upToDate:t(`toolsMenu.openCodeUpToDate`),upToDateWithVersion:t(`toolsMenu.openCodeUpToDateWithVersion`),failed:t(`toolsMenu.openCodeFailed`),alreadyRunning:t(`toolsMenu.openCodeAlreadyRunning`)},claude:{success:t(`toolsMenu.claudeSuccess`),successWithVersion:t(`toolsMenu.claudeSuccessWithVersion`),upToDate:t(`toolsMenu.claudeUpToDate`),upToDateWithVersion:t(`toolsMenu.claudeUpToDateWithVersion`),failed:t(`toolsMenu.claudeFailed`),alreadyRunning:t(`toolsMenu.claudeAlreadyRunning`)}})[e],a=async a=>{if(n[a]===`running`)return;r(e=>({...e,[a]:`running`}));let o=i(a);try{let e=await ab(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 ib){$.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,Y.jsxs)(eb,{disabled:i,onSelect:t=>{t.preventDefault(),a(e)},children:[i?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(rb,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:i?r:t})]})};return{hasRunningUpgrade:Object.values(n).some(e=>e===`running`),renderUpgradeMenuItems:()=>(0,Y.jsxs)(Y.Fragment,{children:[o(`opencode`,t(`toolsMenu.updateOpenCode`),t(`toolsMenu.openCodeRunning`)),o(`claude`,t(`toolsMenu.updateClaude`),t(`toolsMenu.claudeRunning`))]})}},sb=({onUpgrade:e,onOpenExecutionRuntimes:t})=>{let{t:n}=K(`common`),{renderUpgradeMenuItems:r}=ob({onUpgrade:e});return(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,"aria-label":n(`toolsMenu.triggerAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`rounded-xl border border-border/70`,children:(0,Y.jsx)(nb,{className:`h-4 w-4`})})}),(0,Y.jsxs)($y,{align:`end`,className:`w-60`,children:[t&&(0,Y.jsxs)(eb,{onSelect:t,children:[(0,Y.jsx)(nb,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:n(`toolsMenu.runtimes`)})]}),r()]})]})},cb=({className:e})=>(0,Y.jsx)(Mee,{"aria-hidden":`true`,className:e}),lb=({className:e})=>(0,Y.jsx)(Pg,{"aria-hidden":`true`,className:e}),ub=({className:e})=>(0,Y.jsx)(`svg`,{"aria-hidden":`true`,className:e,viewBox:`0 0 16 16`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,Y.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`})}),db=({className:e})=>(0,Y.jsx)(Bee,{"aria-hidden":`true`,className:e}),fb={"X-Archon-Desktop-Action":`mobile-access`},pb=e=>J(q(`/mobile-access/status`),{signal:e}),mb=e=>J(q(`/mobile-access/enable`),{method:`POST`,headers:fb,body:e}),hb=()=>J(q(`/mobile-access/disable`),{method:`POST`,headers:fb}),gb=e=>J(q(`/mobile-access/regenerate-pairing`),{method:`POST`,headers:fb,body:{preferred_project_id:e??null}}),_b=e=>J(q(`/mobile-access/sessions/${encodeURIComponent(e)}/revoke`),{method:`POST`,headers:fb}),vb=new Set,yb=null,bb=null,xb=()=>{for(let e of vb)e(yb)},Sb=()=>{bb!==null&&(window.clearTimeout(bb),bb=null)},Cb=e=>{if(typeof window>`u`||(Sb(),e?.state!==`awaiting_pairing`||!e.pairing))return;let t=new Date(e.pairing.expires_at).getTime();if(Number.isNaN(t))return;let n=()=>{yb?.state!==`awaiting_pairing`||yb.pairing?.expires_at!==e.pairing?.expires_at||wb({...yb,state:`expired`,pairing:null})},r=t-Date.now();if(r<=0){n();return}bb=window.setTimeout(n,r)},wb=e=>{yb=e,Cb(e),xb()},Tb=async e=>{let t=await pb(e);return wb(t),t},Eb=()=>{let[e,t]=(0,p.useState)(yb);return(0,p.useEffect)(()=>(vb.add(t),()=>{vb.delete(t)}),[]),e},Db=e=>{(0,p.useEffect)(()=>{if(!e)return;let t=null,n=()=>{t?.abort(),t=new AbortController;let e=t;Tb(e.signal).catch(e=>{Xe(e)}).finally(()=>{t===e&&(t=null)})};n();let r=e=>{wb(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])},Ob=`(min-width: 1440px)`,kb=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches,Ab=e=>{let[t,n]=(0,p.useState)(()=>kb(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},jb=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`,Mb=(e,t)=>{if(!e||e.state===`disabled`){let n=t(`projectHeader.runtime.mobileDisabled`);return{buttonClassName:jb(e),indicatorState:`inactive`,isActive:!1,statusLabel:n,tooltip:n}}if(e.state===`awaiting_pairing`){let n=t(`projectHeader.runtime.mobileReadyToPair`);return{buttonClassName:jb(e),indicatorState:`running`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`connected`){let n=t(`projectHeader.runtime.mobileConnected`);return{buttonClassName:jb(e),indicatorState:`finished`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`expired`){let n=t(`projectHeader.runtime.mobilePairingExpired`);return{buttonClassName:jb(e),indicatorState:`interrupted`,isActive:!0,statusLabel:n,tooltip:n}}return{buttonClassName:jb(e),indicatorState:`error`,isActive:!0,statusLabel:t(`projectHeader.runtime.mobileUnavailable`),tooltip:e.error??t(`projectHeader.runtime.mobileUnavailable`)}},Nb=(e,t)=>t(e===`opencode`?`projectHeader.agent.openCode`:`projectHeader.agent.claude`),Pb=({activeTool:e,onToolChange:t})=>{let{t:n}=K(`common`);return(0,Y.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,Y.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:Nb(r,n)},r)})})},Fb=({activeTool:e,onToolChange:t})=>{let{t:n}=K(`common`);return(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.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,Y.jsx)(cb,{className:`h-4 w-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{children:Nb(e,n)}),(0,Y.jsx)(Cv,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,Y.jsx)($y,{align:`end`,className:`w-44`,children:[`opencode`,`claude`].map(r=>{let i=e===r;return(0,Y.jsxs)(eb,{onSelect:()=>t(r),children:[(0,Y.jsx)(cb,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:Nb(r,n)}),i&&(0,Y.jsx)(lb,{className:`h-4 w-4 text-muted-foreground`})]},r)})})]})},Ib=({hasActiveGitHubRuns:e=!1,onOpenGitHubActions:t})=>{let{t:n}=K(`common`);return t?(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.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,Y.jsx)(ub,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:n(`workspaceControls.githubActions`)})]}),e&&(0,Y.jsx)(tb,{state:`running`,className:`absolute -top-0.5 -right-0.5`})]}):null},Lb=({onOpenActivity:e})=>{let{t}=K(`common`);return e?(0,Y.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,Y.jsx)(db,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:t(`projectHeader.runtime.activityLabel`)})]}):null},Rb=({mobileAccessStatus:e,onMobileAccessOpen:t})=>{let{t:n}=K(`common`);if(!t)return null;let r=Mb(e,n);return(0,Y.jsx)(vv,{content:r.tooltip,children:(0,Y.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,Y.jsx)(tb,{state:r.indicatorState,className:`mt-0`}),(0,Y.jsx)(`span`,{children:n(`projectHeader.runtime.mobileLabel`)})]})})},zb=({hasActiveGitHubRuns:e=!1,mobileAccessStatus:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onOpenExecutionRuntimes:a})=>{let{t:o}=K(`common`),{hasRunningUpgrade:s,renderUpgradeMenuItems:c}=ob({}),l=Mb(t,o),u=o(`projectHeader.runtime.triggerLabel`),d=null;return i&&e?d=`running`:n&&l.isActive?(u=l.statusLabel,d=l.indicatorState):s&&(u=o(`projectHeader.runtime.toolUpdateRunning`),d=`running`),(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,"aria-label":o(`projectHeader.runtime.triggerAriaLabel`),variant:`ghost`,className:`relative h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-foreground hover:bg-accent/20`,children:[(0,Y.jsx)(nb,{className:`h-4 w-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{children:u}),d&&(0,Y.jsx)(tb,{state:d,className:`absolute -top-0.5 -right-0.5`})]})}),(0,Y.jsxs)($y,{align:`end`,className:`w-60`,children:[a&&(0,Y.jsxs)(eb,{onSelect:a,children:[(0,Y.jsx)(nb,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openExecutionRuntimes`)})]}),r&&(0,Y.jsxs)(eb,{onSelect:r,children:[(0,Y.jsx)(db,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openActivity`)})]}),i&&(0,Y.jsxs)(eb,{onSelect:i,children:[(0,Y.jsx)(ub,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openGitHubActions`)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(e?`projectHeader.runtime.githubStatusRunning`:`projectHeader.runtime.githubStatusIdle`)})]}),n&&(0,Y.jsxs)(eb,{onSelect:n,children:[(0,Y.jsx)(tb,{state:l.indicatorState,className:`mt-0`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openMobileAccess`)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l.statusLabel})]}),c()]})]})},Bb=({activeTool:e,hasActiveGitHubRuns:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onOpenExecutionRuntimes:a,onToolChange:o})=>{let s=Eb(),c=Ab(Ob);return(0,Y.jsxs)(`div`,{className:`flex w-full min-w-0 items-center justify-end gap-2`,children:[c?(0,Y.jsx)(Pb,{activeTool:e,onToolChange:o}):(0,Y.jsx)(Fb,{activeTool:e,onToolChange:o}),c?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ib,{hasActiveGitHubRuns:t,onOpenGitHubActions:i}),(0,Y.jsx)(Lb,{onOpenActivity:r}),(0,Y.jsx)(Rb,{mobileAccessStatus:s,onMobileAccessOpen:n}),(0,Y.jsx)(sb,{onOpenExecutionRuntimes:a})]}):(0,Y.jsx)(zb,{hasActiveGitHubRuns:t,mobileAccessStatus:s,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onOpenExecutionRuntimes:a})]})},Vb=`common`,Hb={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`},autoFix:{attempt:`Attempt {{current}} of {{total}}`,phase:{dispatching:`Starting automatic repair`,repairing:`Repairing checks`,rerunning:`Rerunning the originating check batch`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`,fallback:`Continuation was rejected; starting a fresh repair`},terminal:{passed:`Automatic repair passed all checks`,ineligible:`These failures cannot be repaired automatically`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair agent made no changes`,unchanged_failures:`Automatic repair made no progress`,user_cancelled:`Automatic repair was stopped by the user`,stale:`Check definitions or workspace became stale`,exhausted:`Automatic repair used all three attempts`,interrupted:`Automatic repair was interrupted`}}},workspaceTabs:{ariaLabel:`Project workspace`,board:`Board`,chat:`Chat`,spec:`Spec`,memory:`Memory`},destinationUnavailable:{errorTitle:`Unable to open destination`,errorDescription:`Archon could not load this destination. Check your connection and try again.`,retry:`Try again`,destinationTitle:`Destination unavailable`,destinationDescription:`This item may have been deleted, may not belong to this project, or is not available in this workspace.`,projectTitle:`Project unavailable`,projectDescription:`This project no longer exists or is not available for this link.`,openWorkspace:`Open nearest workspace`,openRetainedProject:`Open {{project}}`,openDefaultProject:`Open {{project}}`,createProject:`Create project`},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`,check_auto_fix:`Automatic check repair`,github_actions:`GitHub Actions`,plan:`Plan`,planning_agent:`Planning agent`,build:`Build`,review:`Review`,chat_turn:`Chat turn`,spec_turn:`Spec turn`,spec_review:`Spec review`,build_follow_up:`Build follow-up`,plan_follow_up:`Plan follow-up`,automation_progression:`Automation progression`,automation_review_fix:`Automated review fix`,automation_commit:`Automated commit`,automation_push:`Automated push`,automation_pull_request:`Automated pull request`,repository_graph_scan:`Repository graph scan`,environment_validation:`Environment validation`,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.`,event:`Unable to load the requested activity event right now.`,retry:`Unable to retry this run right now.`},events:{fallback:`Run state changed`,sequence:`Sequence`,transition:`Status`,transitionValue:`{{from}} to {{to}}`,outcome:`Outcome`,timeInState:`Time in state`},group:{ariaLabel:`Execution sequence`,parentOutsidePage:`{{kind}} parent outside the loaded page`},environmentContext:{summary:`{{target}} · revision {{revision}} · {{provider}}`,unknown:`Unknown`},buildEvidence:{timeline:{host:`Build environment: This machine (host)`,docker_sandbox:`Build environment: Docker Sandbox · revision {{revision}}`,unknown:`Build environment: Unknown`},unknown:`Unknown`,target:`{{kind}}: {{key}}`,provider:{host:`This machine (host)`,docker_sandbox:`Docker Sandbox`,unknown:`Unknown`}},environmentLifecycle:{queued:`Queued`,preparing:`Preparing`,ready:`Ready`,running:`Running`,stopped:`Stopped`,retiring:`Retiring`,cleanup_pending:`Cleanup pending`,retired:`Retired`,failed:`Failed`,unavailable:`Unavailable`,unknown:`Unknown`},artifacts:{title:`Artifacts`,evidence:`Evidence`,summaryAriaLabel_one:`Evidence, {{count}} artifact`,summaryAriaLabel_other:`Evidence, {{count}} artifacts`,count_one:`{{count}} artifact`,count_other:`{{count}} artifacts`,overflow_one:`+{{count}} more`,overflow_other:`+{{count}} more`,overflowDescription_one:`{{count}} additional artifact is not shown in this summary.`,overflowDescription_other:`{{count}} additional artifacts are not shown in this summary.`,sensitiveTitle:`Sensitive artifact`,untitledTitle:`Untitled artifact`,kindLabel:`Kind`,mediaType:`Media type`,size:`Size`,expires:`Expires`,sensitivityLabel:`Sensitivity`,availabilityLabel:`Availability`,downloadOnly:`Download only. Preview and external access are disabled for sensitive artifacts.`,kind:{report:`Report`,screenshot:`Screenshot`,log_excerpt:`Log excerpt`,structured_result:`Structured result`},sensitivity:{normal:`Standard`,sensitive:`Sensitive`},availability:{available:`Available`,expired:`Expired`,missing:`Missing`,deletion_failed:`Deletion pending`,deleted:`Deleted`},actions:{download:`Download`,downloadAriaLabel:`Download {{title}}`,open:`Open`,openAriaLabel:`Open {{title}}`},unavailable:{expired:`This artifact has expired and is no longer available.`,missing:`This artifact can no longer be found.`,deletion_failed:`This artifact is unavailable while deletion is completed.`,deleted:`This artifact has been deleted.`,noAction:`No action is available for this artifact.`}},retry:{confirmTitle:`Retry as a new attempt?`,confirmDescription:`A fresh attempt and provider session will be created. The previous attempt and all retained evidence will remain in history.`,confirmAction:`Create new attempt`,retentionNotice:`Retrying creates a fresh attempt while retaining this attempt and its evidence.`},rerun:{confirmTitle:`Rerun this check batch?`,confirmDescription:`A new batch will run the same source checks. This batch and its retained evidence will remain in history.`,confirmAction:`Rerun checks`,retentionNotice:`Rerunning creates a new batch while retaining this batch and its evidence.`},retryDenial:{unsupported_kind:`This run type cannot be retried.`,status_not_retryable:`This run is not in a retryable status.`,automation_resume_required:`Resume this run from its automation controls instead.`,retry_already_created:`A newer retry attempt already exists.`,retry_source_superseded:`Newer source activity has superseded this run.`,attempt_superseded:`A newer attempt has superseded this run.`,retry_target_missing:`The retry target no longer exists.`,retry_target_busy:`The retry target is currently busy.`,retry_state_incompatible:`The source is no longer in a compatible state for retry.`,retry_input_unavailable:`The exact input required for this retry is no longer available.`,retry_workspace_unavailable:`The required workspace is unavailable.`,unknown:`This run cannot be retried right now.`},details:{ariaLabel:`Run details`,title:`Run details`,selectPrompt:`Select a run to inspect its durable details and transition evidence.`,status:`Status`,attempt:`Attempt`,attemptValue:`Attempt {{count}}`,lineage:`Lineage`,retryOfAttempt:`Retry of attempt {{count}}`,retryLineage:`Retry lineage · attempt {{count}}`,priorAttemptUnavailable:`Prior attempt is outside retained history`,source:`Source`,environment:`Environment`,sourceUnavailable:`Source unavailable`,created:`Created`,started:`Started`,completed:`Completed`,failureReason:`Failure reason`,environmentValidationEvidence:`Environment validation evidence`,buildExecutionEvidence:`Build execution evidence`,buildExecutionEvidenceNotice:`Recorded for this Build run. Later project setting changes do not alter this evidence or its follow-up lineage.`,buildExecutionUnknown:`No recognized provider evidence was recorded. Archon does not assume host execution.`,buildProvider:`Build environment`,environmentId:`Environment ID`,providerVersion:`Provider version`,targetWorkspace:`Target workspace`,validationFingerprint:`Validation fingerprint`,capabilities:`Capabilities`,degradation:`Degradation`,authenticationMode:`Authentication mode`,credentialDelivery:`Credential delivery`,agent:`Agent`,unknown:`Unknown`,none:`None`,environmentRevision:`Environment revision`,environmentLifecycle:`Persistent environment state`,restartInterruptionEvidence:`This validation was interrupted by a server restart. The persistent environment is tracked separately and may still be available.`,loading:`Loading run details...`,testEvidence:`Test evidence`,checkBatchEvidence:`Check batch`,checkAttemptEvidence:`Check attempt`,checkRepairEvidence:`Repair provenance`,checkAutoFixEvidence:`Automatic repair history`,repairSource:`Repair source`,causalBuild:`Causal Build run`,causalExecution:`Causal execution run`,currentPhase:`Current phase`,launchDecision:`Launch decision`,continuation:`Continued provider session`,freshLaunch:`Fresh provider session`,fallbackUsed:`Fallback used`,fallbackYes:`Yes, before execution`,fallbackNo:`No`,repairAttempt:`Repair attempt {{current}} of {{total}}`,terminalExplanation:`Terminal explanation`,repairSourceType:{ticket:`Ticket`,chat_session:`Chat session`},launch:{continued:`Continued exact provider session`,fresh:`Fresh same-configuration session`},autoFixPhase:{dispatching:`Dispatching automatic repair`,repairing:`Repairing checks`,rerunning:`Rerunning originating batch`,stopping:`Stopping`,terminal:`Terminal`},autoFixTerminal:{passed:`Passed`,ineligible:`Not auto-fixable`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`Agent failure`,no_workspace_changes:`No workspace changes`,unchanged_failures:`No progress`,user_cancelled:`Cancelled by user`,stale:`Definitions or workspace became stale`,exhausted:`Three attempts exhausted`,interrupted:`Interrupted`},deterministicEvidenceNotice:`Diagnostics and rerun results are deterministic records. Agent repair summaries are not check evidence.`,sourceBatch:`Source check batch`,sourceAttempts:`Source attempts`,sourceDiagnostics:`Source diagnostics`,sourceRawOutputAttempts:`Source raw-output attempts`,repairWrapper:`Repair wrapper`,followUpRun:`Build follow-up child`,repairChildRun:`Repair child run`,rerunBatch:`Rerun batch`,nextBoundary:`Next automation boundary`,policyFingerprint:`Policy fingerprint`,configurationFingerprint:`Check configuration`,repairResult:`Repair result`,repairPending:`Repair agent or rerun is still active`,boundary:{automation_review:`Pre-Review checks, then automatic Review`,automation_commit:`Required checks, then commit creation`,automation_push:`Required checks, then push`,automation_pull_request:`Required checks, then pull-request creation`,unknown:`No delivery progression is claimed`},providerEvidence:`Provider evidence`,command:`Command`,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`,runtimes:`Runtimes`,updateOpenCode:`Update OpenCode`,updateClaude:`Update Claude`,openCodeRunning:`Updating OpenCode...`,claudeRunning:`Updating Claude...`,openCodeSuccess:`OpenCode updated`,claudeSuccess:`Claude updated`,openCodeSuccessWithVersion:`OpenCode updated to {{version}}`,claudeSuccessWithVersion:`Claude updated to {{version}}`,openCodeUpToDate:`OpenCode is already up to date`,claudeUpToDate:`Claude is already up to date`,openCodeUpToDateWithVersion:`OpenCode is already up to date ({{version}})`,claudeUpToDateWithVersion:`Claude is already up to date ({{version}})`,openCodeFailed:`OpenCode update failed`,claudeFailed:`Claude update failed`,openCodeAlreadyRunning:`OpenCode update already running`,claudeAlreadyRunning:`Claude update already running`,networkError:`Unable to reach the server.`},statusBadge:{queued:`Queued`,planning:`Planning...`,building:`Building`,buildingWithGlyph:`⏳ Building`,reviewing:`Reviewing`,automation:`Automation`,checks:`Checks`,autoFix:`Auto-fix`,commit:`Commit`,push:`Push`,pr:`PR`,done:`✓ Done`,error:`✗ Error`,stopped:`Stopped`},cardStatusBadges:{stale:`Stale`,openQuestions:`Open questions`,chainStart:`Chain start`},ticketAutomation:{depth:{manual:`Manual`,auto_review:`Auto-review`,auto_commit:`Auto-commit`,auto_push:`Auto-push`,auto_pr:`Auto-PR`},override:{title:`Ticket automation`,ariaLabel:`Ticket automation override`,depthAriaLabel:`Automation depth override`,inherit:`Inherit`,summaryLabel:`Automation: {{depth}} ({{source}})`,summaryInherited:`inherited`,summaryOverride:`override`,saving:`Saving...`,updateError:`Unable to update the bundle automation and reviewer settings right now.`,overridingProject:`Override`,autoPrDisabledHint:`Connect the GitHub integration to enable Auto-PR.`,fixToggleLabel:`Auto-fix review findings`,fixToggleDescription:`When automation reaches review, automatically fix blocking findings and re-review until the review is clean or the iteration cap is hit.`,fixToggleAriaLabel:`Auto-fix review findings override`,maxIterationsLabel:`Max fix iterations`,maxIterationsDescription:`Set how many review-fix passes this bundle may run before pausing with the findings unresolved.`,maxIterationsAriaLabel:`Max fix iterations source`,inheritProjectSetting:`Inherit project setting`,overrideSetting:`Override setting`,maxIterationsInputLabel:`Iterations`,maxIterationsInputAriaLabel:`Max fix iterations`,openQuestionsLabel:`Open Questions checkpoint`,openQuestionsDescription:`Pause before Review when Build has unresolved implementation questions.`,openQuestionsAriaLabel:`Open Questions checkpoint override`,enabled:`Enabled`,disabled:`Disabled`},reviewer:{title:`Reviewer`,description:`Choose an OpenCode model for reviews in this bundle, or inherit the project setting.`,effective:`{{model}} · {{variant}}`,fallback:`Implementing model per ticket`,perTicketVariant:`Variant per ticket`,defaultVariant:`Model default`,sourceAriaLabel:`Reviewer setting source`,modelLabel:`Reviewer model`,variantLabel:`Reviewer variant`,clearOverride:`Clear bundle override`,availableVariants:`Available variants`,loading:`Loading OpenCode reviewer models...`,unavailable:`OpenCode model discovery is unavailable. Reviewer override selection cannot be changed right now.`,sources:{bundle:`Bundle`,project:`Project`,fallback:`Fallback`},claudeTicketProvenance:`Claude tickets use their existing ticket model because project and bundle reviewer settings select OpenCode models.`},pause:{label:`Automation paused`,resume:`Resume`,resumePending:`Resume is starting. Wait for the bundle state to update.`,dismiss:`Dismiss`,abandon:`Abandon automation`,openChecks:`Open checks`,stop:`Stop automation`,stopTooltip:`Stop the automation work that is currently running for this bundle.`,abandonTooltip:`Discard the saved automation continuation and keep its execution history for diagnostics.`,iterationCounter:`Review fix iteration {{current}} of {{max}}`,resolveQuestions:`Resolve questions`,diagnostic:`Details: {{reason}}`,resumeOutcome:{complete_manual_boundary:`Resume closes the saved automation progression at the current manual boundary.`,start_review:`Resume starts automatic Review for this bundle.`,resume_review:`Resume continues the interrupted Review session before delivery automation can continue.`,rerun_review:`Resume reruns automatic Review for the latest bundle changes.`,start_review_fix:`Resume starts the next review-fix pass, then reviews the changes again.`,continue_commit_chain:`Resume continues automation with the commit chain.`,reconcile_commit:`Resume verifies whether the commit completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,reconcile_push:`Resume verifies whether the push completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,reconcile_pull_request:`Resume verifies whether the pull request action completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,rerun_required_checks:`Resume reruns the required checks against the current workspace before automated delivery continues.`,rerun_review_checks:`Resume reruns the pre-review checks against the current workspace before automatic Review starts.`},resumeDisabled:{bundle_agent_running:`Resume is unavailable while a Build agent is running in this bundle.`,bundle_build_incomplete:`Resume is unavailable until every active ticket in this bundle completes Build.`,run_setup_preparing:`Resume is unavailable while a bundle run is preparing.`,review_running:`Resume is unavailable because Review is already running for this bundle.`,invalid_progression:`Resume is unavailable because automation progression ownership is invalid.`,invalid_stage_lineage:`Resume is unavailable because the paused stage does not belong to the active automation progression.`,no_resumable_owner:`Resume is unavailable because no ticket currently owns a resumable automation state.`},guidance:{preconditionFailed:`Review the current bundle state and resolve any blockers before continuing.`,stageFailed:`Review the failed stage details, then resume when the issue is resolved.`,serverRestart:`Automation was interrupted by a server restart. Resume to continue from the saved stage.`,reconciliationFailed:`Verify the repository state before resuming because automation could not confirm the latest stage result.`,sideEffectAmbiguous:`Verify whether the last external action completed before resuming.`,manualTransition:`Review the current ticket state before resuming because it changed while automation was running.`,configurationChanged:`Review the current automation settings before resuming because they changed during the run.`,targetBusy:`Another operation owns this target. Review Checks and wait for it to finish before resuming.`,requiredChecksFailed:`Required checks govern automated delivery. Review their durable evidence, then resume to rerun them.`,invalidLineage:`Automation ownership changed. Review the current bundle state before continuing.`,generic:`Review the current bundle state before resuming automation.`},requiredChecks:{boundary:{check_completion:`check completion`,automation_review:`Review progression`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pull-request creation`},reason:{not_required:`required checks are not configured`,policy_invalid:`the required-check policy is invalid`,policy_drift:`the required-check policy changed`,workspace_unavailable:`the workspace is unavailable`,intended_identity_mismatch:`the checked workspace no longer matches the automation target`,missing_evidence:`required check evidence is missing`,target_mismatch:`the checks targeted a different workspace or bundle`,batch_not_completed:`the required-check batch has not finished`,incomplete_evidence:`required check evidence is incomplete`,duplicate_evidence:`duplicate required check evidence was found`,extra_evidence:`unexpected required check evidence was found`,definition_drift:`a required check definition changed`,attempt_failed:`one or more required checks failed`,attempt_stale:`required check evidence is stale`,target_busy:`another check run is already using the target`,check_start_failed:`required checks could not start`},fallbackReason:`the required checks did not produce usable evidence`,failure:`Required checks blocked the automated {{boundary}}. {{explanation}} Review the check results and rerun any failed or unfinished checks before resuming automation.`}}},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.`,continueBundleReview:`Unable to continue the bundle review right now.`,undoBundleReview:`Unable to undo the bundle review right now.`,moveBundle:`Unable to move the bundle right now.`,startBuildChain:`Unable to start the build chain right now.`,stopBuildChain:`Unable to stop the build chain right now.`,emptyDone:`Unable to empty Done right now.`},toasts:{deleteDonePartial_one:`Deleted {{deletedCount}} done ticket, but {{failedCount}} failed.`,deleteDonePartial_other:`Deleted {{deletedCount}} done tickets, but {{failedCount}} failed.`,deleteDoneSuccess_one:`Deleted {{count}} done ticket.`,deleteDoneSuccess_other:`Deleted {{count}} done tickets.`,movedBundleToDonePartial:`Moved {{movedCount}} of {{totalCount}} bundle tickets to Done.`,restoredBundlePartial:`Restored {{restoredCount}} of {{totalCount}} bundle tickets.`,deletedBundleTicketsPartial:`Deleted {{deletedCount}} of {{totalCount}} bundle tickets.`,planningAgentCardsCreated_one:`{{count}} card created`,planningAgentCardsCreated_other:`{{count}} cards created`},doneColumn:{emptyAction:`Empty`},changes:{reviewPromptDisabledReason:`Wait for all bundle tickets to finish building before sending a follow-up prompt.`,modifyChangesDisabledReason:`Wait for all bundle tickets to finish building before modifying changes.`,targetUnavailableReason:`This workspace target is no longer available.`}},projectPreviewPane:{presets:{responsive:`Responsive`,phone:`Phone`,tablet:`Tablet`,laptop:`Laptop`},selection:{unavailableBuildCapable:`Preview selection is only available for build-capable ticket runs.`,waitForLoad:`Wait for the preview to finish loading first.`,enableMode:`Enable selection mode`,disableMode:`Disable selection mode`},targetSummary:{element:`Element`,unknownElement:`Unknown element`},iframeTitle:`Project preview`,pendingComments:{triggerLabel:`Pending comments`,title:`Pending comments`,description:`Review preview comments before sending them back to the agent.`,empty:`No preview comments queued yet.`,clearAll:`Clear all`,sending:`Sending...`,sendFixes:`Send fixes ({{count}})`,deleteAriaLabel:`Delete pending comment for {{elementLabel}}`},prompt:{bundlePlaceholder:`Follow up on this bundle`,ticketPlaceholder:`Follow up on this ticket`,defaultPlaceholder:`Describe what Archon should do next.`,toggleAriaLabel:`Toggle preview prompt`,button:`Prompt`,sent:`Prompt sent.`,sendError:`Unable to send the preview prompt right now.`},commentComposer:{editTitle:`Edit preview comment`,addTitle:`Add preview comment`,closeAriaLabel:`Close preview comment composer`,commentAriaLabel:`Preview comment`,placeholder:`Describe the change you want here.`,cancel:`Cancel`,save:`Save comment`,add:`Add comment`},toasts:{fixesSubmitted:`Fixes submitted.`,fixesError:`Unable to submit the preview review right now.`},states:{loadingTitle:`Loading preview`,loadingDescription:`Archon is loading the current preview state for this project.`,readyMissingUrlTitle:`Preview error`,readyMissingUrlDescription:`Archon did not provide a preview URL for the active run.`,detectingTitle:`Detecting preview`,detectingDescription:`Waiting for the preview service to report a browser URL.`,unsupportedTitle:`Preview unavailable`,unsupportedDescription:`This run cannot be embedded as an in-app preview.`,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.`,targetMismatch:`This Spec targets {{sessionTarget}}, but {{currentTarget}} is selected.`,targetUnavailable:`This Spec target is unavailable.`,targetLoading:`Checking the current project branch before this Spec can continue...`,targetLoadError:`Unable to verify the current project branch. {{error}}`,targetRefreshError:`Unable to verify the current project target. {{error}}`,retryTarget:`Retry branch check`,switchBack:`Switch back to {{target}}`,switchingBack:`Switching target...`,updateTargetError:`Unable to update the project target right now.`}},chatView:{tool:{claude:`Claude`,opencode:`OpenCode`},mode:{plan:`Plan`,build:`Build`},startBuilding:{label:`Start building`,ariaLabel:`Start building this plan`},placeholders:{plan:`Ask Archon to scope, sequence, or reason through project work`,build:`Ask Archon to build, change, or verify something in this project`},shortcuts:{modifierMac:`CMD`,modifierDefault:`CTRL`,startNewSession:`Start new session`,switchToPlan:`Switch to Plan`,switchToBuild:`Switch to Build`},user:{you:`You`},targets:{bundleFallback:`Bundle target`,repoRoot:`Repo root`,repoRootWithBranch:`Repo root ({{branch}})`,currentTarget:`current target`,selectedBundleTarget:`selected bundle target`},pendingMemorySuggestions_one:`{{count}} pending memory suggestion`,pendingMemorySuggestions_other:`{{count}} pending memory suggestions`,deleteSessionModal:{title:`Delete chat session`,bulkTitle:`Delete chat sessions`,description:`This permanently removes the transcript history for this chat session.`,bulkDescription_one:`This permanently removes the transcript history for {{count}} chat session.`,bulkDescription_other:`This permanently removes the transcript history for {{count}} chat sessions.`,cancel:`Cancel`,deleting:`Deleting...`,delete:`Delete`},sidebar:{ariaLabel:`Chat sessions sidebar`,newSession:`New session`,select:`Select`,cancelSelection:`Cancel`,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.`,restoreTarget:`Unable to restore the spec target right now.`},targets:{mismatchReason:`This Spec targets {{sessionTarget}}, but the current target is {{currentTarget}}. Restore the Spec target to continue.`,unavailable:`Target unavailable for this Spec.`,switchBack:`Switch back`,switchingBack:`Switching...`},importNotice:{title:`Import notice`,importedOnly:`Imported {{importedCount}} image(s).`,importedWithSkips:`Imported {{importedCount}} image(s). Skipped {{skippedCount}} reference(s): {{skippedSummary}}.`,skippedOnly:`Skipped {{skippedCount}} reference(s): {{skippedSummary}}.`,skipReasons:{third_party_url:`{{count}} third-party URL(s)`,download_failed:`{{count}} failed download(s)`,permission_denied:`{{count}} permission error(s)`,unsupported_type:`{{count}} unsupported image(s)`,non_image_content:`{{count}} non-image file(s)`,oversize:`{{count}} oversized image(s)`,over_limit:`{{count}} over the 4-image limit`}},composer:{placeholderSpec:`Describe the feature you want to plan...`,describeFeature:`Describe the feature, architecture, or changes you want to spec out.`,loadingMemory:`Loading memory...`,memorySuggestions:`Memory suggestions`,memorySuggestionsTitle:`Memory suggestions`,memorySuggestionsDescription:`Review pending suggestions from this spec before saving them into project memory.`,memorySuggestionsEmpty:`No pending memory suggestions for this spec session.`,closeMemorySuggestions:`Close memory suggestions`,waitTurn:`Wait for the current spec turn to finish.`,waitUpload:`Wait for the current image upload to finish.`,waitGrill:`Answer the question above to continue.`,stop:`Stop`,interrupt:`Interrupt`,interrupting:`Interrupting...`,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 relationships`,repositoryEvidence:{captureLabel:`Capture state`,freshnessLabel:`Captured scan freshness`,capture:{complete:`Complete`,stale:`Stale at capture`,truncated:`Truncated`,unavailable:`Unavailable`},freshness:{fresh:`Current`,stale:`Not current`,unavailable:`Unavailable`},origin:{planner:`Planner`,graph:`Repository graph`,both:`Planner + graph`},class:{deterministic:`Deterministic`,structural_heuristic:`Structural heuristic`,historical_heuristic:`Historical heuristic`},affectedTests:`Affected tests`,affectedTest:`Affected test`,impactHeading:`Repository impact`,impactDescription:`Repository-derived signals are advisory and are not planned edits.`,impactFiles_one:`{{count}} possible file signal`,impactFiles_other:`{{count}} possible file signals`,impactTests_one:`{{count}} possible test signal`,impactTests_other:`{{count}} possible test signals`,impactNone:`No candidates captured`,potentiallyAffectedFiles:`Potentially affected files`,showChains_one:`Show evidence chain`,showChains_other:`Show {{count}} evidence chains`,chainLabel:`Chain {{number}}`,chainSummary_one:`{{seed}} reaches {{candidate}} through {{count}} repository relation.`,chainSummary_other:`{{seed}} reaches {{candidate}} through {{count}} repository relations.`,truncatedNotice:`This capture reached a repository evidence limit, so additional candidates or chains may exist.`,historicalNotice:`Historical heuristic evidence reflects prior co-change patterns and is not a current deterministic relationship.`,impactFallback:`The repository graph projection did not capture any candidates for this snapshot.`,diagramDescription:`Planner-generated relationships between the files in this plan.`},proposedTickets:`Proposed Tickets`,bundleGroups:`Bundle Groups`,proposedTicketCount_one:`{{count}} proposed ticket`,proposedTicketCount_other:`{{count}} proposed tickets`,dependencies:`Dependencies`,openQuestions:`Open Questions`,assumptions:`Assumptions`,noSnapshot:`Run a spec turn to generate an artifact.`,noDiagram:`No diagram available for this spec.`,mermaidParseError:`Unable to render this Mermaid graph; showing raw text instead.`,uiMockup:`UI Mockup`,noMockup:`No UI mockup available for this spec.`,loading:`Loading artifact...`},actions:{createTickets:`Create tickets`,ticketsCreated:`Tickets created`,creatingTickets:`Creating tickets...`,implementInChat:`Implement in Chat`,implementInChatMultiBundleUnavailable:`Multi-bundle Specs must be materialized through Create tickets before implementation.`,startingImplementation:`Starting implementation...`,exportSpec:`Export to docs/plans`,exportingSpec:`Exporting...`,createTicketsSuccess:`Created {{count}} ticket(s) from this spec.`,exportSuccess:`Exported spec to docs/plans.`,exportConflictTitle:`Export already exists`,exportConflictDescription:`A spec has already been exported to {{path}}. Do you want to overwrite the existing file?`,exportConflictConfirm:`Overwrite`,exportConflictCancel:`Cancel`},provenance:{viewSourceSpec:`View source spec`},grill:{toggleTooltip:`Grill mode: pressure-test the plan one focused question at a time before writing the spec. Toggle off to skip remaining questions and write it now.`,toggleAriaLabelOn:`Turn Grill mode off (currently on)`,toggleAriaLabelOff:`Turn Grill mode on`,rationaleLabel:`Why`,suggestionsLabel:`Suggested answers`,recommendedSuggestionLabel:`Recommended`,answerPlaceholder:`Type your answer, or pick a suggestion above to fill this field...`,submitLabel:`Submit answer`,submittingLabel:`Submitting...`,finalizePrompt:`Grilling ended. Write the complete concrete plan now using everything we discussed.`,finalizeError:`Unable to finalize grilling right now.`,updateModeError:`Unable to change Grill mode right now.`,activeDisabledReason:`Wait for the current spec turn to finish before toggling Grill.`},review:{heading:`Review`,launch:`Review spec`,launchAction:`Review spec`,stop:`Stop review`,running:`Running...`,loading:`Loading review...`,noFindings:`No issues found.`,stoppedExplanation:`The review was stopped before it completed.`,errorExplanation:`The review could not be completed because the agent encountered an error.`,parseFailedExplanation:`The review completed, but its findings could not be parsed.`,why:`Why`,suggestion:`Suggestion`,sendToPlanner:`Send to planner`,sendingToPlanner:`Building revision draft...`,popoverTitle:`Spec review`,model:`Model`,variant:`Thinking level`,findingsCount_one:`{{count}} finding`,findingsCount_other:`{{count}} findings`,severity:{high:`high`,medium:`medium`,low:`low`},status:{running:`Running`,completed:`Completed`,parse_failed:`Parse failed`,stopped:`Stopped`,error:`Error`}}},conversationPane:{agentActivityAriaLabel:`Agent activity indicator`,agentWorkingSrText:`Agent is working`,agentError:`Agent error`,statusWorking:`Working...`,liveElapsedAriaLabel:`Approximate elapsed response time: {{duration}}`,statusInterrupted:`Interrupted`,loadingConversation:`Loading conversation...`,noMessagesYet:`No messages yet.`,attachmentPreviewAlt:`Attached image: {{name}}`,showThinkingAriaLabel:`Show thinking`,showThinkingLabel:`Show thinking`,sectionAriaLabel:`Ticket conversation`,contentAriaLabel:`Ticket conversation content`,scrollToLatestAriaLabel:`Scroll to latest message`,changesCommentBadge:`Changes comment`},questionSet:{eyebrow:`Plan clarification`,progress:`Question {{current}} of {{total}}`,questionsAriaLabel:`Questions`,rationaleLabel:`Why`,suggestionsLabel:`Suggested answers`,recommended:`Recommended`,answerLabel:`Your answer`,answerPlaceholder:`Type your answer, or choose a suggestion above...`,dismissOne:`Dismiss this question`,dismissAll:`Dismiss all questions`,saveContinue:`Save and continue`,submitting:`Submitting...`,waitForResolution:`Resolve the plan questions above to continue.`,historicalAnswer:`Answer`,historicalDismissed:`Dismissed`,status:{answered:`Answered`,dismissed:`Dismissed`,current:`Current`,unanswered:`Unanswered`},historicalStatus:{pending:`Awaiting resolution`,resolved:`Resolved`,dismissed:`Dismissed`,superseded:`Superseded`}},multiAgentTranscript:{tabAriaLabel:`Agent run tabs`,mainAgent:`Main agent`,noContent:`No transcript content was captured.`,waitingForOutput:`Waiting for subagent output...`,responseTruncated:`Response transcript truncated after 100 KB.`,thinkingTruncated:`Thinking transcript truncated after 100 KB.`,status:{running:`Running`,done:`Done`,error:`Error`,stopped:`Stopped`}},promptComposer:{followUpPromptAriaLabel:`Follow-up prompt`,sendingPromptAriaLabel:`Sending prompt`,sendPromptAriaLabel:`Send prompt`,attachImageAriaLabel:`Attach images`,uploadingImageAriaLabel:`Uploading images`,removeAttachmentAriaLabel:`Remove {{name}}`,attachmentPreviewAlt:`Selected image: {{name}}`,dropImagePrompt:`Drop images to attach`,dropImageAriaLabel:`Drop image files to attach them`},attachmentPreviewDialog:{title:`Image preview: {{name}}`,description:`Preview the attached image {{name}}.`,imageAlt:`Preview image: {{name}}`,previewImageAriaLabel:`Preview image: {{name}}`,openInNewTab:`Open in new tab`,closeAriaLabel:`Close image preview`},mermaidPreviewDialog:{title:`Diagram Preview`,description:`Preview the spec diagram in full screen.`,controlsAriaLabel:`Diagram controls`,canvasAriaLabel:`Diagram canvas. Drag with the mouse to pan.`,zoomInAriaLabel:`Zoom in`,zoomOutAriaLabel:`Zoom out`,resetViewAriaLabel:`Reset view`,zoomLevel:`{{zoom}}%`,zoomLevelAriaLabel:`Zoom level: {{zoom}}%`,closeAriaLabel:`Close diagram preview`,clickToExpand:`Click to expand diagram`},mockupPreviewDialog:{title:`UI Mockup Preview`,description:`Preview the UI mockup in full screen.`,closeAriaLabel:`Close UI mockup preview`,clickToExpand:`Click to expand UI mockup`},workspaceControls:{files:`Files`,changes:`Changes`,tests:`Tests`,checks:`Checks`,verification:`Verification`,graph:`Graph`,openIde:`Open IDE`,terminal:`Terminal`,chat:`Chat`,close:`Close`,openTerminalAriaLabel:`Open terminal`,hideTerminalAriaLabel:`Hide terminal`,terminalTitle:`Terminal`,ticketMetadataAriaLabel:`Ticket metadata`,githubActions:`Actions`,openGitHubActionsAriaLabel:`Open GitHub Actions`},projectHeader:{agent:{triggerAriaLabel:`Choose active agent`,menuAriaLabel:`Open active agent menu`,openCode:`OpenCode`,claude:`Claude`},runtime:{activityLabel:`Activity`,triggerLabel:`Tools`,triggerAriaLabel:`Open runtime tools`,githubActionsRunning:`Actions`,toolUpdateRunning:`Tool update running`,openGitHubActions:`Open GitHub Actions`,openActivity:`Open Activity`,openMobileAccess:`Open mobile access`,mobileLabel:`Mobile`,githubStatusIdle:`Idle`,githubStatusRunning:`Running`,mobileDisabled:`Mobile disabled`,mobileReadyToPair:`Mobile ready to pair`,mobileConnected:`Mobile connected`,mobilePairingExpired:`Mobile pairing expired`,mobileUnavailable:`Mobile unavailable`,openExecutionRuntimes:`Open execution runtimes`}},executionRuntimes:{title:`Execution runtimes`,description:`Check whether optional execution environments can operate on this machine.`,closeAriaLabel:`Close execution runtimes`,provider:`Optional runtime`,dockerSandbox:`Docker Sandbox`,loading:`Checking this machine...`,errorMessage:`Unable to check Docker Sandbox readiness right now.`,guidance:`Opening or rechecking these diagnostics only reads readiness and does not start services. Install and configure Docker Sandboxes using the official Docker instructions, then recheck this machine.`,productionNotice:`Docker Sandbox Build execution is opt-in and fails closed when the exact target, agent, or model is not ready.`,openGuide:`Open setup guide`,recheck:`Recheck`,rechecking:`Rechecking...`,version:`sbx {{version}}`,versionUnknown:`Version unknown`,unavailableSummary:`The remaining checks were skipped because sbx is unavailable.`,state:{loading:`Loading runtime readiness.`,unsupported:`This platform or sbx version is unsupported.`,setupRequired:`Setup is required before validation can run.`,eligible:`Available to activate when validation needs it.`,degraded:`Readiness is degraded because some evidence is unknown.`,ready:`This machine is ready for Docker Sandbox validation.`,error:`Readiness could not be checked.`},observationState:{ready:`Ready`,not_ready:`Setup required`,unknown:`Unknown`,deferred:`Deferred`,unsupported:`Unsupported`},deferredSummary:{opencode_template:`Validate OpenCode support per project target in execution settings.`,claude_template:`Validate Claude support per project target in execution settings.`},checks:{cli:`CLI`,version:`Supported version`,platform:`Platform`,virtualization:`Virtualization`,daemon:`Docker Sandbox daemon`,docker_login:`Docker account`,network_policy:`Network policy`,opencode_template:`OpenCode built-in agent`,claude_template:`Claude built-in agent`},checkDescription:{cli:`Checks whether the qualified sbx command is available.`,version:`Checks the installed sbx version against the approved command contract.`,platform:`Checks operating system and architecture support.`,virtualization:`Checks whether required virtualization support is available.`,daemon:`Checks whether the Docker Sandbox daemon can respond.`,docker_login:`Classifies Docker account readiness without displaying account or credential values.`,network_policy:`Checks whether sandbox network policy is initialized.`,opencode_template:`Checks built-in OpenCode template support.`,claude_template:`Checks built-in Claude template support.`},checkRemediation:`Follow the official setup guide, resolve this requirement, then recheck.`,virtualizationRemediation:{not_ready:`Resolve the host virtualization requirement in the official Docker Sandboxes guide, then recheck.`,unknown:`Review host virtualization diagnostics in the official Docker Sandboxes guide, then recheck.`,unsupported:`Use Linux x64 or macOS Sonoma 14+ on Apple silicon for Docker Sandboxes.`}},ticketModal:{loadingDiff:`Loading diff...`,planningChatAriaLabel:`Planning chat`,planningChatTitle:`Planning Chat`,closePlanningChatAriaLabel:`Close planning chat`,planningOpenQuestions_one:`{{count}} open question`,planningOpenQuestions_other:`{{count}} open questions`,planningFollowUpPlaceholder:`Ask the agent to refine this plan`,followUpPlanPlaceholder:`Ask a question about this implementation`,ticketChatAriaLabel:`Ticket chat`,ticketChatTitle:`Ticket Chat`,closeTicketChatAriaLabel:`Close ticket chat`,planningFailedPrefix:`Planning failed: `,openQuestionsBadge:`Open questions`,resolveQuestionsError:`Unable to resolve the plan questions right now.`,ticketTerminalAriaLabel:`Ticket terminal`,discardUnsavedTitle:`Discard unsaved edits?`,discardUnsavedDescription:`Any changes made will be lost.`,discardUnsavedConfirm:`Discard`,discardUnsavedCancel:`Keep editing`},ticketPlanDetails:{title:`Details`,ariaLabel:`Ticket details`,triggerAriaLabel:`Toggle ticket details`,closeAriaLabel:`Close details`,editTicket:`Edit ticket`,aiSettings:`AI settings`,aiSettingsAriaLabel:`AI settings`,attentionAriaLabel:`Attention required`,openPlanningChat:`Open planning chat`,viewBlockers:`View blockers`,unfinishedBlockers_one:`{{count}} unfinished blocker`,unfinishedBlockers_other:`{{count}} unfinished blockers`,targetSection:`Target`,dependenciesSection:`Dependencies`,defaultModel:`Default model`,defaultVariant:`Default variant`,usingDefaults:`Using defaults`,skillCount_one:`{{count}} skill`,skillCount_other:`{{count}} skills`},modelSelector:{dockerSandboxNotice:`Docker Sandbox only shows models from providers verified for the selected target.`,openExecutionSettings:`Verify providers in execution settings`},ticketChangesModal:{pushBranch:`Push branch`,pushing:`Pushing...`,morePushActions:`More push actions`,forcePushWithLease:`Force push with lease`,forcePushing:`Force pushing...`,loadingPullRequest:`Loading PR...`,checkingPullRequest:`Checking PR...`,createPullRequest:`Create PR`,createPullRequestTitle:`Create pull request`,createPullRequestFallbackError:`Unable to create the pull request right now.`,pullRequestCreated:`Pull request created.`,pullRequestFieldTitle:`Title`,pullRequestFieldBaseBranch:`Base branch`,pullRequestFieldDescription:`Description`,pullRequestTitlePlaceholder:`Pull request title`,pullRequestBaseBranchDescription:`Optional. Leave blank to use the repository default branch.`,pullRequestBaseBranchPlaceholder:`main`,pullRequestDescriptionPlaceholder:`Summarize the changes for reviewers.`,creatingPullRequest:`Creating PR...`,creating:`Creating...`,generatingDescription:`Generating...`,generateDescription:`Generate`,branchUnavailable:`Branch information is not available right now.`,branchPushed:`Branch pushed.`,pushCompleted:`Push completed.`,branchForcePushed:`Branch force-pushed.`,forcePushCompleted:`Force push completed.`,pushFallbackError:`Unable to push the branch right now.`,forcePushFallbackError:`Unable to force-push the branch right now.`,viewSourceSpec:`View source spec`,switchToPlan:`Switch to Plan`,switchToBuild:`Switch to Build`,committedDiffFallbackError:`Unable to load committed changes right now.`,committedSelectionUnavailable:`That local commit is no longer available. Returned to Uncommitted changes.`,committedDiffEmpty:`No committed changes to show.`,committedFiles:`Committed files`,committedFilesDescription:`Review the selected committed changes.`,allListedCommits:`All listed commits`,viewingCommittedSource:`Viewing: {{source}}`,committedReadOnly:`This committed diff is read-only.`,squashCompleted:`Local commits squashed.`,squashFallbackError:`Unable to squash local commits right now.`},bundleDetailsModal:{bundleTerminalAriaLabel:`Bundle terminal`,rename:`Rename`,renameFieldLabel:`Bundle name`,renameDescription:`The branch name will be regenerated before the branch and worktree are created.`,saveName:`Save name`,savingName:`Saving...`,cancelRename:`Cancel`,renameFallbackError:`Unable to rename the bundle right now.`,renameUnavailable:`Rename availability could not be verified. Refresh the bundle and try again.`,renameProjectContextUnavailable:`Select a project before renaming this bundle.`,continueReview:`Continue review`,rerunReview:`Re-run review`,reviewBundle:`Review Bundle`,renameReasons:{project_root:`Project root bundles cannot be renamed.`,tickets_not_plan:`Rename is unavailable because one or more bundle tickets have left Plan.`,agent_running:`Rename is unavailable while an agent is running for this bundle.`,branch_exists:`Rename is unavailable because this bundle branch already exists.`,worktree_exists:`Rename is unavailable because this bundle already has a worktree.`}},projectFooter:{detachedHead:`Detached HEAD`,unknownBranch:`Unknown branch`,branchActions:`Branch actions`,currentTargetActions:`Current target actions`,pull:`Pull`,pulling:`Pulling...`,sync:`Sync`,syncing:`Syncing...`,rebase:`Rebase`,rebaseOnto:`Rebase onto {{branch}}`,rebasing:`Rebasing...`,abortMerge:`Abort merge`,abortRebase:`Abort rebase`,aborting:`Aborting...`,branchSynced:`Project branch synced.`,branchUpdated:`Project branch updated.`,branchRebased:`Branch rebased.`,branchRebasedOnto:`Branch rebased onto {{branch}}.`,gitOperationAborted:`Git operation aborted.`,syncFallbackError:`Unable to sync the current branch right now.`,rebaseFallbackError:`Unable to rebase the current branch right now.`,abortFallbackError:`Unable to abort the current git operation right now.`,run:`Run`,stop:`Stop`,selectProjectFirst:`Select a project first.`,addRunConfig:`Add a Run config in project settings to enable selected-target runs.`,loadingProjectStatus:`Loading project status...`,stopSelectedTargetRun:`Stop the currently running selected-target run before starting another run.`,stopTicketBeforeSelectedTargetRun:`Stop the currently running ticket before starting the selected target run.`},repositoryGraphDialog:{title:`Repository graph`,target:`Target: {{target}}`,repoRootTarget:`Repo root`,repoRootTargetWithBranch:`Repo root / {{branch}}`,bundleTarget:`{{name}} / {{branch}}`,startScan:`Start scan`,refreshScan:`Refresh scan`,cancelScan:`Cancel scan`,retryScan:`Retry scan`,retryLoad:`Try again`,close:`Close`,truncatedScan:`This scan reached one or more analysis limits. Results remain useful but do not represent complete coverage.`,freshnessUnavailable:`The target is currently unavailable. Persisted results remain inspectable, but freshness cannot be verified.`,status:{title:`Status`,loading:`Loading scan status...`,neverScanned:`Never scanned`,unknown:`Scan status unavailable`,queued:`Queued`,running:`Running`,complete:`Complete and current`,completeUnverified:`Complete; freshness unavailable`,stale:`Complete but stale`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`},counts:{files:`Files`,relationships:`Relationships`,diagnostics:`Diagnostics`,analyzer:`Analyzer`},diagnostics:{show:`View diagnostics ({{count}})`,truncated:`Only a bounded diagnostic summary is shown.`},relationships:{title:`Inspect relationships`,description:`Search by file name or repository-relative path, then choose a file to inspect direct incoming or outgoing relationships.`,pathLabel:`Repository path`,pathPlaceholder:`Search files by name or path`,suggestionsLoading:`Loading file paths...`,noSuggestions:`No matching files found.`,direction:`Direction`,directions:{combined:`Both`,incoming:`Incoming`,outgoing:`Outgoing`},unavailable:`Relationship inspection is available after a scan completes.`,loading:`Loading relationships...`,truncated:`The relationship query reached its result limit. The list does not represent complete coverage.`,empty:`No direct relationships were found for this path and direction.`,showEvidence:`Show evidence`,loadingEvidence:`Loading evidence...`,kinds:{imports:`Import relationship with {{path}}`,dynamic_imports:`Dynamic import relationship with {{path}}`,requires:`Require relationship with {{path}}`,re_exports:`Re-export relationship with {{path}}`,config_reference:`Configuration relationship with {{path}}`,package_dependency:`Package dependency relationship with {{path}}`,package_export:`Package export relationship with {{path}}`,package_import:`Package import relationship with {{path}}`,workspace_member:`Workspace membership relationship with {{path}}`,tests:`Test relationship with {{path}}`,co_changes:`Often changes with {{path}}`},explanations:{imports:`Static repository analysis identified an import between these paths.`,dynamic_imports:`Static repository analysis identified a dynamic import between these paths.`,requires:`Static repository analysis identified a CommonJS require between these paths.`,re_exports:`Static repository analysis identified a re-export between these paths.`,config_reference:`A repository configuration file references the related path.`,package_dependency:`A package manifest identifies this package dependency.`,package_export:`A package manifest identifies this exported path.`,package_import:`A package manifest identifies this imported path.`,workspace_member:`Workspace configuration identifies this package membership.`,tests:`Repository structure identifies this test as covering the related path.`,co_changes:`Git history recorded these paths changing together.`},evidenceDetail:{value:`Matched value`,changeCount:`Shared changes`,sampledCommits:`Sample commits`,coverage:`Evidence coverage`,samplesTruncated:`Only a bounded sample of matching commits is shown.`}},evidence:{deterministic:{label:`Deterministic`,description:`Direct static analysis produced this relationship.`},structural_heuristic:{label:`Structural heuristic`,description:`Repository naming or layout suggests this relationship. It is not a required dependency.`},historical_heuristic:{label:`Historical heuristic`,description:`Version-control history suggests this relationship. It is not a required dependency.`}},errors:{status:`Unable to load repository graph status right now.`,operation:`Unable to update the repository graph scan right now.`,pathNotFound:`That path was not found in this scan.`,impact:`Unable to load relationships for that path right now.`,explanation:`Unable to load evidence for this relationship right now.`}},projectTargetSelector:{title:`Project target`,description:`Controls where chats, changes, tests, and project actions run.`,targetLabel:`Target`,repoRoot:`Repo root`,repoRootWithBranch:`Repo root ({{branch}})`,repoRootBranch:`Repo root branch`,activeBundleUnavailable:`Selected bundle unavailable`,loadingTarget:`Loading target...`,loadingTargets:`Loading targets...`,noBundles:`No prepared bundles yet. Manage bundles to prepare another target.`,noSearchResults:`No prepared targets match your search.`,searchPlaceholder:`Search bundles or branches`,searchAriaLabel:`Search project targets`,defaultBranch:`Default branch`,previousBranch:`Previous branch`,loadingBranches:`Loading branch suggestions...`,noSuggestedBranches:`No suggested branches available.`,switchOrCreateBranch:`Switch or create branch`,branchPlaceholder:`feature/quick-fix`,switchBranch:`Switch`,actions:`Target actions`,manageBundles:`Manage bundles`,newChatAriaLabel:`Select project target for new chat`,newSpecAriaLabel:`Select project target for new spec`,status:{selected:`Selected`,loading:`Loading status`,detachedHead:`Detached HEAD`,unknownBranch:`Unknown branch`,unavailable:`Target unavailable`,upToDate:`Up to date`,pullAvailable:`Pull available`},errors:{bundleSwitch:`Unable to switch to that bundle right now.`,repoRootSwitch:`Unable to switch the repo root target right now.`}},checksDialog:{title:`Checks`,description:`Run configured checks and inspect durable output for the selected target.`,openActivity:`Open activity`,close:`Close Checks`,configured:`Configured checks`,required:`Required for delivery`,optional:`Configured, not required`,preReview:`Runs before automatic Review`,finalOnly:`Final delivery only`,policySource:{project:`Inherited project policy`},policySummary:{title:`Required checks`,counts:`{{requiredCount}} delivery checks · {{preReviewCount}} pre-Review checks`,source:`Source: {{source}}`},gateTitle:`Automated delivery gate`,gatePassed:`Passed`,gateBlocked:`Blocked`,gateStale:`No longer current`,gateUnverifiable:`Unable to verify`,gatePolicy:`Policy {{fingerprint}}`,gateBoundary:{label:`Automation step: {{boundary}}`,check_completion:`Check completion`,automation_review:`Pre-Review checks, then automatic Review`,automation_commit:`Required checks, then commit creation`,automation_push:`Required checks, then push`,automation_pull_request:`Required checks, then pull-request creation`},gateSourceBatch:`Source batch: {{batchId}}`,gateNoBatch:`No source batch was available.`,gateScope:`Required checks govern automated delivery. They do not prevent manual or external Git operations.`,gateLoading:`Loading automated delivery gate...`,gateDetails:`Gate details`,gateReasonSummary:`Most relevant reason: {{reason}}`,gatePassedSummary:`All required checks passed for this delivery boundary.`,gateBlockedSummary:`Required evidence does not currently satisfy this delivery boundary.`,gatePolicyStatus:`Policy status: {{status}}`,gatePolicyValid:`Valid`,gatePolicyInvalid:`Invalid`,gateReasonsTitle:`Decision reasons`,gateEvidenceTitle:`Per-check evidence`,gateApplicability:{label:`Applicability to current state: workspace {{workspace}} · policy {{policy}} · overall applicability: {{overall}}`,current:`current`,stale:`stale`,unavailable:`unavailable`,overallCurrent:`applies`,overallStale:`does not apply`,overallUnverifiable:`unable to verify`},evidence:{current:`Current`,stale:`Stale`,failed:`Failed`,missing:`Missing`,interrupted:`Interrupted`,blocked:`Blocked`},reason:{not_required:`No checks were required.`,policy_invalid:`The persisted required-check policy is invalid.`,policy_drift:`The required-check policy changed.`,workspace_unavailable:`The workspace could not be inspected.`,intended_identity_mismatch:`The workspace no longer matches the intended delivery state.`,missing_evidence:`Required evidence is missing.`,target_mismatch:`Evidence belongs to a different target.`,batch_not_completed:`The source batch did not complete.`,incomplete_evidence:`The source batch has incomplete evidence.`,duplicate_evidence:`The source batch contains duplicate evidence.`,extra_evidence:`The source batch contains unexpected evidence.`,definition_drift:`A required check definition changed.`,attempt_failed:`A required check failed.`,attempt_stale:`Required evidence is stale because the workspace changed.`,target_busy:`Another check batch is already running for this target.`,check_start_failed:`Required checks could not start.`},attempts:`Check attempts`,runActions:`Check run actions`,selectionHint:`Select checks to run`,selectForRun:`Select {{name}} for the next run`,inspectAttempt:`Inspect {{name}}, {{status}}`,evidenceSelected_one:`{{count}} repair evidence source selected`,evidenceSelected_other:`{{count}} repair evidence sources selected`,selectAttemptTitle:`Select a check attempt`,selectAttemptDescription:`Choose a completed or active attempt from the check list to inspect its output and evidence.`,notRunDescription:`This check was not included in the latest run. Its configuration is shown below.`,runSelected:`Run selected`,starting:`Starting...`,stop:`Stop batch`,stopping:`Stopping...`,rerunAll:`Rerun all`,rerunFailed:`Rerun failed`,loading:`Loading durable check state...`,emptyTitle:`No check batches yet`,emptyDescription:`Select one or more configured checks to create a batch.`,stopRequested:`Stop requested`,summary:`{{passed}} passed · {{failed}} failed · {{running}} running · {{queued}} queued`,command:`Command`,directory:`Directory`,targetRoot:`Target root`,outcome:`Outcome`,currencyLabel:`Currency`,policyLabel:`Policy`,output:`Output`,rawOutput:`Raw output`,outputEmpty:`This check has not produced output yet.`,outputExpired:`Output expired under the retention policy. The durable outcome remains available.`,outputTruncated:`Older output was removed by the retention limit.`,diagnostics:{title:`Structured diagnostics`,loading:`Loading parser state...`,availableCount_one:`{{count}} structured diagnostic available`,availableCount_other:`{{count}} structured diagnostics available`,noneAvailable:`No structured diagnostics are available.`,failureOutcome:`Failure outcome: {{outcome}}`,severitySummaryLabel:`Diagnostic counts by severity`,severityCount_one:`{{count}} {{severity}}`,severityCount_other:`{{count}} {{severity}}`,totalAvailable:`{{count}} total recorded`,noStructuredDiagnostics:`No structured diagnostics were returned. Retained raw output may be available below.`,structuredDetailsUnavailable:`Structured issue details are unavailable. The recorded total remains available.`,summary_one:`{{count}} structured diagnostic from {{parser}}`,summary_other:`{{count}} structured diagnostics from {{parser}}`,selectLegend:`Select diagnostics to repair`,selectedEvidence_one:`{{count}} repair evidence source selected`,selectedEvidence_other:`{{count}} repair evidence sources selected`,diagnosticLimit:`A repair can include up to {{count}} diagnostics. Clear a selection to choose another.`,attemptLimit:`A repair can include diagnostics from up to {{count}} check attempts. Clear a selection from another attempt to continue.`,rawOutputSelect:`Use retained raw output as repair evidence`,rawOutputHint:`The server will send this persisted check output to the repair agent. Output is treated as untrusted evidence, not instructions.`,rawOutputTruncated:`Earlier output was removed by the retention limit.`,technicalDetails:`Technical details`,technicalDetailsHint:`Review evidence and repair context.`,parserLabel:`Parser`,parserStateLabel:`Parser state`,parserRetentionLabel:`Parser retention`,outputRetentionLabel:`Output retention`,applicabilityLabel:`Applicability`,sourceLabel:`Source`,source:`Source: {{source}}`,repositoryLocation:`Repository-root diagnostic (no file range)`,applicability:`Present applicability: {{state}}`,repairApplicability:`Applies to the retained batch terminal state`,retention:`Retention: {{state}}`,expired:`Structured diagnostics expired. Issue details are unavailable; retained raw output may still be available below.`,truncated:`The parser reached its diagnostic limit. Use raw output as the primary fallback.`,destinationTitle:`Repair destination`,destinationHint:`The server determines this from the blocked automation boundary.`,destination:{pre_review:`Next: pre-Review checks, then automatic Review.`,commit:`Next: required checks, then commit creation.`,push:`Next: required delivery checks, then push.`,pull_request:`Next: required delivery checks, then pull-request creation.`,manual:`Next: rerun the affected checks. No automation progression is claimed.`,unknown:`Next boundary is unavailable. No delivery progression is claimed.`},ticketLabel:`Repair ticket`,ticketPlaceholder:`Select a ticket for this repair`,repairSelected_one:`Repair {{count}} diagnostic`,repairSelected_other:`Repair {{count}} diagnostics`,repairSelectedEvidence_one:`Repair from {{count}} evidence source`,repairSelectedEvidence_other:`Repair from {{count}} evidence sources`,starting:`Starting repair...`,stopRepair:`Stop repair`,repairRunning:`Repair is running`,repairResult:{passed:`Repair rerun passed`,failed:`Repair failed`,cancelled:`Repair was stopped`,interrupted:`Repair was interrupted`},autoFix:{attempt:`Attempt {{current}} of {{total}}`,stop:`Stop automatic repair`,phase:{dispatching:`Starting automatic repair`,repairing:`Repairing checks`,fallback:`Provider continuation was rejected before execution; starting a fresh repair`,rerunning:`Rerunning checks for attempt {{current}} of {{total}}`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`},terminal:{passed:`Automatic repair passed all checks`,ineligible:`These failures cannot be repaired automatically`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair agent made no changes`,unchanged_failures:`Automatic repair made no progress`,user_cancelled:`Automatic repair was stopped by the user`,stale:`Check definitions or workspace became stale`,exhausted:`Automatic repair used all three attempts`,interrupted:`Automatic repair was interrupted`}},parser:{typescript:`TypeScript`,eslint:`ESLint`,none:`raw output`},state:{pending:`Parsing`,complete:`Parsed`,unsupported:`Unsupported parser`,malformed:`Parsing failed`,interrupted:`Parsing interrupted`},fallback:{unsupported:`This output format is unsupported. Raw output is the primary evidence.`,malformed:`Structured parsing failed. Raw output is the primary evidence.`,interrupted:`Structured parsing was interrupted. Raw output is the primary evidence.`},severity:{error:`Error`,warning:`Warning`,info:`Info`,unknown:`Unknown`},applicabilityState:{current:`current workspace`,stale:`stale workspace`,pending:`pending completion`,unavailable:`unable to verify`},retentionState:{retained:`retained`,expired:`expired`},disabled:{stale:`Repair is disabled because this diagnostic does not apply to the current workspace.`,definition_stale:`Repair is disabled because the check definition changed after this batch ran.`,workspace_changed:`Repair is disabled because the workspace changed after this batch finished.`,workspace_unavailable:`Repair is disabled because the current workspace identity could not be verified.`,evidence_identity_unavailable:`Repair is disabled because the batch terminal workspace identity is unavailable.`,unsupported:`Repair is disabled because structured parsing is unsupported or failed.`,expired:`Repair is disabled because required diagnostics or raw output expired.`,repository_root:`Repair is unavailable for repository-root attempts.`,busy:`Repair is disabled while this target has active checks or another repair.`,non_repairable:`These diagnostics are not eligible for repair.`}},status:{queued:`Queued`,running:`Running`,waiting:`Waiting`,completed:`Passed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`,notRun:`Not run`},category:{test:`Test`,typecheck:`Typecheck`,lint:`Lint`,"format-check":`Format check`,build:`Build`,coverage:`Coverage`,security:`Security`,custom:`Custom`},outcomeValue:{passed:`Passed`,command_failure:`Command failed`,spawn_failure:`Process could not start`,infrastructure_failure:`Check infrastructure failed`,evidence_persistence_failure:`Check evidence could not be saved`,timeout:`Timed out`,workspace_changed_before_start:`Workspace changed before start`,user_stop:`Stopped by user`,restart_loss:`Interrupted by server restart`,shutdown_loss:`Interrupted by server shutdown`},currency:{current:`Current`,stale:`Stale`,pending:`Pending completion`,unavailable:`Unable to verify`},errors:{load:`Unable to load checks right now.`,run:`Unable to start checks right now.`,stop:`Unable to stop this batch right now.`,rerun:`Unable to rerun checks right now.`,diagnostics:`Unable to load structured diagnostics. Raw output remains available.`,repair:`Unable to start repair right now.`,repairStop:`Unable to stop repair right now.`}},verificationDialog:{title:`Verification`,description:`Run configured checks or explore tests for the selected target.`,close:`Close verification`,openActivity:`Open Activity`,tabsAriaLabel:`Verification modes`,tabs:{checks:{label:`Checks`,description:`Run tests and other configured quality gates together as a batch.`},tests:{label:`Test Explorer`,description:`Discover and run a granular test suite, file, or case.`}},status:{checks:{inactive:`Check batch idle`,running:`Check batch running`,finished:`Check batch completed`,error:`Check batch failed`,interrupted:`Check batch interrupted`},tests:{inactive:`Test run idle`,running:`Test run running`,finished:`Test run passed`,error:`Test run failed`,interrupted:`Test run stopped`}}},testsDialog:{status:{passed:`Passed`,failed:`Failed`,running:`Running`,error:`Error`,stopped:`Stopped`,idle:`Idle`},selection:{noRunYet:`No test run yet`,allTests:`All tests`},actions:{run:`Run`,stop:`Stop`},caseRow:{runAriaLabel:`Run {{name}}`},fileRow:{expandAriaLabel:`Expand {{path}}`,collapseAriaLabel:`Collapse {{path}}`,runAriaLabel:`Run {{path}}`,testCount_one:`{{count}} test`,testCount_other:`{{count}} tests`,noNamedTests:`No named tests were detected in this file.`},scope:{label:`Test scope`,selectedCommandAriaLabel:`Selected test command`,selectTestScope:`Select test scope`,fullSuiteOnlyNotice:`This scope supports full-suite runs only, so file and case selection is disabled.`},filter:{placeholder:`Filter`,ariaLabel:`Filter test cases`,clearAriaLabel:`Clear test case filter`},discovery:{noCommands:`No test commands are configured for this target yet.`,fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`,caseCount_one:`{{count}} test case`,caseCount_other:`{{count}} test cases`,noFilesDetected:`No JS or TS test files were detected for this target yet.`,noFilterMatches:`No test cases match this filter.`},summaryCounts:{failed:`failed`,passed:`passed`,filesFailed:`files failed`,filesPassed:`files passed`},output:{trimmed:`Output trimmed to recent logs`,ariaLabel:`Test output`,empty:`No test output yet.`},messages:{loadRunnerError:`Unable to load the test runner right now.`,discoverError:`Unable to discover tests right now.`,startError:`Unable to start the selected tests right now.`,stopError:`Unable to stop the test run right now.`},dialog:{srTitle:`Tests`,srDescription:`Run configured tests for the selected project target. Completed attempts remain in project Activity after this dialog closes.`,title:`Tests`,preparingTarget:`Preparing target...`,closeAriaLabel:`Close modal`},closeConfirmation:{title:`Stop test run and close?`,description:`Closing stops the active process and removes this live discovery session. The durable attempt and its retained evidence remain in Activity.`,keepRunning:`Keep running`,stopAndClose:`Stop and close`}},githubActions:{dialog:{srTitle:`GitHub Actions`,srDescription:`List GitHub Actions workflows, dispatch them with inputs, and watch run status.`,title:`GitHub Actions`,closeAriaLabel:`Close modal`},actions:{run:`Run`,dispatch:`Run workflow`,cancel:`Cancel`,refresh:`Refresh`,openOnGithub:`Open on GitHub`},workflows:{title:`Workflows`,ariaLabel:`GitHub Actions workflows`,runAriaLabel:`Run workflow {{name}}`,stateActive:`Active`,stateDisabled:`Disabled`,empty:`No workflows found in this repository.`,emptyHint:`Add a workflow file under .github/workflows to get started.`,docsLink:`Learn more about GitHub Actions`,loadError:`Unable to load workflows right now.`,loading:`Loading workflows...`},inputs:{title:`Workflow inputs`,refLabel:`Branch or tag`,refPlaceholder:`main`,refAriaLabel:`Branch or tag ref to run the workflow on`,requiredLabel:`Required`,requiredValidationError:`Please fill in all required inputs.`,booleanYes:`Yes`,booleanNo:`No`,selectPlaceholder:`Select an option`,notDispatchable:`This workflow cannot be triggered manually.`,loading:`Loading workflow inputs...`},runs:{title:`Recent runs`,ariaLabel:`Recent GitHub Actions runs`,empty:`No runs yet. Dispatch a workflow to see its status here.`,resolving:`Resolving run...`,notVisible:`Run dispatched but not yet visible on GitHub.`,unknownRef:`Unknown branch or ref`,trackingState:{resolving:`Waiting for this run to become visible on GitHub...`,resolved:`The GitHub run was resolved.`,not_visible:`The dispatched run did not become visible on GitHub.`,ambiguous:`More than one GitHub run matched this dispatch, so Archon could not identify the run safely.`,failed:`GitHub could not provide the run state.`},durationLabel:`Duration`,stepsLabel:`Steps`,jobsLabel:`Jobs`,loadError:`Unable to load runs right now.`},status:{queued:`Queued`,in_progress:`In progress`,completed:`Completed`,unknown:`Unknown`},conclusion:{success:`Success`,failure:`Failure`,cancelled:`Cancelled`,neutral:`Neutral`,skipped:`Skipped`,timed_out:`Timed out`,action_required:`Action required`,stale:`Stale`},messages:{dispatched:`Workflow dispatched. Tracking run status...`,dispatchError:`Unable to dispatch the workflow right now.`}},planningAgentSidebar:{runStatus:{planning:`Planning...`,done:`Done`,failed:`Failed`},runSummary:{tickets:`{{count}} tickets`,dependencies:`{{count}} dependencies`,openQuestions_one:`{{count}} open question`,openQuestions_other:`{{count}} open questions`},actions:{planTickets:`Plan tickets`,openAriaLabel:`Open planning agent`,closeAriaLabel:`Close planning agent`,closePanelAriaLabel:`Close planning agent panel`,manageBundles:`Manage bundles`},tooltip:`Planning agent`,ariaLabel:`Planning agent sidebar`,title:`Planning agent`,description:`Turn a larger initiative into plan-stage tickets with dependencies and bundle context.`,descriptionLabel:`Description`,descriptionAriaLabel:`Planning description`,descriptionPlaceholder:`Describe the task, acceptance criteria, context...`,autoCreateBundle:`Auto-create bundle`,activeRuns:`Active planning runs`,recentRuns:`Recent runs`},reviewFollowUpBubble:{finding:`Finding {{count}}`,externalFix:`External fix {{count}}`,previewComment:`Preview comment {{count}}`,comment:`Comment {{count}}`,unknownTarget:`Unknown target`,textLabel:`Text`,hrefLabel:`Href`,srcLabel:`Src`,changedLineLabel:`Changed line`,selectedFixes:`Selected fixes`,fixCount_one:`{{count}} fix`,fixCount_other:`{{count}} fixes`,locationFile_one:`{{count}} file`,locationFile_other:`{{count}} files`,locationPage_one:`{{count}} page`,locationPage_other:`{{count}} pages`,locationTarget_one:`{{count}} target`,locationTarget_other:`{{count}} targets`,showRawPrompt:`Show raw prompt`,hideRawPrompt:`Hide raw prompt`,rawPrompt:`Raw prompt`},buildRequirementResolutionBubble:{displayTitle:`Build decisions`,title:`Answered Build requirements`,requirementCount_one:`{{count}} decision`,requirementCount_other:`{{count}} decisions`,ticketCount_one:`{{count}} ticket`,ticketCount_other:`{{count}} tickets`,summary:`{{requirementLabel}} across {{ticketLabel}}`,question:`Question`,decision:`Decision`,showRawPrompt:`Show raw prompt`,hideRawPrompt:`Hide raw prompt`,rawPrompt:`Raw prompt`},githubCommentMarkdown:{suggestionLabel:`Suggested change`},ticketStaticDescription:{ariaLabel:`Ticket description`,title:`Description`},ticketDependencyDetails:{blocksTitle:`Blocks`,buildReadinessAriaLabel:`Build readiness`,buildReadinessTitle:`Build readiness`,ready:`Ready`,blocked:`Blocked`,summaryReady:`All blockers have finished build.`,summaryBlocked_one:`{{count}} blocker is still waiting on build.`,summaryBlocked_other:`{{count}} blockers are still waiting on build.`,buildDone:`Build done`,waitingOnBuild:`Waiting on build`,remove:`Remove`,dependencyDetails:`Dependency details`,show:`Show`,hide:`Hide`,unknownTicket:`Unknown ticket`},ticketBuildChainPreview:{ariaLabel:`Build chain`,title:`Build chain`},runControl:{stopAriaLabel:`Stop`,stoppingAriaLabel:`Stopping run`,stoppingTitle:`Stopping run...`,stop:`Stop`,runAriaLabel:`Run`,startingAriaLabel:`Starting run`,startingTitle:`Starting run...`,run:`Run`,disabledReason:`Stop the currently running ticket before starting another run.`},ticketChangesCommitPanel:{title:`Commit selected files`,selectedFiles_one:`{{count}} file selected`,selectedFiles_other:`{{count}} files selected`,commitMessageAriaLabel:`Commit message`,commitMessagePlaceholder:`Commit message`,generateCommitMessageAriaLabel:`Generate commit message`,generating:`Generating...`,generate:`Generate`,committing:`Committing...`,commit:`Commit`},ticketChangesCommitsPanel:{changesLabel:`Local commits`,changesAriaLabel:`Local commits`,changesMenuAriaLabel:`Changes menu`,viewChangesLabel:`View changes`,viewChangesAriaLabel:`View changes`,viewChangesTitle:`View changes`,viewChangesDescription:`Choose which changes to inspect.`,localCommitsLabel:`Local commits`,localCommitsAriaLabel:`Local commits`,localCommitsTitle:`Local commits`,localCommitsDescription:`View local commits on this branch.`,diffSource:`Diff source`,branchDiff:`Branch diff`,uncommittedChanges:`Uncommitted changes`,allListedCommits:`All listed commits`,individualCommits:`Individual commits`,loading:`Loading branch commits...`,undoing:`Undoing...`,undoLatestCommit:`Undo latest commit`,squashCommits:`Squash commits...`,squashTitle:`Squash {{count}} commits?`,squashDescription:`This rewrites your unpushed commit history into one commit. Remote commits will not be changed.`,squashMessageLabel:`New commit message`,squashMessagePlaceholder:`Commit message`,squashCleanWorkspaceWarning:`The workspace must be clean. Commit, stash, or discard current changes before squashing.`,cancel:`Cancel`,squash:`Squash commits`,squashing:`Squashing...`},workspaceReviewModal:{changes:`Changes`,files:`Files`,modeAriaLabel:`Review mode`,closeAriaLabel:`Close workspace review`,chatRequired:`Open Chat to submit review comments.`},workspaceFiles:{target:`Target`,repositoryRoot:`Repository root`,bundleTarget:`{{name}}`,ticketTarget:`Ticket: {{id}}`,fileBrowser:`File browser`,searchFiles:`Search files`,searchPlaceholder:`Search by path`,changedOnly:`Changed files only`,repositoryTree:`Repository tree`,noSearchResults:`No files match your search.`,noFilterResults:`No files match this filter.`,loadingManifest:`Loading workspace files...`,manifestError:`Unable to load workspace files.`,noProject:`No project is selected.`,retry:`Retry`,truncated:`File list truncated at the server limit.`,selectFile:`Select a file`,tracked:`Tracked`,refreshFiles:`Refresh files`,viewChanges:`View changes`,empty:`Choose a readable file from the repository tree to inspect its source.`,loadingFile:`Loading {{path}}...`,contentError:`Unable to load this file.`,viewMode:{ariaLabel:`File view mode`,preview:`Preview`,source:`Source`,sourceRequiredLargeFile:`Source mode is required because this Markdown file is too large to preview.`},expandedFolder:`Expanded: {{path}}`,collapsedFolder:`Collapsed: {{path}}`,fileLabel:`{{status}}{{path}}{{comments}}`,commentsSuffix:`, {{count}} comments`,unsupported:{absolute_path:`Absolute paths cannot be opened.`,binary:`Binary files cannot be displayed.`,deleted:`This file has been deleted.`,invalid_utf8:`This file is not valid UTF-8 text.`,missing:`This file is no longer present in the workspace.`,not_in_manifest:`This file is no longer in the workspace manifest.`,not_regular_file:`This path is not a regular file.`,nul_byte:`This file contains binary data and cannot be displayed.`,oversized:`This file is too large to display.`,path_traversal:`This path is outside the selected workspace.`,symlink:`Symbolic links cannot be opened here.`,unreadable:`This file cannot be read.`},source:{ariaLabel:`Source code`,empty:`This file is empty.`,highlightingDisabledLargeFile:`Syntax highlighting is disabled because this file is too large.`,search:{open:`Search within file`,inputLabel:`Find in file`,placeholder:`Find in file`,matchCount:`{{current}} of {{total}}`,noMatches:`No matches`,previous:`Previous match`,next:`Next match`,close:`Close search`},commentOnLine:`Comment on line {{lineNumber}}`,stale:`Stale`,edit:`Edit`,remove:`Remove`,placeholder:`Tell the agent what should change`,cancel:`Cancel`,add:`Add comment`,save:`Save comment`},markdown:{ariaLabel:`Markdown preview`,empty:`This Markdown file is empty.`,disabledLargeFile:`Markdown preview is disabled because this file is too large.`,imagePlaceholder:`Image not loaded: {{alt}} ({{source}})`,imagePlaceholderNoAlt:`Image not loaded ({{source}})`,missingImageSource:`source unavailable`,missingLinkSource:`unsupported link`}},chatChangesPanel:{unknownFile:`Unknown file`,picker:{diff:`Diff`,file:`File`,allChanges:`All changes`,openChangedFilesAriaLabel:`Open changed files`,fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`,title:`Changed files`,allChangesDescription:`Review the full workspace diff.`},fileStatus:{modified:`Modified`,added:`Added`,deleted:`Deleted`,renamed:`Renamed`,untracked:`Untracked`,typechanged:`Type changed`,staged:`Staged`,unstaged:`Unstaged`,conflicted:`Conflicted`,renamedFrom:`from {{path}}`},errors:{loadDiff:`Unable to load the diff right now.`,sendChanges:`Unable to send the changes right now.`},toasts:{sendChangesSuccess:`Changes sent to chat.`},closeAriaLabel:`Close diff panel`,emptyStateTitle:`No uncommitted changes.`,emptyStateDescription:`The current project branch is clean.`},pendingFixesPopover:{triggerLabel:`Pending fixes`,title:`Pending fixes`,description:`Review selected comments and findings before sending them back to the agent.`,empty:`No pending fixes selected yet.`,manualCommentTitle:`Manual comment`,manualBadge:`Manual`,sourceLocation:`Workspace file · {{path}} · line {{line}}`,staleSource:`Source changed since this comment was added.`,edit:`Edit`,remove:`Remove`,cancel:`Cancel`,save:`Save`,editCommentLabel:`Edit pending comment`,findingTitle:`Finding {{ordinal}}`,githubReviewSummary:`GitHub review summary`,githubReviewComment:`GitHub review comment`,clear:`Clear`,sending:`Sending...`,sendFixes:`Send fixes ({{count}})`,lineReference:{oldAndNew:`old {{oldLine}}, new {{newLine}}`,newOnly:`new {{newLine}}`,oldOnly:`old {{oldLine}}`,unavailable:`line unavailable`}},ticketChangesDiffPanel:{stats:{fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`},reviewComment:{manualBadge:`Manual`,commentOnLine:`Comment on line {{lineNumber}}`,addCommentToLine:`Add a comment to line {{lineNumber}}`,ariaLabel:`Review comment for {{filePath}}`,placeholder:`Add a review comment for this change`,edit:`Edit`,remove:`Remove`,add:`Add comment`,cancel:`Cancel`},lineReference:{oldAndNew:`old {{oldLine}}, new {{newLine}}`,newOnly:`new {{newLine}}`,oldOnly:`old {{oldLine}}`,unavailable:`line unavailable`},reviewFinding:{title:`Finding {{ordinal}}`,selected:`Selected`,fix:`Fix`,hideDetails:`Hide details`,details:`Details`,whyItMatters:`Why it matters`,requestedFix:`Requested fix`,sectionTitle:`Review findings`,reviewerModel:`Reviewed with {{model}}`,reviewerModelVariant:`Reviewed with {{model}} · {{variant}}`},githubComment:{badge:`GitHub`,reviewSummary:`Review summary`,fileComment:`File comment`,inlineComment:`Inline comment`,outdated:`Outdated`,openOnGitHub:`Open on GitHub`,sectionTitle:`GitHub review comments`},viewType:{unified:`Unified`,split:`Split`},header:{allChanges:`All changes`,viewCurrentFile:`View file`,nextComment:`Next comment`,nextCommentAriaLabel:`Next review comment`,nextCommentTooltip:`Jump to the next review comment`},states:{loading:`Loading diff...`,refreshing:`Refreshing diff... Displayed changes may be outdated.`,retry:`Retry`,emptyTitle:`No changes to show.`,noRenderableFileTitle:`No renderable diff for this file in the UI.`},fileBadge:{newFile:`New file`}}},projects:{identity:{activeProjectAriaLabel:`Active project`,emptyLabel:`No projects yet`,filterPlaceholder:`Filter projects...`,emptySearch:`No matches`,newProject:`New project`,newProjectAriaLabel:`Create a new project`,editProjectSettingsAriaLabel:`Edit project settings`},modal:{dialogTitle:{create:`Add a repository to Archon`,edit:`Edit project settings`},dialogDescription:`Configure a project repository, setup commands, services, and IDE launch settings.`,header:{title:{create:`Add project`,edit:`Edit project settings`},description:{create:`Point Archon at a repository, then define only the behavior you want Archon to manage.`,edit:`Update how Archon prepares and opens worktrees for this repository.`},close:`Close modal`},navigation:{title:`Settings`,general:`General`,automation:`Automation`,execution:`Execution`,services:`Services`,checks:`Checks`,sync:`Sync`,memory:`Memory`,integrations:`Integrations`,danger:`Danger Zone`,summary:{required:`Required`,configured:`Configured`,optional:`Optional`,none:`None`,enabled:`Enabled`,disabled:`Disabled`,loading:`Loading`,blocked:`Blocked`,ready:`Ready`,host:`This machine`,dockerSandbox:`Docker Sandbox`,count:`{{count}}`,integrationsCount_one:`{{count}} enabled`,integrationsCount_other:`{{count}} enabled`}},sections:{general:{title:`General`,description:`Start with the repository Archon should use when it creates and manages worktrees for this project.`},automation:{title:`Automation`,description:`Configure helper defaults, setup behavior, and optional workflow rules Archon can apply to this project.`},execution:{title:`Execution`,description:`Choose where Build agents run and validate Docker Sandbox environments for the exact selected target.`},services:{title:`Services`,description:`Add long-running commands that Archon should start automatically inside each worktree.`},checks:{title:`Checks`,description:`Configure reusable commands and manage their project-wide execution policies.`},sync:{title:`Sync`,description:`Define which local files Archon should copy or symlink into a worktree the first time it is created.`},memory:{title:`Memory`,description:`Turn project memory on or off and manage the saved context Archon keeps outside the repository.`},integrations:{title:`Integrations`,description:`Connect external systems that add richer context to planning, tickets, and pull requests for this project.`},danger:{title:`Danger Zone`,description:`Delete this project only after its tickets and worktrees are already gone. This action cannot be undone.`}},linkedProjects:{none:`No linked projects`,count_one:`{{count}} linked project`,count_other:`{{count}} linked projects`},repoPath:{initializable:`Archon will initialize this directory as a git repository when you create the project.`,invalid:`Repository path is not a valid git repository.`,validateFailed:`Unable to validate the repository path right now.`,browseFailed:`Unable to open the folder picker.`},autoConfig:{applied:`Auto-config applied.`,noop:`Auto-config found no empty fields to fill.`,failed:`Auto-config failed.`},generatedCheckName:{scoped:`{{directory}} {{category}}`,repo:`repo {{category}}`,categories:{test:`tests`,typecheck:`typecheck`,lint:`lint`,"format-check":`format check`,build:`build`,coverage:`coverage`,security:`security`,custom:`check`}},validation:{projectNameRequired:`Project name is required.`,repositoryPathRequired:`Repository path is required.`,serviceCommandRequired:`A service command is required when a service row has values.`,syncSourceRequired:`A source path is required when a sync row has values.`,checkCommandRequired:`A command is required when a check row has values.`,checkDraftPending:`Confirm this check or cancel the draft before saving or closing.`,checkDraftNeedsAttention:`Fix the highlighted check fields, then add the check or cancel the draft.`,checkIdUnique:`Each check must have a unique ID.`,checkDirectoryRelative:`Directory must be a relative path inside the project repository.`,checkTimeoutRange:`Timeout must be a whole number between {{min}} and {{max}} milliseconds.`,previewServiceRequired:`Choose a named service before enabling preview.`},actions:{cancel:`Cancel`,createProject:`Create project`,createProjectBusy:`Creating...`,saveChanges:`Save changes`,saveChangesBusy:`Saving...`}},execution:{loading:`Loading execution readiness...`,loadError:`Unable to load project execution readiness.`,unknown:`Unknown`,provider:{title:`Build execution provider`,description:`This setting applies to new Build runs. Existing runs and their follow-ups retain their recorded execution environment.`,host:{label:`This machine`,description:`Run Build agents directly on the Archon host for compatibility with the existing workflow.`},docker_sandbox:{label:`Docker Sandbox`,description:`Run Build agents in validated, exact-target Docker Sandbox environments.`,status:{loading:`Checking runtime readiness...`,error:`Unavailable until runtime diagnostics can be checked.`,blocked:`Setup required before this can be selected.`,eligible:`Available; the daemon will start when needed.`,ready:`Available for validation.`}}},runtime:{title:`Docker Sandbox runtime`,loadError:`Unable to check Docker Sandbox runtime readiness.`,openDiagnostics:`Open runtime diagnostics`,state:{loading:`Checking whether Docker Sandbox can run on this machine.`,error:`Readiness could not be confirmed.`,blocked:`Setup is required before Docker Sandbox can be selected.`,eligible:`Ready to activate when validation needs it.`,ready:`Ready for project validation.`}},effective:{title:`Effective Build environment`,host:`This machine (host)`,docker_sandbox:`Docker Sandbox`},readiness:{loading:`Checking whether every agent environment is ready...`,runtimeLoading:`Checking Docker Sandbox runtime readiness...`,runtimeBlocked:`Blocked: configure Docker Sandbox runtime prerequisites before validating this target.`,runtimeError:`Unavailable: Docker Sandbox readiness could not be confirmed. Open runtime diagnostics and retry.`,projectRequired:`Create the project, then validate {{agents}} before starting a sandboxed Build.`,providerRequired:`Select the OpenCode provider that Docker Sandbox should validate before starting a sandboxed Build.`,ready:`Ready. {{agents}} have current validation for this exact target.`,blocked:`Blocked: {{ready}} of {{total}} required agent validations are ready for this exact target and provider.`},requirements:{title:`Docker Sandbox requirements`,exactTarget:`The environment and validation must match the exact current project target.`,agents:`OpenCode and Claude are validated independently; each Build requires its selected agent to be ready.`,failClosed:`Builds do not fall back to this machine when Docker Sandbox is selected. Missing, stale, leased, or invalid evidence blocks execution.`},target:{title:`Current target`,selected:`Selected target`,path:`Writable path`,warning:`Direct mode mounts this worktree read-write. It does not protect the selected worktree from edits made by the sandboxed agent.`,kind:{"project-root":`Repository root`,"bundle-worktree":`Bundle worktree`,"branch-worktree":`Branch worktree`}},agent:{opencode:`OpenCode`,claude:`Claude`},validation:{title:`Agent sandbox validation`,action:`Validate {{agent}}`,validating:`Validating...`,notValidated:`Not validated`,ready:`Ready`,notReady:`Setup required or degraded`,environmentWillPrepare:`Every explicit validation rechecks runtime readiness and may automatically start the Docker Sandbox daemon when eligible before it prepares, reconnects to, or revalidates this agent's dedicated exact-target sandbox.`,stale:`This result belongs to a prior execution environment or project target and is stale.`,runState:`Execution-run state`,provider:`Validation provider`,providerLabel:`OpenCode provider for validation`,providerDescription:`Docker Sandbox validates provider access with a representative model. Models from the approved provider can then be selected for ticket Build, with the selected model rechecked before execution.`,probeModel:`Probe model`,providerNotSelected:`Not selected`,credentialDescription:`Docker Sandbox uses its own template or proxy credential setup; host OpenCode and Claude logins are not imported automatically.`,secretSetup:"For the Docker credential proxy, configure {{service}} on the host with `sbx secret set {{service}}` before validating. Archon never receives the secret.",secretSetupUnsupported:`No qualified Docker credential mapping is known for {{provider}}. Configure this provider using its documented sandbox flow before validating.`,providerLoading:`Loading available OpenCode providers...`,providerPlaceholder:`Select a provider before validating OpenCode`,verifiedOption:`sandbox verified`,modelNotSelected:`Not selected`,isolation:`Effective isolation`,template:`Template identity`,authentication:`Authentication`,skills:`Sandbox skills`,destinations:`Required destinations`,checkKind:{workspace_location:`Workspace location`,workspace_readable:`Workspace readability`,workspace_writable:`Workspace writability`,executable:`Executable`,headless:`Headless mode`,authentication:`Authentication`,skills:`Sandbox skills`,destination:`Destination access`},destinationReason:{invalid_json:`The agent returned an invalid structured response.`,nonzero_exit:`The destination command exited unsuccessfully.`,provider_error:`The provider reported an error while serving the selected model.`,model_not_found:`The selected model is not available in the sandbox provider.`,credential_rejected:`The provider rejected the sandbox credential or proxy mapping.`,unexpected_response:`The agent response did not match the validation sentinel.`},checkReason:{model_required:`An explicit OpenCode model is required for this validation.`,provider_required:`An explicit OpenCode provider is required for this validation.`,credential_inventory_unavailable:`Docker Sandbox credential inventory could not be read, so provider-specific access could not be verified.`},evidence:{title:`{{check}} evidence`,reason:`Reason: {{reason}}`,providerName:`Provider error: {{name}}.`,providerMessage:`Provider message: {{message}}`,providerReference:`Provider reference: {{reference}}`,runReference:`Archon run: {{runId}}; correlation: {{correlationId}}`,exitCode:`Exit code: {{code}}.`,exitCodeUnknown:`unknown`,truncated:`Output was truncated.`},interruption:`Interruption`,interrupted:`Interrupted; the persistent environment may still be available`,notInterrupted:`Not interrupted`,remediation:`Resolve the failed checks, configure provider access through the Docker Sandbox setup, and validate this provider again.`,error:`Unable to validate the {{agent}} environment.`,failure:`Failure`},checkState:{passed:`Passed`,failed:`Setup required`,cancelled:`Interrupted`},credentialSource:{stored:`stored credential`,environment:`environment or proxy credential`,brokered:`Docker credential proxy`,brokeredWithService:`Docker credential proxy: {{service}}`,guest:`guest authentication`,none:`no credential source`,unknown:`unknown credential source`},reset:{action:`Reset sandbox`,confirm:`Reset this Docker Sandbox? It removes the persistent sandbox state and requires validation again.`,resetting:`Resetting...`,error:`Unable to reset the Docker Sandbox.`},runState:{queued:`Queued`,running:`Running`,waiting:`Waiting`,completed:`Completed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`},isolation:{microvm:`MicroVM`,unknown:`Unknown`}},advanced:{summary:{none:`None`,configured:`Configured`,toolDefault:`Tool default`,implementingModel:`Implementing model per ticket`,default:`Default`,customRules:`Custom rules`,autoParkOn:`Auto-park on`,specAwareOn:`Spec coverage on`,modified:`Modified`,enabled:`Enabled`,manualOnly:`Manual only`,depthOnly:`{{depth}}`,depthWithFix:`{{depth}} + fix loop`,disabled:`Disabled`,watching:`Watching {{name}}`,commandCount_one:`{{count}} command`,commandCount_other:`{{count}} commands`,serviceCount_one:`{{count}} service`,serviceCount_other:`{{count}} services`,ruleCount_one:`{{count}} rule`,ruleCount_other:`{{count}} rules`},autoConfigPanel:{badge:`Auto-config`,description:`Inspect the repo and fill any empty setup, service, or sync fields.`,note:`Existing values stay untouched. Uses helper model if set, otherwise the selected tool's default model.`,loading:`Inspecting repo...`,action:`Auto-config`},helperModel:{title:`Helper model`,description:`Set an optional OpenCode model for auto-config and other lightweight project tasks.`,panelDescription:`Used for auto-config and other lightweight project tasks. Leave empty to use the selected tool's default model.`,unavailable:`OpenCode model discovery is unavailable right now. Leave this setting empty to use the selected tool's default model.`},reviewerModel:{title:`Reviewer model`,description:`Set an optional OpenCode model for project code and spec reviews.`,unavailable:`OpenCode model discovery is unavailable right now. Leave this setting empty to use the implementing model for each ticket.`,modelLabel:`Reviewer model`,variantLabel:`Reviewer variant`,defaultModel:`Implementing model per ticket`},modelSelection:{loading:`Loading OpenCode models...`,modelLabel:`Model`,variantLabel:`Variant`,defaultModel:`Use default model`,defaultVariant:`Use model default`,availableVariants:`Available variants`},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`,ws=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xs(Cs).contentName}}.`;return p.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ts=Xo,Es=ns,Ds=is,Os=cs,ks=ps,As=hs,js=_s;function Ms(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 Ns(e){let[t,n]=p.useState(void 0);return mi(()=>{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 Ps=[`top`,`right`,`bottom`,`left`],Fs=Math.min,Is=Math.max,Ls=Math.round,Rs=Math.floor,zs=e=>({x:e,y:e}),Bs={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Vs(e,t,n){return Is(e,Fs(t,n))}function Hs(e,t){return typeof e==`function`?e(t):e}function Us(e){return e.split(`-`)[0]}function Ws(e){return e.split(`-`)[1]}function Gs(e){return e===`x`?`y`:`x`}function Ks(e){return e===`y`?`height`:`width`}function qs(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Js(e){return Gs(qs(e))}function Ys(e,t,n){n===void 0&&(n=!1);let r=Ws(e),i=Js(e),a=Ks(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ic(o)),[o,ic(o)]}function Xs(e){let t=ic(e);return[Zs(e),t,Zs(t)]}function Zs(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Qs=[`left`,`right`],$s=[`right`,`left`],ec=[`top`,`bottom`],tc=[`bottom`,`top`];function nc(e,t,n){switch(e){case`top`:case`bottom`:return n?t?$s:Qs:t?Qs:$s;case`left`:case`right`:return t?ec:tc;default:return[]}}function rc(e,t,n,r){let i=Ws(e),a=nc(Us(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Zs)))),a}function ic(e){let t=Us(e);return Bs[t]+e.slice(t.length)}function ac(e){return{top:0,right:0,bottom:0,left:0,...e}}function oc(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ac(e)}function sc(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 cc(e,t,n){let{reference:r,floating:i}=e,a=qs(t),o=Js(t),s=Ks(o),c=Us(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(Ws(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 lc(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}=Hs(t,e),p=oc(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=sc(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=sc(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 uc=50,dc=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:lc},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=cc(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<uc&&(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}=cc(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},fc=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}=Hs(e,t)||{};if(l==null)return{};let d=oc(u),f={x:n,y:r},p=Js(i),m=Ks(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=Fs(d[_],T),D=Fs(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Vs(O,A,k),M=!c.arrow&&Ws(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}}}),pc=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}=Hs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Us(r),_=qs(o),v=Us(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ic(o)]:Xs(o)),x=p!==`none`;!d&&x&&b.push(...rc(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=Ys(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==qs(t))||T.every(e=>qs(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=qs(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function mc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hc(e){return Ps.some(t=>e[t]>=0)}var gc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Hs(e,t);switch(i){case`referenceHidden`:{let e=mc(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:hc(e)}}}case`escaped`:{let e=mc(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:hc(e)}}}default:return{}}}}},_c=new Set([`left`,`top`]);async function vc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Us(n),s=Ws(n),c=qs(n)===`y`,l=_c.has(o)?-1:1,u=a&&c?-1:1,d=Hs(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 yc=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 vc(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}}}}},bc=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}=Hs(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=qs(Us(i)),p=Gs(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=Vs(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=Vs(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}}}}}},xc=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}=Hs(e,t),u={x:n,y:r},d=qs(i),f=Gs(d),p=u[f],m=u[d],h=Hs(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=_c.has(Us(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}=Hs(e,t),u=await o.detectOverflow(t,l),d=Us(i),f=Ws(i),p=qs(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Fs(h-u[g],v),x=Fs(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=Is(u.left,0),t=Is(u.right,0),n=Is(u.top,0),r=Is(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Is(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Is(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 wc(e){return Dc(e)?(e.nodeName||``).toLowerCase():`#document`}function Tc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ec(e){return((Dc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Dc(e){return Cc()?e instanceof Node||e instanceof Tc(e).Node:!1}function Oc(e){return Cc()?e instanceof Element||e instanceof Tc(e).Element:!1}function kc(e){return Cc()?e instanceof HTMLElement||e instanceof Tc(e).HTMLElement:!1}function Ac(e){return!Cc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Tc(e).ShadowRoot}function jc(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Hc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Mc(e){return/^(table|td|th)$/.test(wc(e))}function Nc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Pc=/transform|translate|scale|rotate|perspective|filter/,Fc=/paint|layout|strict|content/,Ic=e=>!!e&&e!==`none`,Lc;function Rc(e){let t=Oc(e)?Hc(e):e;return Ic(t.transform)||Ic(t.translate)||Ic(t.scale)||Ic(t.rotate)||Ic(t.perspective)||!Bc()&&(Ic(t.backdropFilter)||Ic(t.filter))||Pc.test(t.willChange||``)||Fc.test(t.contain||``)}function zc(e){let t=Wc(e);for(;kc(t)&&!Vc(t);){if(Rc(t))return t;if(Nc(t))return null;t=Wc(t)}return null}function Bc(){return Lc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Lc}function Vc(e){return/^(html|body|#document)$/.test(wc(e))}function Hc(e){return Tc(e).getComputedStyle(e)}function Uc(e){return Oc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wc(e){if(wc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ac(e)&&e.host||Ec(e);return Ac(t)?t.host:t}function Gc(e){let t=Wc(e);return Vc(t)?e.ownerDocument?e.ownerDocument.body:e.body:kc(t)&&jc(t)?t:Gc(t)}function Kc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Gc(e),i=r===e.ownerDocument?.body,a=Tc(r);if(i){let e=qc(a);return t.concat(a,a.visualViewport||[],jc(r)?r:[],e&&n?Kc(e):[])}else return t.concat(r,Kc(r,[],n))}function qc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jc(e){let t=Hc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=kc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ls(n)!==a||Ls(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Yc(e){return Oc(e)?e:e.contextElement}function Xc(e){let t=Yc(e);if(!kc(t))return zs(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Jc(t),o=(a?Ls(n.width):n.width)/r,s=(a?Ls(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Zc=zs(0);function Qc(e){let t=Tc(e);return!Bc()||!t.visualViewport?Zc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $c(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tc(e)?!1:t}function el(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Yc(e),o=zs(1);t&&(r?Oc(r)&&(o=Xc(r)):o=Xc(e));let s=$c(a,n,r)?Qc(a):zs(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=Tc(a),t=r&&Oc(r)?Tc(r):r,n=e,i=qc(n);for(;i&&r&&t!==n;){let e=Xc(i),t=i.getBoundingClientRect(),r=Hc(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=Tc(i),i=qc(n)}}return sc({width:u,height:d,x:c,y:l})}function tl(e,t){let n=Uc(e).scrollLeft;return t?t.left+n:el(Ec(e)).left+n}function nl(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-tl(e,n),y:n.top+t.scrollTop}}function rl(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ec(r),s=t?Nc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=zs(1),u=zs(0),d=kc(r);if((d||!d&&!a)&&((wc(r)!==`body`||jc(o))&&(c=Uc(r)),d)){let e=el(r);l=Xc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?nl(o,c):zs(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 il(e){return Array.from(e.getClientRects())}function al(e){let t=Ec(e),n=Uc(e),r=e.ownerDocument.body,i=Is(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Is(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+tl(e),s=-n.scrollTop;return Hc(r).direction===`rtl`&&(o+=Is(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ol=25;function sl(e,t){let n=Tc(e),r=Ec(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Bc();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=tl(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<=ol&&(a-=o)}else l<=ol&&(a+=l);return{width:a,height:o,x:s,y:c}}function cl(e,t){let n=el(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=kc(e)?Xc(e):zs(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ll(e,t,n){let r;if(t===`viewport`)r=sl(e,n);else if(t===`document`)r=al(Ec(e));else if(Oc(t))r=cl(t,n);else{let n=Qc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return sc(r)}function ul(e,t){let n=Wc(e);return n===t||!Oc(n)||Vc(n)?!1:Hc(n).position===`fixed`||ul(n,t)}function dl(e,t){let n=t.get(e);if(n)return n;let r=Kc(e,[],!1).filter(e=>Oc(e)&&wc(e)!==`body`),i=null,a=Hc(e).position===`fixed`,o=a?Wc(e):e;for(;Oc(o)&&!Vc(o);){let t=Hc(o),n=Rc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||jc(o)&&!n&&ul(e,o))?r=r.filter(e=>e!==o):i=t,o=Wc(o)}return t.set(e,r),r}function fl(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Nc(t)?[]:dl(t,this._c):[].concat(n),r],o=ll(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=ll(t,a[e],i);s=Is(n.top,s),c=Fs(n.right,c),l=Fs(n.bottom,l),u=Is(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function pl(e){let{width:t,height:n}=Jc(e);return{width:t,height:n}}function ml(e,t,n){let r=kc(t),i=Ec(t),a=n===`fixed`,o=el(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=zs(0);function l(){c.x=tl(i)}if(r||!r&&!a)if((wc(t)!==`body`||jc(i))&&(s=Uc(t)),r){let e=el(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?nl(i,s):zs(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 hl(e){return Hc(e).position===`static`}function gl(e,t){if(!kc(e)||Hc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ec(e)===n&&(n=n.ownerDocument.body),n}function _l(e,t){let n=Tc(e);if(Nc(e))return n;if(!kc(e)){let t=Wc(e);for(;t&&!Vc(t);){if(Oc(t)&&!hl(t))return t;t=Wc(t)}return n}let r=gl(e,t);for(;r&&Mc(r)&&hl(r);)r=gl(r,t);return r&&Vc(r)&&hl(r)&&!Rc(r)?n:r||zc(e)||n}var vl=async function(e){let t=this.getOffsetParent||_l,n=this.getDimensions,r=await n(e.floating);return{reference:ml(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yl(e){return Hc(e).direction===`rtl`}var bl={convertOffsetParentRelativeRectToViewportRelativeRect:rl,getDocumentElement:Ec,getClippingRect:fl,getOffsetParent:_l,getElementRects:vl,getClientRects:il,getDimensions:pl,getScale:Xc,isElement:Oc,isRTL:yl};function xl(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=Ec(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=Rs(d),h=Rs(i.clientWidth-(u+f)),g=Rs(i.clientHeight-(d+p)),_=Rs(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Is(0,Fs(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&&!xl(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=Yc(e),u=i||a?[...l?Kc(l):[],...t?Kc(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?el(e):null;c&&g();function g(){let t=el(e);h&&!xl(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 wl=yc,Tl=bc,El=pc,Dl=Sc,Ol=gc,kl=fc,Al=xc,jl=(e,t,n)=>{let r=new Map,i={platform:bl,...n},a={...i.platform,_c:r};return dc(e,t,{...i,platform:a})},Ml=typeof document<`u`?p.useLayoutEffect:function(){};function Nl(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(!Nl(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)&&!Nl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Pl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fl(e,t){let n=Pl(e);return Math.round(t*n)/n}function Il(e){let t=p.useRef(e);return Ml(()=>{t.current=e}),t}function Ll(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);Nl(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=Il(c),k=Il(i),A=Il(l),j=p.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),jl(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Nl(E.current,t)&&(E.current=t,m.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Ml(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=p.useRef(!1);Ml(()=>(M.current=!0,()=>{M.current=!1}),[]),Ml(()=>{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=Fl(P.floating,u.x),r=Fl(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Pl(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 Rl=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?{}:kl({element:r.current,padding:i}).fn(n):r?kl({element:r,padding:i}).fn(n):{}}}},zl=(e,t)=>{let n=wl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bl=(e,t)=>{let n=Tl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vl=(e,t)=>({fn:Al(e).fn,options:[e,t]}),Hl=(e,t)=>{let n=El(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ul=(e,t)=>{let n=Dl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wl=(e,t)=>{let n=Ol(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gl=(e,t)=>{let n=Rl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kl=`Arrow`,ql=p.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Y.jsx)(ri.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Y.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});ql.displayName=Kl;var Jl=ql,Yl=`Popper`,[Xl,Zl]=ui(Yl),[Ql,$l]=Xl(Yl),eu=e=>{let{__scopePopper:t,children:n}=e,[r,i]=p.useState(null);return(0,Y.jsx)(Ql,{scope:t,anchor:r,onAnchorChange:i,children:n})};eu.displayName=Yl;var tu=`PopperAnchor`,nu=p.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=$l(tu,n),o=p.useRef(null),s=Jr(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,Y.jsx)(ri.div,{...i,ref:s})});nu.displayName=tu;var ru=`PopperContent`,[iu,au]=Xl(ru),ou=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,_=$l(ru,n),[v,y]=p.useState(null),b=Jr(t,e=>y(e)),[x,S]=p.useState(null),C=Ns(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(uu),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Ll({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Cl(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[zl({mainAxis:i+T,alignmentAxis:o}),c&&Bl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Vl():void 0,...A}),c&&Hl({...A}),Ul({...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&&Gl({element:x,padding:s}),du({arrowWidth:w,arrowHeight:T}),f&&Wl({strategy:`referenceHidden`,...A})]}),[I,L]=fu(N),R=Wi(h);mi(()=>{P&&R?.()},[P,R]);let ee=F.arrow?.x,te=F.arrow?.y,z=F.arrow?.centerOffset!==0,[B,V]=p.useState();return mi(()=>{v&&V(window.getComputedStyle(v).zIndex)},[v]),(0,Y.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:B,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Y.jsx)(iu,{scope:n,placedSide:I,onArrowChange:S,arrowX:ee,arrowY:te,shouldHideArrow:z,children:(0,Y.jsx)(ri.div,{"data-side":I,"data-align":L,...g,ref:b,style:{...g.style,animation:P?void 0:`none`}})})})});ou.displayName=ru;var su=`PopperArrow`,cu={top:`bottom`,right:`left`,bottom:`top`,left:`right`},lu=p.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=au(su,n),a=cu[i.placedSide];return(0,Y.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,Y.jsx)(Jl,{...r,ref:t,style:{...r.style,display:`block`}})})});lu.displayName=su;function uu(e){return e!==null}var du=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]=fu(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 fu(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var pu=eu,mu=nu,hu=ou,gu=lu,_u=`rovingFocusGroup.onEntryFocus`,vu={bubbles:!1,cancelable:!0},yu=`RovingFocusGroup`,[bu,xu,Su]=fi(yu),[Cu,wu]=ui(yu,[Su]),[Tu,Eu]=Cu(yu),Du=p.forwardRef((e,t)=>(0,Y.jsx)(bu.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,Y.jsx)(bu.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,Y.jsx)(Ou,{...e,ref:t})})}));Du.displayName=yu;var Ou=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=Jr(t,f),h=Ui(a),[g,_]=gi({prop:o,defaultProp:s??null,onChange:c,caller:yu}),[v,y]=p.useState(!1),b=Wi(l),x=xu(n),S=p.useRef(!1),[C,w]=p.useState(0);return p.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(_u,b),()=>e.removeEventListener(_u,b)},[b]),(0,Y.jsx)(Tu,{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,Y.jsx)(ri.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:`none`,...e.style},onMouseDown:pi(e.onMouseDown,()=>{S.current=!0}),onFocus:pi(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(_u,vu);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Pu([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:pi(e.onBlur,()=>y(!1))})})}),ku=`RovingFocusGroupItem`,Au=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ei(),l=a||c,u=Eu(ku,n),d=u.currentTabStopId===l,f=xu(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u;return p.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,Y.jsx)(bu.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,Y.jsx)(ri.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:pi(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:pi(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:pi(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Nu(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?Fu(n,r+1):n.slice(r+1)}setTimeout(()=>Pu(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});Au.displayName=ku;var ju={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Mu(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Nu(e,t,n){let r=Mu(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return ju[r]}function Pu(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Fu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Iu=Du,Lu=Au,Ru=[`Enter`,` `],zu=[`ArrowDown`,`PageUp`,`Home`],Bu=[`ArrowUp`,`PageDown`,`End`],Vu=[...zu,...Bu],Hu={ltr:[...Ru,`ArrowRight`],rtl:[...Ru,`ArrowLeft`]},Uu={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Wu=`Menu`,[Gu,Ku,qu]=fi(Wu),[Ju,Yu]=ui(Wu,[qu,Zl,wu]),Xu=Zl(),Zu=wu(),[Qu,$u]=Ju(Wu),[ed,td]=Ju(Wu),nd=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Xu(t),[c,l]=p.useState(null),u=p.useRef(!1),d=Wi(a),f=Ui(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,Y.jsx)(pu,{...s,children:(0,Y.jsx)(Qu,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,Y.jsx)(ed,{scope:t,onClose:p.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};nd.displayName=Wu;var rd=`MenuAnchor`,id=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Xu(n);return(0,Y.jsx)(mu,{...i,...r,ref:t})});id.displayName=rd;var ad=`MenuPortal`,[od,sd]=Ju(ad,{forceMount:void 0}),cd=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=$u(ad,t);return(0,Y.jsx)(od,{scope:t,forceMount:n,children:(0,Y.jsx)(bi,{present:n||a.open,children:(0,Y.jsx)(Sa,{asChild:!0,container:i,children:r})})})};cd.displayName=ad;var ld=`MenuContent`,[ud,dd]=Ju(ld),fd=p.forwardRef((e,t)=>{let n=sd(ld,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$u(ld,e.__scopeMenu),o=td(ld,e.__scopeMenu);return(0,Y.jsx)(Gu.Provider,{scope:e.__scopeMenu,children:(0,Y.jsx)(bi,{present:r||a.open,children:(0,Y.jsx)(Gu.Slot,{scope:e.__scopeMenu,children:o.modal?(0,Y.jsx)(pd,{...i,ref:t}):(0,Y.jsx)(md,{...i,ref:t})})})})}),pd=p.forwardRef((e,t)=>{let n=$u(ld,e.__scopeMenu),r=p.useRef(null),i=Jr(t,r);return p.useEffect(()=>{let e=r.current;if(e)return Wo(e)},[]),(0,Y.jsx)(gd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:pi(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),md=p.forwardRef((e,t)=>{let n=$u(ld,e.__scopeMenu);return(0,Y.jsx)(gd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),hd=Yr(`MenuContent.ScrollLock`),gd=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,_=$u(ld,n),v=td(ld,n),y=Xu(n),b=Zu(n),x=Ku(n),[S,C]=p.useState(null),w=p.useRef(null),T=Jr(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?Fo:p.Fragment,N=h?{as:hd,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=ef(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),[]),wa();let F=p.useCallback(e=>A.current===k.current?.side&&nf(e,k.current?.area),[]);return(0,Y.jsx)(ud,{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,Y.jsx)(M,{...N,children:(0,Y.jsx)(la,{asChild:!0,trapped:i,onMountAutoFocus:pi(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,Y.jsx)(Qi,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:m,children:(0,Y.jsx)(Iu,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:pi(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Y.jsx)(hu,{role:`menu`,"aria-orientation":`vertical`,"data-state":Yd(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:pi(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||!Vu.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Bu.includes(e.key)&&a.reverse(),Qd(a)}),onBlur:pi(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:pi(e.onPointerMove,rf(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)}))})})})})})})});fd.displayName=ld;var _d=`MenuGroup`,vd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ri.div,{role:`group`,...r,ref:t})});vd.displayName=_d;var yd=`MenuLabel`,bd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ri.div,{...r,ref:t})});bd.displayName=yd;var xd=`MenuItem`,Sd=`menu.itemSelect`,Cd=p.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=p.useRef(null),o=td(xd,e.__scopeMenu),s=dd(xd,e.__scopeMenu),c=Jr(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}),ii(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,Y.jsx)(wd,{...i,ref:c,disabled:n,onClick:pi(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:pi(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:pi(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Ru.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Cd.displayName=xd;var wd=p.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=dd(xd,n),s=Zu(n),c=p.useRef(null),l=Jr(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,Y.jsx)(Gu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,Y.jsx)(Lu,{asChild:!0,...s,focusable:!r,children:(0,Y.jsx)(ri.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:pi(e.onPointerMove,rf(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:pi(e.onPointerLeave,rf(e=>o.onItemLeave(e))),onFocus:pi(e.onFocus,()=>d(!0)),onBlur:pi(e.onBlur,()=>d(!1))})})})}),Td=`MenuCheckboxItem`,Ed=p.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,Y.jsx)(Pd,{scope:e.__scopeMenu,checked:n,children:(0,Y.jsx)(Cd,{role:`menuitemcheckbox`,"aria-checked":Xd(n)?`mixed`:n,...i,ref:t,"data-state":Zd(n),onSelect:pi(i.onSelect,()=>r?.(Xd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ed.displayName=Td;var Dd=`MenuRadioGroup`,[Od,kd]=Ju(Dd,{value:void 0,onValueChange:()=>{}}),Ad=p.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Wi(r);return(0,Y.jsx)(Od,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,Y.jsx)(vd,{...i,ref:t})})});Ad.displayName=Dd;var jd=`MenuRadioItem`,Md=p.forwardRef((e,t)=>{let{value:n,...r}=e,i=kd(jd,e.__scopeMenu),a=n===i.value;return(0,Y.jsx)(Pd,{scope:e.__scopeMenu,checked:a,children:(0,Y.jsx)(Cd,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Zd(a),onSelect:pi(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Md.displayName=jd;var Nd=`MenuItemIndicator`,[Pd,Fd]=Ju(Nd,{checked:!1}),Id=p.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Fd(Nd,n);return(0,Y.jsx)(bi,{present:r||Xd(a.checked)||a.checked===!0,children:(0,Y.jsx)(ri.span,{...i,ref:t,"data-state":Zd(a.checked)})})});Id.displayName=Nd;var Ld=`MenuSeparator`,Rd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ri.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Rd.displayName=Ld;var zd=`MenuArrow`,Bd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Xu(n);return(0,Y.jsx)(gu,{...i,...r,ref:t})});Bd.displayName=zd;var Vd=`MenuSub`,[Hd,Ud]=Ju(Vd),Wd=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=$u(Vd,t),o=Xu(t),[s,c]=p.useState(null),[l,u]=p.useState(null),d=Wi(i);return p.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,Y.jsx)(pu,{...o,children:(0,Y.jsx)(Qu,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,Y.jsx)(Hd,{scope:t,contentId:Ei(),triggerId:Ei(),trigger:s,onTriggerChange:c,children:n})})})};Wd.displayName=Vd;var Gd=`MenuSubTrigger`,Kd=p.forwardRef((e,t)=>{let n=$u(Gd,e.__scopeMenu),r=td(Gd,e.__scopeMenu),i=Ud(Gd,e.__scopeMenu),a=dd(Gd,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,Y.jsx)(id,{asChild:!0,...l,children:(0,Y.jsx)(wd,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Yd(n.open),...e,ref:qr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:pi(e.onPointerMove,rf(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:pi(e.onPointerLeave,rf(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:pi(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Hu[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Kd.displayName=Gd;var qd=`MenuSubContent`,Jd=p.forwardRef((e,t)=>{let n=sd(ld,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$u(ld,e.__scopeMenu),o=td(ld,e.__scopeMenu),s=Ud(qd,e.__scopeMenu),c=p.useRef(null),l=Jr(t,c);return(0,Y.jsx)(Gu.Provider,{scope:e.__scopeMenu,children:(0,Y.jsx)(bi,{present:r||a.open,children:(0,Y.jsx)(Gu.Slot,{scope:e.__scopeMenu,children:(0,Y.jsx)(gd,{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:pi(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:pi(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:pi(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Uu[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Jd.displayName=qd;function Yd(e){return e?`open`:`closed`}function Xd(e){return e===`indeterminate`}function Zd(e){return Xd(e)?`indeterminate`:e?`checked`:`unchecked`}function Qd(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $d(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ef(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=$d(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 tf(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 nf(e,t){return t?tf({x:e.clientX,y:e.clientY},t):!1}function rf(e){return t=>t.pointerType===`mouse`?e(t):void 0}var af=nd,of=id,sf=cd,cf=fd,lf=vd,uf=bd,df=Cd,ff=Ed,pf=Ad,mf=Md,hf=Id,gf=Rd,_f=Bd,vf=Kd,yf=Jd,bf=`DropdownMenu`,[xf,Sf]=ui(bf,[Yu]),Cf=Yu(),[wf,Tf]=xf(bf),Ef=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]=gi({prop:i,defaultProp:a??!1,onChange:o,caller:bf});return(0,Y.jsx)(wf,{scope:t,triggerId:Ei(),triggerRef:l,contentId:Ei(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,Y.jsx)(af,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Ef.displayName=bf;var Df=`DropdownMenuTrigger`,Of=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Tf(Df,n),o=Cf(n);return(0,Y.jsx)(of,{asChild:!0,...o,children:(0,Y.jsx)(ri.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:qr(t,a.triggerRef),onPointerDown:pi(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:pi(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Of.displayName=Df;var kf=`DropdownMenuPortal`,Af=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Cf(t);return(0,Y.jsx)(sf,{...r,...n})};Af.displayName=kf;var jf=`DropdownMenuContent`,Mf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Tf(jf,n),a=Cf(n),o=p.useRef(!1);return(0,Y.jsx)(cf,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:pi(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:pi(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)`}})});Mf.displayName=jf;var Nf=`DropdownMenuGroup`,Pf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(lf,{...i,...r,ref:t})});Pf.displayName=Nf;var Ff=`DropdownMenuLabel`,If=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(uf,{...i,...r,ref:t})});If.displayName=Ff;var Lf=`DropdownMenuItem`,Rf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(df,{...i,...r,ref:t})});Rf.displayName=Lf;var zf=`DropdownMenuCheckboxItem`,Bf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(ff,{...i,...r,ref:t})});Bf.displayName=zf;var Vf=`DropdownMenuRadioGroup`,Hf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(pf,{...i,...r,ref:t})});Hf.displayName=Vf;var Uf=`DropdownMenuRadioItem`,Wf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(mf,{...i,...r,ref:t})});Wf.displayName=Uf;var Gf=`DropdownMenuItemIndicator`,Kf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(hf,{...i,...r,ref:t})});Kf.displayName=Gf;var qf=`DropdownMenuSeparator`,Jf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(gf,{...i,...r,ref:t})});Jf.displayName=qf;var Yf=`DropdownMenuArrow`,Xf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(_f,{...i,...r,ref:t})});Xf.displayName=Yf;var Zf=`DropdownMenuSubTrigger`,Qf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(vf,{...i,...r,ref:t})});Qf.displayName=Zf;var $f=`DropdownMenuSubContent`,ep=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cf(n);return(0,Y.jsx)(yf,{...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)`}})});ep.displayName=$f;var tp=Ef,np=Of,rp=Af,ip=Mf,ap=Rf,op=`Label`,sp=p.forwardRef((e,t)=>(0,Y.jsx)(ri.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));sp.displayName=op;var cp=sp,lp=`Popover`,[up,dp]=ui(lp,[Zl]),fp=Zl(),[pp,mp]=up(lp),hp=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=fp(t),c=p.useRef(null),[l,u]=p.useState(!1),[d,f]=gi({prop:r,defaultProp:i??!1,onChange:a,caller:lp});return(0,Y.jsx)(pu,{...s,children:(0,Y.jsx)(pp,{scope:t,contentId:Ei(),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})})};hp.displayName=lp;var gp=`PopoverAnchor`,_p=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mp(gp,n),a=fp(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return p.useEffect(()=>(o(),()=>s()),[o,s]),(0,Y.jsx)(mu,{...a,...r,ref:t})});_p.displayName=gp;var vp=`PopoverTrigger`,yp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mp(vp,n),a=fp(n),o=Jr(t,i.triggerRef),s=(0,Y.jsx)(ri.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Pp(i.open),...r,ref:o,onClick:pi(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,Y.jsx)(mu,{asChild:!0,...a,children:s})});yp.displayName=vp;var bp=`PopoverPortal`,[xp,Sp]=up(bp,{forceMount:void 0}),Cp=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=mp(bp,t);return(0,Y.jsx)(xp,{scope:t,forceMount:n,children:(0,Y.jsx)(bi,{present:n||a.open,children:(0,Y.jsx)(Sa,{asChild:!0,container:i,children:r})})})};Cp.displayName=bp;var wp=`PopoverContent`,Tp=p.forwardRef((e,t)=>{let n=Sp(wp,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=mp(wp,e.__scopePopover);return(0,Y.jsx)(bi,{present:r||a.open,children:a.modal?(0,Y.jsx)(Dp,{...i,ref:t}):(0,Y.jsx)(Op,{...i,ref:t})})});Tp.displayName=wp;var Ep=Yr(`PopoverContent.RemoveScroll`),Dp=p.forwardRef((e,t)=>{let n=mp(wp,e.__scopePopover),r=p.useRef(null),i=Jr(t,r),a=p.useRef(!1);return p.useEffect(()=>{let e=r.current;if(e)return Wo(e)},[]),(0,Y.jsx)(Fo,{as:Ep,allowPinchZoom:!0,children:(0,Y.jsx)(kp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:pi(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:pi(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:pi(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Op=p.forwardRef((e,t)=>{let n=mp(wp,e.__scopePopover),r=p.useRef(!1),i=p.useRef(!1);return(0,Y.jsx)(kp,{...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()}})}),kp=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=mp(wp,n),p=fp(n);return wa(),(0,Y.jsx)(la,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Y.jsx)(Qi,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Y.jsx)(hu,{"data-state":Pp(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)`}})})})}),Ap=`PopoverClose`,jp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mp(Ap,n);return(0,Y.jsx)(ri.button,{type:`button`,...r,ref:t,onClick:pi(e.onClick,()=>i.onOpenChange(!1))})});jp.displayName=Ap;var Mp=`PopoverArrow`,Np=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fp(n);return(0,Y.jsx)(gu,{...i,...r,ref:t})});Np.displayName=Mp;function Pp(e){return e?`open`:`closed`}var Fp=hp,Ip=yp,Lp=Cp,Rp=Tp,zp=`Switch`,[Bp,eee]=ui(zp),[Vp,tee]=Bp(zp),Hp=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=Jr(t,e=>m(e)),g=p.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=gi({prop:i,defaultProp:a??!1,onChange:l,caller:zp});return(0,Y.jsxs)(Vp,{scope:n,checked:v,disabled:s,children:[(0,Y.jsx)(ri.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Kp(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:h,onClick:pi(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,Y.jsx)(Gp,{control:f,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Hp.displayName=zp;var Up=`SwitchThumb`,Wp=p.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=tee(Up,n);return(0,Y.jsx)(ri.span,{"data-state":Kp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Wp.displayName=Up;var nee=`SwitchBubbleInput`,Gp=p.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=p.useRef(null),s=Jr(o,a),c=Ms(n),l=Ns(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,Y.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}})});Gp.displayName=nee;function Kp(e){return e?`checked`:`unchecked`}var qp=Hp,Jp=Wp,Yp=`Tabs`,[Xp,ree]=ui(Yp,[wu]),Zp=wu(),[iee,Qp]=Xp(Yp),$p=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Ui(s),[d,f]=gi({prop:r,onChange:i,defaultProp:a??``,caller:Yp});return(0,Y.jsx)(iee,{scope:n,baseId:Ei(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Y.jsx)(ri.div,{dir:u,"data-orientation":o,...l,ref:t})})});$p.displayName=Yp;var em=`TabsList`,tm=p.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Qp(em,n),o=Zp(n);return(0,Y.jsx)(Iu,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Y.jsx)(ri.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});tm.displayName=em;var nm=`TabsTrigger`,rm=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Qp(nm,n),s=Zp(n),c=om(o.baseId,r),l=sm(o.baseId,r),u=r===o.value;return(0,Y.jsx)(Lu,{asChild:!0,...s,focusable:!i,active:u,children:(0,Y.jsx)(ri.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:pi(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:pi(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:pi(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});rm.displayName=nm;var im=`TabsContent`,am=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Qp(im,n),c=om(s.baseId,r),l=sm(s.baseId,r),u=r===s.value,d=p.useRef(u);return p.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Y.jsx)(bi,{present:i||u,children:({present:n})=>(0,Y.jsx)(ri.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})})});am.displayName=im;function om(e,t){return`${e}-trigger-${t}`}function sm(e,t){return`${e}-content-${t}`}var cm=$p,lm=tm,um=rm,dm=am,fm=`Toggle`,pm=p.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=gi({prop:n,onChange:i,defaultProp:r??!1,caller:fm});return(0,Y.jsx)(ri.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:pi(e.onClick,()=>{e.disabled||s(!o)})})});pm.displayName=fm;var mm=`ToggleGroup`,[hm,aee]=ui(mm,[wu]),gm=wu(),_m=p.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,Y.jsx)(bm,{...r,ref:t});if(n===`multiple`)return(0,Y.jsx)(xm,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${mm}\``)});_m.displayName=mm;var[vm,ym]=hm(mm),bm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=gi({prop:n,defaultProp:r??``,onChange:i,caller:mm});return(0,Y.jsx)(vm,{scope:e.__scopeToggleGroup,type:`single`,value:p.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:p.useCallback(()=>s(``),[s]),children:(0,Y.jsx)(wm,{...a,ref:t})})}),xm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=gi({prop:n,defaultProp:r??[],onChange:i,caller:mm}),c=p.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=p.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,Y.jsx)(vm,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,Y.jsx)(wm,{...a,ref:t})})});_m.displayName=mm;var[Sm,Cm]=hm(mm),wm=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=gm(n),u=Ui(o),d={role:`group`,dir:u,...c};return(0,Y.jsx)(Sm,{scope:n,rovingFocus:i,disabled:r,children:i?(0,Y.jsx)(Iu,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,Y.jsx)(ri.div,{...d,ref:t})}):(0,Y.jsx)(ri.div,{...d,ref:t})})}),Tm=`ToggleGroupItem`,Em=p.forwardRef((e,t)=>{let n=ym(Tm,e.__scopeToggleGroup),r=Cm(Tm,e.__scopeToggleGroup),i=gm(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,Y.jsx)(Lu,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,Y.jsx)(Dm,{...s,ref:t})}):(0,Y.jsx)(Dm,{...s,ref:t})});Em.displayName=Tm;var Dm=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=ym(Tm,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,Y.jsx)(pm,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),Om=_m,km=Em,[Am,oee]=ui(`Tooltip`,[Zl]),jm=Zl(),Mm=`TooltipProvider`,Nm=700,Pm=`tooltip.open`,[Fm,Im]=Am(Mm),Lm=e=>{let{__scopeTooltip:t,delayDuration:n=Nm,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,Y.jsx)(Fm,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Lm.displayName=Mm;var Rm=`Tooltip`,[see,zm]=Am(Rm),Bm=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Im(Rm,e.__scopeTooltip),l=jm(t),[u,d]=p.useState(null),f=Ei(),m=p.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=p.useRef(!1),[v,y]=gi({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Pm))):c.onClose(),a?.(e)},caller:Rm}),b=p.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),S=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return p.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,Y.jsx)(pu,{...l,children:(0,Y.jsx)(see,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:p.useCallback(()=>{h?S():(window.clearTimeout(m.current),m.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};Bm.displayName=Rm;var Vm=`TooltipTrigger`,Hm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=zm(Vm,n),a=Im(Vm,n),o=jm(n),s=Jr(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,Y.jsx)(mu,{asChild:!0,...o,children:(0,Y.jsx)(ri.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:pi(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:pi(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:pi(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:pi(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:pi(e.onBlur,i.onClose),onClick:pi(e.onClick,i.onClose)})})});Hm.displayName=Vm;var Um=`TooltipPortal`,[cee,lee]=Am(Um,{forceMount:void 0}),Wm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=zm(Um,t);return(0,Y.jsx)(cee,{scope:t,forceMount:n,children:(0,Y.jsx)(bi,{present:n||a.open,children:(0,Y.jsx)(Sa,{asChild:!0,container:i,children:r})})})};Wm.displayName=Um;var Gm=`TooltipContent`,Km=p.forwardRef((e,t)=>{let n=lee(Gm,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=zm(Gm,e.__scopeTooltip);return(0,Y.jsx)(bi,{present:r||o.open,children:o.disableHoverableContent?(0,Y.jsx)(qm,{side:i,...a,ref:t}):(0,Y.jsx)(uee,{side:i,...a,ref:t})})}),uee=p.forwardRef((e,t)=>{let n=zm(Gm,e.__scopeTooltip),r=Im(Gm,e.__scopeTooltip),i=p.useRef(null),a=Jr(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=hee(r,mee(r,n.getBoundingClientRect())),a=gee(t.getBoundingClientRect());s(Xm([...i,...a])),d(!0)},[d]);return p.useEffect(()=>()=>f(),[f]),p.useEffect(()=>{if(c&&u){let e=e=>m(e,u),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,m,f]),p.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!_ee(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,Y.jsx)(qm,{...e,ref:a})}),[dee,fee]=Am(Rm,{isInside:!1}),pee=$r(`TooltipContent`),qm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=zm(Gm,n),l=jm(n),{onClose:u}=c;return p.useEffect(()=>(document.addEventListener(Pm,u),()=>document.removeEventListener(Pm,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,Y.jsx)(Qi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Y.jsxs)(hu,{"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,Y.jsx)(pee,{children:r}),(0,Y.jsx)(dee,{scope:n,isInside:!0,children:(0,Y.jsx)(ci,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Km.displayName=Gm;var Jm=`TooltipArrow`,Ym=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=jm(n);return fee(Jm,n).isInside?null:(0,Y.jsx)(gu,{...i,...r,ref:t})});Ym.displayName=Jm;function mee(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 hee(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 gee(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 _ee(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Xm(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Zm(t)}function Zm(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Qm=Lm,$m=Bm,eh=Hm,th=Wm,nh=Km,rh=Ym,ih=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ah=(e,t)=>({classGroupId:e,validator:t}),oh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),sh=`-`,ch=[],lh=`arbitrary..`,uh=e=>{let t=ph(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return fh(e);let n=e.split(sh);return dh(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ih(i,t):t:i||ch}return n[e]||ch}}},dh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=dh(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(sh):e.slice(t).join(sh),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},fh=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?lh+r:void 0})(),ph=e=>{let{theme:t,classGroups:n}=e;return mh(n,t)},mh=(e,t)=>{let n=oh();for(let r in e){let i=e[r];hh(i,n,r,t)}return n},hh=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];gh(i,t,n,r)}},gh=(e,t,n,r)=>{if(typeof e==`string`){_h(e,t,n);return}if(typeof e==`function`){vh(e,t,n,r);return}yh(e,t,n,r)},_h=(e,t,n)=>{let r=e===``?t:bh(t,e);r.classGroupId=n},vh=(e,t,n,r)=>{if(xh(e)){hh(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ah(n,e))},yh=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];hh(o,bh(t,a),n,r)}},bh=(e,t)=>{let n=e,r=t.split(sh),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=oh(),n.nextPart.set(t,i)),n=i}return n},xh=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Sh=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ch=`!`,wh=`:`,Th=[],Eh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Dh=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===wh){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ch)?(c=s.slice(0,-1),l=!0):s.startsWith(Ch)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Eh(t,l,c,u)};if(t){let e=t+wh,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Eh(Th,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Oh=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},kh=e=>({cache:Sh(e.cacheSize),parseClassName:Dh(e),sortModifiers:Oh(e),...uh(e)}),Ah=/\s+/,jh=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Ah),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Ch:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Mh=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Nh(n))&&(i&&(i+=` `),i+=r);return i},Nh=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Nh(e[r]))&&(n&&(n+=` `),n+=t);return n},Ph=(e,...t)=>{let n,r,i,a,o=o=>(n=kh(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=jh(e,n);return i(e,a),a};return a=o,(...e)=>a(Mh(...e))},Fh=[],Ih=e=>{let t=t=>t[e]||Fh;return t.isThemeGetter=!0,t},Lh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Bh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Uh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gh=e=>zh.test(e),Kh=e=>!!e&&!Number.isNaN(Number(e)),qh=e=>!!e&&Number.isInteger(Number(e)),Jh=e=>e.endsWith(`%`)&&Kh(e.slice(0,-1)),Yh=e=>Bh.test(e),Xh=()=>!0,Zh=e=>Vh.test(e)&&!Hh.test(e),Qh=()=>!1,$h=e=>Uh.test(e),eg=e=>Wh.test(e),tg=e=>!rg(e)&&!dg(e),ng=e=>yg(e,Cg,Qh),rg=e=>Lh.test(e),ig=e=>yg(e,wg,Zh),ag=e=>yg(e,Tg,Kh),og=e=>yg(e,Dg,Xh),sg=e=>yg(e,Eg,Qh),cg=e=>yg(e,xg,Qh),lg=e=>yg(e,Sg,eg),ug=e=>yg(e,Og,$h),dg=e=>Rh.test(e),fg=e=>bg(e,wg),pg=e=>bg(e,Eg),mg=e=>bg(e,xg),hg=e=>bg(e,Cg),gg=e=>bg(e,Sg),_g=e=>bg(e,Og,!0),vg=e=>bg(e,Dg,!0),yg=(e,t,n)=>{let r=Lh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bg=(e,t,n=!1)=>{let r=Rh.exec(e);return r?r[1]?t(r[1]):n:!1},xg=e=>e===`position`||e===`percentage`,Sg=e=>e===`image`||e===`url`,Cg=e=>e===`length`||e===`size`||e===`bg-size`,wg=e=>e===`length`,Tg=e=>e===`number`,Eg=e=>e===`family-name`,Dg=e=>e===`number`||e===`weight`,Og=e=>e===`shadow`,vee=Ph(()=>{let e=Ih(`color`),t=Ih(`font`),n=Ih(`text`),r=Ih(`font-weight`),i=Ih(`tracking`),a=Ih(`leading`),o=Ih(`breakpoint`),s=Ih(`container`),c=Ih(`spacing`),l=Ih(`radius`),u=Ih(`shadow`),d=Ih(`inset-shadow`),f=Ih(`text-shadow`),p=Ih(`drop-shadow`),m=Ih(`blur`),h=Ih(`perspective`),g=Ih(`aspect`),_=Ih(`ease`),v=Ih(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),dg,rg],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[dg,rg,c],T=()=>[Gh,`full`,`auto`,...w()],E=()=>[qh,`none`,`subgrid`,dg,rg],D=()=>[`auto`,{span:[`full`,qh,dg,rg]},qh,dg,rg],O=()=>[qh,`auto`,dg,rg],k=()=>[`auto`,`min`,`max`,`fr`,dg,rg],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Gh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Gh,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Gh,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,dg,rg],L=()=>[...b(),mg,cg,{position:[dg,rg]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,hg,ng,{size:[dg,rg]}],te=()=>[Jh,fg,ig],z=()=>[``,`none`,`full`,l,dg,rg],B=()=>[``,Kh,fg,ig],V=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],U=()=>[Kh,Jh,mg,cg],ne=()=>[``,`none`,m,dg,rg],re=()=>[`none`,Kh,dg,rg],ie=()=>[`none`,Kh,dg,rg],ae=()=>[Kh,dg,rg],oe=()=>[Gh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Yh],breakpoint:[Yh],color:[Xh],container:[Yh],"drop-shadow":[Yh],ease:[`in`,`out`,`in-out`],font:[tg],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Yh],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Yh],shadow:[Yh],spacing:[`px`,Kh],text:[Yh],"text-shadow":[Yh],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Gh,rg,dg,g]}],container:[`container`],columns:[{columns:[Kh,rg,dg,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[qh,`auto`,dg,rg]}],basis:[{basis:[Gh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Kh,Gh,`auto`,`initial`,`none`,rg]}],grow:[{grow:[``,Kh,dg,rg]}],shrink:[{shrink:[``,Kh,dg,rg]}],order:[{order:[qh,`first`,`last`,`none`,dg,rg]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,fg,ig]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,vg,og]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Jh,rg]}],"font-family":[{font:[pg,sg,t]}],"font-features":[{"font-features":[rg]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,dg,rg]}],"line-clamp":[{"line-clamp":[Kh,`none`,dg,ag]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,dg,rg]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,dg,rg]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[Kh,`from-font`,`auto`,dg,ig]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Kh,`auto`,dg,rg]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,dg,rg]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,dg,rg]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},qh,dg,rg],radial:[``,dg,rg],conic:[qh,dg,rg]},gg,lg]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`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:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Kh,dg,rg]}],"outline-w":[{outline:[``,Kh,fg,ig]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,_g,ug]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,_g,ug]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Kh,ig]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,_g,ug]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Kh,dg,rg]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Kh]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[dg,rg]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Kh]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,dg,rg]}],filter:[{filter:[``,`none`,dg,rg]}],blur:[{blur:ne()}],brightness:[{brightness:[Kh,dg,rg]}],contrast:[{contrast:[Kh,dg,rg]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,_g,ug]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Kh,dg,rg]}],"hue-rotate":[{"hue-rotate":[Kh,dg,rg]}],invert:[{invert:[``,Kh,dg,rg]}],saturate:[{saturate:[Kh,dg,rg]}],sepia:[{sepia:[``,Kh,dg,rg]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,dg,rg]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Kh,dg,rg]}],"backdrop-contrast":[{"backdrop-contrast":[Kh,dg,rg]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Kh,dg,rg]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Kh,dg,rg]}],"backdrop-invert":[{"backdrop-invert":[``,Kh,dg,rg]}],"backdrop-opacity":[{"backdrop-opacity":[Kh,dg,rg]}],"backdrop-saturate":[{"backdrop-saturate":[Kh,dg,rg]}],"backdrop-sepia":[{"backdrop-sepia":[``,Kh,dg,rg]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,dg,rg]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Kh,`initial`,dg,rg]}],ease:[{ease:[`linear`,`initial`,_,dg,rg]}],delay:[{delay:[Kh,dg,rg]}],animate:[{animate:[`none`,v,dg,rg]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,dg,rg]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[dg,rg,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,dg,rg]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,dg,rg]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Kh,fg,ig,ag]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}}),Z=(...e)=>vee(Hr(e)),yee=Gr(`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,Y.jsx)(r?Xr:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Z(yee({variant:t,size:n,className:e})),...i}),kg=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),xee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ag=e=>{let t=xee(e);return t.charAt(0).toUpperCase()+t.slice(1)},jg={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`},See=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Cee=(0,p.createContext)({}),wee=()=>(0,p.useContext)(Cee),Tee=(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=``}=wee()??{},h=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,p.createElement)(`svg`,{ref:c,...jg,width:t??l??jg.width,height:t??l??jg.height,stroke:e??f,strokeWidth:h,className:kg(`lucide`,m,i),...!a&&!See(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Mg=(e,t)=>{let n=(0,p.forwardRef)(({className:n,...r},i)=>(0,p.createElement)(Tee,{ref:i,iconNode:t,className:kg(`lucide-${bee(Ag(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ag(e),n},Ng=Mg(`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`}]]),Eee=Mg(`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`}]]),Dee=Mg(`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`}]]),Oee=Mg(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),kee=Mg(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Aee=Mg(`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`}]]),jee=Mg(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Mee=Mg(`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`}]]),Pg=Mg(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Fg=Mg(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Nee=Mg(`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`}]]),Pee=Mg(`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`}]]),Fee=Mg(`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`}]]),Iee=Mg(`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`}]]),Lee=Mg(`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`}]]),Ree=Mg(`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`}]]),zee=Mg(`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`}]]),Bee=Mg(`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`}]]),Vee=Mg(`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`}]]),Hee=Mg(`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`}]]),Uee=Mg(`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`}]]),Wee=Mg(`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`}]]),Gee=Mg(`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`}]]),Ig=Mg(`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`}]]),Kee=Mg(`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`}]]),qee=Mg(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Jee=Mg(`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`}]]),Yee=Mg(`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`}]]),Xee=Mg(`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`}]]),Zee=Mg(`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`}]]),Qee=Mg(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),$ee=Mg(`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`}]]),ete=Mg(`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`}]]),tte=Mg(`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`}]]),nte=Mg(`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`}]]),rte=Mg(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ite=Mg(`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`}]]),ate=Mg(`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`}]]),ote=Mg(`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`}]]),ste=Mg(`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`}]]),cte=Mg(`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`}]]),lte=Mg(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ute=Mg(`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`}]]),dte=Mg(`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`}]]),fte=Mg(`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`}]]),pte=Mg(`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`}]]),Lg=Mg(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),mte=Mg(`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`}]]),Rg=Mg(`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`}]]),zg=Mg(`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`}]]),Bg=Mg(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Vg=Mg(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Hg=Mg(`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`}]]),Ug=Mg(`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`}]]),Wg=Mg(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Gg=1,hte=.9,gte=.8,_te=.17,Kg=.1,qg=.999,vte=.9999,yte=.99,bte=/[\\\/_+.#"@\[\(\{&]/,xte=/[\\\/_+.#"@\[\(\{&]/g,Ste=/[\s-]/,Jg=/[\s-]/g;function Yg(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Gg:yte;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=Yg(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Gg:bte.test(e.charAt(l-1))?(d*=gte,p=e.slice(i,l-1).match(xte),p&&i>0&&(d*=qg**+p.length)):Ste.test(e.charAt(l-1))?(d*=hte,m=e.slice(i,l-1).match(Jg),m&&i>0&&(d*=qg**+m.length)):(d*=_te,i>0&&(d*=qg**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=vte)),(d<Kg&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Yg(e,t,n,r,l+1,a+2,o),f*Kg>d&&(d=f*Kg)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Xg(e){return e.toLowerCase().replace(Jg,` `)}function Cte(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Yg(e,t,Xg(e),Xg(t),0,0,{})}var Zg=`[cmdk-group=""]`,Qg=`[cmdk-group-items=""]`,$g=`[cmdk-group-heading=""]`,e_=`[cmdk-item=""]`,t_=`${e_}:not([aria-disabled="true"])`,n_=`cmdk-item-select`,r_=`data-value`,i_=(e,t,n)=>Cte(e,t,n),a_=p.createContext(void 0),o_=()=>p.useContext(a_),s_=p.createContext(void 0),c_=()=>p.useContext(s_),l_=p.createContext(void 0),u_=p.forwardRef((e,t)=>{let n=w_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=w_(()=>new Set),i=w_(()=>new Map),a=w_(()=>new Map),o=w_(()=>new Set),s=S_(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=Ei(),b=Ei(),x=Ei(),S=p.useRef(null),C=wte();C_(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),C_(()=>{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??i_;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Qg);t?t.appendChild(e.parentElement===t?e:e.closest(`${Qg} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Qg} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${Zg}[${r_}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(r_);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(Zg)?.querySelector($g))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${e_}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(t_)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(r_))}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(r_))}function F(e){let t=j()?.closest(Zg),n;for(;t&&!n;)t=e>0?b_(t,Zg):x_(t,Zg),n=t?.querySelector(t_);n?w.setState(`value`,n.getAttribute(r_)):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(ri.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(n_);t.dispatchEvent(e)}}}}},p.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Ete},c),D_(e,e=>p.createElement(s_.Provider,{value:w},p.createElement(a_.Provider,{value:T},e))))}),d_=p.forwardRef((e,t)=>{let n=Ei(),r=p.useRef(null),i=p.useContext(l_),a=o_(),o=S_(e),s=o.current?.forceMount??i?.forceMount;C_(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=E_(n,r,[e.value,e.children,r],e.keywords),l=c_(),u=T_(e=>e.value&&e.value===c.current),d=T_(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(n_,f),()=>t.removeEventListener(n_,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(ri.div,{ref:qr(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:f},e.children)}),f_=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ei(),s=p.useRef(null),c=p.useRef(null),l=Ei(),u=o_(),d=T_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);C_(()=>u.group(o),[]),E_(o,s,[e.value,e.heading,c]);let f=p.useMemo(()=>({id:o,forceMount:i}),[i]);return p.createElement(ri.div,{ref:qr(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&p.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),D_(e,e=>p.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},p.createElement(l_.Provider,{value:f},e))))}),p_=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=p.useRef(null),a=T_(e=>!e.search);return!n&&!a?null:p.createElement(ri.div,{ref:qr(i,t),...r,"cmdk-separator":``,role:`separator`})}),m_=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=c_(),o=T_(e=>e.search),s=T_(e=>e.selectedItemId),c=o_();return p.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),p.createElement(ri.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)}})}),h_=p.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=p.useRef(null),o=p.useRef(null),s=T_(e=>e.selectedItemId),c=o_();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(ri.div,{ref:qr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},D_(e,e=>p.createElement(`div`,{ref:qr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),g_=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return p.createElement(Ts,{open:n,onOpenChange:r},p.createElement(Es,{container:o},p.createElement(Ds,{"cmdk-overlay":``,className:i}),p.createElement(Os,{"aria-label":e.label,"cmdk-dialog":``,className:a},p.createElement(u_,{ref:t,...s}))))}),__=p.forwardRef((e,t)=>T_(e=>e.filtered.count===0)?p.createElement(ri.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),v_=p.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return p.createElement(ri.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},D_(e,e=>p.createElement(`div`,{"aria-hidden":!0},e)))}),y_=Object.assign(u_,{List:h_,Item:d_,Input:m_,Group:f_,Separator:p_,Dialog:g_,Empty:__,Loading:v_});function b_(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function x_(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function S_(e){let t=p.useRef(e);return C_(()=>{t.current=e}),t}var C_=typeof window>`u`?p.useEffect:p.useLayoutEffect;function w_(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function T_(e){let t=c_(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function E_(e,t,n,r=[]){let i=p.useRef(),a=o_();return C_(()=>{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(r_,s),i.current=s}),i}var wte=()=>{let[e,t]=p.useState(),n=w_(()=>new Map);return C_(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Tte(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function D_({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Tte(t),{ref:t.ref},n(t.props.children)):n(t)}var Ete={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},O_=e=>(0,Y.jsx)(Ts,{"data-slot":`dialog`,...e}),Dte=e=>(0,Y.jsx)(Es,{"data-slot":`dialog-portal`,...e}),k_=e=>(0,Y.jsx)(js,{"data-slot":`dialog-close`,...e}),Ote=({className:e,...t})=>(0,Y.jsx)(Ds,{"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}),A_=({className:e,children:t,showCloseButton:n=!0,overlayClassName:r,...i})=>(0,Y.jsxs)(Dte,{children:[(0,Y.jsx)(Ote,{className:r}),(0,Y.jsxs)(Os,{"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,Y.jsx)(js,{"data-slot":`dialog-close`,asChild:!0,children:(0,Y.jsxs)(Q,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`,children:[(0,Y.jsx)(Wg,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]}),j_=({className:e,...t})=>(0,Y.jsx)(`div`,{"data-slot":`dialog-header`,className:Z(`flex flex-col gap-1.5`,e),...t}),M_=({className:e,showCloseButton:t=!1,children:n,...r})=>(0,Y.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,Y.jsx)(js,{asChild:!0,children:(0,Y.jsx)(Q,{variant:`outline`,children:`Close`})})]}),N_=({className:e,...t})=>(0,Y.jsx)(ks,{"data-slot":`dialog-title`,className:Z(`font-heading text-base leading-none font-medium`,e),...t}),P_=({className:e,...t})=>(0,Y.jsx)(As,{"data-slot":`dialog-description`,className:Z(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t}),F_=(0,p.forwardRef)(({className:e,type:t,...n},r)=>(0,Y.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})),I_=(0,p.forwardRef)(({className:e,...t},n)=>(0,Y.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}));I_.displayName=`Textarea`;function L_({className:e,...t}){return(0,Y.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 kte=Gr(`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 R_({className:e,align:t=`inline-start`,...n}){return(0,Y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Z(kte({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var z_=Gr(`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 B_({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,Y.jsx)(Q,{type:t,"data-size":r,variant:n,className:Z(z_({size:r}),e),...i})}function V_({className:e,...t}){return(0,Y.jsx)(F_,{"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 H_({className:e,...t}){return(0,Y.jsx)(y_,{"data-slot":`command`,className:Z(`flex size-full flex-col overflow-hidden rounded-4xl bg-popover p-1 text-popover-foreground`,e),...t})}function U_({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,Y.jsxs)(L_,{className:`h-9 bg-input/50`,children:[(0,Y.jsx)(y_.Input,{"data-slot":`command-input`,className:Z(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,Y.jsx)(R_,{children:(0,Y.jsx)(Lg,{className:`size-4 shrink-0 opacity-50`})})]})})}function W_({className:e,...t}){return(0,Y.jsx)(y_.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 G_({className:e,...t}){return(0,Y.jsx)(y_.Empty,{"data-slot":`command-empty`,className:Z(`py-6 text-center text-sm`,e),...t})}function K_({className:e,...t}){return(0,Y.jsx)(y_.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 q_({className:e,children:t,...n}){return(0,Y.jsxs)(y_.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,Y.jsx)(Pg,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function J_({className:e,...t}){return(0,Y.jsx)(cp,{"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 Y_=e=>(0,Y.jsx)(Fp,{"data-slot":`popover`,...e}),X_=e=>(0,Y.jsx)(Ip,{"data-slot":`popover-trigger`,...e}),Z_=({className:e,align:t=`center`,sideOffset:n=4,...r})=>(0,Y.jsx)(Lp,{children:(0,Y.jsx)(Rp,{"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})}),Q_=({className:e,...t})=>(0,Y.jsx)(`div`,{"data-slot":`popover-header`,className:Z(`flex flex-col gap-1 text-sm`,e),...t}),$_=({className:e,...t})=>(0,Y.jsx)(`div`,{"data-slot":`popover-title`,className:Z(`font-heading text-base font-medium`,e),...t}),ev=/[\s\-_/.:]+/,tv=/\d(?:[._:-]*\d)+/g,nv=e=>e.toLowerCase().trim().split(ev).filter(Boolean),rv=(e,t)=>t===e?300:t.startsWith(e)?200:e.length>=3&&t.includes(e)?100:0,iv=e=>(e.toLowerCase().match(tv)??[]).map(e=>e.replace(/\D/g,``)).filter(e=>e.length>=2),av=e=>/^\d+$/.test(e),ov=(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=nv(e);if(n.length===0)return 1;let r=t.flatMap(e=>nv(e??``)),i=[...new Set(t.flatMap(e=>iv(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=rv(e,n);r>t&&(t=r)}if(t===0&&av(e)&&(t=ov(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,Y.jsxs)(`div`,{className:Z(`flex flex-col gap-1.5`,o),children:[e&&(0,Y.jsx)(J_,{className:Z(`text-xs font-medium text-muted-foreground`,s),htmlFor:r,children:e}),(0,Y.jsxs)(Y_,{open:m,onOpenChange:e=>{e&&_(b()),h(e)},children:[(0,Y.jsx)(`div`,{className:`relative`,ref:v,children:(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.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,Y.jsx)(`span`,{className:`truncate`,children:t}),(0,Y.jsx)(Fg,{className:`h-4 w-4 text-muted-foreground`})]})})}),(0,Y.jsx)(Z_,{side:g?`top`:`bottom`,align:`start`,className:Z(`w-[var(--radix-popover-trigger-width)] p-0`,c),children:(0,Y.jsxs)(H_,{filter:(e,t,n)=>sv(t,[e,...n??[]]),children:[y&&(0,Y.jsx)(U_,{placeholder:`Filter...`}),(0,Y.jsxs)(W_,{className:`max-h-72`,children:[(0,Y.jsx)(G_,{children:`No matches`}),i.map((e,t)=>e.options.length===0?null:(0,Y.jsx)(K_,{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,Y.jsx)(q_,{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,Y.jsx)(`span`,{className:`truncate`,children:t.label})},t.value))},e.label||`group-${t}`))]})]})})]})]})},lv=({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,Y.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}),uv=({model:e,showModelSelector:t,availableModels:n,onModelChange:r,selectId:i,label:a=`Model`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l,defaultModelLabel:u=`Use default model`,notice:d})=>{let f=(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]),m=e||u;return!t&&!d?null:(0,Y.jsxs)(`div`,{className:Z(c),children:[t&&(0,Y.jsx)(lv,{label:a,triggerLabel:m,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:u}]},...f.map(e=>({label:e.provider,options:e.models}))]}),d]})},dv=({variant:e,selectedModel:t,showVariantSelector:n,onVariantChange:r,selectId:i,label:a=`Variant`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l,defaultVariantLabel:u=`Use model default`,availableVariantsLabel:d=`Available levels`})=>{if(!n||!t)return null;let f=e||u;return(0,Y.jsx)(`div`,{className:Z(c),children:(0,Y.jsx)(lv,{label:a,triggerLabel:f,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:u}]},{label:d,options:t.variants.map(e=>({value:e,label:e}))}]})})},fv=({model:e,variant:t,availableModels:n,isLoadingModels:r,onModelChange:i,onVariantChange:a,modelSelectId:o,variantSelectId:s,title:c,description:l,loadingDescription:u,unavailableDescription:d,modelLabel:f,variantLabel:p,defaultModelLabel:m,defaultVariantLabel:h,availableVariantsLabel:g,className:_,compact:v=!1,showHeader:y=!0,disabled:b=!1})=>{let x=n.find(t=>t.id===e)??null,S=n.length>0,C=x!==null&&x.variants.length>0;return(0,Y.jsxs)(`div`,{className:Z(`rounded-2xl border border-border/70 bg-background/25 p-4`,_),children:[y&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:c}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:l})]}),r?(0,Y.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,y&&`mt-4`),children:u}):S?(0,Y.jsxs)(`div`,{className:Z(y&&`mt-4`,`gap-3`,v?`flex flex-col`:`flex flex-wrap`),children:[(0,Y.jsx)(uv,{model:e,showModelSelector:!0,availableModels:n,onModelChange:i,selectId:o,label:f,defaultModelLabel:m,disabled:b,className:v?`min-w-0`:`min-w-[10rem] flex-[1.35_1_10rem]`}),C&&(0,Y.jsx)(dv,{variant:t,selectedModel:x,showVariantSelector:!0,onVariantChange:a,selectId:s,label:p,defaultVariantLabel:h,availableVariantsLabel:g,disabled:b,className:v?`min-w-0`:`min-w-[7rem] flex-[0.7_1_7rem]`})]}):(0,Y.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,y&&`mt-4`),children:d})]})},pv=({helperModel:e,helperVariant:t,availableModels:n,isLoadingModels:r,onHelperModelChange:i,onHelperVariantChange:a,modelSelectId:o,variantSelectId:s,className:c,compact:l=!1,showHeader:u=!0})=>{let{t:d}=K(`projects`);return(0,Y.jsx)(fv,{model:e,variant:t,availableModels:n,isLoadingModels:r,onModelChange:i,onVariantChange:a,modelSelectId:o,variantSelectId:s,title:d(`advanced.helperModel.title`),description:d(`advanced.helperModel.panelDescription`),loadingDescription:d(`advanced.modelSelection.loading`),unavailableDescription:d(`advanced.helperModel.unavailable`),modelLabel:d(`advanced.modelSelection.modelLabel`),variantLabel:d(`advanced.modelSelection.variantLabel`),defaultModelLabel:d(`advanced.modelSelection.defaultModel`),defaultVariantLabel:d(`advanced.modelSelection.defaultVariant`),availableVariantsLabel:d(`advanced.modelSelection.availableVariants`),className:c,compact:l,showHeader:u})},mv=({delayDuration:e=0,...t})=>(0,Y.jsx)(Qm,{"data-slot":`tooltip-provider`,delayDuration:e,...t}),hv=e=>(0,Y.jsx)($m,{"data-slot":`tooltip`,...e}),gv=e=>(0,Y.jsx)(eh,{"data-slot":`tooltip-trigger`,...e}),_v=({className:e,sideOffset:t=8,children:n,...r})=>(0,Y.jsx)(th,{children:(0,Y.jsxs)(nh,{"data-slot":`tooltip-content`,sideOffset:t,className:Z(`pointer-events-none z-[100] inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) select-none items-center gap-1.5 rounded-md border border-sky-500/20 bg-popover px-2.5 py-1.5 text-xs font-medium text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,Y.jsx)(rh,{className:`fill-popover`})]})}),vv=({content:e,children:t,align:n,side:r,sideOffset:i,disabled:a=!1,contentClassName:o,delayDuration:s=0})=>(0,Y.jsx)(mv,{delayDuration:s,disableHoverableContent:!0,children:(0,Y.jsxs)(hv,{children:[(0,Y.jsx)(gv,{asChild:!0,children:t}),a?null:(0,Y.jsx)(_v,{className:o,align:n,side:r,sideOffset:i??8,children:e})]})}),yv=({value:e,items:t,onChange:n,disabled:r=!1,className:i})=>(0,Y.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,Y.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,Y.jsx)(vv,{content:t.inactiveTooltip,children:a},t.value)})}),bv=({activeTool:e,onChange:t})=>(0,Y.jsx)(yv,{value:e,items:[{value:`opencode`,label:`OpenCode`},{value:`claude`,label:`Claude`}],onChange:t}),xv=({activeTool:e,availableHelperModels:t,helperModel:n,helperVariant:r,isHelperModelsLoaded:i,isToolLoaded:a,onCreateProject:o,onHelperModelChange:s,onHelperVariantChange:c,onToolChange:l})=>{let{t:u}=K(`common`);return(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-10`,children:(0,Y.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,Y.jsx)(`h2`,{className:`max-w-xl text-3xl font-semibold tracking-tight text-foreground sm:text-4xl`,children:u(`emptyState.title`)}),(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u(`emptyState.description`)}),a?(0,Y.jsx)(`div`,{className:`w-fit`,children:(0,Y.jsx)(bv,{activeTool:e,onChange:l})}):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u(`emptyState.loadingToolPreference`)}),(0,Y.jsx)(pv,{helperModel:n,helperVariant:r,availableModels:t,isLoadingModels:!i,onHelperModelChange:s,onHelperVariantChange:c,modelSelectId:`welcome-helper-model`,variantSelectId:`welcome-helper-variant`,compact:!0})]}),(0,Y.jsx)(`div`,{className:`mt-8 flex flex-col gap-3 sm:flex-row sm:items-center`,children:(0,Y.jsx)(Q,{type:`button`,onClick:o,variant:`success`,size:`lg`,children:u(`emptyState.createFirstProject`)})})]})})},Sv=({isTransientError:e=!1,requestedProjectExists:t,retainedProject:n,defaultProject:r,onCreateProject:i,onOpenProject:a,onOpenWorkspace:o,onRetry:s})=>{let{t:c}=K(`common`);return(0,Y.jsx)(`main`,{className:`flex flex-1 items-center justify-center px-6 py-10`,children:(0,Y.jsxs)(`section`,{"aria-labelledby":`destination-unavailable-title`,className:`w-full max-w-2xl rounded-2xl border border-border bg-card p-8 shadow-xl shadow-black/20`,children:[(0,Y.jsx)(`h2`,{id:`destination-unavailable-title`,className:`text-2xl font-semibold tracking-tight`,children:c(e?`destinationUnavailable.errorTitle`:t?`destinationUnavailable.destinationTitle`:`destinationUnavailable.projectTitle`)}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:c(e?`destinationUnavailable.errorDescription`:t?`destinationUnavailable.destinationDescription`:`destinationUnavailable.projectDescription`)}),(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[e&&s&&(0,Y.jsx)(Q,{type:`button`,onClick:s,children:c(`destinationUnavailable.retry`)}),t&&!e&&(0,Y.jsx)(Q,{type:`button`,onClick:o,children:c(`destinationUnavailable.openWorkspace`)}),n&&(0,Y.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>a(n),children:c(`destinationUnavailable.openRetainedProject`,{project:n.name})}),!n&&r&&(0,Y.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>a(r),children:c(`destinationUnavailable.openDefaultProject`,{project:r.name})}),!r&&(0,Y.jsx)(Q,{type:`button`,onClick:i,children:c(`destinationUnavailable.createProject`)})]})]})})},Cv=({className:e})=>(0,Y.jsx)(Fg,{"aria-hidden":`true`,className:e}),wv=({className:e})=>(0,Y.jsx)(lte,{"aria-hidden":`true`,className:e}),Tv=({className:e})=>(0,Y.jsx)(mte,{"aria-hidden":`true`,className:e}),Ev=({activeProjectId:e,onCreateProject:t,projects:n,onEditProject:r,onProjectChange:i})=>{let{t:a}=K(`projects`),[o,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(!1),u=(0,p.useRef)(null),d=n.find(t=>t.id===e)??null,f=n.length>4,m=(0,p.useCallback)(()=>{let e=u.current?.getBoundingClientRect();if(!e)return!1;let t=window.innerHeight-e.bottom-16,n=e.top-16;return t<320&&n>t},[]);return(0,p.useEffect)(()=>{if(!o)return;let e=()=>{l(m())};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[m,o]),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-stretch`,children:[(0,Y.jsxs)(Y_,{open:o,onOpenChange:e=>{e&&l(m()),s(e)},children:[(0,Y.jsx)(`div`,{className:`relative min-w-0 flex-1`,ref:u,children:(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.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,Y.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:d?.name??a(`identity.emptyLabel`)})}),(0,Y.jsx)(`span`,{className:`flex h-6 w-6 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground`,children:(0,Y.jsx)(Cv,{className:`h-4 w-4`})})]})})}),(0,Y.jsxs)(Z_,{side:c?`top`:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:[(0,Y.jsxs)(H_,{filter:(e,t,n)=>sv(t,[e,...n??[]]),children:[f&&(0,Y.jsx)(U_,{placeholder:a(`identity.filterPlaceholder`)}),(0,Y.jsxs)(W_,{className:`max-h-72`,children:[(0,Y.jsx)(G_,{children:a(`identity.emptySearch`)}),(0,Y.jsx)(K_,{children:n.map(t=>(0,Y.jsx)(q_,{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,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:t.name}),(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t.repo_path})]})},t.id))})]})]}),(0,Y.jsx)(`div`,{className:`border-t border-border/70 p-1.5`,children:(0,Y.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,Y.jsx)(wv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:a(`identity.newProject`)})]})})]})]}),(0,Y.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,Y.jsx)(Tv,{className:`h-4 w-4`})})]})};function Dv({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:Z(`animate-pulse rounded-2xl bg-muted`,e),...t})}var Ov=({className:e=``})=>(0,Y.jsx)(Dv,{"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)}),kv=({stats:e=null,isLoading:t=!1,showFiles:n=!1,className:r=``})=>{if(t)return(0,Y.jsx)(`div`,{"data-testid":`ticket-diff-stats-skeleton`,className:`flex items-center gap-2 text-[11px] font-medium ${r}`.trim(),children:(0,Y.jsx)(Ov,{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,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium ${r}`.trim(),children:[n&&(0,Y.jsx)(`span`,{className:`text-muted-foreground text-nowrap`,children:i}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,e.additions]}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,e.deletions]})]})},Av=({className:e})=>(0,Y.jsx)(Zee,{"aria-hidden":`true`,className:e}),jv=({className:e})=>(0,Y.jsx)(Uee,{"aria-hidden":`true`,className:e}),Mv=({className:e})=>(0,Y.jsx)(Ig,{"aria-hidden":`true`,className:e}),Nv=({className:e})=>(0,Y.jsx)(Ng,{"aria-hidden":`true`,className:e}),Pv=({className:e})=>(0,Y.jsx)(Qee,{"aria-hidden":`true`,className:e}),Fv=({className:e})=>(0,Y.jsx)(cte,{"aria-hidden":`true`,className:e}),Iv=({className:e})=>(0,Y.jsx)(Ig,{"aria-hidden":`true`,className:e}),Lv=({className:e})=>(0,Y.jsx)(Bg,{"aria-hidden":`true`,className:e}),Rv=({className:e})=>(0,Y.jsx)(Vg,{"aria-hidden":`true`,className:e});function zv(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 Bv=e=>{switch(e){case`success`:return Ate;case`info`:return Mte;case`warning`:return jte;case`error`:return Nte;default:return null}},Vv=Array(12).fill(0),Hv=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},Vv.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Ate=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`})),jte=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`})),Nte=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`})),Pte=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`})),Fte=()=>{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(Lte(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}},Ite=(e,t)=>{let n=t?.id||Uv++;return Wv.addToast({title:e,...t,id:n}),n},Lte=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,$=Object.assign(Ite,{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()});zv(`[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 Rte=3,zte=`24px`,Bte=`16px`,Kv=4e3,Vte=356,Hte=14,Ute=45,Wte=200;function qv(...e){return e.filter(Boolean).join(` `)}function Gte(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Kte=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),[ee,te]=p.useState(!1),[z,B]=p.useState(0),[V,H]=p.useState(0),U=p.useRef(n.duration||b||Kv),ne=p.useRef(null),re=p.useRef(null),ie=c===0,ae=c+1<=o,oe=n.type,W=n.dismissible!==!1,se=n.className||``,ce=n.descriptionClassName||``,le=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ue=p.useMemo(()=>n.closeButton??m,[n.closeButton,m]),de=p.useMemo(()=>n.duration||b||Kv,[n.duration,b]),fe=p.useRef(0),pe=p.useRef(0),me=p.useRef(0),he=p.useRef(null),[ge,_e]=x.split(`-`),ve=p.useMemo(()=>s.reduce((e,t,n)=>n>=le?e:e+t.height,0),[s,le]),ye=Fte(),be=n.invert||t,xe=oe===`loading`;pe.current=p.useMemo(()=>le*S+ve,[le,ve]),p.useEffect(()=>{U.current=de},[de]),p.useEffect(()=>{M(!0)},[]),p.useEffect(()=>{let e=re.current;if(e){let t=e.getBoundingClientRect().height;return H(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),p.useLayoutEffect(()=>{if(!j)return;let e=re.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,H(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Se=p.useCallback(()=>{P(!0),B(pe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Wte)},[n,d,a,pe]);p.useEffect(()=>{if(n.promise&&oe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||ye?(()=>{if(me.current<fe.current){let e=new Date().getTime()-fe.current;U.current-=e}me.current=new Date().getTime()})():U.current!==1/0&&(fe.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Se()},U.current)),()=>clearTimeout(e)},[u,i,n,oe,ye,Se]),p.useEffect(()=>{n.delete&&(Se(),n.onDismiss==null||n.onDismiss.call(n,n))},[Se,n.delete]);function Ce(){return T?.loading?p.createElement(`div`,{className:qv(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},T.loading):p.createElement(Hv,{className:qv(w?.loader,n?.classNames?.loader),visible:oe===`loading`})}let we=n.icon||T?.[oe]||Bv(oe);return p.createElement(`li`,{tabIndex:0,ref:re,className:qv(v,se,w?.toast,n?.classNames?.toast,w?.default,w?.[oe],n?.classNames?.[oe]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":ee,"data-removed":N,"data-visible":ae,"data-y-position":ge,"data-x-position":_e,"data-index":c,"data-front":ie,"data-swiping":F,"data-dismissible":W,"data-type":oe,"data-invert":be,"data-swipe-out":L,"data-swipe-direction":k,"data-expanded":!!(u||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${N?z:pe.current}px`,"--initial-height":C?`auto`:`${V}px`,...h,...n.style},onDragEnd:()=>{I(!1),O(null),he.current=null},onPointerDown:e=>{e.button!==2&&(xe||!W||(ne.current=new Date,B(pe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),he.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!W)return;he.current=null;let e=Number(re.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(re.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ne.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Ute||a>.11){B(pe.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Se(),R(!0);return}else{var o,s;(o=re.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=re.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}te(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!he.current||!W||window.getSelection()?.toString().length>0)return;let i=t.clientY-he.current.y,a=t.clientX-he.current.x,o=e.swipeDirections??Gte(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)&&te(!0),(n=re.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=re.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ue&&!n.jsx&&oe!==`loading`?p.createElement(`button`,{"aria-label":E,"data-disabled":xe,"data-close-button":!0,onClick:xe||!W?()=>{}:()=>{Se(),n.onDismiss==null||n.onDismiss.call(n,n)},className:qv(w?.closeButton,n?.classNames?.closeButton)},T?.close??Pte):null,(oe||n.icon||n.promise)&&n.icon!==null&&(T?.[oe]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:qv(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ce():null,n.type===`loading`?null:we):null,p.createElement(`div`,{"data-content":``,className: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,ce,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)&&W&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Se())},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&&Se())},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 qte(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Bte:zte;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 Jte=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:_=Rte,toastOptions:v,dir:y=Jv(),gap:b=Hte,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),ee=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":`${Vte}px`,"--gap":`${b}px`,...g,...qte(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(Kte,{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:ee,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,Y.jsx)(Gee,{"aria-hidden":`true`,className:e}),Yte=(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)),Xte=(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},ny=(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`}:Xte(e,t,n)?{valid:!1,reason:`cycle`}:{valid:!0},Zte=e=>e===`self`?`A ticket cannot depend on itself.`:e===`duplicate`?`This dependency already exists.`:`This dependency would create a cycle.`,ry=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,iy=e=>!e||e.has_worktree===!1?!1:e.run_setup_status===`ready`?!0:ry(e),ay=e=>{if(!(!e||e.has_worktree===!1)){if(e.run_setup_status===`preparing`)return`Setting up worktree...`;if(!iy(e))return`Run unlocks after setup finishes.`}},Qte=(e,t,n)=>n.filter(t=>t.dependent_ticket_id===e.id).map(e=>t.get(e.blocker_ticket_id)).filter(e=>!!e&&!ry(e)),$te=(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},oy=(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&&Yte(r,o)<0){e.splice(a,0,t),i=!0;break}}i||e.push(t)},ene=(e,t,n)=>{if(!t.get(e))return[];let r=$te(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&&oy(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&&oy(c,n,t)}}}return l.map(e=>t.get(e)).filter(e=>!!e)},sy=(e,t,n)=>{let r=ene(e.id,t,n),i=r.filter(e=>!ry(e)),a=r.length>1,o=Qte(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}},cy=(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}}},tne=(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)}},ly={plan:0,build:1,review:2},nne={plan:`build`,build:`review`},uy=e=>nne[e]??null,dy=e=>e===`plan`?`plan`:e===`build`||e===`review`||e===`done`?`build`:`default`,fy=e=>e.worktree_bundle_id??e.id,rne=(e,t)=>{if(!e)return null;let n=t.find(t=>t.id===e.ticket_id);return n?fy(n):e.ticket_id},ine=({bundleId:e,activeRunContextKey:t,isProjectRootRunActive:n})=>n?!0:t!==null&&t!==e,py=(e,t,n,r)=>n||t!==null&&t!==fy(e)?r:ay(e),my=(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,ane=(e,t)=>t.map(t=>{let n=e.find(e=>e.id===t.id);return!n||n.agent_status!==`running`||t.agent_status===`running`||n.updated_at<t.updated_at?t:my(t,n)}),one=(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)))},hy=e=>e.state===`build`||e.state===`review`&&e.review_follow_up_active===!0,gy=e=>e.state===`review`&&e.review_follow_up_active!==!0,_y=e=>e.parked_at!==null,vy=e=>_y(e)?`done`:e.state,yy=e=>e.is_stale===!0,sne=e=>e?e.files_changed===0&&e.additions===0&&e.deletions===0:!1,by=(e,t)=>!t||e===`plan`?!1:!(e===`done`&&sne(t)),xy=e=>_y(e)||e.agent_status===`running`?!1:e.state===`build`?e.agent_status===`done`:e.state===`review`,cne=(e,t)=>_y(e)&&e.state===t,Sy=e=>e.tickets.length>0&&e.tickets.every(e=>Dy(e,`trash`)),lne=e=>e.tickets.length>0&&e.tickets.every(e=>Dy(e,`done`)),Cy=e=>e.column===`done`&&e.tickets.length>0&&e.tickets.every(e=>e.state!==`plan`),wy=(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}:{},Ty=(e,t)=>e===`plan`&&t===`build`?`build`:e===`build`&&t===`review`?`review`:e===`review`&&t===`build`?`undoReview`:null,Ey=(e,t,n)=>t===`review`&&n===`build`?{}:wy(e,n),Dy=(e,t)=>e.agent_status===`running`?!1:t===`done`?xy(e):!(t!==`trash`&&ly[t]<=ly[e.state]||t===`review`&&(e.state!==`build`||e.agent_status!==`done`&&e.agent_status!==`stopped`)),Oy=e=>{let t=uy(e.state);return!t||Dy(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},ky=[...[`plan`,`build`,`review`],`done`],Ay=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}),jy=(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},My=e=>e.kind===`project_root`?!0:e.has_prepared_worktree!==!1,Ny=e=>e.filter(e=>e.kind!==`project_root`&&My(e)),Py=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,Fy=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,Iy=e=>e.has_worktree??!!(e.bundle?.branch??e.branch),Ly=(e,t)=>My(e)||t.some(t=>t.worktree_bundle_id===e.id&&Iy(t)),Ry=(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=Fy(e),a=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId&&e.session_id)??null:Py(e),o=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId)??null:null;return n??r??i??a??o??e.find(e=>Iy(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=jy(t[0],r);return i?[{kind:`bundle`,group:{id:`${i.id}:${n}`,bundle:i,column:n,tickets:Ay(t)}}]:t.map(e=>({kind:`ticket`,ticket:e}))})},By=e=>`bundle-group:${e.id}`,Vy=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(vy(n));continue}t.set(n.worktree_bundle_id,new Set([vy(n)]))}let n=new Set;for(let[e,r]of t)r.size>=2&&n.add(e);return n},Hy=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 ky.includes(i)?{bundleId:r,column:i}:null},Uy=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()},Wy=(e,t)=>{let n=Uy(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},Gy=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?e.name??``:e.branch??``;let t=Uy(e.name||e.branch||``);return e.branch?Wy(t,e.branch):t},Ky=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?`Project root`:`Project root (${e.branch})`;let t=Gy(e),n=e.branch??``,r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return t===``||n===``?t||n:r===i?t:`${t} (${n})`},qy=(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`,Jy=({activeProject:e,branchState:t,bundles:n,branchSuggestions:r,activeTargetCanPull:i=null,isBundleLoading:a=!1,isLoading:o,presentation:s=`footer`,closeAfterSelection:c=!0,triggerAriaLabel:l,onOpenChange:u,onSelectBundle:d,onSelectRepoRoot:f,targetGitStatus:m=null,activeBranchAction:h=null,onRebase:g,onManageBundles:_})=>{let{t:v}=K(`common`),[y,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(!1),T=s===`composer`,E=e.active_target_kind!==`bundle`,D=(0,p.useMemo)(()=>Ny(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?Ky(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)(()=>qy(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`),ee=m?.operation_state===`idle`,te=!g||!ee||!!m?.rebase_disabled_reason||h!==null||C;(0,p.useEffect)(()=>{y&&S(t?.branch??``)},[t?.branch,y]);let z=e=>{b(e),u?.(e)},B=()=>{c&&z(!1)},V=async e=>{w(!0);try{await d(e)&&B()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.bundleSwitch`))}finally{w(!1)}},H=async(e,t)=>{w(!0);try{await f(e,t)&&B()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.repoRootSwitch`))}finally{w(!1)}},U=async()=>{if(g){w(!0);try{await g(),z(!1)}catch(e){$.error(e instanceof Error?e.message:v(`projectFooter.rebaseFallbackError`))}finally{w(!1)}}};return(0,Y.jsxs)(Y_,{open:y,onOpenChange:z,children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.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,Y.jsx)(Ov,{className:`h-3.5 w-20`}):(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 ${M}`,children:[(0,Y.jsx)(Yv,{className:`h-3.5 w-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate font-medium`,children:A})]})})}),(0,Y.jsx)(Z_,{align:`start`,className:T?`w-[22rem] max-w-[calc(100vw-2rem)] p-3`:`w-[28rem] max-w-[calc(100vw-2rem)] p-4`,children:(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:v(`projectTargetSelector.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:v(`projectTargetSelector.description`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.targetLabel`)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:I})]}),(0,Y.jsxs)(H_,{className:`rounded-xl border border-border/70 bg-background/40 p-0`,label:v(`projectTargetSelector.searchAriaLabel`),shouldFilter:!0,children:[(0,Y.jsx)(U_,{placeholder:v(`projectTargetSelector.searchPlaceholder`),"aria-label":v(`projectTargetSelector.searchAriaLabel`)}),(0,Y.jsxs)(W_,{className:`max-h-56 p-1`,"data-testid":`project-target-options`,children:[(0,Y.jsx)(G_,{children:v(N?`projectTargetSelector.loadingTargets`:`projectTargetSelector.noSearchResults`)}),(0,Y.jsxs)(q_,{value:`${v(`projectTargetSelector.repoRoot`)} ${k??``}`,"data-checked":E,disabled:N||C,"aria-label":`${j}. ${E?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{H(null)},className:`min-h-12`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:v(`projectTargetSelector.repoRoot`)}),(0,Y.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:k??v(`projectTargetSelector.loadingTarget`)})]}),E&&(0,Y.jsx)(`span`,{className:`mr-6 text-xs text-muted-foreground`,children:v(`projectTargetSelector.status.selected`)})]}),D.map(t=>{let n=Gy(t),r=Ky(t),i=e.active_target_kind===`bundle`&&e.active_target_bundle_id===t.id;return(0,Y.jsxs)(q_,{value:r,"data-checked":i,disabled:N||C,"aria-label":`${r}. ${i?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{V(t.id)},className:`min-h-12`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:n}),t.branch&&n.toLowerCase()!==t.branch.toLowerCase()&&(0,Y.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:t.branch})]}),i&&(0,Y.jsx)(`span`,{className:`mr-6 text-xs text-muted-foreground`,children:v(`projectTargetSelector.status.selected`)})]},t.id)}),N&&(0,Y.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,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin`}),(0,Y.jsx)(`span`,{children:v(`projectTargetSelector.loadingTargets`)})]}),!N&&D.length===0&&(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:v(`projectTargetSelector.noBundles`)})]})]}),!T&&_&&(0,Y.jsx)(Q,{type:`button`,variant:`outline`,className:`w-full justify-start`,disabled:C,onClick:()=>{z(!1),_?.()},children:v(`projectTargetSelector.manageBundles`)})]}),!T&&(0,Y.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 pt-4`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.repoRootBranch`)}),(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-3`,children:[(0,Y.jsx)(`div`,{className:`space-y-2`,children:L.length>0?L.map(({key:e,label:t,branch:n})=>(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between`,disabled:!E||C||!n,onClick:()=>{H(n)},children:[(0,Y.jsx)(`span`,{children:t}),(0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n})]},e)):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v(o?`projectTargetSelector.loadingBranches`:`projectTargetSelector.noSuggestedBranches`)})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 sm:flex-nowrap`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56 space-y-1`,children:[(0,Y.jsx)(J_,{htmlFor:`project-target-branch-input`,className:`text-xs text-muted-foreground`,children:v(`projectTargetSelector.switchOrCreateBranch`)}),(0,Y.jsx)(F_,{id:`project-target-branch-input`,value:x,disabled:!E||C,onChange:e=>S(e.target.value),placeholder:v(`projectTargetSelector.branchPlaceholder`)})]}),(0,Y.jsx)(Q,{type:`button`,disabled:!E||!x.trim()||C,onClick:()=>{H(x)},children:v(`projectTargetSelector.switchBranch`)})]})]})]}),!T&&ee&&(0,Y.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 pt-4`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.actions`)}),(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between`,disabled:te,title:m?.rebase_disabled_reason??void 0,onClick:()=>{U()},children:[(0,Y.jsx)(`span`,{children:R}),h===`rebase`&&(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`})]})]})]})})]})},Yy=(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,Xy=({activeProject:e,activeRun:t,branchState:n,targetGitStatus:r,isBoardLoadedForActiveProject:i,activeProjectBranchAction:a,isProjectIdeAvailable:o,isProjectRunAvailable:s,isRunStatusLoadedForActiveProject:c,isTerminalOpen:l,hasConfiguredTests:u,hasConfiguredChecks:d,targetBundles:f,targetBranchSuggestions:p,isTargetBundleLoading:m,isTargetSelectorLoading:h,isTargetGitStatusLoading:g,onProjectFilesOpen:_,onProjectChangesOpen:v,onProjectVerificationOpen:y,onProjectPull:b,onProjectRebase:x,onProjectAbortGitOperation:S,onProjectRunToggle:C,onTerminalToggle:w,onProjectIdeOpen:T,onTargetSelectorOpenChange:E,onSelectBundleTarget:D,onSelectRepoRootTarget:O,onManageBundles:k})=>{let{t:A}=K(`common`),j=r?.operation_state??`idle`,M=!!(e&&r&&r.behind>0&&j===`idle`),N=(()=>{let e=Yy(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`),ee=j===`merge`||j===`rebase`,te=A(j===`merge`?`projectFooter.abortMerge`:`projectFooter.abortRebase`),z=!!e,B=!!(e&&n?.diffStats?.is_dirty),V=A(l?`workspaceControls.hideTerminalAriaLabel`:`workspaceControls.openTerminalAriaLabel`),H=e?.active_target_kind??`repo_root`,U=e?.active_target_bundle_id??null,ne=H!==`bundle`||f.some(e=>e.id===U&&e.has_prepared_worktree===!0),re=e!==null&&t?.kind===`project`&&t.project_id===e.id&&(t.target_kind??`repo_root`)===H&&((t.target_kind??`repo_root`)!==`bundle`||t.target_bundle_id===U),ie=e!==null&&!re&&(!i||!c),ae=!e||!re&&(!s||t!==null||ie),oe=A(re?`projectFooter.stop`:`projectFooter.run`),W=(()=>{if(!e)return A(`projectFooter.selectProjectFirst`);if(!re){if(!s)return A(`projectFooter.addRunConfig`);if(ie)return A(`projectFooter.loadingProjectStatus`);if(t?.kind===`project`)return A(`projectFooter.stopSelectedTargetRun`);if(t?.kind===`ticket`)return A(`projectFooter.stopTicketBeforeSelectedTargetRun`)}})();return(0,Y.jsx)(`footer`,{className:`border-t border-border bg-background/95 px-6 py-3 backdrop-blur`,"data-testid":`project-footer`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Y.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,Y.jsx)(`div`,{className:`flex max-w-full items-center gap-2 overflow-hidden`,children:(0,Y.jsx)(Jy,{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})}),ee&&(0,Y.jsxs)(Q,{type:`button`,onClick:()=>{S()},disabled:a!==null,variant:`outline`,className:`h-8 gap-2 px-3 text-xs`,children:[I?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:I?A(`projectFooter.aborting`):te})]}),M&&(0,Y.jsxs)(Q,{type:`button`,onClick:b,disabled:!L,variant:`outline`,className:`h-8 gap-2 px-3 text-xs`,children:[F?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Iv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:F?R===A(`projectFooter.sync`)?A(`projectFooter.syncing`):A(`projectFooter.pulling`):R})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3 sm:gap-4`,children:[B&&n?.diffStats&&(0,Y.jsx)(kv,{stats:n.diffStats,showFiles:!0,className:`text-xs`}),z&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.changes`),onClick:v,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(Mv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.changes`)})]}),(0,Y.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.files`),onClick:_,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(jv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.files`)})]})]}),(d||u)&&ne&&(0,Y.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.verification`),onClick:y,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(Av,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.verification`)})]}),(0,Y.jsxs)(Q,{type:`button`,"aria-label":V,"aria-pressed":l,onClick:w,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(Rv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.terminal`)})]}),e&&o&&(0,Y.jsxs)(Q,{type:`button`,onClick:T,variant:`outline`,className:`gap-2`,children:[(0,Y.jsx)(Nv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:A(`workspaceControls.openIde`)})]}),(0,Y.jsxs)(Q,{type:`button`,"data-testid":`project-root-run-button`,disabled:ae,title:W,onClick:C,variant:re?`destructive`:`secondary`,className:[`gap-2`,re?``:`bg-sky-700 text-sky-100 hover:bg-sky-600 hover:text-white`,ae?`bg-slate-700 text-slate-400 hover:bg-slate-700 hover:text-slate-400`:``].join(` `),children:[re&&(0,Y.jsx)(`span`,{className:`h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400 animate-pulse`,"data-testid":`project-root-run-indicator`}),re?(0,Y.jsx)(Lv,{className:`h-4 w-4`}):(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:oe})]})]})]})})},Zy=e=>(0,Y.jsx)(tp,{"data-slot":`dropdown-menu`,...e}),Qy=e=>(0,Y.jsx)(np,{"data-slot":`dropdown-menu-trigger`,...e}),$y=({className:e,align:t=`end`,sideOffset:n=6,...r})=>(0,Y.jsx)(rp,{children:(0,Y.jsx)(ip,{"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})}),eb=({className:e,inset:t=!1,...n})=>(0,Y.jsx)(ap,{"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}),tb=({state:e,className:t})=>e?(0,Y.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,nb=({className:e})=>(0,Y.jsx)(Ug,{"aria-hidden":`true`,className:e}),rb=({className:e})=>(0,Y.jsx)(ute,{"aria-hidden":`true`,className:e}),ib=class extends Error{constructor(e){super(e),this.name=`UpgradeInProgressError`}},ab=async e=>{let t=await fetch(q(`/tools/upgrade`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tool:e})});if(t.status===409)throw new ib(await Ze(t,`upgrade already running`));if(!t.ok)throw new Ke(await Ze(t,`Upgrade failed.`),t.status);return await t.json()},ob=({onUpgrade:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)({opencode:`idle`,claude:`idle`}),i=e=>({opencode:{success:t(`toolsMenu.openCodeSuccess`),successWithVersion:t(`toolsMenu.openCodeSuccessWithVersion`),upToDate:t(`toolsMenu.openCodeUpToDate`),upToDateWithVersion:t(`toolsMenu.openCodeUpToDateWithVersion`),failed:t(`toolsMenu.openCodeFailed`),alreadyRunning:t(`toolsMenu.openCodeAlreadyRunning`)},claude:{success:t(`toolsMenu.claudeSuccess`),successWithVersion:t(`toolsMenu.claudeSuccessWithVersion`),upToDate:t(`toolsMenu.claudeUpToDate`),upToDateWithVersion:t(`toolsMenu.claudeUpToDateWithVersion`),failed:t(`toolsMenu.claudeFailed`),alreadyRunning:t(`toolsMenu.claudeAlreadyRunning`)}})[e],a=async a=>{if(n[a]===`running`)return;r(e=>({...e,[a]:`running`}));let o=i(a);try{let e=await ab(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 ib){$.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,Y.jsxs)(eb,{disabled:i,onSelect:t=>{t.preventDefault(),a(e)},children:[i?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(rb,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:i?r:t})]})};return{hasRunningUpgrade:Object.values(n).some(e=>e===`running`),renderUpgradeMenuItems:()=>(0,Y.jsxs)(Y.Fragment,{children:[o(`opencode`,t(`toolsMenu.updateOpenCode`),t(`toolsMenu.openCodeRunning`)),o(`claude`,t(`toolsMenu.updateClaude`),t(`toolsMenu.claudeRunning`))]})}},sb=({onUpgrade:e,onOpenExecutionRuntimes:t})=>{let{t:n}=K(`common`),{renderUpgradeMenuItems:r}=ob({onUpgrade:e});return(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,"aria-label":n(`toolsMenu.triggerAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`rounded-xl border border-border/70`,children:(0,Y.jsx)(nb,{className:`h-4 w-4`})})}),(0,Y.jsxs)($y,{align:`end`,className:`w-60`,children:[t&&(0,Y.jsxs)(eb,{onSelect:t,children:[(0,Y.jsx)(nb,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:n(`toolsMenu.runtimes`)})]}),r()]})]})},cb=({className:e})=>(0,Y.jsx)(Mee,{"aria-hidden":`true`,className:e}),lb=({className:e})=>(0,Y.jsx)(Pg,{"aria-hidden":`true`,className:e}),ub=({className:e})=>(0,Y.jsx)(`svg`,{"aria-hidden":`true`,className:e,viewBox:`0 0 16 16`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,Y.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`})}),db=({className:e})=>(0,Y.jsx)(Bee,{"aria-hidden":`true`,className:e}),fb={"X-Archon-Desktop-Action":`mobile-access`},pb=e=>J(q(`/mobile-access/status`),{signal:e}),mb=e=>J(q(`/mobile-access/enable`),{method:`POST`,headers:fb,body:e}),hb=()=>J(q(`/mobile-access/disable`),{method:`POST`,headers:fb}),gb=e=>J(q(`/mobile-access/regenerate-pairing`),{method:`POST`,headers:fb,body:{preferred_project_id:e??null}}),_b=e=>J(q(`/mobile-access/sessions/${encodeURIComponent(e)}/revoke`),{method:`POST`,headers:fb}),vb=new Set,yb=null,bb=null,xb=()=>{for(let e of vb)e(yb)},Sb=()=>{bb!==null&&(window.clearTimeout(bb),bb=null)},Cb=e=>{if(typeof window>`u`||(Sb(),e?.state!==`awaiting_pairing`||!e.pairing))return;let t=new Date(e.pairing.expires_at).getTime();if(Number.isNaN(t))return;let n=()=>{yb?.state!==`awaiting_pairing`||yb.pairing?.expires_at!==e.pairing?.expires_at||wb({...yb,state:`expired`,pairing:null})},r=t-Date.now();if(r<=0){n();return}bb=window.setTimeout(n,r)},wb=e=>{yb=e,Cb(e),xb()},Tb=async e=>{let t=await pb(e);return wb(t),t},Eb=()=>{let[e,t]=(0,p.useState)(yb);return(0,p.useEffect)(()=>(vb.add(t),()=>{vb.delete(t)}),[]),e},Db=e=>{(0,p.useEffect)(()=>{if(!e)return;let t=null,n=()=>{t?.abort(),t=new AbortController;let e=t;Tb(e.signal).catch(e=>{Xe(e)}).finally(()=>{t===e&&(t=null)})};n();let r=e=>{wb(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])},Ob=`(min-width: 1440px)`,kb=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches,Ab=e=>{let[t,n]=(0,p.useState)(()=>kb(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},jb=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`,Mb=(e,t)=>{if(!e||e.state===`disabled`){let n=t(`projectHeader.runtime.mobileDisabled`);return{buttonClassName:jb(e),indicatorState:`inactive`,isActive:!1,statusLabel:n,tooltip:n}}if(e.state===`awaiting_pairing`){let n=t(`projectHeader.runtime.mobileReadyToPair`);return{buttonClassName:jb(e),indicatorState:`running`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`connected`){let n=t(`projectHeader.runtime.mobileConnected`);return{buttonClassName:jb(e),indicatorState:`finished`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`expired`){let n=t(`projectHeader.runtime.mobilePairingExpired`);return{buttonClassName:jb(e),indicatorState:`interrupted`,isActive:!0,statusLabel:n,tooltip:n}}return{buttonClassName:jb(e),indicatorState:`error`,isActive:!0,statusLabel:t(`projectHeader.runtime.mobileUnavailable`),tooltip:e.error??t(`projectHeader.runtime.mobileUnavailable`)}},Nb=(e,t)=>t(e===`opencode`?`projectHeader.agent.openCode`:`projectHeader.agent.claude`),Pb=({activeTool:e,onToolChange:t})=>{let{t:n}=K(`common`);return(0,Y.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,Y.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:Nb(r,n)},r)})})},Fb=({activeTool:e,onToolChange:t})=>{let{t:n}=K(`common`);return(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.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,Y.jsx)(cb,{className:`h-4 w-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{children:Nb(e,n)}),(0,Y.jsx)(Cv,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,Y.jsx)($y,{align:`end`,className:`w-44`,children:[`opencode`,`claude`].map(r=>{let i=e===r;return(0,Y.jsxs)(eb,{onSelect:()=>t(r),children:[(0,Y.jsx)(cb,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:Nb(r,n)}),i&&(0,Y.jsx)(lb,{className:`h-4 w-4 text-muted-foreground`})]},r)})})]})},Ib=({hasActiveGitHubRuns:e=!1,onOpenGitHubActions:t})=>{let{t:n}=K(`common`);return t?(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.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,Y.jsx)(ub,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:n(`workspaceControls.githubActions`)})]}),e&&(0,Y.jsx)(tb,{state:`running`,className:`absolute -top-0.5 -right-0.5`})]}):null},Lb=({onOpenActivity:e})=>{let{t}=K(`common`);return e?(0,Y.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,Y.jsx)(db,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:t(`projectHeader.runtime.activityLabel`)})]}):null},Rb=({mobileAccessStatus:e,onMobileAccessOpen:t})=>{let{t:n}=K(`common`);if(!t)return null;let r=Mb(e,n);return(0,Y.jsx)(vv,{content:r.tooltip,children:(0,Y.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,Y.jsx)(tb,{state:r.indicatorState,className:`mt-0`}),(0,Y.jsx)(`span`,{children:n(`projectHeader.runtime.mobileLabel`)})]})})},zb=({hasActiveGitHubRuns:e=!1,mobileAccessStatus:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onOpenExecutionRuntimes:a})=>{let{t:o}=K(`common`),{hasRunningUpgrade:s,renderUpgradeMenuItems:c}=ob({}),l=Mb(t,o),u=o(`projectHeader.runtime.triggerLabel`),d=null;return i&&e?d=`running`:n&&l.isActive?(u=l.statusLabel,d=l.indicatorState):s&&(u=o(`projectHeader.runtime.toolUpdateRunning`),d=`running`),(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,"aria-label":o(`projectHeader.runtime.triggerAriaLabel`),variant:`ghost`,className:`relative h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-foreground hover:bg-accent/20`,children:[(0,Y.jsx)(nb,{className:`h-4 w-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{children:u}),d&&(0,Y.jsx)(tb,{state:d,className:`absolute -top-0.5 -right-0.5`})]})}),(0,Y.jsxs)($y,{align:`end`,className:`w-60`,children:[a&&(0,Y.jsxs)(eb,{onSelect:a,children:[(0,Y.jsx)(nb,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openExecutionRuntimes`)})]}),r&&(0,Y.jsxs)(eb,{onSelect:r,children:[(0,Y.jsx)(db,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openActivity`)})]}),i&&(0,Y.jsxs)(eb,{onSelect:i,children:[(0,Y.jsx)(ub,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openGitHubActions`)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(e?`projectHeader.runtime.githubStatusRunning`:`projectHeader.runtime.githubStatusIdle`)})]}),n&&(0,Y.jsxs)(eb,{onSelect:n,children:[(0,Y.jsx)(tb,{state:l.indicatorState,className:`mt-0`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openMobileAccess`)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l.statusLabel})]}),c()]})]})},Bb=({activeTool:e,hasActiveGitHubRuns:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onOpenExecutionRuntimes:a,onToolChange:o})=>{let s=Eb(),c=Ab(Ob);return(0,Y.jsxs)(`div`,{className:`flex w-full min-w-0 items-center justify-end gap-2`,children:[c?(0,Y.jsx)(Pb,{activeTool:e,onToolChange:o}):(0,Y.jsx)(Fb,{activeTool:e,onToolChange:o}),c?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ib,{hasActiveGitHubRuns:t,onOpenGitHubActions:i}),(0,Y.jsx)(Lb,{onOpenActivity:r}),(0,Y.jsx)(Rb,{mobileAccessStatus:s,onMobileAccessOpen:n}),(0,Y.jsx)(sb,{onOpenExecutionRuntimes:a})]}):(0,Y.jsx)(zb,{hasActiveGitHubRuns:t,mobileAccessStatus:s,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onOpenExecutionRuntimes:a})]})},Vb=`common`,Hb={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`},autoFix:{attempt:`Attempt {{current}} of {{total}}`,phase:{dispatching:`Starting automatic repair`,repairing:`Repairing checks`,rerunning:`Rerunning the originating check batch`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`,fallback:`Continuation was rejected; starting a fresh repair`},terminal:{passed:`Automatic repair passed all checks`,ineligible:`These failures cannot be repaired automatically`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair agent made no changes`,unchanged_failures:`Automatic repair made no progress`,user_cancelled:`Automatic repair was stopped by the user`,stale:`Check definitions or workspace became stale`,exhausted:`Automatic repair used all three attempts`,interrupted:`Automatic repair was interrupted`}}},workspaceTabs:{ariaLabel:`Project workspace`,board:`Board`,chat:`Chat`,spec:`Spec`,memory:`Memory`},destinationUnavailable:{errorTitle:`Unable to open destination`,errorDescription:`Archon could not load this destination. Check your connection and try again.`,retry:`Try again`,destinationTitle:`Destination unavailable`,destinationDescription:`This item may have been deleted, may not belong to this project, or is not available in this workspace.`,projectTitle:`Project unavailable`,projectDescription:`This project no longer exists or is not available for this link.`,openWorkspace:`Open nearest workspace`,openRetainedProject:`Open {{project}}`,openDefaultProject:`Open {{project}}`,createProject:`Create project`},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`,check_auto_fix:`Automatic check repair`,github_actions:`GitHub Actions`,plan:`Plan`,planning_agent:`Planning agent`,build:`Build`,review:`Review`,chat_turn:`Chat turn`,spec_turn:`Spec turn`,spec_review:`Spec review`,build_follow_up:`Build follow-up`,plan_follow_up:`Plan follow-up`,automation_progression:`Automation progression`,automation_review_fix:`Automated review fix`,automation_commit:`Automated commit`,automation_push:`Automated push`,automation_pull_request:`Automated pull request`,repository_graph_scan:`Repository graph scan`,environment_validation:`Environment validation`,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.`,event:`Unable to load the requested activity event right now.`,retry:`Unable to retry this run right now.`},events:{fallback:`Run state changed`,sequence:`Sequence`,transition:`Status`,transitionValue:`{{from}} to {{to}}`,outcome:`Outcome`,timeInState:`Time in state`},group:{ariaLabel:`Execution sequence`,parentOutsidePage:`{{kind}} parent outside the loaded page`},environmentContext:{summary:`{{target}} · revision {{revision}} · {{provider}}`,unknown:`Unknown`},buildEvidence:{timeline:{host:`Build environment: This machine (host)`,docker_sandbox:`Build environment: Docker Sandbox · revision {{revision}}`,unknown:`Build environment: Unknown`},unknown:`Unknown`,target:`{{kind}}: {{key}}`,provider:{host:`This machine (host)`,docker_sandbox:`Docker Sandbox`,unknown:`Unknown`}},environmentLifecycle:{queued:`Queued`,preparing:`Preparing`,ready:`Ready`,running:`Running`,stopped:`Stopped`,retiring:`Retiring`,cleanup_pending:`Cleanup pending`,retired:`Retired`,failed:`Failed`,unavailable:`Unavailable`,unknown:`Unknown`},artifacts:{title:`Artifacts`,evidence:`Evidence`,summaryAriaLabel_one:`Evidence, {{count}} artifact`,summaryAriaLabel_other:`Evidence, {{count}} artifacts`,count_one:`{{count}} artifact`,count_other:`{{count}} artifacts`,overflow_one:`+{{count}} more`,overflow_other:`+{{count}} more`,overflowDescription_one:`{{count}} additional artifact is not shown in this summary.`,overflowDescription_other:`{{count}} additional artifacts are not shown in this summary.`,sensitiveTitle:`Sensitive artifact`,untitledTitle:`Untitled artifact`,kindLabel:`Kind`,mediaType:`Media type`,size:`Size`,expires:`Expires`,sensitivityLabel:`Sensitivity`,availabilityLabel:`Availability`,downloadOnly:`Download only. Preview and external access are disabled for sensitive artifacts.`,kind:{report:`Report`,screenshot:`Screenshot`,log_excerpt:`Log excerpt`,structured_result:`Structured result`},sensitivity:{normal:`Standard`,sensitive:`Sensitive`},availability:{available:`Available`,expired:`Expired`,missing:`Missing`,deletion_failed:`Deletion pending`,deleted:`Deleted`},actions:{download:`Download`,downloadAriaLabel:`Download {{title}}`,open:`Open`,openAriaLabel:`Open {{title}}`},unavailable:{expired:`This artifact has expired and is no longer available.`,missing:`This artifact can no longer be found.`,deletion_failed:`This artifact is unavailable while deletion is completed.`,deleted:`This artifact has been deleted.`,noAction:`No action is available for this artifact.`}},retry:{confirmTitle:`Retry as a new attempt?`,confirmDescription:`A fresh attempt and provider session will be created. The previous attempt and all retained evidence will remain in history.`,confirmAction:`Create new attempt`,retentionNotice:`Retrying creates a fresh attempt while retaining this attempt and its evidence.`},rerun:{confirmTitle:`Rerun this check batch?`,confirmDescription:`A new batch will run the same source checks. This batch and its retained evidence will remain in history.`,confirmAction:`Rerun checks`,retentionNotice:`Rerunning creates a new batch while retaining this batch and its evidence.`},retryDenial:{unsupported_kind:`This run type cannot be retried.`,status_not_retryable:`This run is not in a retryable status.`,automation_resume_required:`Resume this run from its automation controls instead.`,retry_already_created:`A newer retry attempt already exists.`,retry_source_superseded:`Newer source activity has superseded this run.`,attempt_superseded:`A newer attempt has superseded this run.`,retry_target_missing:`The retry target no longer exists.`,retry_target_busy:`The retry target is currently busy.`,retry_state_incompatible:`The source is no longer in a compatible state for retry.`,retry_input_unavailable:`The exact input required for this retry is no longer available.`,retry_workspace_unavailable:`The required workspace is unavailable.`,unknown:`This run cannot be retried right now.`},details:{ariaLabel:`Run details`,title:`Run details`,selectPrompt:`Select a run to inspect its durable details and transition evidence.`,status:`Status`,attempt:`Attempt`,attemptValue:`Attempt {{count}}`,lineage:`Lineage`,retryOfAttempt:`Retry of attempt {{count}}`,retryLineage:`Retry lineage · attempt {{count}}`,priorAttemptUnavailable:`Prior attempt is outside retained history`,source:`Source`,environment:`Environment`,sourceUnavailable:`Source unavailable`,created:`Created`,started:`Started`,completed:`Completed`,failureReason:`Failure reason`,environmentValidationEvidence:`Environment validation evidence`,buildExecutionEvidence:`Build execution evidence`,buildExecutionEvidenceNotice:`Recorded for this Build run. Later project setting changes do not alter this evidence or its follow-up lineage.`,buildExecutionUnknown:`No recognized provider evidence was recorded. Archon does not assume host execution.`,buildProvider:`Build environment`,environmentId:`Environment ID`,providerVersion:`Provider version`,targetWorkspace:`Target workspace`,validationFingerprint:`Validation fingerprint`,capabilities:`Capabilities`,degradation:`Degradation`,authenticationMode:`Authentication mode`,credentialDelivery:`Credential delivery`,agent:`Agent`,unknown:`Unknown`,none:`None`,environmentRevision:`Environment revision`,environmentLifecycle:`Persistent environment state`,restartInterruptionEvidence:`This validation was interrupted by a server restart. The persistent environment is tracked separately and may still be available.`,loading:`Loading run details...`,testEvidence:`Test evidence`,checkBatchEvidence:`Check batch`,checkAttemptEvidence:`Check attempt`,checkRepairEvidence:`Repair provenance`,checkAutoFixEvidence:`Automatic repair history`,repairSource:`Repair source`,causalBuild:`Causal Build run`,causalExecution:`Causal execution run`,currentPhase:`Current phase`,launchDecision:`Launch decision`,continuation:`Continued provider session`,freshLaunch:`Fresh provider session`,fallbackUsed:`Fallback used`,fallbackYes:`Yes, before execution`,fallbackNo:`No`,repairAttempt:`Repair attempt {{current}} of {{total}}`,terminalExplanation:`Terminal explanation`,repairSourceType:{ticket:`Ticket`,chat_session:`Chat session`},launch:{continued:`Continued exact provider session`,fresh:`Fresh same-configuration session`},autoFixPhase:{dispatching:`Dispatching automatic repair`,repairing:`Repairing checks`,rerunning:`Rerunning originating batch`,stopping:`Stopping`,terminal:`Terminal`},autoFixTerminal:{passed:`Passed`,ineligible:`Not auto-fixable`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`Agent failure`,no_workspace_changes:`No workspace changes`,unchanged_failures:`No progress`,user_cancelled:`Cancelled by user`,stale:`Definitions or workspace became stale`,exhausted:`Three attempts exhausted`,interrupted:`Interrupted`},deterministicEvidenceNotice:`Diagnostics and rerun results are deterministic records. Agent repair summaries are not check evidence.`,sourceBatch:`Source check batch`,sourceAttempts:`Source attempts`,sourceDiagnostics:`Source diagnostics`,sourceRawOutputAttempts:`Source raw-output attempts`,repairWrapper:`Repair wrapper`,followUpRun:`Build follow-up child`,repairChildRun:`Repair child run`,rerunBatch:`Rerun batch`,nextBoundary:`Next automation boundary`,policyFingerprint:`Policy fingerprint`,configurationFingerprint:`Check configuration`,repairResult:`Repair result`,repairPending:`Repair agent or rerun is still active`,boundary:{automation_review:`Pre-Review checks, then automatic Review`,automation_commit:`Required checks, then commit creation`,automation_push:`Required checks, then push`,automation_pull_request:`Required checks, then pull-request creation`,unknown:`No delivery progression is claimed`},providerEvidence:`Provider evidence`,command:`Command`,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`,runtimes:`Runtimes`,updateOpenCode:`Update OpenCode`,updateClaude:`Update Claude`,openCodeRunning:`Updating OpenCode...`,claudeRunning:`Updating Claude...`,openCodeSuccess:`OpenCode updated`,claudeSuccess:`Claude updated`,openCodeSuccessWithVersion:`OpenCode updated to {{version}}`,claudeSuccessWithVersion:`Claude updated to {{version}}`,openCodeUpToDate:`OpenCode is already up to date`,claudeUpToDate:`Claude is already up to date`,openCodeUpToDateWithVersion:`OpenCode is already up to date ({{version}})`,claudeUpToDateWithVersion:`Claude is already up to date ({{version}})`,openCodeFailed:`OpenCode update failed`,claudeFailed:`Claude update failed`,openCodeAlreadyRunning:`OpenCode update already running`,claudeAlreadyRunning:`Claude update already running`,networkError:`Unable to reach the server.`},statusBadge:{queued:`Queued`,planning:`Planning...`,building:`Building`,buildingWithGlyph:`⏳ Building`,reviewing:`Reviewing`,automation:`Automation`,checks:`Checks`,autoFix:`Auto-fix`,commit:`Commit`,push:`Push`,pr:`PR`,done:`✓ Done`,error:`✗ Error`,stopped:`Stopped`},cardStatusBadges:{stale:`Stale`,openQuestions:`Open questions`,chainStart:`Chain start`},ticketAutomation:{depth:{manual:`Manual`,auto_review:`Auto-review`,auto_commit:`Auto-commit`,auto_push:`Auto-push`,auto_pr:`Auto-PR`},override:{title:`Ticket automation`,ariaLabel:`Ticket automation override`,depthAriaLabel:`Automation depth override`,inherit:`Inherit`,summaryLabel:`Automation: {{depth}} ({{source}})`,summaryInherited:`inherited`,summaryOverride:`override`,saving:`Saving...`,updateError:`Unable to update the bundle automation and reviewer settings right now.`,overridingProject:`Override`,autoPrDisabledHint:`Connect the GitHub integration to enable Auto-PR.`,fixToggleLabel:`Auto-fix review findings`,fixToggleDescription:`When automation reaches review, automatically fix blocking findings and re-review until the review is clean or the iteration cap is hit.`,fixToggleAriaLabel:`Auto-fix review findings override`,maxIterationsLabel:`Max fix iterations`,maxIterationsDescription:`Set how many review-fix passes this bundle may run before pausing with the findings unresolved.`,maxIterationsAriaLabel:`Max fix iterations source`,inheritProjectSetting:`Inherit project setting`,overrideSetting:`Override setting`,maxIterationsInputLabel:`Iterations`,maxIterationsInputAriaLabel:`Max fix iterations`,openQuestionsLabel:`Open Questions checkpoint`,openQuestionsDescription:`Pause before Review when Build has unresolved implementation questions.`,openQuestionsAriaLabel:`Open Questions checkpoint override`,enabled:`Enabled`,disabled:`Disabled`},reviewer:{title:`Reviewer`,description:`Choose an OpenCode model for reviews in this bundle, or inherit the project setting.`,effective:`{{model}} · {{variant}}`,fallback:`Implementing model per ticket`,perTicketVariant:`Variant per ticket`,defaultVariant:`Model default`,sourceAriaLabel:`Reviewer setting source`,modelLabel:`Reviewer model`,variantLabel:`Reviewer variant`,clearOverride:`Clear bundle override`,availableVariants:`Available variants`,loading:`Loading OpenCode reviewer models...`,unavailable:`OpenCode model discovery is unavailable. Reviewer override selection cannot be changed right now.`,sources:{bundle:`Bundle`,project:`Project`,fallback:`Fallback`},claudeTicketProvenance:`Claude tickets use their existing ticket model because project and bundle reviewer settings select OpenCode models.`},pause:{label:`Automation paused`,resume:`Resume`,resumePending:`Resume is starting. Wait for the bundle state to update.`,dismiss:`Dismiss`,abandon:`Abandon automation`,openChecks:`Open checks`,stop:`Stop automation`,stopTooltip:`Stop the automation work that is currently running for this bundle.`,abandonTooltip:`Discard the saved automation continuation and keep its execution history for diagnostics.`,iterationCounter:`Review fix iteration {{current}} of {{max}}`,resolveQuestions:`Resolve questions`,diagnostic:`Details: {{reason}}`,resumeOutcome:{complete_manual_boundary:`Resume closes the saved automation progression at the current manual boundary.`,start_review:`Resume starts automatic Review for this bundle.`,resume_review:`Resume continues the interrupted Review session before delivery automation can continue.`,rerun_review:`Resume reruns automatic Review for the latest bundle changes.`,start_review_fix:`Resume starts the next review-fix pass, then reviews the changes again.`,continue_commit_chain:`Resume continues automation with the commit chain.`,reconcile_commit:`Resume verifies whether the commit completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,reconcile_push:`Resume verifies whether the push completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,reconcile_pull_request:`Resume verifies whether the pull request action completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,rerun_required_checks:`Resume reruns the required checks against the current workspace before automated delivery continues.`,rerun_review_checks:`Resume reruns the pre-review checks against the current workspace before automatic Review starts.`},resumeDisabled:{bundle_agent_running:`Resume is unavailable while a Build agent is running in this bundle.`,bundle_build_incomplete:`Resume is unavailable until every active ticket in this bundle completes Build.`,run_setup_preparing:`Resume is unavailable while a bundle run is preparing.`,review_running:`Resume is unavailable because Review is already running for this bundle.`,invalid_progression:`Resume is unavailable because automation progression ownership is invalid.`,invalid_stage_lineage:`Resume is unavailable because the paused stage does not belong to the active automation progression.`,no_resumable_owner:`Resume is unavailable because no ticket currently owns a resumable automation state.`},guidance:{preconditionFailed:`Review the current bundle state and resolve any blockers before continuing.`,stageFailed:`Review the failed stage details, then resume when the issue is resolved.`,serverRestart:`Automation was interrupted by a server restart. Resume to continue from the saved stage.`,reconciliationFailed:`Verify the repository state before resuming because automation could not confirm the latest stage result.`,sideEffectAmbiguous:`Verify whether the last external action completed before resuming.`,manualTransition:`Review the current ticket state before resuming because it changed while automation was running.`,configurationChanged:`Review the current automation settings before resuming because they changed during the run.`,targetBusy:`Another operation owns this target. Review Checks and wait for it to finish before resuming.`,requiredChecksFailed:`Required checks govern automated delivery. Review their durable evidence, then resume to rerun them.`,invalidLineage:`Automation ownership changed. Review the current bundle state before continuing.`,generic:`Review the current bundle state before resuming automation.`},requiredChecks:{boundary:{check_completion:`check completion`,automation_review:`Review progression`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pull-request creation`},reason:{not_required:`required checks are not configured`,policy_invalid:`the required-check policy is invalid`,policy_drift:`the required-check policy changed`,workspace_unavailable:`the workspace is unavailable`,intended_identity_mismatch:`the checked workspace no longer matches the automation target`,missing_evidence:`required check evidence is missing`,target_mismatch:`the checks targeted a different workspace or bundle`,batch_not_completed:`the required-check batch has not finished`,incomplete_evidence:`required check evidence is incomplete`,duplicate_evidence:`duplicate required check evidence was found`,extra_evidence:`unexpected required check evidence was found`,definition_drift:`a required check definition changed`,attempt_failed:`one or more required checks failed`,attempt_stale:`required check evidence is stale`,target_busy:`another check run is already using the target`,check_start_failed:`required checks could not start`},fallbackReason:`the required checks did not produce usable evidence`,failure:`Required checks blocked the automated {{boundary}}. {{explanation}} Review the check results and rerun any failed or unfinished checks before resuming automation.`}}},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.`,continueBundleReview:`Unable to continue the bundle review right now.`,undoBundleReview:`Unable to undo the bundle review right now.`,moveBundle:`Unable to move the bundle right now.`,startBuildChain:`Unable to start the build chain right now.`,stopBuildChain:`Unable to stop the build chain right now.`,emptyDone:`Unable to empty Done right now.`},toasts:{deleteDonePartial_one:`Deleted {{deletedCount}} done ticket, but {{failedCount}} failed.`,deleteDonePartial_other:`Deleted {{deletedCount}} done tickets, but {{failedCount}} failed.`,deleteDoneSuccess_one:`Deleted {{count}} done ticket.`,deleteDoneSuccess_other:`Deleted {{count}} done tickets.`,movedBundleToDonePartial:`Moved {{movedCount}} of {{totalCount}} bundle tickets to Done.`,restoredBundlePartial:`Restored {{restoredCount}} of {{totalCount}} bundle tickets.`,deletedBundleTicketsPartial:`Deleted {{deletedCount}} of {{totalCount}} bundle tickets.`,planningAgentCardsCreated_one:`{{count}} card created`,planningAgentCardsCreated_other:`{{count}} cards created`},doneColumn:{emptyAction:`Empty`},changes:{reviewPromptDisabledReason:`Wait for all bundle tickets to finish building before sending a follow-up prompt.`,modifyChangesDisabledReason:`Wait for all bundle tickets to finish building before modifying changes.`,targetUnavailableReason:`This workspace target is no longer available.`}},projectPreviewPane:{presets:{responsive:`Responsive`,phone:`Phone`,tablet:`Tablet`,laptop:`Laptop`},selection:{unavailableBuildCapable:`Preview selection is only available for build-capable ticket runs.`,waitForLoad:`Wait for the preview to finish loading first.`,enableMode:`Enable selection mode`,disableMode:`Disable selection mode`},targetSummary:{element:`Element`,unknownElement:`Unknown element`},iframeTitle:`Project preview`,pendingComments:{triggerLabel:`Pending comments`,title:`Pending comments`,description:`Review preview comments before sending them back to the agent.`,empty:`No preview comments queued yet.`,clearAll:`Clear all`,sending:`Sending...`,sendFixes:`Send fixes ({{count}})`,deleteAriaLabel:`Delete pending comment for {{elementLabel}}`},prompt:{bundlePlaceholder:`Follow up on this bundle`,ticketPlaceholder:`Follow up on this ticket`,defaultPlaceholder:`Describe what Archon should do next.`,toggleAriaLabel:`Toggle preview prompt`,button:`Prompt`,sent:`Prompt sent.`,sendError:`Unable to send the preview prompt right now.`},commentComposer:{editTitle:`Edit preview comment`,addTitle:`Add preview comment`,closeAriaLabel:`Close preview comment composer`,commentAriaLabel:`Preview comment`,placeholder:`Describe the change you want here.`,cancel:`Cancel`,save:`Save comment`,add:`Add comment`},toasts:{fixesSubmitted:`Fixes submitted.`,fixesError:`Unable to submit the preview review right now.`},states:{loadingTitle:`Loading preview`,loadingDescription:`Archon is loading the current preview state for this project.`,readyMissingUrlTitle:`Preview error`,readyMissingUrlDescription:`Archon did not provide a preview URL for the active run.`,detectingTitle:`Detecting preview`,detectingDescription:`Waiting for the preview service to report a browser URL.`,unsupportedTitle:`Preview unavailable`,unsupportedDescription:`This run cannot be embedded as an in-app preview.`,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.`,targetMismatch:`This Spec targets {{sessionTarget}}, but {{currentTarget}} is selected.`,targetUnavailable:`This Spec target is unavailable.`,targetLoading:`Checking the current project branch before this Spec can continue...`,targetLoadError:`Unable to verify the current project branch. {{error}}`,targetRefreshError:`Unable to verify the current project target. {{error}}`,retryTarget:`Retry branch check`,switchBack:`Switch back to {{target}}`,switchingBack:`Switching target...`,updateTargetError:`Unable to update the project target right now.`}},chatView:{tool:{claude:`Claude`,opencode:`OpenCode`},mode:{plan:`Plan`,build:`Build`},startBuilding:{label:`Start building`,ariaLabel:`Start building this plan`},placeholders:{plan:`Ask Archon to scope, sequence, or reason through project work`,build:`Ask Archon to build, change, or verify something in this project`},shortcuts:{modifierMac:`CMD`,modifierDefault:`CTRL`,startNewSession:`Start new session`,switchToPlan:`Switch to Plan`,switchToBuild:`Switch to Build`},user:{you:`You`},targets:{bundleFallback:`Bundle target`,repoRoot:`Repo root`,repoRootWithBranch:`Repo root ({{branch}})`,currentTarget:`current target`,selectedBundleTarget:`selected bundle target`},pendingMemorySuggestions_one:`{{count}} pending memory suggestion`,pendingMemorySuggestions_other:`{{count}} pending memory suggestions`,deleteSessionModal:{title:`Delete chat session`,bulkTitle:`Delete chat sessions`,description:`This permanently removes the transcript history for this chat session.`,bulkDescription_one:`This permanently removes the transcript history for {{count}} chat session.`,bulkDescription_other:`This permanently removes the transcript history for {{count}} chat sessions.`,cancel:`Cancel`,deleting:`Deleting...`,delete:`Delete`},sidebar:{ariaLabel:`Chat sessions sidebar`,newSession:`New session`,select:`Select`,cancelSelection:`Cancel`,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.`,restoreTarget:`Unable to restore the spec target right now.`},targets:{mismatchReason:`This Spec targets {{sessionTarget}}, but the current target is {{currentTarget}}. Restore the Spec target to continue.`,unavailable:`Target unavailable for this Spec.`,switchBack:`Switch back`,switchingBack:`Switching...`},importNotice:{title:`Import notice`,importedOnly:`Imported {{importedCount}} image(s).`,importedWithSkips:`Imported {{importedCount}} image(s). Skipped {{skippedCount}} reference(s): {{skippedSummary}}.`,skippedOnly:`Skipped {{skippedCount}} reference(s): {{skippedSummary}}.`,skipReasons:{third_party_url:`{{count}} third-party URL(s)`,download_failed:`{{count}} failed download(s)`,permission_denied:`{{count}} permission error(s)`,unsupported_type:`{{count}} unsupported image(s)`,non_image_content:`{{count}} non-image file(s)`,oversize:`{{count}} oversized image(s)`,over_limit:`{{count}} over the 4-image limit`}},composer:{placeholderSpec:`Describe the feature you want to plan...`,describeFeature:`Describe the feature, architecture, or changes you want to spec out.`,loadingMemory:`Loading memory...`,memorySuggestions:`Memory suggestions`,memorySuggestionsTitle:`Memory suggestions`,memorySuggestionsDescription:`Review pending suggestions from this spec before saving them into project memory.`,memorySuggestionsEmpty:`No pending memory suggestions for this spec session.`,closeMemorySuggestions:`Close memory suggestions`,waitTurn:`Wait for the current spec turn to finish.`,waitUpload:`Wait for the current image upload to finish.`,waitGrill:`Answer the question above to continue.`,stop:`Stop`,interrupt:`Interrupt`,interrupting:`Interrupting...`,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 relationships`,repositoryEvidence:{captureLabel:`Capture state`,freshnessLabel:`Captured scan freshness`,capture:{complete:`Complete`,stale:`Stale at capture`,truncated:`Truncated`,unavailable:`Unavailable`},freshness:{fresh:`Current`,stale:`Not current`,unavailable:`Unavailable`},origin:{planner:`Planner`,graph:`Repository graph`,both:`Planner + graph`},class:{deterministic:`Deterministic`,structural_heuristic:`Structural heuristic`,historical_heuristic:`Historical heuristic`},affectedTests:`Affected tests`,affectedTest:`Affected test`,impactHeading:`Repository impact`,impactDescription:`Repository-derived signals are advisory and are not planned edits.`,impactFiles_one:`{{count}} possible file signal`,impactFiles_other:`{{count}} possible file signals`,impactTests_one:`{{count}} possible test signal`,impactTests_other:`{{count}} possible test signals`,impactNone:`No candidates captured`,potentiallyAffectedFiles:`Potentially affected files`,showChains_one:`Show evidence chain`,showChains_other:`Show {{count}} evidence chains`,chainLabel:`Chain {{number}}`,chainSummary_one:`{{seed}} reaches {{candidate}} through {{count}} repository relation.`,chainSummary_other:`{{seed}} reaches {{candidate}} through {{count}} repository relations.`,truncatedNotice:`This capture reached a repository evidence limit, so additional candidates or chains may exist.`,historicalNotice:`Historical heuristic evidence reflects prior co-change patterns and is not a current deterministic relationship.`,impactFallback:`The repository graph projection did not capture any candidates for this snapshot.`,diagramDescription:`Planner-generated relationships between the files in this plan.`},proposedTickets:`Proposed Tickets`,bundleGroups:`Bundle Groups`,proposedTicketCount_one:`{{count}} proposed ticket`,proposedTicketCount_other:`{{count}} proposed tickets`,dependencies:`Dependencies`,openQuestions:`Open Questions`,assumptions:`Assumptions`,noSnapshot:`Run a spec turn to generate an artifact.`,noDiagram:`No diagram available for this spec.`,mermaidParseError:`Unable to render this Mermaid graph; showing raw text instead.`,uiMockup:`UI Mockup`,noMockup:`No UI mockup available for this spec.`,loading:`Loading artifact...`},actions:{createTickets:`Create tickets`,ticketsCreated:`Tickets created`,creatingTickets:`Creating tickets...`,implementInChat:`Implement in Chat`,implementInChatMultiBundleUnavailable:`Multi-bundle Specs must be materialized through Create tickets before implementation.`,startingImplementation:`Starting implementation...`,exportSpec:`Export to docs/plans`,exportingSpec:`Exporting...`,createTicketsSuccess:`Created {{count}} ticket(s) from this spec.`,exportSuccess:`Exported spec to docs/plans.`,exportConflictTitle:`Export already exists`,exportConflictDescription:`A spec has already been exported to {{path}}. Do you want to overwrite the existing file?`,exportConflictConfirm:`Overwrite`,exportConflictCancel:`Cancel`},provenance:{viewSourceSpec:`View source spec`},grill:{toggleTooltip:`Grill mode: pressure-test the plan one focused question at a time before writing the spec. Toggle off to skip remaining questions and write it now.`,toggleAriaLabelOn:`Turn Grill mode off (currently on)`,toggleAriaLabelOff:`Turn Grill mode on`,rationaleLabel:`Why`,suggestionsLabel:`Suggested answers`,recommendedSuggestionLabel:`Recommended`,answerPlaceholder:`Type your answer, or pick a suggestion above to fill this field...`,submitLabel:`Submit answer`,submittingLabel:`Submitting...`,finalizePrompt:`Grilling ended. Write the complete concrete plan now using everything we discussed.`,finalizeError:`Unable to finalize grilling right now.`,updateModeError:`Unable to change Grill mode right now.`,activeDisabledReason:`Wait for the current spec turn to finish before toggling Grill.`},review:{heading:`Review`,launch:`Review spec`,launchAction:`Review spec`,stop:`Stop review`,running:`Running...`,loading:`Loading review...`,noFindings:`No issues found.`,stoppedExplanation:`The review was stopped before it completed.`,errorExplanation:`The review could not be completed because the agent encountered an error.`,parseFailedExplanation:`The review completed, but its findings could not be parsed.`,why:`Why`,suggestion:`Suggestion`,sendToPlanner:`Send to planner`,sendingToPlanner:`Building revision draft...`,popoverTitle:`Spec review`,model:`Model`,variant:`Thinking level`,findingsCount_one:`{{count}} finding`,findingsCount_other:`{{count}} findings`,severity:{high:`high`,medium:`medium`,low:`low`},status:{running:`Running`,completed:`Completed`,parse_failed:`Parse failed`,stopped:`Stopped`,error:`Error`}}},conversationPane:{agentActivityAriaLabel:`Agent activity indicator`,agentWorkingSrText:`Agent is working`,agentError:`Agent error`,statusWorking:`Working...`,liveElapsedAriaLabel:`Approximate elapsed response time: {{duration}}`,statusInterrupted:`Interrupted`,loadingConversation:`Loading conversation...`,noMessagesYet:`No messages yet.`,attachmentPreviewAlt:`Attached image: {{name}}`,showThinkingAriaLabel:`Show thinking`,showThinkingLabel:`Show thinking`,sectionAriaLabel:`Ticket conversation`,contentAriaLabel:`Ticket conversation content`,scrollToLatestAriaLabel:`Scroll to latest message`,changesCommentBadge:`Changes comment`},questionSet:{eyebrow:`Plan clarification`,progress:`Question {{current}} of {{total}}`,questionsAriaLabel:`Questions`,rationaleLabel:`Why`,suggestionsLabel:`Suggested answers`,recommended:`Recommended`,answerLabel:`Your answer`,answerPlaceholder:`Type your answer, or choose a suggestion above...`,dismissOne:`Dismiss this question`,dismissAll:`Dismiss all questions`,saveContinue:`Save and continue`,submitting:`Submitting...`,waitForResolution:`Resolve the plan questions above to continue.`,historicalAnswer:`Answer`,historicalDismissed:`Dismissed`,status:{answered:`Answered`,dismissed:`Dismissed`,current:`Current`,unanswered:`Unanswered`},historicalStatus:{pending:`Awaiting resolution`,resolved:`Resolved`,dismissed:`Dismissed`,superseded:`Superseded`}},multiAgentTranscript:{tabAriaLabel:`Agent run tabs`,mainAgent:`Main agent`,noContent:`No transcript content was captured.`,waitingForOutput:`Waiting for subagent output...`,responseTruncated:`Response transcript truncated after 100 KB.`,thinkingTruncated:`Thinking transcript truncated after 100 KB.`,status:{running:`Running`,done:`Done`,error:`Error`,stopped:`Stopped`}},promptComposer:{followUpPromptAriaLabel:`Follow-up prompt`,sendingPromptAriaLabel:`Sending prompt`,sendPromptAriaLabel:`Send prompt`,attachImageAriaLabel:`Attach images`,uploadingImageAriaLabel:`Uploading images`,removeAttachmentAriaLabel:`Remove {{name}}`,attachmentPreviewAlt:`Selected image: {{name}}`,dropImagePrompt:`Drop images to attach`,dropImageAriaLabel:`Drop image files to attach them`},attachmentPreviewDialog:{title:`Image preview: {{name}}`,description:`Preview the attached image {{name}}.`,imageAlt:`Preview image: {{name}}`,previewImageAriaLabel:`Preview image: {{name}}`,openInNewTab:`Open in new tab`,closeAriaLabel:`Close image preview`},mermaidPreviewDialog:{title:`Diagram Preview`,description:`Preview the spec diagram in full screen.`,controlsAriaLabel:`Diagram controls`,canvasAriaLabel:`Diagram canvas. Drag with the mouse to pan.`,zoomInAriaLabel:`Zoom in`,zoomOutAriaLabel:`Zoom out`,resetViewAriaLabel:`Reset view`,zoomLevel:`{{zoom}}%`,zoomLevelAriaLabel:`Zoom level: {{zoom}}%`,closeAriaLabel:`Close diagram preview`,clickToExpand:`Click to expand diagram`},mockupPreviewDialog:{title:`UI Mockup Preview`,description:`Preview the UI mockup in full screen.`,closeAriaLabel:`Close UI mockup preview`,clickToExpand:`Click to expand UI mockup`},workspaceControls:{files:`Files`,changes:`Changes`,tests:`Tests`,checks:`Checks`,verification:`Verification`,graph:`Graph`,openIde:`Open IDE`,terminal:`Terminal`,chat:`Chat`,close:`Close`,openTerminalAriaLabel:`Open terminal`,hideTerminalAriaLabel:`Hide terminal`,terminalTitle:`Terminal`,ticketMetadataAriaLabel:`Ticket metadata`,githubActions:`Actions`,openGitHubActionsAriaLabel:`Open GitHub Actions`},projectHeader:{agent:{triggerAriaLabel:`Choose active agent`,menuAriaLabel:`Open active agent menu`,openCode:`OpenCode`,claude:`Claude`},runtime:{activityLabel:`Activity`,triggerLabel:`Tools`,triggerAriaLabel:`Open runtime tools`,githubActionsRunning:`Actions`,toolUpdateRunning:`Tool update running`,openGitHubActions:`Open GitHub Actions`,openActivity:`Open Activity`,openMobileAccess:`Open mobile access`,mobileLabel:`Mobile`,githubStatusIdle:`Idle`,githubStatusRunning:`Running`,mobileDisabled:`Mobile disabled`,mobileReadyToPair:`Mobile ready to pair`,mobileConnected:`Mobile connected`,mobilePairingExpired:`Mobile pairing expired`,mobileUnavailable:`Mobile unavailable`,openExecutionRuntimes:`Open execution runtimes`}},executionRuntimes:{title:`Execution runtimes`,description:`Check whether optional execution environments can operate on this machine.`,closeAriaLabel:`Close execution runtimes`,provider:`Optional runtime`,dockerSandbox:`Docker Sandbox`,loading:`Checking this machine...`,errorMessage:`Unable to check Docker Sandbox readiness right now.`,guidance:`Opening or rechecking these diagnostics only reads readiness and does not start services. Install and configure Docker Sandboxes using the official Docker instructions, then recheck this machine.`,productionNotice:`Docker Sandbox Build execution is opt-in and fails closed when the exact target, agent, or model is not ready.`,openGuide:`Open setup guide`,recheck:`Recheck`,rechecking:`Rechecking...`,version:`sbx {{version}}`,versionUnknown:`Version unknown`,unavailableSummary:`The remaining checks were skipped because sbx is unavailable.`,state:{loading:`Loading runtime readiness.`,unsupported:`This platform or sbx version is unsupported.`,setupRequired:`Setup is required before validation can run.`,eligible:`Available to activate when validation needs it.`,degraded:`Readiness is degraded because some evidence is unknown.`,ready:`This machine is ready for Docker Sandbox validation.`,error:`Readiness could not be checked.`},observationState:{ready:`Ready`,not_ready:`Setup required`,unknown:`Unknown`,deferred:`Deferred`,unsupported:`Unsupported`},deferredSummary:{opencode_template:`Validate OpenCode support per project target in execution settings.`,claude_template:`Validate Claude support per project target in execution settings.`},checks:{cli:`CLI`,version:`Supported version`,platform:`Platform`,virtualization:`Virtualization`,daemon:`Docker Sandbox daemon`,docker_login:`Docker account`,network_policy:`Network policy`,opencode_template:`OpenCode built-in agent`,claude_template:`Claude built-in agent`},checkDescription:{cli:`Checks whether the qualified sbx command is available.`,version:`Checks the installed sbx version against the approved command contract.`,platform:`Checks operating system and architecture support.`,virtualization:`Checks whether required virtualization support is available.`,daemon:`Checks whether the Docker Sandbox daemon can respond.`,docker_login:`Classifies Docker account readiness without displaying account or credential values.`,network_policy:`Checks whether sandbox network policy is initialized.`,opencode_template:`Checks built-in OpenCode template support.`,claude_template:`Checks built-in Claude template support.`},checkRemediation:`Follow the official setup guide, resolve this requirement, then recheck.`,virtualizationRemediation:{not_ready:`Resolve the host virtualization requirement in the official Docker Sandboxes guide, then recheck.`,unknown:`Review host virtualization diagnostics in the official Docker Sandboxes guide, then recheck.`,unsupported:`Use Linux x64 or macOS Sonoma 14+ on Apple silicon for Docker Sandboxes.`}},ticketModal:{loadingDiff:`Loading diff...`,planningChatAriaLabel:`Planning chat`,planningChatTitle:`Planning Chat`,closePlanningChatAriaLabel:`Close planning chat`,planningOpenQuestions_one:`{{count}} open question`,planningOpenQuestions_other:`{{count}} open questions`,planningFollowUpPlaceholder:`Ask the agent to refine this plan`,followUpPlanPlaceholder:`Ask a question about this implementation`,ticketChatAriaLabel:`Ticket chat`,ticketChatTitle:`Ticket Chat`,closeTicketChatAriaLabel:`Close ticket chat`,planningFailedPrefix:`Planning failed: `,openQuestionsBadge:`Open questions`,resolveQuestionsError:`Unable to resolve the plan questions right now.`,ticketTerminalAriaLabel:`Ticket terminal`,discardUnsavedTitle:`Discard unsaved edits?`,discardUnsavedDescription:`Any changes made will be lost.`,discardUnsavedConfirm:`Discard`,discardUnsavedCancel:`Keep editing`},ticketPlanDetails:{title:`Details`,ariaLabel:`Ticket details`,triggerAriaLabel:`Toggle ticket details`,closeAriaLabel:`Close details`,editTicket:`Edit ticket`,aiSettings:`AI settings`,aiSettingsAriaLabel:`AI settings`,attentionAriaLabel:`Attention required`,openPlanningChat:`Open planning chat`,viewBlockers:`View blockers`,unfinishedBlockers_one:`{{count}} unfinished blocker`,unfinishedBlockers_other:`{{count}} unfinished blockers`,targetSection:`Target`,dependenciesSection:`Dependencies`,defaultModel:`Default model`,defaultVariant:`Default variant`,usingDefaults:`Using defaults`,skillCount_one:`{{count}} skill`,skillCount_other:`{{count}} skills`},modelSelector:{dockerSandboxNotice:`Docker Sandbox only shows models from providers verified for the selected target.`,openExecutionSettings:`Verify providers in execution settings`},ticketChangesModal:{pushBranch:`Push branch`,pushing:`Pushing...`,morePushActions:`More push actions`,forcePushWithLease:`Force push with lease`,forcePushing:`Force pushing...`,loadingPullRequest:`Loading PR...`,checkingPullRequest:`Checking PR...`,createPullRequest:`Create PR`,createPullRequestTitle:`Create pull request`,createPullRequestFallbackError:`Unable to create the pull request right now.`,pullRequestCreated:`Pull request created.`,pullRequestFieldTitle:`Title`,pullRequestFieldBaseBranch:`Base branch`,pullRequestFieldDescription:`Description`,pullRequestTitlePlaceholder:`Pull request title`,pullRequestBaseBranchDescription:`Optional. Leave blank to use the repository default branch.`,pullRequestBaseBranchPlaceholder:`main`,pullRequestDescriptionPlaceholder:`Summarize the changes for reviewers.`,creatingPullRequest:`Creating PR...`,creating:`Creating...`,generatingDescription:`Generating...`,generateDescription:`Generate`,branchUnavailable:`Branch information is not available right now.`,branchPushed:`Branch pushed.`,pushCompleted:`Push completed.`,branchForcePushed:`Branch force-pushed.`,forcePushCompleted:`Force push completed.`,pushFallbackError:`Unable to push the branch right now.`,forcePushFallbackError:`Unable to force-push the branch right now.`,viewSourceSpec:`View source spec`,switchToPlan:`Switch to Plan`,switchToBuild:`Switch to Build`,committedDiffFallbackError:`Unable to load committed changes right now.`,committedSelectionUnavailable:`That local commit is no longer available. Returned to Uncommitted changes.`,committedDiffEmpty:`No committed changes to show.`,committedFiles:`Committed files`,committedFilesDescription:`Review the selected committed changes.`,allListedCommits:`All listed commits`,viewingCommittedSource:`Viewing: {{source}}`,committedReadOnly:`This committed diff is read-only.`,squashCompleted:`Local commits squashed.`,squashFallbackError:`Unable to squash local commits right now.`},bundleDetailsModal:{bundleTerminalAriaLabel:`Bundle terminal`,rename:`Rename`,renameFieldLabel:`Bundle name`,renameDescription:`The branch name will be regenerated before the branch and worktree are created.`,saveName:`Save name`,savingName:`Saving...`,cancelRename:`Cancel`,renameFallbackError:`Unable to rename the bundle right now.`,renameUnavailable:`Rename availability could not be verified. Refresh the bundle and try again.`,renameProjectContextUnavailable:`Select a project before renaming this bundle.`,continueReview:`Continue review`,rerunReview:`Re-run review`,reviewBundle:`Review Bundle`,renameReasons:{project_root:`Project root bundles cannot be renamed.`,tickets_not_plan:`Rename is unavailable because one or more bundle tickets have left Plan.`,agent_running:`Rename is unavailable while an agent is running for this bundle.`,branch_exists:`Rename is unavailable because this bundle branch already exists.`,worktree_exists:`Rename is unavailable because this bundle already has a worktree.`}},projectFooter:{detachedHead:`Detached HEAD`,unknownBranch:`Unknown branch`,branchActions:`Branch actions`,currentTargetActions:`Current target actions`,pull:`Pull`,pulling:`Pulling...`,sync:`Sync`,syncing:`Syncing...`,rebase:`Rebase`,rebaseOnto:`Rebase onto {{branch}}`,rebasing:`Rebasing...`,abortMerge:`Abort merge`,abortRebase:`Abort rebase`,aborting:`Aborting...`,branchSynced:`Project branch synced.`,branchUpdated:`Project branch updated.`,branchRebased:`Branch rebased.`,branchRebasedOnto:`Branch rebased onto {{branch}}.`,gitOperationAborted:`Git operation aborted.`,syncFallbackError:`Unable to sync the current branch right now.`,rebaseFallbackError:`Unable to rebase the current branch right now.`,abortFallbackError:`Unable to abort the current git operation right now.`,run:`Run`,stop:`Stop`,selectProjectFirst:`Select a project first.`,addRunConfig:`Add a Run config in project settings to enable selected-target runs.`,loadingProjectStatus:`Loading project status...`,stopSelectedTargetRun:`Stop the currently running selected-target run before starting another run.`,stopTicketBeforeSelectedTargetRun:`Stop the currently running ticket before starting the selected target run.`},repositoryGraphDialog:{title:`Repository graph`,target:`Target: {{target}}`,repoRootTarget:`Repo root`,repoRootTargetWithBranch:`Repo root / {{branch}}`,bundleTarget:`{{name}} / {{branch}}`,startScan:`Start scan`,refreshScan:`Refresh scan`,cancelScan:`Cancel scan`,retryScan:`Retry scan`,retryLoad:`Try again`,close:`Close`,truncatedScan:`This scan reached one or more analysis limits. Results remain useful but do not represent complete coverage.`,freshnessUnavailable:`The target is currently unavailable. Persisted results remain inspectable, but freshness cannot be verified.`,status:{title:`Status`,loading:`Loading scan status...`,neverScanned:`Never scanned`,unknown:`Scan status unavailable`,queued:`Queued`,running:`Running`,complete:`Complete and current`,completeUnverified:`Complete; freshness unavailable`,stale:`Complete but stale`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`},counts:{files:`Files`,relationships:`Relationships`,diagnostics:`Diagnostics`,analyzer:`Analyzer`},diagnostics:{show:`View diagnostics ({{count}})`,truncated:`Only a bounded diagnostic summary is shown.`},relationships:{title:`Inspect relationships`,description:`Search by file name or repository-relative path, then choose a file to inspect direct incoming or outgoing relationships.`,pathLabel:`Repository path`,pathPlaceholder:`Search files by name or path`,suggestionsLoading:`Loading file paths...`,noSuggestions:`No matching files found.`,direction:`Direction`,directions:{combined:`Both`,incoming:`Incoming`,outgoing:`Outgoing`},unavailable:`Relationship inspection is available after a scan completes.`,loading:`Loading relationships...`,truncated:`The relationship query reached its result limit. The list does not represent complete coverage.`,empty:`No direct relationships were found for this path and direction.`,showEvidence:`Show evidence`,loadingEvidence:`Loading evidence...`,kinds:{imports:`Import relationship with {{path}}`,dynamic_imports:`Dynamic import relationship with {{path}}`,requires:`Require relationship with {{path}}`,re_exports:`Re-export relationship with {{path}}`,config_reference:`Configuration relationship with {{path}}`,package_dependency:`Package dependency relationship with {{path}}`,package_export:`Package export relationship with {{path}}`,package_import:`Package import relationship with {{path}}`,workspace_member:`Workspace membership relationship with {{path}}`,tests:`Test relationship with {{path}}`,co_changes:`Often changes with {{path}}`},explanations:{imports:`Static repository analysis identified an import between these paths.`,dynamic_imports:`Static repository analysis identified a dynamic import between these paths.`,requires:`Static repository analysis identified a CommonJS require between these paths.`,re_exports:`Static repository analysis identified a re-export between these paths.`,config_reference:`A repository configuration file references the related path.`,package_dependency:`A package manifest identifies this package dependency.`,package_export:`A package manifest identifies this exported path.`,package_import:`A package manifest identifies this imported path.`,workspace_member:`Workspace configuration identifies this package membership.`,tests:`Repository structure identifies this test as covering the related path.`,co_changes:`Git history recorded these paths changing together.`},evidenceDetail:{value:`Matched value`,changeCount:`Shared changes`,sampledCommits:`Sample commits`,coverage:`Evidence coverage`,samplesTruncated:`Only a bounded sample of matching commits is shown.`}},evidence:{deterministic:{label:`Deterministic`,description:`Direct static analysis produced this relationship.`},structural_heuristic:{label:`Structural heuristic`,description:`Repository naming or layout suggests this relationship. It is not a required dependency.`},historical_heuristic:{label:`Historical heuristic`,description:`Version-control history suggests this relationship. It is not a required dependency.`}},errors:{status:`Unable to load repository graph status right now.`,operation:`Unable to update the repository graph scan right now.`,pathNotFound:`That path was not found in this scan.`,impact:`Unable to load relationships for that path right now.`,explanation:`Unable to load evidence for this relationship right now.`}},projectTargetSelector:{title:`Project target`,description:`Controls where chats, changes, tests, and project actions run.`,targetLabel:`Target`,repoRoot:`Repo root`,repoRootWithBranch:`Repo root ({{branch}})`,repoRootBranch:`Repo root branch`,activeBundleUnavailable:`Selected bundle unavailable`,loadingTarget:`Loading target...`,loadingTargets:`Loading targets...`,noBundles:`No prepared bundles yet. Manage bundles to prepare another target.`,noSearchResults:`No prepared targets match your search.`,searchPlaceholder:`Search bundles or branches`,searchAriaLabel:`Search project targets`,defaultBranch:`Default branch`,previousBranch:`Previous branch`,loadingBranches:`Loading branch suggestions...`,noSuggestedBranches:`No suggested branches available.`,switchOrCreateBranch:`Switch or create branch`,branchPlaceholder:`feature/quick-fix`,switchBranch:`Switch`,actions:`Target actions`,manageBundles:`Manage bundles`,newChatAriaLabel:`Select project target for new chat`,newSpecAriaLabel:`Select project target for new spec`,status:{selected:`Selected`,loading:`Loading status`,detachedHead:`Detached HEAD`,unknownBranch:`Unknown branch`,unavailable:`Target unavailable`,upToDate:`Up to date`,pullAvailable:`Pull available`},errors:{bundleSwitch:`Unable to switch to that bundle right now.`,repoRootSwitch:`Unable to switch the repo root target right now.`}},checksDialog:{title:`Checks`,description:`Run configured checks and inspect durable output for the selected target.`,openActivity:`Open activity`,close:`Close Checks`,configured:`Configured checks`,required:`Required for delivery`,optional:`Configured, not required`,preReview:`Runs before automatic Review`,finalOnly:`Final delivery only`,policySource:{project:`Inherited project policy`},policySummary:{title:`Required checks`,counts:`{{requiredCount}} delivery checks · {{preReviewCount}} pre-Review checks`,source:`Source: {{source}}`},gateTitle:`Automated delivery gate`,gatePassed:`Passed`,gateBlocked:`Blocked`,gateStale:`No longer current`,gateUnverifiable:`Unable to verify`,gatePolicy:`Policy {{fingerprint}}`,gateBoundary:{label:`Automation step: {{boundary}}`,check_completion:`Check completion`,automation_review:`Pre-Review checks, then automatic Review`,automation_commit:`Required checks, then commit creation`,automation_push:`Required checks, then push`,automation_pull_request:`Required checks, then pull-request creation`},gateSourceBatch:`Source batch: {{batchId}}`,gateNoBatch:`No source batch was available.`,gateScope:`Required checks govern automated delivery. They do not prevent manual or external Git operations.`,gateLoading:`Loading automated delivery gate...`,gateDetails:`Gate details`,gateReasonSummary:`Most relevant reason: {{reason}}`,gatePassedSummary:`All required checks passed for this delivery boundary.`,gateBlockedSummary:`Required evidence does not currently satisfy this delivery boundary.`,gatePolicyStatus:`Policy status: {{status}}`,gatePolicyValid:`Valid`,gatePolicyInvalid:`Invalid`,gateReasonsTitle:`Decision reasons`,gateEvidenceTitle:`Per-check evidence`,gateApplicability:{label:`Applicability to current state: workspace {{workspace}} · policy {{policy}} · overall applicability: {{overall}}`,current:`current`,stale:`stale`,unavailable:`unavailable`,overallCurrent:`applies`,overallStale:`does not apply`,overallUnverifiable:`unable to verify`},evidence:{current:`Current`,stale:`Stale`,failed:`Failed`,missing:`Missing`,interrupted:`Interrupted`,blocked:`Blocked`},reason:{not_required:`No checks were required.`,policy_invalid:`The persisted required-check policy is invalid.`,policy_drift:`The required-check policy changed.`,workspace_unavailable:`The workspace could not be inspected.`,intended_identity_mismatch:`The workspace no longer matches the intended delivery state.`,missing_evidence:`Required evidence is missing.`,target_mismatch:`Evidence belongs to a different target.`,batch_not_completed:`The source batch did not complete.`,incomplete_evidence:`The source batch has incomplete evidence.`,duplicate_evidence:`The source batch contains duplicate evidence.`,extra_evidence:`The source batch contains unexpected evidence.`,definition_drift:`A required check definition changed.`,attempt_failed:`A required check failed.`,attempt_stale:`Required evidence is stale because the workspace changed.`,target_busy:`Another check batch is already running for this target.`,check_start_failed:`Required checks could not start.`},attempts:`Check attempts`,runActions:`Check run actions`,selectionHint:`Select checks to run`,selectForRun:`Select {{name}} for the next run`,inspectAttempt:`Inspect {{name}}, {{status}}`,evidenceSelected_one:`{{count}} repair evidence source selected`,evidenceSelected_other:`{{count}} repair evidence sources selected`,selectAttemptTitle:`Select a check attempt`,selectAttemptDescription:`Choose a completed or active attempt from the check list to inspect its output and evidence.`,notRunDescription:`This check was not included in the latest run. Its configuration is shown below.`,runSelected:`Run selected`,starting:`Starting...`,stop:`Stop batch`,stopping:`Stopping...`,rerunAll:`Rerun all`,rerunFailed:`Rerun failed`,loading:`Loading durable check state...`,emptyTitle:`No check batches yet`,emptyDescription:`Select one or more configured checks to create a batch.`,stopRequested:`Stop requested`,summary:`{{passed}} passed · {{failed}} failed · {{running}} running · {{queued}} queued`,command:`Command`,directory:`Directory`,targetRoot:`Target root`,outcome:`Outcome`,currencyLabel:`Currency`,policyLabel:`Policy`,output:`Output`,rawOutput:`Raw output`,outputEmpty:`This check has not produced output yet.`,outputExpired:`Output expired under the retention policy. The durable outcome remains available.`,outputTruncated:`Older output was removed by the retention limit.`,diagnostics:{title:`Structured diagnostics`,loading:`Loading parser state...`,availableCount_one:`{{count}} structured diagnostic available`,availableCount_other:`{{count}} structured diagnostics available`,noneAvailable:`No structured diagnostics are available.`,failureOutcome:`Failure outcome: {{outcome}}`,severitySummaryLabel:`Diagnostic counts by severity`,severityCount_one:`{{count}} {{severity}}`,severityCount_other:`{{count}} {{severity}}`,totalAvailable:`{{count}} total recorded`,noStructuredDiagnostics:`No structured diagnostics were returned. Retained raw output may be available below.`,structuredDetailsUnavailable:`Structured issue details are unavailable. The recorded total remains available.`,summary_one:`{{count}} structured diagnostic from {{parser}}`,summary_other:`{{count}} structured diagnostics from {{parser}}`,selectLegend:`Select diagnostics to repair`,selectedEvidence_one:`{{count}} repair evidence source selected`,selectedEvidence_other:`{{count}} repair evidence sources selected`,diagnosticLimit:`A repair can include up to {{count}} diagnostics. Clear a selection to choose another.`,attemptLimit:`A repair can include diagnostics from up to {{count}} check attempts. Clear a selection from another attempt to continue.`,rawOutputSelect:`Use retained raw output as repair evidence`,rawOutputHint:`The server will send this persisted check output to the repair agent. Output is treated as untrusted evidence, not instructions.`,rawOutputTruncated:`Earlier output was removed by the retention limit.`,technicalDetails:`Technical details`,technicalDetailsHint:`Review evidence and repair context.`,parserLabel:`Parser`,parserStateLabel:`Parser state`,parserRetentionLabel:`Parser retention`,outputRetentionLabel:`Output retention`,applicabilityLabel:`Applicability`,sourceLabel:`Source`,source:`Source: {{source}}`,repositoryLocation:`Repository-root diagnostic (no file range)`,applicability:`Present applicability: {{state}}`,repairApplicability:`Applies to the retained batch terminal state`,retention:`Retention: {{state}}`,expired:`Structured diagnostics expired. Issue details are unavailable; retained raw output may still be available below.`,truncated:`The parser reached its diagnostic limit. Use raw output as the primary fallback.`,destinationTitle:`Repair destination`,destinationHint:`The server determines this from the blocked automation boundary.`,destination:{pre_review:`Next: pre-Review checks, then automatic Review.`,commit:`Next: required checks, then commit creation.`,push:`Next: required delivery checks, then push.`,pull_request:`Next: required delivery checks, then pull-request creation.`,manual:`Next: rerun the affected checks. No automation progression is claimed.`,unknown:`Next boundary is unavailable. No delivery progression is claimed.`},ticketLabel:`Repair ticket`,ticketPlaceholder:`Select a ticket for this repair`,repairSelected_one:`Repair {{count}} diagnostic`,repairSelected_other:`Repair {{count}} diagnostics`,repairSelectedEvidence_one:`Repair from {{count}} evidence source`,repairSelectedEvidence_other:`Repair from {{count}} evidence sources`,starting:`Starting repair...`,stopRepair:`Stop repair`,repairRunning:`Repair is running`,repairResult:{passed:`Repair rerun passed`,failed:`Repair failed`,cancelled:`Repair was stopped`,interrupted:`Repair was interrupted`},autoFix:{attempt:`Attempt {{current}} of {{total}}`,stop:`Stop automatic repair`,phase:{dispatching:`Starting automatic repair`,repairing:`Repairing checks`,fallback:`Provider continuation was rejected before execution; starting a fresh repair`,rerunning:`Rerunning checks for attempt {{current}} of {{total}}`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`},terminal:{passed:`Automatic repair passed all checks`,ineligible:`These failures cannot be repaired automatically`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair agent made no changes`,unchanged_failures:`Automatic repair made no progress`,user_cancelled:`Automatic repair was stopped by the user`,stale:`Check definitions or workspace became stale`,exhausted:`Automatic repair used all three attempts`,interrupted:`Automatic repair was interrupted`}},parser:{typescript:`TypeScript`,eslint:`ESLint`,none:`raw output`},state:{pending:`Parsing`,complete:`Parsed`,unsupported:`Unsupported parser`,malformed:`Parsing failed`,interrupted:`Parsing interrupted`},fallback:{unsupported:`This output format is unsupported. Raw output is the primary evidence.`,malformed:`Structured parsing failed. Raw output is the primary evidence.`,interrupted:`Structured parsing was interrupted. Raw output is the primary evidence.`},severity:{error:`Error`,warning:`Warning`,info:`Info`,unknown:`Unknown`},applicabilityState:{current:`current workspace`,stale:`stale workspace`,pending:`pending completion`,unavailable:`unable to verify`},retentionState:{retained:`retained`,expired:`expired`},disabled:{stale:`Repair is disabled because this diagnostic does not apply to the current workspace.`,definition_stale:`Repair is disabled because the check definition changed after this batch ran.`,workspace_changed:`Repair is disabled because the workspace changed after this batch finished.`,workspace_unavailable:`Repair is disabled because the current workspace identity could not be verified.`,evidence_identity_unavailable:`Repair is disabled because the batch terminal workspace identity is unavailable.`,unsupported:`Repair is disabled because structured parsing is unsupported or failed.`,expired:`Repair is disabled because required diagnostics or raw output expired.`,repository_root:`Repair is unavailable for repository-root attempts.`,busy:`Repair is disabled while this target has active checks or another repair.`,non_repairable:`These diagnostics are not eligible for repair.`}},status:{queued:`Queued`,running:`Running`,waiting:`Waiting`,completed:`Passed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`,notRun:`Not run`},category:{test:`Test`,typecheck:`Typecheck`,lint:`Lint`,"format-check":`Format check`,build:`Build`,coverage:`Coverage`,security:`Security`,custom:`Custom`},outcomeValue:{passed:`Passed`,command_failure:`Command failed`,spawn_failure:`Process could not start`,infrastructure_failure:`Check infrastructure failed`,evidence_persistence_failure:`Check evidence could not be saved`,timeout:`Timed out`,workspace_changed_before_start:`Workspace changed before start`,user_stop:`Stopped by user`,restart_loss:`Interrupted by server restart`,shutdown_loss:`Interrupted by server shutdown`},currency:{current:`Current`,stale:`Stale`,pending:`Pending completion`,unavailable:`Unable to verify`},errors:{load:`Unable to load checks right now.`,run:`Unable to start checks right now.`,stop:`Unable to stop this batch right now.`,rerun:`Unable to rerun checks right now.`,diagnostics:`Unable to load structured diagnostics. Raw output remains available.`,repair:`Unable to start repair right now.`,repairStop:`Unable to stop repair right now.`}},verificationDialog:{title:`Verification`,description:`Run configured checks or explore tests for the selected target.`,close:`Close verification`,openActivity:`Open Activity`,tabsAriaLabel:`Verification modes`,tabs:{checks:{label:`Checks`,description:`Run tests and other configured quality gates together as a batch.`},tests:{label:`Test Explorer`,description:`Discover and run a granular test suite, file, or case.`}},status:{checks:{inactive:`Check batch idle`,running:`Check batch running`,finished:`Check batch completed`,error:`Check batch failed`,interrupted:`Check batch interrupted`},tests:{inactive:`Test run idle`,running:`Test run running`,finished:`Test run passed`,error:`Test run failed`,interrupted:`Test run stopped`}}},testsDialog:{status:{passed:`Passed`,failed:`Failed`,running:`Running`,error:`Error`,stopped:`Stopped`,idle:`Idle`},selection:{noRunYet:`No test run yet`,allTests:`All tests`},actions:{run:`Run`,stop:`Stop`},caseRow:{runAriaLabel:`Run {{name}}`},fileRow:{expandAriaLabel:`Expand {{path}}`,collapseAriaLabel:`Collapse {{path}}`,runAriaLabel:`Run {{path}}`,testCount_one:`{{count}} test`,testCount_other:`{{count}} tests`,noNamedTests:`No named tests were detected in this file.`},scope:{label:`Test scope`,selectedCommandAriaLabel:`Selected test command`,selectTestScope:`Select test scope`,fullSuiteOnlyNotice:`This scope supports full-suite runs only, so file and case selection is disabled.`},filter:{placeholder:`Filter`,ariaLabel:`Filter test cases`,clearAriaLabel:`Clear test case filter`},discovery:{noCommands:`No test commands are configured for this target yet.`,fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`,caseCount_one:`{{count}} test case`,caseCount_other:`{{count}} test cases`,noFilesDetected:`No JS or TS test files were detected for this target yet.`,noFilterMatches:`No test cases match this filter.`},summaryCounts:{failed:`failed`,passed:`passed`,filesFailed:`files failed`,filesPassed:`files passed`},output:{trimmed:`Output trimmed to recent logs`,ariaLabel:`Test output`,empty:`No test output yet.`},messages:{loadRunnerError:`Unable to load the test runner right now.`,discoverError:`Unable to discover tests right now.`,startError:`Unable to start the selected tests right now.`,stopError:`Unable to stop the test run right now.`},dialog:{srTitle:`Tests`,srDescription:`Run configured tests for the selected project target. Completed attempts remain in project Activity after this dialog closes.`,title:`Tests`,preparingTarget:`Preparing target...`,closeAriaLabel:`Close modal`},closeConfirmation:{title:`Stop test run and close?`,description:`Closing stops the active process and removes this live discovery session. The durable attempt and its retained evidence remain in Activity.`,keepRunning:`Keep running`,stopAndClose:`Stop and close`}},githubActions:{dialog:{srTitle:`GitHub Actions`,srDescription:`List GitHub Actions workflows, dispatch them with inputs, and watch run status.`,title:`GitHub Actions`,closeAriaLabel:`Close modal`},actions:{run:`Run`,dispatch:`Run workflow`,cancel:`Cancel`,refresh:`Refresh`,openOnGithub:`Open on GitHub`},workflows:{title:`Workflows`,ariaLabel:`GitHub Actions workflows`,runAriaLabel:`Run workflow {{name}}`,stateActive:`Active`,stateDisabled:`Disabled`,empty:`No workflows found in this repository.`,emptyHint:`Add a workflow file under .github/workflows to get started.`,docsLink:`Learn more about GitHub Actions`,loadError:`Unable to load workflows right now.`,loading:`Loading workflows...`},inputs:{title:`Workflow inputs`,refLabel:`Branch or tag`,refPlaceholder:`main`,refAriaLabel:`Branch or tag ref to run the workflow on`,requiredLabel:`Required`,requiredValidationError:`Please fill in all required inputs.`,booleanYes:`Yes`,booleanNo:`No`,selectPlaceholder:`Select an option`,notDispatchable:`This workflow cannot be triggered manually.`,loading:`Loading workflow inputs...`},runs:{title:`Recent runs`,ariaLabel:`Recent GitHub Actions runs`,empty:`No runs yet. Dispatch a workflow to see its status here.`,resolving:`Resolving run...`,notVisible:`Run dispatched but not yet visible on GitHub.`,unknownRef:`Unknown branch or ref`,trackingState:{resolving:`Waiting for this run to become visible on GitHub...`,resolved:`The GitHub run was resolved.`,not_visible:`The dispatched run did not become visible on GitHub.`,ambiguous:`More than one GitHub run matched this dispatch, so Archon could not identify the run safely.`,failed:`GitHub could not provide the run state.`},durationLabel:`Duration`,stepsLabel:`Steps`,jobsLabel:`Jobs`,loadError:`Unable to load runs right now.`},status:{queued:`Queued`,in_progress:`In progress`,completed:`Completed`,unknown:`Unknown`},conclusion:{success:`Success`,failure:`Failure`,cancelled:`Cancelled`,neutral:`Neutral`,skipped:`Skipped`,timed_out:`Timed out`,action_required:`Action required`,stale:`Stale`},messages:{dispatched:`Workflow dispatched. Tracking run status...`,dispatchError:`Unable to dispatch the workflow right now.`}},planningAgentSidebar:{runStatus:{planning:`Planning...`,done:`Done`,failed:`Failed`},runSummary:{tickets:`{{count}} tickets`,dependencies:`{{count}} dependencies`,openQuestions_one:`{{count}} open question`,openQuestions_other:`{{count}} open questions`},actions:{planTickets:`Plan tickets`,openAriaLabel:`Open planning agent`,closeAriaLabel:`Close planning agent`,closePanelAriaLabel:`Close planning agent panel`,manageBundles:`Manage bundles`},tooltip:`Planning agent`,ariaLabel:`Planning agent sidebar`,title:`Planning agent`,description:`Turn a larger initiative into plan-stage tickets with dependencies and bundle context.`,descriptionLabel:`Description`,descriptionAriaLabel:`Planning description`,descriptionPlaceholder:`Describe the task, acceptance criteria, context...`,autoCreateBundle:`Auto-create bundle`,activeRuns:`Active planning runs`,recentRuns:`Recent runs`},reviewFollowUpBubble:{finding:`Finding {{count}}`,externalFix:`External fix {{count}}`,previewComment:`Preview comment {{count}}`,comment:`Comment {{count}}`,unknownTarget:`Unknown target`,textLabel:`Text`,hrefLabel:`Href`,srcLabel:`Src`,changedLineLabel:`Changed line`,selectedFixes:`Selected fixes`,fixCount_one:`{{count}} fix`,fixCount_other:`{{count}} fixes`,locationFile_one:`{{count}} file`,locationFile_other:`{{count}} files`,locationPage_one:`{{count}} page`,locationPage_other:`{{count}} pages`,locationTarget_one:`{{count}} target`,locationTarget_other:`{{count}} targets`,showRawPrompt:`Show raw prompt`,hideRawPrompt:`Hide raw prompt`,rawPrompt:`Raw prompt`},buildRequirementResolutionBubble:{displayTitle:`Build decisions`,title:`Answered Build requirements`,requirementCount_one:`{{count}} decision`,requirementCount_other:`{{count}} decisions`,ticketCount_one:`{{count}} ticket`,ticketCount_other:`{{count}} tickets`,summary:`{{requirementLabel}} across {{ticketLabel}}`,question:`Question`,decision:`Decision`,showRawPrompt:`Show raw prompt`,hideRawPrompt:`Hide raw prompt`,rawPrompt:`Raw prompt`},githubCommentMarkdown:{suggestionLabel:`Suggested change`},ticketStaticDescription:{ariaLabel:`Ticket description`,title:`Description`},ticketDependencyDetails:{blocksTitle:`Blocks`,buildReadinessAriaLabel:`Build readiness`,buildReadinessTitle:`Build readiness`,ready:`Ready`,blocked:`Blocked`,summaryReady:`All blockers have finished build.`,summaryBlocked_one:`{{count}} blocker is still waiting on build.`,summaryBlocked_other:`{{count}} blockers are still waiting on build.`,buildDone:`Build done`,waitingOnBuild:`Waiting on build`,remove:`Remove`,dependencyDetails:`Dependency details`,show:`Show`,hide:`Hide`,unknownTicket:`Unknown ticket`},ticketBuildChainPreview:{ariaLabel:`Build chain`,title:`Build chain`},runControl:{stopAriaLabel:`Stop`,stoppingAriaLabel:`Stopping run`,stoppingTitle:`Stopping run...`,stop:`Stop`,runAriaLabel:`Run`,startingAriaLabel:`Starting run`,startingTitle:`Starting run...`,run:`Run`,disabledReason:`Stop the currently running ticket before starting another run.`},ticketChangesCommitPanel:{title:`Commit selected files`,selectedFiles_one:`{{count}} file selected`,selectedFiles_other:`{{count}} files selected`,commitMessageAriaLabel:`Commit message`,commitMessagePlaceholder:`Commit message`,generateCommitMessageAriaLabel:`Generate commit message`,generating:`Generating...`,generate:`Generate`,committing:`Committing...`,commit:`Commit`},ticketChangesCommitsPanel:{changesLabel:`Local commits`,changesAriaLabel:`Local commits`,changesMenuAriaLabel:`Changes menu`,viewChangesLabel:`View changes`,viewChangesAriaLabel:`View changes`,viewChangesTitle:`View changes`,viewChangesDescription:`Choose which changes to inspect.`,localCommitsLabel:`Local commits`,localCommitsAriaLabel:`Local commits`,localCommitsTitle:`Local commits`,localCommitsDescription:`View local commits on this branch.`,diffSource:`Diff source`,branchDiff:`Branch diff`,uncommittedChanges:`Uncommitted changes`,allListedCommits:`All listed commits`,individualCommits:`Individual commits`,loading:`Loading branch commits...`,undoing:`Undoing...`,undoLatestCommit:`Undo latest commit`,squashCommits:`Squash commits...`,squashTitle:`Squash {{count}} commits?`,squashDescription:`This rewrites your unpushed commit history into one commit. Remote commits will not be changed.`,squashMessageLabel:`New commit message`,squashMessagePlaceholder:`Commit message`,squashCleanWorkspaceWarning:`The workspace must be clean. Commit, stash, or discard current changes before squashing.`,cancel:`Cancel`,squash:`Squash commits`,squashing:`Squashing...`},workspaceReviewModal:{changes:`Changes`,files:`Files`,modeAriaLabel:`Review mode`,closeAriaLabel:`Close workspace review`,chatRequired:`Open Chat to submit review comments.`},workspaceFiles:{target:`Target`,repositoryRoot:`Repository root`,bundleTarget:`{{name}}`,ticketTarget:`Ticket: {{id}}`,fileBrowser:`File browser`,searchFiles:`Search files`,searchPlaceholder:`Search by path`,changedOnly:`Changed files only`,repositoryTree:`Repository tree`,noSearchResults:`No files match your search.`,noFilterResults:`No files match this filter.`,loadingManifest:`Loading workspace files...`,manifestError:`Unable to load workspace files.`,noProject:`No project is selected.`,retry:`Retry`,truncated:`File list truncated at the server limit.`,selectFile:`Select a file`,tracked:`Tracked`,refreshFiles:`Refresh files`,viewChanges:`View changes`,empty:`Choose a readable file from the repository tree to inspect its source.`,loadingFile:`Loading {{path}}...`,contentError:`Unable to load this file.`,viewMode:{ariaLabel:`File view mode`,preview:`Preview`,source:`Source`,sourceRequiredLargeFile:`Source mode is required because this Markdown file is too large to preview.`},expandedFolder:`Expanded: {{path}}`,collapsedFolder:`Collapsed: {{path}}`,fileLabel:`{{status}}{{path}}{{comments}}`,commentsSuffix:`, {{count}} comments`,unsupported:{absolute_path:`Absolute paths cannot be opened.`,binary:`Binary files cannot be displayed.`,deleted:`This file has been deleted.`,invalid_utf8:`This file is not valid UTF-8 text.`,missing:`This file is no longer present in the workspace.`,not_in_manifest:`This file is no longer in the workspace manifest.`,not_regular_file:`This path is not a regular file.`,nul_byte:`This file contains binary data and cannot be displayed.`,oversized:`This file is too large to display.`,path_traversal:`This path is outside the selected workspace.`,symlink:`Symbolic links cannot be opened here.`,unreadable:`This file cannot be read.`},source:{ariaLabel:`Source code`,empty:`This file is empty.`,highlightingDisabledLargeFile:`Syntax highlighting is disabled because this file is too large.`,search:{open:`Search within file`,inputLabel:`Find in file`,placeholder:`Find in file`,matchCount:`{{current}} of {{total}}`,noMatches:`No matches`,previous:`Previous match`,next:`Next match`,close:`Close search`},commentOnLine:`Comment on line {{lineNumber}}`,stale:`Stale`,edit:`Edit`,remove:`Remove`,placeholder:`Tell the agent what should change`,cancel:`Cancel`,add:`Add comment`,save:`Save comment`},markdown:{ariaLabel:`Markdown preview`,empty:`This Markdown file is empty.`,disabledLargeFile:`Markdown preview is disabled because this file is too large.`,imagePlaceholder:`Image not loaded: {{alt}} ({{source}})`,imagePlaceholderNoAlt:`Image not loaded ({{source}})`,missingImageSource:`source unavailable`,missingLinkSource:`unsupported link`}},chatChangesPanel:{unknownFile:`Unknown file`,picker:{diff:`Diff`,file:`File`,allChanges:`All changes`,openChangedFilesAriaLabel:`Open changed files`,fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`,title:`Changed files`,allChangesDescription:`Review the full workspace diff.`},fileStatus:{modified:`Modified`,added:`Added`,deleted:`Deleted`,renamed:`Renamed`,untracked:`Untracked`,typechanged:`Type changed`,staged:`Staged`,unstaged:`Unstaged`,conflicted:`Conflicted`,renamedFrom:`from {{path}}`},errors:{loadDiff:`Unable to load the diff right now.`,sendChanges:`Unable to send the changes right now.`},toasts:{sendChangesSuccess:`Changes sent to chat.`},closeAriaLabel:`Close diff panel`,emptyStateTitle:`No uncommitted changes.`,emptyStateDescription:`The current project branch is clean.`},pendingFixesPopover:{triggerLabel:`Pending fixes`,title:`Pending fixes`,description:`Review selected comments and findings before sending them back to the agent.`,empty:`No pending fixes selected yet.`,manualCommentTitle:`Manual comment`,manualBadge:`Manual`,sourceLocation:`Workspace file · {{path}} · line {{line}}`,staleSource:`Source changed since this comment was added.`,edit:`Edit`,remove:`Remove`,cancel:`Cancel`,save:`Save`,editCommentLabel:`Edit pending comment`,findingTitle:`Finding {{ordinal}}`,githubReviewSummary:`GitHub review summary`,githubReviewComment:`GitHub review comment`,clear:`Clear`,sending:`Sending...`,sendFixes:`Send fixes ({{count}})`,lineReference:{oldAndNew:`old {{oldLine}}, new {{newLine}}`,newOnly:`new {{newLine}}`,oldOnly:`old {{oldLine}}`,unavailable:`line unavailable`}},ticketChangesDiffPanel:{stats:{fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`},reviewComment:{manualBadge:`Manual`,commentOnLine:`Comment on line {{lineNumber}}`,addCommentToLine:`Add a comment to line {{lineNumber}}`,ariaLabel:`Review comment for {{filePath}}`,placeholder:`Add a review comment for this change`,edit:`Edit`,remove:`Remove`,add:`Add comment`,cancel:`Cancel`},lineReference:{oldAndNew:`old {{oldLine}}, new {{newLine}}`,newOnly:`new {{newLine}}`,oldOnly:`old {{oldLine}}`,unavailable:`line unavailable`},reviewFinding:{title:`Finding {{ordinal}}`,selected:`Selected`,fix:`Fix`,hideDetails:`Hide details`,details:`Details`,whyItMatters:`Why it matters`,requestedFix:`Requested fix`,sectionTitle:`Review findings`,reviewerModel:`Reviewed with {{model}}`,reviewerModelVariant:`Reviewed with {{model}} · {{variant}}`},githubComment:{badge:`GitHub`,reviewSummary:`Review summary`,fileComment:`File comment`,inlineComment:`Inline comment`,outdated:`Outdated`,openOnGitHub:`Open on GitHub`,sectionTitle:`GitHub review comments`},viewType:{unified:`Unified`,split:`Split`},header:{allChanges:`All changes`,viewCurrentFile:`View file`,nextComment:`Next comment`,nextCommentAriaLabel:`Next review comment`,nextCommentTooltip:`Jump to the next review comment`},states:{loading:`Loading diff...`,refreshing:`Refreshing diff... Displayed changes may be outdated.`,retry:`Retry`,emptyTitle:`No changes to show.`,noRenderableFileTitle:`No renderable diff for this file in the UI.`},fileBadge:{newFile:`New file`}}},projects:{identity:{activeProjectAriaLabel:`Active project`,emptyLabel:`No projects yet`,filterPlaceholder:`Filter projects...`,emptySearch:`No matches`,newProject:`New project`,newProjectAriaLabel:`Create a new project`,editProjectSettingsAriaLabel:`Edit project settings`},modal:{dialogTitle:{create:`Add a repository to Archon`,edit:`Edit project settings`},dialogDescription:`Configure a project repository, setup commands, services, and IDE launch settings.`,header:{title:{create:`Add project`,edit:`Edit project settings`},description:{create:`Point Archon at a repository, then define only the behavior you want Archon to manage.`,edit:`Update how Archon prepares and opens worktrees for this repository.`},close:`Close modal`},navigation:{title:`Settings`,general:`General`,automation:`Automation`,execution:`Execution`,services:`Services`,checks:`Checks`,sync:`Sync`,memory:`Memory`,integrations:`Integrations`,danger:`Danger Zone`,summary:{required:`Required`,configured:`Configured`,optional:`Optional`,none:`None`,enabled:`Enabled`,disabled:`Disabled`,loading:`Loading`,blocked:`Blocked`,ready:`Ready`,host:`This machine`,dockerSandbox:`Docker Sandbox`,count:`{{count}}`,integrationsCount_one:`{{count}} enabled`,integrationsCount_other:`{{count}} enabled`}},sections:{general:{title:`General`,description:`Start with the repository Archon should use when it creates and manages worktrees for this project.`},automation:{title:`Automation`,description:`Configure helper defaults, setup behavior, and optional workflow rules Archon can apply to this project.`},execution:{title:`Execution`,description:`Choose where Build agents run and validate Docker Sandbox environments for the exact selected target.`},services:{title:`Services`,description:`Add long-running commands that Archon should start automatically inside each worktree.`},checks:{title:`Checks`,description:`Configure reusable commands and manage their project-wide execution policies.`},sync:{title:`Sync`,description:`Define which local files Archon should copy or symlink into a worktree the first time it is created.`},memory:{title:`Memory`,description:`Turn project memory on or off and manage the saved context Archon keeps outside the repository.`},integrations:{title:`Integrations`,description:`Connect external systems that add richer context to planning, tickets, and pull requests for this project.`},danger:{title:`Danger Zone`,description:`Delete this project only after its tickets and worktrees are already gone. This action cannot be undone.`}},linkedProjects:{none:`No linked projects`,count_one:`{{count}} linked project`,count_other:`{{count}} linked projects`},repoPath:{initializable:`Archon will initialize this directory as a git repository when you create the project.`,invalid:`Repository path is not a valid git repository.`,validateFailed:`Unable to validate the repository path right now.`,browseFailed:`Unable to open the folder picker.`},autoConfig:{applied:`Auto-config applied.`,noop:`Auto-config found no empty fields to fill.`,failed:`Auto-config failed.`},generatedCheckName:{scoped:`{{directory}} {{category}}`,repo:`repo {{category}}`,categories:{test:`tests`,typecheck:`typecheck`,lint:`lint`,"format-check":`format check`,build:`build`,coverage:`coverage`,security:`security`,custom:`check`}},validation:{projectNameRequired:`Project name is required.`,repositoryPathRequired:`Repository path is required.`,serviceCommandRequired:`A service command is required when a service row has values.`,syncSourceRequired:`A source path is required when a sync row has values.`,checkCommandRequired:`A command is required when a check row has values.`,checkDraftPending:`Confirm this check or cancel the draft before saving or closing.`,checkDraftNeedsAttention:`Fix the highlighted check fields, then add the check or cancel the draft.`,checkIdUnique:`Each check must have a unique ID.`,checkDirectoryRelative:`Directory must be a relative path inside the project repository.`,checkTimeoutRange:`Timeout must be a whole number between {{min}} and {{max}} milliseconds.`,previewServiceRequired:`Choose a named service before enabling preview.`},actions:{cancel:`Cancel`,createProject:`Create project`,createProjectBusy:`Creating...`,saveChanges:`Save changes`,saveChangesBusy:`Saving...`}},execution:{loading:`Loading execution readiness...`,loadError:`Unable to load project execution readiness.`,unknown:`Unknown`,provider:{title:`Build execution provider`,description:`This setting applies to new Build runs. Existing runs and their follow-ups retain their recorded execution environment.`,host:{label:`This machine`,description:`Run Build agents directly on the Archon host for compatibility with the existing workflow.`},docker_sandbox:{label:`Docker Sandbox`,description:`Run Build agents in validated, exact-target Docker Sandbox environments.`,status:{loading:`Checking runtime readiness...`,error:`Unavailable until runtime diagnostics can be checked.`,blocked:`Setup required before this can be selected.`,eligible:`Available; the daemon will start when needed.`,ready:`Available for validation.`}}},runtime:{title:`Docker Sandbox runtime`,loadError:`Unable to check Docker Sandbox runtime readiness.`,openDiagnostics:`Open runtime diagnostics`,state:{loading:`Checking whether Docker Sandbox can run on this machine.`,error:`Readiness could not be confirmed.`,blocked:`Setup is required before Docker Sandbox can be selected.`,eligible:`Ready to activate when validation needs it.`,ready:`Ready for project validation.`}},effective:{title:`Effective Build environment`,host:`This machine (host)`,docker_sandbox:`Docker Sandbox`},readiness:{loading:`Checking whether every agent environment is ready...`,runtimeLoading:`Checking Docker Sandbox runtime readiness...`,runtimeBlocked:`Blocked: configure Docker Sandbox runtime prerequisites before validating this target.`,runtimeError:`Unavailable: Docker Sandbox readiness could not be confirmed. Open runtime diagnostics and retry.`,projectRequired:`Create the project, then validate {{agents}} before starting a sandboxed Build.`,providerRequired:`Select the OpenCode provider that Docker Sandbox should validate before starting a sandboxed Build.`,ready:`Ready. {{agents}} have current validation for this exact target.`,blocked:`Blocked: {{ready}} of {{total}} required agent validations are ready for this exact target and provider.`},requirements:{title:`Docker Sandbox requirements`,exactTarget:`The environment and validation must match the exact current project target.`,agents:`OpenCode and Claude are validated independently; each Build requires its selected agent to be ready.`,failClosed:`Builds do not fall back to this machine when Docker Sandbox is selected. Missing, stale, leased, or invalid evidence blocks execution.`},target:{title:`Current target`,selected:`Selected target`,path:`Writable path`,warning:`Direct mode mounts this worktree read-write. It does not protect the selected worktree from edits made by the sandboxed agent.`,kind:{"project-root":`Repository root`,"bundle-worktree":`Bundle worktree`,"branch-worktree":`Branch worktree`}},agent:{opencode:`OpenCode`,claude:`Claude`},validation:{title:`Agent sandbox validation`,action:`Validate {{agent}}`,validating:`Validating...`,notValidated:`Not validated`,ready:`Ready`,notReady:`Setup required or degraded`,environmentWillPrepare:`Every explicit validation rechecks runtime readiness and may automatically start the Docker Sandbox daemon when eligible before it prepares, reconnects to, or revalidates this agent's dedicated exact-target sandbox.`,stale:`This result belongs to a prior execution environment or project target and is stale.`,runState:`Execution-run state`,provider:`Validation provider`,providerLabel:`OpenCode provider for validation`,providerDescription:`Docker Sandbox validates provider access with a representative model. Models from the approved provider can then be selected for ticket Build, with the selected model rechecked before execution.`,probeModel:`Probe model`,providerNotSelected:`Not selected`,credentialDescription:`Docker Sandbox uses its own template or proxy credential setup; host OpenCode and Claude logins are not imported automatically.`,secretSetup:"For the Docker credential proxy, configure {{service}} on the host with `sbx secret set {{service}}` before validating. Archon never receives the secret.",secretSetupUnsupported:`No qualified Docker credential mapping is known for {{provider}}. Configure this provider using its documented sandbox flow before validating.`,providerLoading:`Loading available OpenCode providers...`,providerPlaceholder:`Select a provider before validating OpenCode`,verifiedOption:`sandbox verified`,modelNotSelected:`Not selected`,isolation:`Effective isolation`,template:`Template identity`,authentication:`Authentication`,skills:`Sandbox skills`,destinations:`Required destinations`,checkKind:{workspace_location:`Workspace location`,workspace_readable:`Workspace readability`,workspace_writable:`Workspace writability`,executable:`Executable`,headless:`Headless mode`,authentication:`Authentication`,skills:`Sandbox skills`,destination:`Destination access`},destinationReason:{invalid_json:`The agent returned an invalid structured response.`,nonzero_exit:`The destination command exited unsuccessfully.`,timeout:`The destination validation exceeded its time limit.`,provider_error:`The provider reported an error while serving the selected model.`,model_not_found:`The selected model is not available in the sandbox provider.`,credential_rejected:`The provider rejected the sandbox credential or proxy mapping.`,unexpected_response:`The agent response did not match the validation sentinel.`},checkReason:{model_required:`An explicit OpenCode model is required for this validation.`,provider_required:`An explicit OpenCode provider is required for this validation.`,credential_inventory_unavailable:`Docker Sandbox credential inventory could not be read, so provider-specific access could not be verified.`},evidence:{title:`{{check}} evidence`,reason:`Reason: {{reason}}`,providerName:`Provider error: {{name}}.`,providerMessage:`Provider message: {{message}}`,providerReference:`Provider reference: {{reference}}`,runReference:`Archon run: {{runId}}; correlation: {{correlationId}}`,exitCode:`Exit code: {{code}}.`,exitCodeUnknown:`unknown`,truncated:`Output was truncated.`},interruption:`Interruption`,interrupted:`Interrupted; the persistent environment may still be available`,notInterrupted:`Not interrupted`,remediation:`Resolve the failed checks, configure provider access through the Docker Sandbox setup, and validate this provider again.`,error:`Unable to validate the {{agent}} environment.`,failure:`Failure`},checkState:{passed:`Passed`,failed:`Setup required`,cancelled:`Interrupted`},credentialSource:{stored:`stored credential`,environment:`environment or proxy credential`,brokered:`Docker credential proxy`,brokeredWithService:`Docker credential proxy: {{service}}`,guest:`guest authentication`,none:`no credential source`,unknown:`unknown credential source`},reset:{action:`Reset sandbox`,confirm:`Reset this Docker Sandbox? It removes the persistent sandbox state and requires validation again.`,resetting:`Resetting...`,error:`Unable to reset the Docker Sandbox.`},runState:{queued:`Queued`,running:`Running`,waiting:`Waiting`,completed:`Completed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`},isolation:{microvm:`MicroVM`,unknown:`Unknown`}},advanced:{summary:{none:`None`,configured:`Configured`,toolDefault:`Tool default`,implementingModel:`Implementing model per ticket`,default:`Default`,customRules:`Custom rules`,autoParkOn:`Auto-park on`,specAwareOn:`Spec coverage on`,modified:`Modified`,enabled:`Enabled`,manualOnly:`Manual only`,depthOnly:`{{depth}}`,depthWithFix:`{{depth}} + fix loop`,disabled:`Disabled`,watching:`Watching {{name}}`,commandCount_one:`{{count}} command`,commandCount_other:`{{count}} commands`,serviceCount_one:`{{count}} service`,serviceCount_other:`{{count}} services`,ruleCount_one:`{{count}} rule`,ruleCount_other:`{{count}} rules`},autoConfigPanel:{badge:`Auto-config`,description:`Inspect the repo and fill any empty setup, service, or sync fields.`,note:`Existing values stay untouched. Uses helper model if set, otherwise the selected tool's default model.`,loading:`Inspecting repo...`,action:`Auto-config`},helperModel:{title:`Helper model`,description:`Set an optional OpenCode model for auto-config and other lightweight project tasks.`,panelDescription:`Used for auto-config and other lightweight project tasks. Leave empty to use the selected tool's default model.`,unavailable:`OpenCode model discovery is unavailable right now. Leave this setting empty to use the selected tool's default model.`},reviewerModel:{title:`Reviewer model`,description:`Set an optional OpenCode model for project code and spec reviews.`,unavailable:`OpenCode model discovery is unavailable right now. Leave this setting empty to use the implementing model for each ticket.`,modelLabel:`Reviewer model`,variantLabel:`Reviewer variant`,defaultModel:`Implementing model per ticket`},modelSelection:{loading:`Loading OpenCode models...`,modelLabel:`Model`,variantLabel:`Variant`,defaultModel:`Use default model`,defaultVariant:`Use model default`,availableVariants:`Available variants`},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. Execution policies are managed separately below.`,addCommand:`Add check`,empty:`No checks yet. Add one manually or use auto-config to seed a starting point.`,configuredTitle:`Configured checks`,composer:{title:`Add a check`,commandDetails:`Command details`,addAction:`Add check`,confirmAction:`Add to checks`,cancelAction:`Cancel draft`,nameAriaLabel:`Draft check name`,commandAriaLabel:`Draft check command`,categoryAriaLabel:`Draft check category`,directoryAriaLabel:`Draft check directory`,timeoutAriaLabel:`Draft check timeout`,runnerAriaLabel:`Draft test runner`}},checkPolicies:{title:`Check policies`,description:`Choose when each configured check runs and whether Archon may repair its failures automatically. Run before Review requires Required for delivery; Auto-fix is independent.`,empty:`Add a check definition before configuring check policies.`,check:`Check`,required:`Required for delivery`,preReview:`Run before Review`,postBuild:`Run after build`,autoFix:`Auto-fix failures`,aria:{required:`Require {{name}} for delivery`,preReview:`Run {{name}} before Review`,postBuild:`Run {{name}} after build`,autoFix:`Auto-fix {{name}} failures`}},sync:{title:`Worktree sync`,description:`Copy or symlink files into a new worktree only the first time Archon creates it.`,addRule:`Add sync rule`,empty:`No sync rules yet. Add one for files like env or local config templates.`}},serviceRow:{title:`Service {{index}}`,description:`Runs from the worktree after setup completes.`,remove:`Remove`,fields:{nameLabel:`Name`,nameDescription:`Optional stable identifier used by preview selection.`,nameAriaLabel:`Service name {{index}}`,namePlaceholder:`web`,commandLabel:`Command`,commandAriaLabel:`Service command {{index}}`,commandPlaceholder:`npm run dev`,workingDirectoryLabel:`Working directory`,workingDirectoryDescription:`Relative to the worktree root.`,workingDirectoryAriaLabel:`Working directory {{index}}`,workingDirectoryPlaceholder:`client`}},checkDefinitionRow:{title:`Check {{index}}`,description:`A reusable project command. Test checks are also available in the Tests dialog.`,remove:`Remove`,removeAriaLabel:`Remove check {{name}}`,toggleAriaLabel:`Toggle check {{name}} details`,summary:{unnamed:`Unnamed check`,noCommand:`No command configured`,required:`Required`,preReview:`Pre-Review`,postBuild:`Post-Build`,runner:`Runner: {{runner}}`},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
@@ -114,7 +114,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
114
114
  To pick up a draggable item, press the space bar.
115
115
  While dragging, use the arrow keys to move the item.
116
116
  Press space again to drop the item in its new position, or press escape to cancel.
117
- `},PN={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function FN(e){let{announcements:t=PN,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=NN}=e,{announce:a,announcement:o}=kN(),s=hN(`DndLiveRegion`),[c,l]=(0,p.useState)(!1);if((0,p.useEffect)(()=>{l(!0)},[]),jN((0,p.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=p.createElement(p.Fragment,null,p.createElement(DN,{id:r,value:i.draggable}),p.createElement(ON,{id:s,announcement:o}));return n?(0,m.createPortal)(u,n):u}var IN;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(IN||={});function LN(){}function RN(e,t){return(0,p.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function zN(){var e=[...arguments];return(0,p.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var BN=Object.freeze({x:0,y:0});function VN(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function HN(e,t){let n=SN(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function UN(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function WN(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function GN(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function KN(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function qN(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var JN=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=qN(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(WN)};function YN(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var XN=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&YN(r,a)){let n=GN(a).reduce((e,t)=>e+VN(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(UN)};function ZN(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function QN(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:BN}function $N(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var eP=$N(1);function tP(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function nP(e,t,n){let r=tP(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var rP={ignoreTransform:!1};function iP(e,t){t===void 0&&(t=rP);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=nN(e).getComputedStyle(e);t&&(n=nP(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function aP(e){return iP(e,{ignoreTransform:!0})}function oP(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function sP(e,t){return t===void 0&&(t=nN(e).getComputedStyle(e)),t.position===`fixed`}function cP(e,t){t===void 0&&(t=nN(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function lP(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(rN(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!iN(i)||aN(i)||n.includes(i))return n;let a=nN(e).getComputedStyle(i);return i!==e&&cP(i,a)&&n.push(i),sP(i,a)?n:r(i.parentNode)}return e?r(e):n}function uP(e){let[t]=lP(e,1);return t??null}function dP(e){return!$M||!e?null:eN(e)?e:tN(e)?rN(e)||e===oN(e).scrollingElement?window:iN(e)?e:null:null}function fP(e){return eN(e)?e.scrollX:e.scrollLeft}function pP(e){return eN(e)?e.scrollY:e.scrollTop}function mP(e){return{x:fP(e),y:pP(e)}}var hP;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(hP||={});function gP(e){return!$M||!e?!1:e===document.scrollingElement}function _P(e){let t={x:0,y:0},n=gP(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var vP={x:.2,y:.2};function yP(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=vP);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=_P(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=hP.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=hP.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=hP.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=hP.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function bP(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function xP(e){return e.reduce((e,t)=>_N(e,mP(t)),BN)}function SP(e){return e.reduce((e,t)=>e+fP(t),0)}function pae(e){return e.reduce((e,t)=>e+pP(t),0)}function CP(e,t){if(t===void 0&&(t=iP),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);uP(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var mae=[[`x`,[`left`,`right`],SP],[`y`,[`top`,`bottom`],pae]],wP=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=lP(t),r=xP(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of mae)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},TP=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function hae(e){let{EventTarget:t}=nN(e);return e instanceof t?e:oN(e)}function EP(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var DP;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(DP||={});function OP(e){e.preventDefault()}function gae(e){e.stopPropagation()}var kP;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(kP||={});var AP={start:[kP.Space,kP.Enter],cancel:[kP.Esc],end:[kP.Space,kP.Enter,kP.Tab]},_ae=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case kP.Right:return{...n,x:n.x+25};case kP.Left:return{...n,x:n.x-25};case kP.Down:return{...n,y:n.y+25};case kP.Up:return{...n,y:n.y-25}}},jP=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new TP(oN(t)),this.windowListeners=new TP(nN(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(DP.Resize,this.handleCancel),this.windowListeners.add(DP.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(DP.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&CP(n),t(BN)}handleKeyDown(e){if(bN(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=AP,coordinateGetter:a=_ae,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:BN;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=vN(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=_P(n),p=bP(n),m={x:Math.min(i===kP.Right?p.right-p.width/2:p.right,Math.max(i===kP.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===kP.Down?p.bottom-p.height/2:p.bottom,Math.max(i===kP.Down?p.top:p.top+p.height/2,u.y))},h=i===kP.Right&&!s||i===kP.Left&&!c,g=i===kP.Down&&!l||i===kP.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===kP.Right&&e<=d.x||i===kP.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===kP.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===kP.Down&&e<=d.y||i===kP.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===kP.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,_N(vN(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};jP.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=AP,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function MP(e){return!!(e&&`distance`in e)}function NP(e){return!!(e&&`delay`in e)}var PP=class{constructor(e,t,n){n===void 0&&(n=hae(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=oN(i),this.documentListeners=new TP(this.document),this.listeners=new TP(n),this.windowListeners=new TP(nN(i)),this.initialCoordinates=SN(r)??BN,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(DP.Resize,this.handleCancel),this.windowListeners.add(DP.DragStart,OP),this.windowListeners.add(DP.VisibilityChange,this.handleCancel),this.windowListeners.add(DP.ContextMenu,OP),this.documentListeners.add(DP.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(NP(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(MP(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(DP.Click,gae,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(DP.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=SN(e)??BN,s=vN(n,o);if(!t&&a){if(MP(a)){if(a.tolerance!=null&&EP(s,a.tolerance))return this.handleCancel();if(EP(s,a.distance))return this.handleStart()}if(NP(a)&&EP(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===kP.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},vae={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},FP=class extends PP{constructor(e){let{event:t}=e,n=oN(t.target);super(e,vae,n)}};FP.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var yae={move:{name:`mousemove`},end:{name:`mouseup`}},IP;(function(e){e[e.RightClick=2]=`RightClick`})(IP||={});var bae=class extends PP{constructor(e){super(e,yae,oN(e.event.target))}};bae.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===IP.RightClick?!1:(r?.({event:n}),!0)}}];var LP={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},xae=class extends PP{constructor(e){super(e,LP)}static setup(){return window.addEventListener(LP.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(LP.move.name,e)};function e(){}}};xae.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var RP;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(RP||={});var zP;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(zP||={});function Sae(e){let{acceleration:t,activator:n=RP.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=zP.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,m=wae({delta:d,disabled:!a}),[h,g]=lN(),_=(0,p.useRef)({x:0,y:0}),v=(0,p.useRef)({x:0,y:0}),y=(0,p.useMemo)(()=>{switch(n){case RP.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case RP.DraggableRect:return i}},[n,i,c]),b=(0,p.useRef)(null),x=(0,p.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,p.useMemo)(()=>s===zP.TreeOrder?[...l].reverse():l,[s,l]);(0,p.useEffect)(()=>{if(!a||!l.length||!y){g();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=yP(e,n,y,t,f);for(let e of[`x`,`y`])m[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){g(),b.current=e,h(x,o),_.current=a,v.current=i;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[t,x,r,g,a,o,JSON.stringify(y),JSON.stringify(m),h,l,S,u,JSON.stringify(f)])}var Cae={x:{[hP.Backward]:!1,[hP.Forward]:!1},y:{[hP.Backward]:!1,[hP.Forward]:!1}};function wae(e){let{delta:t,disabled:n}=e,r=pN(t);return dN(e=>{if(n||!r||!e)return Cae;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hP.Backward]:e.x[hP.Backward]||i.x===-1,[hP.Forward]:e.x[hP.Forward]||i.x===1},y:{[hP.Backward]:e.y[hP.Backward]||i.y===-1,[hP.Forward]:e.y[hP.Forward]||i.y===1}}},[n,t,r])}function Tae(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return dN(e=>t==null?null:r??e??null,[r,t])}function Eae(e,t){return(0,p.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var BP;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(BP||={});var VP;(function(e){e.Optimized=`optimized`})(VP||={});var HP=new Map;function Dae(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,p.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,p.useRef)(e),d=_(),f=uN(d),m=(0,p.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),h=(0,p.useRef)(null),g=dN(t=>{if(d&&!n)return HP;if(!t||t===HP||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new wP(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,p.useEffect)(()=>{u.current=e},[e]),(0,p.useEffect)(()=>{d||m()},[n,d]),(0,p.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,p.useEffect)(()=>{d||typeof s!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,d,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function _(){switch(l){case BP.Always:return!1;case BP.BeforeDragging:return n;default:return!n}}}function UP(e,t){return dN(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Oae(e,t){return UP(e,t)}function kae(e){let{callback:t,disabled:n}=e,r=cN(t),i=(0,p.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,p.useEffect)(()=>()=>i?.disconnect(),[i]),i}function WP(e){let{callback:t,disabled:n}=e,r=cN(t),i=(0,p.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,p.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Aae(e){return new wP(iP(e),e)}function GP(e,t,n){t===void 0&&(t=Aae);let[r,i]=(0,p.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=kae({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=WP({callback:a});return sN(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function jae(e){return QN(e,UP(e))}var KP=[];function Mae(e){let t=(0,p.useRef)(e),n=dN(n=>e?n&&n!==KP&&e&&t.current&&e.parentNode===t.current.parentNode?n:lP(e):KP,[e]);return(0,p.useEffect)(()=>{t.current=e},[e]),n}function Nae(e){let[t,n]=(0,p.useState)(null),r=(0,p.useRef)(e),i=(0,p.useCallback)(e=>{let t=dP(e.target);t&&n(e=>e?(e.set(t,mP(t)),new Map(e)):null)},[]);return(0,p.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=dP(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,mP(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{dP(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,p.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>_N(e,t),BN):xP(e):BN,[e,t])}function qP(e,t){t===void 0&&(t=[]);let n=(0,p.useRef)(null);return(0,p.useEffect)(()=>{n.current=null},t),(0,p.useEffect)(()=>{let t=e!==BN;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?vN(e,n.current):BN}function Pae(e){(0,p.useEffect)(()=>{if(!$M)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Fae(e,t){return(0,p.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function JP(e){return(0,p.useMemo)(()=>e?oP(e):null,[e])}var YP=[];function Iae(e,t){t===void 0&&(t=iP);let[n]=e,r=JP(n?nN(n):null),[i,a]=(0,p.useState)(YP);function o(){a(()=>e.length?e.map(e=>gP(e)?r:new wP(t(e),e)):YP)}let s=WP({callback:o});return sN(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function XP(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return iN(t)?t:e}function Lae(e){let{measure:t}=e,[n,r]=(0,p.useState)(null),i=WP({callback:(0,p.useCallback)(e=>{for(let{target:n}of e)if(iN(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=fN((0,p.useCallback)(e=>{let n=XP(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,p.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Rae=[{sensor:FP,options:{}},{sensor:jP,options:{}}],zae={current:{}},ZP={draggable:{measure:aP},droppable:{measure:aP,strategy:BP.WhileDragging,frequency:VP.Optimized},dragOverlay:{measure:iP}},QP=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Bae={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new QP,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:LN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ZP,measureDroppableContainers:LN,windowRect:null,measuringScheduled:!1},$P={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:LN,draggableNodes:new Map,over:null,measureDroppableContainers:LN},eF=(0,p.createContext)($P),tF=(0,p.createContext)(Bae);function Vae(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new QP}}}function Hae(e,t){switch(t.type){case IN.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case IN.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case IN.DragEnd:case IN.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case IN.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new QP(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case IN.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new QP(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case IN.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new QP(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Uae(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,p.useContext)(eF),a=pN(r),o=pN(n?.id);return(0,p.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!bN(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=TN(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function nF(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Wae(e){return(0,p.useMemo)(()=>({draggable:{...ZP.draggable,...e?.draggable},droppable:{...ZP.droppable,...e?.droppable},dragOverlay:{...ZP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Gae(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,p.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;sN(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=QN(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=uP(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var rF=(0,p.createContext)({...BN,scaleX:1,scaleY:1}),iF;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(iF||={});var Kae=(0,p.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Rae,collisionDetection:o=JN,measuring:s,modifiers:c,...l}=e,[u,d]=(0,p.useReducer)(Hae,void 0,Vae),[f,h]=MN(),[g,_]=(0,p.useState)(iF.Uninitialized),v=g===iF.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=u,C=y==null?null:b.get(y),w=(0,p.useRef)({initial:null,translated:null}),T=(0,p.useMemo)(()=>y==null?null:{id:y,data:C?.data??zae,rect:w},[y,C]),E=(0,p.useRef)(null),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(null),j=uN(l,Object.values(l)),M=hN(`DndDescribedBy`,t),N=(0,p.useMemo)(()=>S.getEnabled(),[S]),P=Wae(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=Dae(N,{dragging:v,dependencies:[x.x,x.y],config:P.droppable}),R=Tae(b,y),ee=(0,p.useMemo)(()=>k?SN(k):null,[k]),te=Ee(),z=Oae(R,P.draggable.measure);Gae({activeNode:y==null?null:b.get(y),config:te.layoutShiftCompensation,initialRect:z,measure:P.draggable.measure});let B=GP(R,P.draggable.measure,z),V=GP(R?R.parentElement:null),H=(0,p.useRef)({activatorEvent:null,active:null,activeNode:R,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),U=S.getNodeFor(H.current.over?.id),ne=Lae({measure:P.dragOverlay.measure}),re=ne.nodeRef.current??R,ie=v?ne.rect??B:null,ae=!!(ne.nodeRef.current&&ne.rect),oe=jae(ae?null:B),W=JP(re?nN(re):null),se=Mae(v?U??R:null),ce=Iae(se),le=nF(c,{transform:{x:x.x-oe.x,y:x.y-oe.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:B,containerNodeRect:V,draggingNodeRect:ie,over:H.current.over,overlayNodeRect:ne.rect,scrollableAncestors:se,scrollableAncestorRects:ce,windowRect:W}),ue=ee?_N(ee,x):null,de=Nae(se),fe=qP(de),pe=qP(de,[B]),me=_N(le,fe),he=ie?eP(ie,le):null,ge=T&&he?o({active:T,collisionRect:he,droppableRects:F,droppableContainers:N,pointerCoordinates:ue}):null,_e=KN(ge,`id`),[ve,ye]=(0,p.useState)(null),be=ZN(ae?le:_N(le,pe),ve?.rect??null,B),xe=(0,p.useRef)(null),Se=(0,p.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(E.current==null)return;let i=b.get(E.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:E.current,activeNode:i,event:a,options:r,context:H,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let n=b.get(t);if(!n)return;let{onDragStart:r}=j.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,m.unstable_batchedUpdates)(()=>{r?.(i),_(iF.Initializing),d({type:IN.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),O(xe.current),A(a)})},onMove(e){d({type:IN.DragMove,coordinates:e})},onEnd:o(IN.DragEnd),onCancel:o(IN.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=H.current,o=null;if(t&&i){let{cancelDrop:s}=j.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===IN.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=IN.DragCancel)}E.current=null,(0,m.unstable_batchedUpdates)(()=>{d({type:e}),_(iF.Uninitialized),ye(null),O(null),A(null),xe.current=null;let t=e===IN.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=j.current[t];e?.(o),f({type:t,event:o})}})}}},[b]),Ce=Eae(a,(0,p.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,Se(n,t))},[b,Se]));Pae(a),sN(()=>{B&&g===iF.Initializing&&_(iF.Initialized)},[B,g]),(0,p.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:n,collisions:r,over:i}=H.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,m.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,p.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=H.current;if(!e||E.current==null||!t||!i)return;let{onDragOver:a}=j.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,m.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),sN(()=>{H.current={activatorEvent:k,active:T,activeNode:R,collisionRect:he,collisions:ge,droppableRects:F,draggableNodes:b,draggingNode:re,draggingNodeRect:ie,droppableContainers:S,over:ve,scrollableAncestors:se,scrollAdjustedTranslate:me},w.current={initial:ie,translated:he}},[T,R,ge,he,b,re,ie,F,S,ve,se,me]),Sae({...te,delta:x,draggingRect:he,pointerCoordinates:ue,scrollableAncestors:se,scrollableAncestorRects:ce});let we=(0,p.useMemo)(()=>({active:T,activeNode:R,activeNodeRect:B,activatorEvent:k,collisions:ge,containerNodeRect:V,dragOverlay:ne,draggableNodes:b,droppableContainers:S,droppableRects:F,over:ve,measureDroppableContainers:I,scrollableAncestors:se,scrollableAncestorRects:ce,measuringConfiguration:P,measuringScheduled:L,windowRect:W}),[T,R,B,k,ge,V,ne,b,S,F,ve,I,se,ce,P,L,W]),Te=(0,p.useMemo)(()=>({activatorEvent:k,activators:Ce,active:T,activeNodeRect:B,ariaDescribedById:{draggable:M},dispatch:d,draggableNodes:b,over:ve,measureDroppableContainers:I}),[k,Ce,T,B,d,M,b,ve,I]);return p.createElement(AN.Provider,{value:h},p.createElement(eF.Provider,{value:Te},p.createElement(tF.Provider,{value:we},p.createElement(rF.Provider,{value:be},i)),p.createElement(Uae,{disabled:n?.restoreFocus===!1})),p.createElement(FN,{...n,hiddenTextDescribedById:M}));function Ee(){let e=D?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=v&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),qae=(0,p.createContext)(null),aF=`button`,Jae=`Draggable`;function oF(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=hN(Jae),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,p.useContext)(eF),{role:m=aF,roleDescription:h=`draggable`,tabIndex:g=0}=i??{},_=c?.id===t,v=(0,p.useContext)(_?rF:qae),[y,b]=fN(),[x,S]=fN(),C=Fae(o,t),w=uN(n);return sN(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,p.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":_&&m===aF?!0:void 0,"aria-roledescription":h,"aria-describedby":u.draggable}),[r,m,g,_,h,u.draggable]),isDragging:_,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function Yae(){return(0,p.useContext)(tF)}var Xae=`Droppable`,Zae={timeout:25};function sF(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=hN(Xae),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,p.useContext)(eF),u=(0,p.useRef)({disabled:n}),d=(0,p.useRef)(!1),f=(0,p.useRef)(null),m=(0,p.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={...Zae,...i},v=uN(g??r),y=WP({callback:(0,p.useCallback)(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{l(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!o}),[b,x]=fN((0,p.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=uN(t);return(0,p.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,p.useEffect)(()=>(s({type:IN.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:IN.UnregisterDroppable,key:a,id:r})),[r]),(0,p.useEffect)(()=>{n!==u.current.disabled&&(s({type:IN.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function Qae(e){let{animation:t,children:n}=e,[r,i]=(0,p.useState)(null),[a,o]=(0,p.useState)(null),s=pN(n);return!n&&!r&&s&&i(s),sN(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),p.createElement(p.Fragment,null,n,r?(0,p.cloneElement)(r,{ref:o}):null)}var $ae={x:0,y:0,scaleX:1,scaleY:1};function eoe(e){let{children:t}=e;return p.createElement(eF.Provider,{value:$P},p.createElement(rF.Provider,{value:$ae},t))}var toe={position:`fixed`,touchAction:`none`},noe=e=>bN(e)?`transform 250ms ease`:void 0,roe=(0,p.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=noe}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...toe,width:s.width,height:s.height,top:s.top,left:s.left,transform:CN.Transform.toString(d),transformOrigin:i&&r?HN(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return p.createElement(n,{className:o,style:f,ref:t},a)}),ioe={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:CN.Transform.toString(t)},{transform:CN.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function aoe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return cN((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=XP(a);if(!c)return;let{transform:l}=nN(a).getComputedStyle(a),u=tP(l);if(!u)return;let d=typeof t==`function`?t:ooe(t);return CP(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function ooe(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...ioe,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var cF=0;function soe(e){return(0,p.useMemo)(()=>{if(e!=null)return cF++,cF},[e])}var coe=p.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:m,draggableNodes:h,droppableContainers:g,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:x,windowRect:S}=Yae(),C=(0,p.useContext)(rF),w=soe(d?.id),T=nF(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:m,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:b,scrollableAncestorRects:x,transform:C,windowRect:S}),E=UP(f),D=aoe({config:r,draggableNodes:h,droppableContainers:g,measuringConfiguration:y}),O=E?_.setRef:void 0;return p.createElement(eoe,null,p.createElement(Qae,{animation:D},d&&w?p.createElement(roe,{key:w,id:d.id,ref:O,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:E,style:{zIndex:l,...i},transform:T},n):null))}),loe=3e4,lF=new Map,uF=new Map,dF=e=>!!(e&&Date.now()-e.timestamp<loe),fF=e=>{let t=lF.get(e);return{tool:e,models:t?.models??[],isLoading:!dF(t),error:null}},uoe=e=>{let t=uF.get(e);if(t)return t;let n=Rr(e).then(t=>(lF.set(e,{models:t,timestamp:Date.now()}),t)),r=()=>{uF.get(e)===n&&uF.delete(e)};return n.then(()=>{r()},()=>{r()}),uF.set(e,n),n},pF=e=>{let[t,n]=(0,p.useState)(()=>fF(e));(0,p.useEffect)(()=>{let t=lF.get(e);if(dF(t)){n({tool:e,models:t?.models??[],isLoading:!1,error:null});return}let r=!1;return n({tool:e,models:t?.models??[],isLoading:!0,error:null}),uoe(e).then(t=>{r||n({tool:e,models:t,isLoading:!1,error:null})}).catch(t=>{r||n({tool:e,models:lF.get(e)?.models??[],isLoading:!1,error:t instanceof Error?t:Error(String(t))})}),()=>{r=!0}},[e]);let r=t.tool===e?t:fF(e);return{models:r.models,isLoading:r.isLoading,error:r.error}},mF=async(e,t,n=null)=>{let r=new URLSearchParams({tool:e});n&&r.set(`project_id`,n);let i=await J(q(`/skills?${r.toString()}`),{signal:t,cache:`no-store`});return Array.isArray(i)?i.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.name==`string`&&typeof t.description==`string`}):[]},doe=new Set([`check_completion`,`automation_review`,`automation_commit`,`automation_push`,`automation_pull_request`]),foe=new Set([`not_required`,`policy_invalid`,`policy_drift`,`workspace_unavailable`,`intended_identity_mismatch`,`missing_evidence`,`target_mismatch`,`batch_not_completed`,`incomplete_evidence`,`duplicate_evidence`,`extra_evidence`,`definition_drift`,`attempt_failed`,`attempt_stale`,`target_busy`,`check_start_failed`]),poe=e=>{try{let t=JSON.parse(e);return t.type!==`required_check_gate_failure`||typeof t.boundaryKind!=`string`||!doe.has(t.boundaryKind)||t.reasonCodes!==void 0&&(!Array.isArray(t.reasonCodes)||t.reasonCodes.some(e=>typeof e!=`string`))?null:t}catch{return null}},hF=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,gF=e=>{let t=poe(e);if(!t)return null;let n=(t.reasonCodes??[]).filter(e=>foe.has(e)).map(e=>Wb.t(`common:ticketAutomation.pause.requiredChecks.reason.${e}`)),r=n.length>0?`${n.map((e,t)=>t===0?hF(e):e).join(`; `)}.`:`${hF(Wb.t(`common:ticketAutomation.pause.requiredChecks.fallbackReason`))}.`;return Wb.t(`common:ticketAutomation.pause.requiredChecks.failure`,{boundary:Wb.t(`common:ticketAutomation.pause.requiredChecks.boundary.${t.boundaryKind}`),explanation:r})},_F=240,moe=e=>{switch(e){case`precondition_failed`:return`ticketAutomation.pause.guidance.preconditionFailed`;case`stage_failed`:return`ticketAutomation.pause.guidance.stageFailed`;case`server_restart`:return`ticketAutomation.pause.guidance.serverRestart`;case`reconciliation_failed`:return`ticketAutomation.pause.guidance.reconciliationFailed`;case`side_effect_ambiguous`:return`ticketAutomation.pause.guidance.sideEffectAmbiguous`;case`manual_transition`:return`ticketAutomation.pause.guidance.manualTransition`;case`configuration_changed`:return`ticketAutomation.pause.guidance.configurationChanged`;case`target_busy`:return`ticketAutomation.pause.guidance.targetBusy`;case`required_checks_failed`:return`ticketAutomation.pause.guidance.requiredChecksFailed`;case`invalid_lineage`:return`ticketAutomation.pause.guidance.invalidLineage`;default:return`ticketAutomation.pause.guidance.generic`}},hoe=e=>{let t=e.trim().replace(/\s+/g,` `);return t.length<=_F?t:`${t.slice(0,_F-3)}...`},goe=e=>e.status===`disabled`?`ticketAutomation.pause.resumeDisabled.${e.reason}`:`ticketAutomation.pause.resumeOutcome.${e.outcome}`,vF=e=>{let{onResume:t,onDismiss:n,onResolveQuestions:r,onOpenChecks:i,onStop:a,showActions:o=!0,className:s}=e,{t:c}=K(`common`),[l,u]=(0,p.useState)(!1),d=(0,p.useRef)(!1),f=`ticket`in e?e.ticket.automation_paused_reason??null:e.pausedReason??null,m=`ticket`in e?e.ticket.automation_review_iteration_count??0:e.reviewIterationCount??0,h=`ticket`in e?e.ticket.automation_config?.reviewMaxIterations??null:e.maxIterations??null,g=`ticket`in e?e.ticket.automation_fix_loop_active===!0:e.fixLoopActive===!0,_=`ticket`in e?e.ticket.automation_paused_code??null:e.pausedCode??null,v=`ticket`in e?e.ticket.automation_pause_reason_code??null:e.pausedReasonCode??null,y=`ticket`in e?e.ticket.automation_config?.pauseOnOpenQuestions===!0:e.pauseOnOpenQuestions===!0,b=`ticket`in e?(e.ticket.build_open_questions??[]).filter(e=>e.status===`open`).length:e.openQuestionCount??0,x=`ticket`in e?e.ticket.build_open_question_batch_status??null:e.buildOpenQuestionBatchStatus??null,S=`ticket`in e?e.ticket.automation_resume_decision??null:e.automationResumeDecision??null;if(!f)return null;let C=g&&m>0&&h!==null,w=c(moe(v)),T=c(`ticketAutomation.pause.diagnostic`,{reason:gF(f)??hoe(f)}),E=C?c(`ticketAutomation.pause.iterationCounter`,{current:m,max:h}):null,D=_===`open_questions`,O=_===`required_checks`,k=x===`pending`||x===`running`,A=D&&!k&&y&&b>0,j=!D||!k&&(!y||b===0),M=S?.status===`hidden`?null:S,N=M?c(goe(M)):null,P=M?.status===`disabled`||l,F=S?.status===`disabled`&&(S.reason===`bundle_agent_running`||S.reason===`review_running`),I=O&&F&&!!a,L=j&&t&&M&&N?(0,Y.jsx)(vv,{content:l?c(`ticketAutomation.pause.resumePending`):N,contentClassName:`max-w-80 break-words`,children:(0,Y.jsx)(`span`,{className:`inline-flex`,tabIndex:P?0:void 0,children:(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,disabled:P,onClick:async e=>{if(e.stopPropagation(),!(d.current||M.status!==`enabled`)){d.current=!0,u(!0);try{await t()}finally{d.current=!1,u(!1)}}},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.resume`)})})}):null;return(0,Y.jsxs)(`div`,{className:Z(`flex flex-col gap-1.5`,s),children:[(0,Y.jsx)(vv,{content:T,contentClassName:`max-w-80 break-words`,children:(0,Y.jsx)(bC,{variant:`outline`,className:`w-fit gap-1.5 border-amber-500/30 bg-amber-500/12 text-amber-200`,children:c(`ticketAutomation.pause.label`)})}),(0,Y.jsx)(`p`,{className:`max-w-xl text-xs text-muted-foreground`,children:w}),E&&(0,Y.jsx)(bC,{variant:`outline`,className:`w-fit text-[10px] uppercase tracking-wide text-muted-foreground`,children:E}),o&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A&&r&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,onClick:e=>{e.stopPropagation(),r()},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.resolveQuestions`)}),L,O&&i&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,onClick:e=>{e.stopPropagation(),i()},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.openChecks`)}),I&&a&&(0,Y.jsx)(vv,{content:c(`ticketAutomation.pause.stopTooltip`),contentClassName:`max-w-80 break-words`,children:(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`destructive`,onClick:e=>{e.stopPropagation(),a()},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.stop`)})}),j&&!I&&n&&(0,Y.jsx)(vv,{content:c(`ticketAutomation.pause.abandonTooltip`),contentClassName:`max-w-80 break-words`,children:(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`ghost`,className:`text-muted-foreground`,onClick:e=>{e.stopPropagation(),n()},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.abandon`)})})]})]})},_oe={draft:`border-sky-400/30 bg-sky-500/15 text-sky-100`,open:`border-emerald-400/30 bg-emerald-500/15 text-emerald-100`,merged:`border-violet-400/30 bg-violet-500/15 text-violet-100`,closed:`border-slate-400/30 bg-slate-500/15 text-slate-200`},voe={draft:`PR Draft`,open:`PR Open`,merged:`PR Merged`,closed:`PR Closed`},yF=({pullRequest:e,asLink:t=!1,onClick:n,onPointerDown:r,showNumber:i=!1})=>{let a=i?`PR #${e.number} ${e.state}`:voe[e.state],o=(0,Y.jsx)(bC,{variant:`outline`,className:_oe[e.state],children:a});return t?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex underline underline-offset-2 decoration-current hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,onClick:n,onPointerDown:r,children:o}):o},bF=({className:e})=>(0,Y.jsx)(Lee,{"aria-hidden":`true`,className:e}),xF=({className:e})=>(0,Y.jsx)(kee,{"aria-hidden":`true`,className:e}),SF=({className:e})=>(0,Y.jsx)(Eee,{"aria-hidden":`true`,className:e}),CF=({className:e})=>(0,Y.jsx)(Oee,{"aria-hidden":`true`,className:e}),wF=({label:e,className:t})=>(0,Y.jsxs)(bC,{className:Z(`inline-flex w-fit items-center gap-2 px-3 py-1 text-xs font-medium text-primary-foreground`,t),children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-violet-300`}),e]}),TF=({status:e,showBuildGlyph:t=!1})=>{let{t:n}=K(`common`);return e===null?null:e===`queued`?(0,Y.jsx)(bC,{variant:`outline`,children:n(`statusBadge.queued`)}):e===`planning`?(0,Y.jsx)(wF,{label:n(`statusBadge.planning`)}):e===`building`?(0,Y.jsx)(bC,{variant:`warning`,children:n(t?`statusBadge.buildingWithGlyph`:`statusBadge.building`)}):e===`reviewing`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.reviewing`)}):e===`automation`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.automation`)}):e===`checks`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.checks`)}):e===`auto_fix`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.autoFix`)}):e===`commit`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.commit`)}):e===`push`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.push`)}):e===`pr`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.pr`)}):e===`done`?(0,Y.jsx)(bC,{variant:`success`,children:n(`statusBadge.done`)}):e===`error`?(0,Y.jsx)(bC,{variant:`destructive`,children:n(`statusBadge.error`)}):(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.stopped`)})},EF=({title:e,stage:t,subjectLabel:n,onConfirm:r,onCancel:i})=>{let{t:a}=K(`common`);(0,p.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]);let o=n||a(`cardConfirmUndoModal.defaultSubjectLabel`),s=a(t===`review`?`cardConfirmUndoModal.headingReview`:`cardConfirmUndoModal.headingBuild`),c=a(t===`review`?`cardConfirmUndoModal.descriptionReview`:`cardConfirmUndoModal.descriptionBuild`,{subjectLabel:o});return(0,Y.jsxs)(gC,{onClose:i,overlayClassName:`bg-black/60`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,Y.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:s}),(0,Y.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:c}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:i,children:a(`cardConfirmUndoModal.cancel`)}),(0,Y.jsx)(Q,{type:`button`,variant:`destructive`,onClick:r,children:a(`cardConfirmUndoModal.confirm`)})]})]})},DF=({isRunning:e,isRunPending:t=!1,isStopPending:n=!1,runDisabled:r=!1,runDisabledReason:i,onRun:a,onStop:o,className:s})=>{let{t:c}=K(`common`);if(e)return o?(0,Y.jsxs)(Q,{type:`button`,size:`xs`,variant:`destructive`,disabled:n,"aria-busy":n,"aria-label":c(n?`runControl.stoppingAriaLabel`:`runControl.stopAriaLabel`),title:n?c(`runControl.stoppingTitle`):void 0,className:s,onClick:e=>{e.stopPropagation(),o()},onPointerDown:e=>e.stopPropagation(),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400 animate-pulse`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`flex w-3.5 justify-center`,children:n?(0,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`span`,{className:`min-w-[2.25rem] text-left`,children:c(`runControl.stop`)})]}):null;if(!a)return null;let l=c(t?`runControl.startingAriaLabel`:`runControl.runAriaLabel`);return(0,Y.jsxs)(Q,{type:`button`,size:`xs`,variant:`secondary`,disabled:t||r,"aria-busy":t,"aria-label":l,title:r?i??c(`runControl.disabledReason`):t?c(`runControl.startingTitle`):void 0,className:Z(`bg-sky-700 text-sky-50 hover:bg-sky-600 hover:text-white disabled:bg-slate-700 disabled:text-slate-400`,s),onClick:e=>{e.stopPropagation(),!r&&a()},onPointerDown:e=>e.stopPropagation(),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`h-2 w-2 flex-shrink-0 rounded-full invisible`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`flex w-3.5 justify-center`,children:t?(0,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin`}):(0,Y.jsx)(Fv,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`span`,{className:`min-w-[2.25rem] text-left`,children:c(`runControl.run`)})]})},OF=e=>e?.status===`queued`||e?.status===`running`||e?.status===`waiting`,kF=e=>OF(e)?`checks`:null,AF=(e,t)=>t?t===`automation`?e===`done`||e===`queued`?t:e:t:e,jF=e=>e.length===0?null:e.some(e=>e.agent_status===`running`&&e.review_follow_up_active===!0)?`building`:e.some(e=>e.agent_status===`running`)?`reviewing`:e.some(e=>e.agent_status===`error`)?`error`:e.some(e=>e.agent_status===`stopped`)?`stopped`:e.some(e=>e.agent_status===`done`)&&e.every(e=>e.agent_status===null||e.agent_status===`done`)?`done`:e.every(e=>e.agent_status===null)?`queued`:null,MF=(e,{allTickets:t=[],preferBundleReviewStatus:n=!1,automationStatus:r=null}={})=>{if(e.parked_at!==null)return null;let i=kF(e.post_build_check);if(i)return AF(i,r);if(e.state===`plan`){if(e.agent_status===`running`)return AF(`planning`,r);if(e.agent_status===null)return null;if(e.agent_status===`done`)return AF(`done`,r);if(e.agent_status===`error`)return AF(`error`,r);if(e.agent_status===`stopped`)return AF(`stopped`,r)}if(n&&e.worktree_bundle_id){let n=t.filter(t=>t.worktree_bundle_id===e.worktree_bundle_id),i=jF((n.length>0?n:[e]).filter(e=>e.state===`review`));if(i)return AF(i,r)}return e.agent_status===null?AF(`queued`,r):e.agent_status===`running`?AF(e.state===`review`&&e.review_follow_up_active!==!0?`reviewing`:`building`,r):e.agent_status===`done`?AF(`done`,r):e.agent_status===`error`?AF(`error`,r):e.agent_status===`stopped`?AF(`stopped`,r):null},NF=(e,t,{automationStatus:n=null}={})=>{if(t===`done`||e.every(e=>e.parked_at!==null))return null;let r=e.filter(e=>e.parked_at===null).map(e=>kF(e.post_build_check)).find(e=>e!==null);if(r)return AF(r,n);let i=e.filter(e=>e.state===`review`);if(t===`review`){let e=jF(i);if(e)return AF(e,n)}let a=jF(i.filter(e=>e.agent_status===`running`));return a?AF(a,n):t===`plan`&&e.some(e=>e.state===`plan`&&e.agent_status===`running`)?AF(`planning`,n):e.some(e=>e.agent_status===`running`)?AF(`building`,n):e.some(e=>e.agent_status===`error`)?AF(`error`,n):e.some(e=>e.agent_status===`stopped`)?AF(`stopped`,n):e.length>0&&e.every(e=>e.agent_status===`done`)?AF(`done`,n):e.some(e=>e.state===`build`)?AF(`queued`,n):null},yoe=e=>e===`claude`?`Claude`:`OpenCode`,PF=(e,t)=>e?.tool??t,FF=e=>e===`opencode`||e===`claude`,IF=(e,t)=>e?t.length===0?!0:t.some(t=>t.id===e):!1,LF=(e,t)=>e?.model?e.tool===null?IF(e.model,t)?e.model:``:e.model:``,boe=({bundleName:e,ticketCount:t,onConfirm:n,onCancel:r})=>((0,p.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,Y.jsxs)(gC,{onClose:r,overlayClassName:`bg-black/60`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,Y.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:`Delete bundle`}),(0,Y.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:e}),(0,Y.jsxs)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:[`This deletes the `,t,` ticket`,t===1?``:`s`,` `,`currently inside this wrapper.`]}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:r,children:`Cancel`}),(0,Y.jsx)(Q,{type:`button`,variant:`destructive`,onClick:n,children:`Delete`})]})]})),xoe=e=>e.find(e=>e.state===`review`&&e.undo?.stage===`review`&&e.undo.can_undo)??e.find(e=>e.state===`review`&&e.undo?.stage===`review`)??null,Soe=(e,t)=>t?.diff_stats===void 0?e.find(e=>e.diff_stats!==void 0)?.diff_stats:t.diff_stats,Coe=e=>e.length>0&&e.every(e=>yy(e)),RF=(0,p.memo)(({group:e,renderTicket:t,activeTool:n,modelsByTool:r,runDisabled:i=!1,onStopBuildTicket:a,onResumeBuildTicket:o,onInterruptReviewTicket:s,onBuildBundle:c,onReviewBundle:l,onUndoBundleReview:u,onRunBundle:d,onStopBundle:f,onParkBundleWrapper:m,onUnparkBundleWrapper:h,bundleActionState:g,onOpenBundleDetails:_,onOpenBundleFiles:v,onOpenBundleChanges:y,onOpenBundleVerification:b,onOpenBundleChecks:x,onOpenBundleIde:S,onRequestBundleRefresh:C,onDeleteBundleWrapper:w,onAddTicketToBundle:T,onStartChatFromBundle:E,undoInProgress:D=!1,overlay:O=!1,hoveredBundleId:k,onHoverBundleChange:A,multiColumnBundleIds:j,automationPausedReason:M,automationStatus:N,automationPausedCode:P,automationPauseReasonCode:F,automationReviewIterationCount:I,automationFixLoopActive:L,automationConfig:R,automationResumeDecision:ee,onResumeBundleAutomation:te,onDismissBundleAutomationPause:z,onOpenBuildQuestions:B})=>{let{t:V}=K(`common`),[H,U]=(0,p.useState)(!1),[ne,re]=(0,p.useState)(!1),{attributes:ie,listeners:ae,setNodeRef:oe,isDragging:W}=oF({id:By(e),disabled:O||D}),se=(0,p.useMemo)(()=>NF(e.tickets,e.column,{automationStatus:N}),[N,e.column,e.tickets]),ce=(0,p.useMemo)(()=>(0,Y.jsx)(TF,{status:se}),[se]),le=e.column===`plan`,ue=e.column===`build`&&e.tickets.every(e=>e.agent_status===`done`),de=(0,p.useMemo)(()=>xoe(e.tickets),[e.tickets]),fe=e.column===`review`&&de!==null,pe=de?.undo?.can_undo??!1,me=de?.undo?.reason??void 0,he=g??{build:!1,stopBuild:!1,resumeBuild:!1,review:!1,undoReview:!1,run:!1,stop:!1,followUp:!1},ge=he.review||he.followUp,_e=e.column===`review`&&!e.tickets.some(e=>e.agent_status===`running`)&&!ge&&e.tickets.some(e=>e.can_re_review),ve=_e?`Re-run review`:`Review Bundle`,ye=e.tickets.find(e=>e.is_running)??e.tickets.find(e=>e.session_id)??e.tickets.find(e=>e.has_worktree)??e.tickets[0],be=(0,p.useMemo)(()=>Soe(e.tickets,ye),[ye,e.tickets]),xe=(0,p.useMemo)(()=>Coe(e.tickets),[e.tickets]),Se=(0,p.useMemo)(()=>e.column!==`plan`&&be===void 0&&e.tickets.some(e=>e.diff_stats===void 0),[be,e.column,e.tickets]),Ce=xe||e.column===`done`,we=e.tickets.some(e=>e.is_running),Te=e.tickets.some(e=>e.has_run_config&&iy(e)),Ee=(0,p.useMemo)(()=>[...new Set(e.tickets.map(e=>LF(e,r[PF(e,n)]??[])).filter(e=>e.length>0))],[n,e.tickets,r]),De=Ee.length===1?Ee[0]:null,Oe=e.tickets.find(e=>hy(e)&&e.agent_status===`running`&&!!e.session_id)??null,ke=e.tickets.find(e=>hy(e)&&e.agent_status===`stopped`&&!!e.session_id)??null,Ae=Oe!==null,je=!Ae&&ke!==null,Me=e.tickets.find(e=>gy(e)&&e.agent_status===`running`)??null,Ne=e.tickets.length>0&&e.tickets.every(e=>Dy(e,`trash`)),Pe=e.column!==`done`&&e.tickets.length>0&&e.tickets.every(e=>Dy(e,`done`)),Fe=e.column===`done`&&e.tickets.length>0&&e.tickets.every(e=>e.state!==`plan`),Ie=e.tickets.length===1?`Return to ${e.tickets[0]?.state.charAt(0).toUpperCase()}${e.tickets[0]?.state.slice(1)}`:`Return to original columns`,Le=!!k&&e.bundle.id===k&&(j?.has(e.bundle.id)??!1),G=Le?`ring-inset ring-2 ring-primary/40 bg-primary/5`:``,Re=j?.has(e.bundle.id)??!1,ze=O?`border-violet-400`:Ce?`border-border/80 hover:border-border`:`border-border hover:border-primary/40`,Be=O||D?`pointer-events-none cursor-grabbing shadow-2xl`:`cursor-pointer`,Ve=W?`opacity-30`:Ce?`opacity-90`:`opacity-100`,He=Ce?`bg-card/60`:`bg-secondary/60`,Ue=Ce?`rounded-lg border border-border/60 bg-background/25 p-2.5`:`rounded-lg border border-border/60 bg-background/35 p-2.5`,We=Ce?`truncate text-sm font-medium text-foreground/70`:`truncate text-sm font-medium text-foreground`,Ge=Ce?`text-[11px] text-foreground/55`:`text-[11px] text-muted-foreground`,Ke=e.column===`done`,qe=!!(b&&ye?.project_id&&Iy(ye)),q=!O&&!Ke&&!!T,Je=new Set(e.tickets.filter(e=>e.state===`build`).map(e=>e.id)),Ye=(e.bundle.open_questions??[]).filter(e=>e.status===`open`&&Je.has(e.ticket_id)).length;return(0,Y.jsxs)(xC,{ref:oe,"data-testid":`bundle-card-${e.bundle.id}-${e.column}`,className:`relative shrink-0 select-none transition-colors ${ze} ${Be} ${Ve} ${He} ${G} gap-0 rounded-xl border shadow-none`,onMouseEnter:()=>{Re&&A?.(e.bundle.id??null)},onMouseLeave:()=>A?.(null),onClick:()=>{O||D||(C?.(e.bundle.id),_?.(e.bundle.id,e.column))},...ae,...ie,children:[D&&(0,Y.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-background/85 backdrop-blur-[1px]`,children:(0,Y.jsxs)(bC,{variant:`warning`,className:`gap-1.5`,children:[(0,Y.jsx)(tT,{className:`h-3.5 w-3.5 animate-spin`}),`Undo in progress...`]})}),(0,Y.jsxs)(EC,{className:`p-3`,children:[(0,Y.jsxs)(`div`,{className:`group/bundle mb-3 flex items-start justify-between gap-2 border-b pb-3 border-border/70`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 text-left`,children:[(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`div`,{className:`${We} min-w-0 ${Le?`font-semibold`:``}`,onMouseEnter:t=>{t.currentTarget.scrollWidth>t.currentTarget.clientWidth&&(t.currentTarget.title=Gy(e.bundle))},onMouseLeave:e=>{e.currentTarget.removeAttribute(`title`)},children:Gy(e.bundle)})}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`shrink-0 ${Ge}`,children:[e.tickets.length,` ticket`,e.tickets.length===1?``:`s`]}),ce,Ye>0&&B&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,"aria-label":V(`buildOpenQuestionsDialog.openActionAriaLabel`,{count:Ye}),onClick:t=>{t.stopPropagation(),B(e.bundle.id)},onPointerDown:e=>e.stopPropagation(),children:V(`buildOpenQuestionsDialog.count`,{count:Ye})}),e.bundle.pull_request&&(0,Y.jsx)(yF,{pullRequest:e.bundle.pull_request,asLink:!0,showNumber:!0,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()}),xe&&(0,Y.jsx)(bC,{variant:`outline`,className:`border-border/80 bg-card/60 text-muted-foreground`,children:`Stale`})]}),(by(e.column,be)||Se||De)&&(0,Y.jsxs)(`div`,{"data-testid":`bundle-card-metadata-${e.bundle.id}-${e.column}`,className:`mt-2 flex flex-col gap-1`,children:[(by(e.column,be)||Se)&&(0,Y.jsx)(kv,{stats:be,isLoading:Se,showFiles:!0,className:Ge}),De&&(0,Y.jsx)(`div`,{className:Ge,children:(0,Y.jsx)(`span`,{className:`truncate`,children:De})})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-shrink-0 items-start gap-1`,children:[(0,Y.jsx)(`div`,{className:`mr-1`,children:(0,Y.jsx)(DF,{isRunning:we,isRunPending:he.run,isStopPending:he.stop,runDisabled:i,onRun:!Te||Ke||!d?void 0:()=>d(e.bundle.id),onStop:f?()=>f(e.bundle.id):void 0})}),(0,Y.jsx)(`div`,{className:`flex size-7 items-start justify-center`,children:q?(0,Y.jsx)(vv,{content:V(`bundleCard.addTicketTooltip`),children:(0,Y.jsx)(Q,{type:`button`,"aria-label":V(`bundleCard.addTicketAriaLabel`,{bundleName:Gy(e.bundle)}),variant:`ghost`,size:`icon-xs`,className:`opacity-0 transition-all group-hover/bundle:opacity-100 group-focus-within/bundle:opacity-100`,onClick:t=>{t.stopPropagation(),T?.(e.bundle.id)},onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(wv,{className:`h-4 w-4`})})}):null}),(0,Y.jsx)(`div`,{className:`flex size-7 items-start justify-center`,children:(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,"aria-label":V(`bundleCard.openActionsAriaLabel`,{bundleName:Gy(e.bundle)}),variant:`ghost`,size:`icon-xs`,className:`opacity-0 transition-all group-hover/bundle:opacity-100 data-[state=open]:opacity-100`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(bF,{className:`h-4 w-4`})})}),(0,Y.jsxs)($y,{side:`right`,align:`start`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[Ne&&w&&(0,Y.jsxs)(eb,{className:`text-red-200 focus:bg-destructive/20 focus:text-red-100`,onSelect:()=>{U(!0)},children:[(0,Y.jsx)(kC,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:`Delete bundle`})]}),Fe&&h&&(0,Y.jsxs)(eb,{onSelect:()=>{h(e)},children:[(0,Y.jsx)(CF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:Ie})]}),le&&c&&(0,Y.jsxs)(eb,{disabled:he.build,onSelect:()=>{c(e.bundle.id)},children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.build?`Building Bundle...`:`Build Bundle`})]}),(ue||_e)&&l&&(0,Y.jsxs)(eb,{disabled:ge,onSelect:()=>{l(e.bundle.id)},children:[(0,Y.jsx)(xF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:ge?`Reviewing Bundle...`:ve})]}),fe&&u&&(0,Y.jsxs)(eb,{disabled:he.undoReview||!pe,title:pe?void 0:me,onSelect:()=>{pe&&re(!0)},children:[(0,Y.jsx)(tT,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.undoReview?`Undoing...`:`Undo Review`})]}),!we&&d&&(0,Y.jsxs)(eb,{disabled:he.run||i,onSelect:()=>{i||d(e.bundle.id)},children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.run?`Starting Run...`:`Run`})]}),we&&f&&(0,Y.jsxs)(eb,{disabled:he.stop,onSelect:()=>{f(e.bundle.id)},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.stop?`Stopping...`:`Stop Run`})]}),Ae&&Oe&&a&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,disabled:he.stopBuild,onSelect:()=>{a(Oe.id)},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.stopBuild?`Pausing Build...`:`Pause Build`})]}),je&&ke&&o&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,disabled:he.resumeBuild,onSelect:()=>{o(ke.id)},children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.resumeBuild?`Resuming Build...`:`Resume Build`})]}),Me&&s&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,disabled:he.stopBuild,onSelect:()=>{s(Me.id)},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.stopBuild?V(`cardActionsMenu.interruptingReview`):V(`cardActionsMenu.interruptReview`)})]}),E&&(0,Y.jsxs)(eb,{onSelect:()=>{E?.(e.bundle.id)},children:[(0,Y.jsx)(SE,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:V(`cardActionsMenu.startChat`)})]}),(0,Y.jsxs)(eb,{disabled:!v,onSelect:()=>{v?.(e.bundle.id)},children:[(0,Y.jsx)(jv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:V(`cardActionsMenu.files`)})]}),(0,Y.jsxs)(eb,{disabled:!y,onSelect:()=>{y?.(e.bundle.id)},children:[(0,Y.jsx)(Mv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:V(`cardActionsMenu.changes`)})]}),qe&&(0,Y.jsxs)(eb,{onSelect:()=>{b?.(e.bundle.id)},children:[(0,Y.jsx)(Av,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:V(`bundleCard.verification`)})]}),(0,Y.jsxs)(eb,{disabled:!S,onSelect:()=>{S?.(e.bundle.id)},children:[(0,Y.jsx)(Nv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:`Open IDE`})]}),Pe&&m&&(0,Y.jsxs)(eb,{onSelect:()=>{m(e)},children:[(0,Y.jsx)(SF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:`Done`})]})]})]})})]})]}),M&&(0,Y.jsx)(`div`,{className:`mb-3`,children:(0,Y.jsx)(vF,{pausedReason:M,pausedCode:P,pausedReasonCode:F,reviewIterationCount:I,maxIterations:R?.reviewMaxIterations??null,fixLoopActive:L,pauseOnOpenQuestions:R?.pauseOnOpenQuestions===!0,openQuestionCount:Ye,buildOpenQuestionBatchStatus:e.bundle.build_open_question_batch_status,automationResumeDecision:ee,onResume:te?()=>te(e.bundle.id):void 0,onDismiss:z?()=>z(e.bundle.id):void 0,onResolveQuestions:B?()=>B(e.bundle.id):void 0,onOpenChecks:x?()=>x(e.bundle.id):void 0,onStop:f?()=>f(e.bundle.id):void 0,showActions:!0})}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2 ${Ue}`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:e.tickets.map(e=>(0,Y.jsx)(p.Fragment,{children:t(e)},e.id))}),H&&(0,Y.jsx)(boe,{bundleName:Gy(e.bundle),ticketCount:e.tickets.length,onConfirm:()=>{U(!1),w?.(e)},onCancel:()=>U(!1)}),ne&&de?.undo?.stage&&(0,Y.jsx)(EF,{title:Gy(e.bundle),stage:de.undo.stage,subjectLabel:`bundle`,onConfirm:()=>{re(!1),u?.(e.bundle.id)},onCancel:()=>re(!1)})]})]})}),zF=({className:e})=>(0,Y.jsx)(Yee,{"aria-hidden":`true`,className:e}),woe=({title:e,canDelete:t,undo:n,undoInProgress:r,runDisabled:i,isRunPending:a,isStopPending:o,showVerificationAction:s,showOpenFilesAction:c,showOpenChangesAction:l,showOpenIdeAction:u,showAddTicketToBundleAction:d,showStartChatFromBundleAction:f,showRunAction:p,showStopRunAction:m,showAdvanceAction:h,advanceLabel:g,canAdvance:_,showParkAction:v,showReturnAction:y,returnLabel:b,showBuildChainAction:x,showPauseBuildAction:S,showResumeBuildAction:C,showInterruptReviewAction:w,showStopBuildChainAction:T,onDelete:E,onConfirmDelete:D,onConfirmUndo:O,onOpenVerification:k,onOpenFiles:A,onOpenChanges:j,onOpenIde:M,onAddTicketToBundle:N,onStartChatFromBundle:P,onAdvance:F,onPark:I,onUnpark:L,onBuildChain:R,onRun:ee,onStop:te,onStopBuild:z,onResumeBuild:B,onInterruptReview:V,onStopBuildChain:H})=>{let{t:U}=K(`common`);return(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,"aria-label":U(`cardActionsMenu.openAriaLabel`,{title:e}),variant:`ghost`,size:`icon-xs`,className:`opacity-0 transition-all group-hover/card:opacity-100 data-[state=open]:opacity-100`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(bF,{className:`h-4 w-4`})})}),(0,Y.jsxs)($y,{side:`right`,align:`start`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[E&&(0,Y.jsxs)(eb,{disabled:!t,className:`text-red-200 focus:bg-destructive/20 focus:text-red-100 data-[disabled]:text-muted-foreground`,onSelect:()=>{t&&D()},children:[(0,Y.jsx)(kC,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.delete`)})]}),n?.stage&&(0,Y.jsxs)(eb,{disabled:!n.can_undo,title:n.can_undo?void 0:n.reason??void 0,onSelect:()=>{r||!n.can_undo||O()},children:[(0,Y.jsx)(tT,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:n.stage===`review`?U(`cardActionsMenu.undoReview`):U(`cardActionsMenu.undoBuild`)})]}),h&&g&&(0,Y.jsxs)(eb,{disabled:!_,onSelect:()=>{_&&F?.()},children:[(0,Y.jsx)(xF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:g})]}),y&&b&&(0,Y.jsxs)(eb,{onSelect:()=>{L?.()},children:[(0,Y.jsx)(CF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:b})]}),x&&(0,Y.jsxs)(eb,{onSelect:()=>{R?.()},children:[(0,Y.jsx)(zF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.buildChain`)})]}),d&&(0,Y.jsxs)(eb,{onSelect:()=>N?.(),children:[(0,Y.jsx)(wv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.addTicketToBundle`)})]}),f&&(0,Y.jsxs)(eb,{onSelect:()=>P?.(),children:[(0,Y.jsx)(SE,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.startChat`)})]}),p&&(0,Y.jsxs)(eb,{disabled:i||a,onSelect:()=>{i||a||ee?.()},children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(a?`cardActionsMenu.startingRun`:`cardActionsMenu.run`)})]}),m&&(0,Y.jsxs)(eb,{disabled:o,className:`text-red-200 focus:bg-destructive/20 focus:text-red-100`,onSelect:()=>{o||te?.()},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(o?`cardActionsMenu.stopping`:`cardActionsMenu.stopRun`)})]}),S&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,onSelect:()=>z?.(),children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.pauseBuild`)})]}),C&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,onSelect:()=>B?.(),children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.resumeBuild`)})]}),w&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,onSelect:()=>V?.(),children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.interruptReview`)})]}),c&&(0,Y.jsxs)(eb,{onSelect:()=>A?.(),children:[(0,Y.jsx)(jv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.files`)})]}),l&&(0,Y.jsxs)(eb,{onSelect:()=>j?.(),children:[(0,Y.jsx)(Mv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.changes`)})]}),s&&(0,Y.jsxs)(eb,{onSelect:()=>k?.(),children:[(0,Y.jsx)(Av,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.verification`)})]}),u&&(0,Y.jsxs)(eb,{onSelect:()=>M?.(),children:[(0,Y.jsx)(Nv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.openIde`)})]}),T&&(0,Y.jsxs)(eb,{className:`text-red-200 focus:bg-destructive/20 focus:text-red-100`,onSelect:()=>{H?.()},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.stopBuildChain`)})]}),v&&(0,Y.jsxs)(eb,{onSelect:()=>{I?.()},children:[(0,Y.jsx)(SF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.done`)})]})]})]})},Toe=({title:e,bundleName:t=null,onConfirm:n,onCancel:r})=>{let{t:i}=K(`common`);return(0,p.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,Y.jsxs)(gC,{onClose:r,overlayClassName:`bg-black/60`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,Y.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:i(`cardConfirmDeleteModal.heading`)}),(0,Y.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:t?i(`cardConfirmDeleteModal.descriptionInBundle`,{bundleName:t}):i(`cardConfirmDeleteModal.descriptionStandalone`)}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:r,children:i(`cardConfirmDeleteModal.cancel`)}),(0,Y.jsx)(Q,{type:`button`,variant:`destructive`,onClick:n,children:i(`cardConfirmDeleteModal.confirm`)})]})]})},BF=({description:e,descriptionClass:t,isExpanded:n,collapsedState:r,useStaleLikeStyling:i,onExpand:a,onCollapse:o})=>{if(!e)return null;let s=`ml-1 inline h-auto px-0 py-0 align-baseline text-xs lowercase ${i?`text-foreground/75`:`text-foreground/70`}`;return(0,Y.jsx)(`div`,{className:`mb-2 text-xs leading-relaxed ${i?`text-foreground/55`:`text-muted-foreground`}`,children:n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:t,children:e}),(0,Y.jsx)(Q,{type:`button`,variant:`link`,size:`xs`,className:s,onClick:e=>{e.stopPropagation(),o()},onPointerDown:e=>e.stopPropagation(),children:`show less`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:t,children:r.text}),r.truncated&&(0,Y.jsx)(Q,{type:`button`,variant:`link`,size:`xs`,className:s,onClick:e=>{e.stopPropagation(),a()},onPointerDown:e=>e.stopPropagation(),children:`show more`})]})})},Eoe=({ticket:e,hideStatusBadge:t,isStale:n,runControl:r,onRetry:i,undoInProgress:a,isChainStart:o,automationBadge:s,automationStatus:c,onOpenBuildQuestions:l})=>{let{t:u}=K(`common`),d=e.state===`plan`&&(e.planning_context?.open_questions.length??0)>0,f=e.state===`build`?(e.build_open_questions??[]).filter(e=>e.status===`open`).length:0,p=MF(e,{automationStatus:c}),m=c!=null&&c!==`automation`,h=t&&!m||e.state===`plan`&&e.agent_status===null;return(0,Y.jsxs)(Y.Fragment,{children:[n&&(0,Y.jsx)(`div`,{className:`mb-2`,children:(0,Y.jsx)(bC,{variant:`outline`,className:`border-border/80 bg-card/60 text-muted-foreground`,children:u(`cardStatusBadges.stale`)})}),(!t||m)&&p!==null&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(TF,{status:p,showBuildGlyph:!0}),p===`error`&&i&&!a&&(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:e=>{e.stopPropagation(),i()},onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(tT,{className:`w-3.5 h-3.5`})}),r]}),h&&r,d&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(bC,{variant:`warning`,children:u(`cardStatusBadges.openQuestions`)})}),f>0&&l&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,"aria-label":u(`buildOpenQuestionsDialog.openActionAriaLabel`,{count:f}),onClick:e=>{e.stopPropagation(),l()},onPointerDown:e=>e.stopPropagation(),children:u(`buildOpenQuestionsDialog.count`,{count:f})})}),o&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsxs)(bC,{variant:`secondary`,className:`gap-1.5 border-violet-500/25 bg-violet-500/12 text-violet-200`,children:[(0,Y.jsx)(zF,{className:`h-3.5 w-3.5`}),u(`cardStatusBadges.chainStart`)]})}),s&&(0,Y.jsx)(`div`,{className:`mt-2`,children:s})]})},VF=(e,t)=>J(Ye(`/tickets/${e}/terminal`,t),{method:`POST`,fallbackErrorMessage:`Unable to open the terminal right now.`}),Doe=e=>J(q(`/projects/${e}/terminal`),{method:`POST`,fallbackErrorMessage:`Unable to open the project terminal right now.`}),HF=e=>{let t=q(`/terminals/${e}/destroy`);if(typeof navigator<`u`&&typeof navigator.sendBeacon==`function`){let e=new Blob([`{}`],{type:`application/json`});if(navigator.sendBeacon(t,e))return}fetch(t,{method:`POST`,keepalive:!0,headers:{"Content-Type":`application/json`},body:`{}`}).catch(()=>{})},UF=2,Ooe=e=>e.length===0?`No skills`:e.length<=UF?e.join(`, `):`${e.slice(0,UF).join(`, `)} +${e.length-UF}`,WF=({skills:e,availableSkills:t,onSkillsChange:n,selectId:r,label:i=`Skills`,triggerAriaLabel:a,disabled:o=!1,className:s,triggerClassName:c,showSelectedBadges:l=!0})=>{let u=e.map(e=>t.find(t=>t.name===e)?.name??e).filter(Boolean),d=u.slice(0,UF),f=Math.max(0,u.length-d.length);return(0,Y.jsxs)(`div`,{className:Z(`flex flex-col gap-2`,s),children:[(0,Y.jsx)(Vw,{label:i,triggerLabel:Ooe(u),triggerAriaLabel:a??`Skills`,selectId:r,selectedValues:e,onToggle:t=>{n(e.includes(t)?e.filter(e=>e!==t):[...e,t])},disabled:o,contentClassName:`min-w-[22rem]`,triggerClassName:c,groups:[{label:``,options:t.map(e=>({value:e.name,label:e.name}))}]}),l&&u.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[d.map(e=>(0,Y.jsx)(bC,{variant:`outline`,className:`border-border/80 bg-background/70 text-[11px] text-foreground`,children:e},e)),f>0&&(0,Y.jsxs)(bC,{variant:`ghost`,className:`px-1.5 text-[11px] text-muted-foreground`,children:[`+`,f,` more`]})]})]})},koe=({model:e,variant:t,skills:n,selectedModel:r,defaultModelLabel:i,defaultVariantLabel:a,skillCountLabel:o,showCompleteSummary:s})=>{let c=[];return(e||s)&&c.push(e?r?.label??e:i),(t||s)&&c.push(t||a),(n.length>0||s)&&c.push(o),c.length===0?`AI defaults`:c.join(` / `)},GF=({model:e,variant:t,skills:n,showModelSelector:r,showSkillsSelector:i,availableModels:a,availableSkills:o,selectedModel:s,onModelChange:c,onVariantChange:l,onSkillsChange:u,modelSelectId:d,variantSelectId:f,skillsSelectId:p,disabled:m=!1,className:h,showCompleteSummary:g=!1,modelSelectorNotice:_})=>{let{t:v}=K(`common`),y=r&&s!==null&&s.variants.length>0,b=koe({model:e,variant:t,skills:n,selectedModel:s,defaultModelLabel:v(`ticketPlanDetails.defaultModel`),defaultVariantLabel:v(`ticketPlanDetails.defaultVariant`),skillCountLabel:v(`ticketPlanDetails.skillCount`,{count:n.length}),showCompleteSummary:g});return!r&&!i&&!g&&!_?null:(0,Y.jsxs)(Y_,{children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,disabled:m,className:Z(`max-w-full w-fit justify-start gap-2 text-left sm:max-w-80`,h),"aria-label":`AI settings`,children:[(0,Y.jsx)(cb,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`truncate`,children:b})]})}),(0,Y.jsx)(Z_,{align:`start`,className:`w-80 max-w-[calc(100vw-2rem)] p-3`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,children:`AI settings`})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(uv,{model:e,showModelSelector:r,availableModels:a,onModelChange:c,selectId:d,disabled:m,notice:_}),(0,Y.jsx)(dv,{variant:t,selectedModel:s,showVariantSelector:y,onVariantChange:l,selectId:f,disabled:m}),i&&(0,Y.jsx)(WF,{skills:n,availableSkills:o,onSkillsChange:u,selectId:p,disabled:m,showSelectedBadges:!1})]})]})})]})},KF=({tool:e,className:t})=>{if(!e)return null;let n=yoe(e),r=`Locked to ${n}`;return(0,Y.jsx)(vv,{content:r,children:(0,Y.jsx)(bC,{variant:`outline`,"aria-label":r,className:Z(`border-violet-500/25 bg-violet-500/10 text-violet-100`,e===`claude`&&`border-orange-500/25 bg-orange-500/10 text-orange-100`,t),children:n})})},Aoe=e=>{if(!Number.isFinite(e))return`0`;if(e>=1e6){let t=e/1e6,n=t<10?2:1;return`${t.toFixed(n)}M`}return e>=1e3?`${(e/1e3).toFixed(1)}K`:`${Math.round(e)}`},joe=({totalTokens:e,contextWindow:t})=>!Number.isFinite(e)||!Number.isFinite(t)||t<=0?null:Math.round(e/t*100),Moe=({model:e,availableModels:t,fallbackContextWindow:n})=>(t.find(t=>t.id===e)??null)?.context_window??n,qF=({totalTokens:e,contextWindow:t,cost:n,tool:r,model:i,availableModels:a,fallbackContextWindow:o=null,hideCost:s=!1})=>{let c=e;if(c===null)return null;let l=Moe({tool:r,model:i,availableModels:a,fallbackContextWindow:t??o});if(l===null)return null;let u=joe({totalTokens:c,contextWindow:l});if(u===null)return null;let d=n,f=typeof d==`number`&&d>0,p=`${Aoe(c)} (${u}%)`;return(0,Y.jsx)(`div`,{"data-testid":`context-usage-badge`,className:`inline-flex items-center rounded-full border border-border/80 bg-muted/40 px-2 py-0.5 text-[11px] font-medium text-foreground`,children:!s&&f?`${p} · $${d.toFixed(2)}`:p})},JF=[`manual`,`auto_review`,`auto_commit`,`auto_push`,`auto_pr`],YF=(e,t)=>JF.indexOf(e)>=JF.indexOf(t),Noe=({resolvedDepth:e,resolvedFixEnabled:t,depthOverride:n,fixOverride:r,resolvedMaxIterations:i,maxIterationsOverride:a,resolvedPauseOnOpenQuestions:o=!1,pauseOnOpenQuestionsOverride:s=null,reviewerConfig:c,reviewerModelOverride:l,reviewerVariantOverride:u,availableReviewerModels:d,isLoadingReviewerModels:f,showClaudeTicketProvenance:m,isGitHubConnected:h,onChange:g,isPending:_=!1,className:v})=>{let{t:y}=K(`common`),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(()=>String(a??i)),w=(0,p.useRef)(null),T=(0,p.useRef)(!1),E=n!=null,D=r!=null,O=s!=null,k=a!=null,A=l!=null;(0,p.useEffect)(()=>{C(String(a??i)),w.current=null},[a,i]);let j=(t={})=>({automation_depth:E?e:null,automation_review_fix_enabled:D?r:null,automation_pause_on_open_questions:s,automation_review_max_iterations:a,reviewer_model:l,reviewer_variant:l?u:null,...t}),M=e=>{if(w.current===e)return;w.current=e;let t=Number(e);if(!(/^\d+$/.test(e)&&Number.isInteger(t)&&t>=1&&t<=10)){C(String(a??i));return}C(String(t)),a!==t&&g(j({automation_review_max_iterations:t}))},N=y(E||D||O||k?`ticketAutomation.override.summaryOverride`:`ticketAutomation.override.summaryInherited`),P=y(e===`manual`?`ticketAutomation.depth.manual`:`ticketAutomation.depth.${e}`),F=c.source!==`fallback`&&c.model?d.find(e=>e.id===c.model)?.label??c.model:y(`ticketAutomation.reviewer.fallback`),I=c.source===`fallback`?y(`ticketAutomation.reviewer.perTicketVariant`):c.variant??y(`ticketAutomation.reviewer.defaultVariant`);return(0,Y.jsxs)(Y_,{open:b,onOpenChange:x,children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,className:Z(`max-w-full w-fit justify-start gap-2 text-left`,v),"aria-label":y(`ticketAutomation.override.ariaLabel`),"aria-busy":_,disabled:_,children:[_&&(0,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:y(`ticketAutomation.override.summaryLabel`,{depth:P,source:N})})]})}),(0,Y.jsx)(Z_,{align:`start`,className:`w-[36rem] max-w-[calc(100vw-2rem)] p-3`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,children:y(`ticketAutomation.override.title`)}),_&&(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y(`ticketAutomation.override.saving`)})]}),(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-background/40 px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:y(`ticketAutomation.reviewer.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.reviewer.effective`,{model:F,variant:I})})]}),(0,Y.jsx)(bC,{variant:`outline`,className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:y(`ticketAutomation.reviewer.sources.${c.source}`)})]}),(0,Y.jsxs)(Rw,{type:`single`,value:A?`override`:`__inherit__`,onValueChange:e=>{_||!e||g(j({reviewer_model:e===`override`?c.model??d[0]?.id??null:null,reviewer_variant:e===`override`&&c.model?c.variant:null}))},variant:`outline`,spacing:0,className:`mt-3 flex w-full flex-wrap`,"aria-label":y(`ticketAutomation.reviewer.sourceAriaLabel`),children:[(0,Y.jsx)(zw,{value:`__inherit__`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.inherit`)}),(0,Y.jsx)(zw,{value:`override`,disabled:_||d.length===0,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.overrideSetting`)})]}),m&&(0,Y.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.reviewer.claudeTicketProvenance`)}),A&&(0,Y.jsx)(fv,{model:l,variant:u??``,availableModels:d,isLoadingModels:f,onModelChange:e=>{let t=(d.find(t=>t.id===e)??null)?.variants.includes(u??``)?u:null;g(j({reviewer_model:e||null,reviewer_variant:e?t:null}))},onVariantChange:e=>g(j({reviewer_variant:e||null})),modelSelectId:`bundle-reviewer-model`,variantSelectId:`bundle-reviewer-variant`,title:y(`ticketAutomation.reviewer.title`),description:y(`ticketAutomation.reviewer.description`),loadingDescription:y(`ticketAutomation.reviewer.loading`),unavailableDescription:y(`ticketAutomation.reviewer.unavailable`),modelLabel:y(`ticketAutomation.reviewer.modelLabel`),variantLabel:y(`ticketAutomation.reviewer.variantLabel`),defaultModelLabel:y(`ticketAutomation.reviewer.clearOverride`),defaultVariantLabel:y(`ticketAutomation.reviewer.defaultVariant`),availableVariantsLabel:y(`ticketAutomation.reviewer.availableVariants`),className:`mt-3 border-0 bg-transparent p-0`,compact:!0,showHeader:!1,disabled:_})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(Rw,{type:`single`,value:E?e:`__inherit__`,onValueChange:e=>{if(!(_||!e)){if(e===`__inherit__`){g(j({automation_depth:null}));return}g(j({automation_depth:e}))}},variant:`outline`,spacing:0,className:`flex w-full flex-wrap`,"aria-label":y(`ticketAutomation.override.depthAriaLabel`),children:[(0,Y.jsx)(zw,{value:`__inherit__`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.inherit`)}),(0,Y.jsx)(zw,{value:`manual`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.manual`)}),(0,Y.jsx)(zw,{value:`auto_review`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.auto_review`)}),(0,Y.jsx)(zw,{value:`auto_commit`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.auto_commit`)}),(0,Y.jsx)(zw,{value:`auto_push`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.auto_push`)}),(0,Y.jsx)(zw,{value:`auto_pr`,disabled:_||!h,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.auto_pr`)})]}),!h&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`ticketAutomation.override.autoPrDisabledHint`)}),E&&(0,Y.jsx)(bC,{variant:`outline`,className:`w-fit text-[10px] uppercase tracking-wide text-muted-foreground`,children:y(`ticketAutomation.override.overridingProject`)})]}),YF(e,`auto_review`)&&(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-background/40 px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:y(`ticketAutomation.override.fixToggleLabel`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.override.fixToggleDescription`)})]}),(0,Y.jsx)(Iw,{"aria-label":y(`ticketAutomation.override.fixToggleAriaLabel`),checked:t,disabled:_,onCheckedChange:e=>{g(j({automation_review_fix_enabled:e}))}})]}),D&&(0,Y.jsx)(bC,{variant:`outline`,className:`mt-2 text-[10px] uppercase tracking-wide text-muted-foreground`,children:y(`ticketAutomation.override.overridingProject`)})]}),YF(e,`auto_review`)&&t&&(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-background/40 px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:y(`ticketAutomation.override.maxIterationsLabel`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.override.maxIterationsDescription`)}),(0,Y.jsxs)(Rw,{type:`single`,value:k?`override`:`__inherit__`,onValueChange:e=>{_||!e||g(j({automation_review_max_iterations:e===`override`?i:null}))},variant:`outline`,spacing:0,className:`mt-3 flex w-full flex-wrap`,"aria-label":y(`ticketAutomation.override.maxIterationsAriaLabel`),children:[(0,Y.jsx)(zw,{value:`__inherit__`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.inheritProjectSetting`)}),(0,Y.jsx)(zw,{value:`override`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.overrideSetting`)})]}),k&&(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,Y.jsx)(`label`,{htmlFor:`ticket-automation-max-iterations`,className:`text-xs text-muted-foreground`,children:y(`ticketAutomation.override.maxIterationsInputLabel`)}),(0,Y.jsx)(F_,{id:`ticket-automation-max-iterations`,type:`number`,min:1,max:10,"aria-label":y(`ticketAutomation.override.maxIterationsInputAriaLabel`),value:S,disabled:_,onChange:e=>{w.current=null,C(e.target.value)},onBlur:()=>{if(T.current){T.current=!1;return}M(S)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T.current=!0,M(S),window.setTimeout(()=>{T.current=!1},0))},className:`w-20`})]})]}),(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-background/40 px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:y(`ticketAutomation.override.openQuestionsLabel`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.override.openQuestionsDescription`)}),(0,Y.jsxs)(Rw,{type:`single`,value:O?String(o):`__inherit__`,onValueChange:e=>{_||!e||g(j({automation_pause_on_open_questions:e===`__inherit__`?null:e===`true`}))},variant:`outline`,spacing:0,className:`mt-3 flex w-full flex-wrap`,"aria-label":y(`ticketAutomation.override.openQuestionsAriaLabel`),children:[(0,Y.jsx)(zw,{value:`__inherit__`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.inherit`)}),(0,Y.jsx)(zw,{value:`true`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.enabled`)}),(0,Y.jsx)(zw,{value:`false`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.disabled`)})]})]})]})})]})},Poe=({bundle:e,availableModels:t,className:n})=>{let{t:r}=K(`common`),i=e.reviewer_config??{model:null,variant:null,source:`fallback`},a=i.source!==`fallback`&&i.model?t.find(e=>e.id===i.model)?.label??i.model:r(`ticketAutomation.reviewer.fallback`),o=i.source===`fallback`?r(`ticketAutomation.reviewer.perTicketVariant`):i.variant??r(`ticketAutomation.reviewer.defaultVariant`);return(0,Y.jsx)(`div`,{className:Z(`rounded-xl border border-border/70 bg-background/30 px-3 py-2`,n),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`ticketAutomation.reviewer.effective`,{model:a,variant:o})}),(0,Y.jsx)(bC,{variant:`outline`,className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:r(`ticketAutomation.reviewer.sources.${i.source}`)})]})})},XF=({bundle:e,isGitHubConnected:t,onChange:n,isPending:r,className:i,availableReviewerModels:a=[],isLoadingReviewerModels:o=!1,showClaudeTicketProvenance:s=!1})=>{if(e.kind===`project_root`)return(0,Y.jsx)(Poe,{bundle:e,availableModels:a,className:i});let c=e.automation_config?.depth??`manual`,l=e.automation_config?.reviewFixEnabled??!1,u=e.automation_config?.reviewMaxIterations??3,d=e.automation_config?.pauseOnOpenQuestions??!1;return(0,Y.jsx)(Noe,{resolvedDepth:c,resolvedFixEnabled:l,depthOverride:e.automation_depth??null,fixOverride:e.automation_review_fix_enabled==null?null:!!e.automation_review_fix_enabled,resolvedMaxIterations:u,maxIterationsOverride:e.automation_review_max_iterations??null,resolvedPauseOnOpenQuestions:d,pauseOnOpenQuestionsOverride:e.automation_pause_on_open_questions==null?null:!!e.automation_pause_on_open_questions,reviewerConfig:e.reviewer_config??{model:null,variant:null,source:`fallback`},reviewerModelOverride:e.reviewer_model??null,reviewerVariantOverride:e.reviewer_variant??null,availableReviewerModels:a,isLoadingReviewerModels:o,showClaudeTicketProvenance:s,isGitHubConnected:t,onChange:n,isPending:r,className:i})},Foe=e=>{if(e.provider===`github`){let t=e.metadata?.issue_number;if(typeof t==`number`||typeof t==`string`&&t.trim()!==``)return`#${t}`;let n=e.external_key.lastIndexOf(`#`);return n>=0&&n<e.external_key.length-1?`#${e.external_key.slice(n+1)}`:e.external_key}return e.external_key},ZF=({externalSource:e=null,className:t})=>{let{t:n}=K(`common`);if(!e||e.provider!==`jira`&&e.provider!==`github`)return null;let r=Foe(e),i=e.provider===`jira`?n(`externalSourceBadge.tooltip.jira`,{key:e.external_key}):n(`externalSourceBadge.tooltip.github`,{key:e.external_key}),a=(0,Y.jsx)(bC,{variant:`outline`,className:Z(`border-ticket-link/30 bg-ticket-link/15 text-ticket-link`,t),children:r});return e.external_url?(0,Y.jsx)(`a`,{href:e.external_url,target:`_blank`,rel:`noreferrer`,title:i,className:`inline-flex underline underline-offset-2 decoration-current hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:a}):(0,Y.jsx)(`span`,{title:i,children:a})};function Ioe(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Loe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Roe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zoe={};function QF(e,t){return((t||zoe).jsx?Roe:Loe).test(e)}var Boe=/[ \t\n\f\r]/g;function Voe(e){return typeof e==`object`?e.type===`text`?$F(e.value):!1:$F(e)}function $F(e){return e.replace(Boe,``)===``}var eI=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};eI.prototype.normal={},eI.prototype.property={},eI.prototype.space=void 0;function tI(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new eI(n,r,t)}function nI(e){return e.toLowerCase()}var rI=class{constructor(e,t){this.attribute=t,this.property=e}};rI.prototype.attribute=``,rI.prototype.booleanish=!1,rI.prototype.boolean=!1,rI.prototype.commaOrSpaceSeparated=!1,rI.prototype.commaSeparated=!1,rI.prototype.defined=!1,rI.prototype.mustUseProperty=!1,rI.prototype.number=!1,rI.prototype.overloadedBoolean=!1,rI.prototype.property=``,rI.prototype.spaceSeparated=!1,rI.prototype.space=void 0;var iI=r({boolean:()=>aI,booleanish:()=>oI,commaOrSpaceSeparated:()=>dI,commaSeparated:()=>uI,number:()=>cI,overloadedBoolean:()=>sI,spaceSeparated:()=>lI}),Hoe=0,aI=fI(),oI=fI(),sI=fI(),cI=fI(),lI=fI(),uI=fI(),dI=fI();function fI(){return 2**++Hoe}var pI=Object.keys(iI),mI=class extends rI{constructor(e,t,n,r){let i=-1;if(super(e,t),hI(this,`space`,r),typeof n==`number`)for(;++i<pI.length;){let e=pI[i];hI(this,pI[i],(n&iI[e])===iI[e])}}};mI.prototype.defined=!0;function hI(e,t,n){n&&(e[t]=n)}function gI(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new mI(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[nI(r)]=r,n[nI(a.attribute)]=r}return new eI(t,n,e.space)}var _I=gI({properties:{ariaActiveDescendant:null,ariaAtomic:oI,ariaAutoComplete:null,ariaBusy:oI,ariaChecked:oI,ariaColCount:cI,ariaColIndex:cI,ariaColSpan:cI,ariaControls:lI,ariaCurrent:null,ariaDescribedBy:lI,ariaDetails:null,ariaDisabled:oI,ariaDropEffect:lI,ariaErrorMessage:null,ariaExpanded:oI,ariaFlowTo:lI,ariaGrabbed:oI,ariaHasPopup:null,ariaHidden:oI,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lI,ariaLevel:cI,ariaLive:null,ariaModal:oI,ariaMultiLine:oI,ariaMultiSelectable:oI,ariaOrientation:null,ariaOwns:lI,ariaPlaceholder:null,ariaPosInSet:cI,ariaPressed:oI,ariaReadOnly:oI,ariaRelevant:null,ariaRequired:oI,ariaRoleDescription:lI,ariaRowCount:cI,ariaRowIndex:cI,ariaRowSpan:cI,ariaSelected:oI,ariaSetSize:cI,ariaSort:null,ariaValueMax:cI,ariaValueMin:cI,ariaValueNow:cI,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function vI(e,t){return t in e?e[t]:t}function yI(e,t){return vI(e,t.toLowerCase())}var Uoe=gI({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:uI,acceptCharset:lI,accessKey:lI,action:null,allow:null,allowFullScreen:aI,allowPaymentRequest:aI,allowUserMedia:aI,alt:null,as:null,async:aI,autoCapitalize:null,autoComplete:lI,autoFocus:aI,autoPlay:aI,blocking:lI,capture:null,charSet:null,checked:aI,cite:null,className:lI,cols:cI,colSpan:null,content:null,contentEditable:oI,controls:aI,controlsList:lI,coords:cI|uI,crossOrigin:null,data:null,dateTime:null,decoding:null,default:aI,defer:aI,dir:null,dirName:null,disabled:aI,download:sI,draggable:oI,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:aI,formTarget:null,headers:lI,height:cI,hidden:sI,high:cI,href:null,hrefLang:null,htmlFor:lI,httpEquiv:lI,id:null,imageSizes:null,imageSrcSet:null,inert:aI,inputMode:null,integrity:null,is:null,isMap:aI,itemId:null,itemProp:lI,itemRef:lI,itemScope:aI,itemType:lI,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:aI,low:cI,manifest:null,max:null,maxLength:cI,media:null,method:null,min:null,minLength:cI,multiple:aI,muted:aI,name:null,nonce:null,noModule:aI,noValidate:aI,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:aI,optimum:cI,pattern:null,ping:lI,placeholder:null,playsInline:aI,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:aI,referrerPolicy:null,rel:lI,required:aI,reversed:aI,rows:cI,rowSpan:cI,sandbox:lI,scope:null,scoped:aI,seamless:aI,selected:aI,shadowRootClonable:aI,shadowRootDelegatesFocus:aI,shadowRootMode:null,shape:null,size:cI,sizes:null,slot:null,span:cI,spellCheck:oI,src:null,srcDoc:null,srcLang:null,srcSet:null,start:cI,step:null,style:null,tabIndex:cI,target:null,title:null,translate:null,type:null,typeMustMatch:aI,useMap:null,value:oI,width:cI,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lI,axis:null,background:null,bgColor:null,border:cI,borderColor:null,bottomMargin:cI,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:aI,declare:aI,event:null,face:null,frame:null,frameBorder:null,hSpace:cI,leftMargin:cI,link:null,longDesc:null,lowSrc:null,marginHeight:cI,marginWidth:cI,noResize:aI,noHref:aI,noShade:aI,noWrap:aI,object:null,profile:null,prompt:null,rev:null,rightMargin:cI,rules:null,scheme:null,scrolling:oI,standby:null,summary:null,text:null,topMargin:cI,valueType:null,version:null,vAlign:null,vLink:null,vSpace:cI,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:aI,disableRemotePlayback:aI,prefix:null,property:null,results:cI,security:null,unselectable:null},space:`html`,transform:yI}),Woe=gI({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:dI,accentHeight:cI,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:cI,amplitude:cI,arabicForm:null,ascent:cI,attributeName:null,attributeType:null,azimuth:cI,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:cI,by:null,calcMode:null,capHeight:cI,className:lI,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:cI,diffuseConstant:cI,direction:null,display:null,dur:null,divisor:cI,dominantBaseline:null,download:aI,dx:null,dy:null,edgeMode:null,editable:null,elevation:cI,enableBackground:null,end:null,event:null,exponent:cI,externalResourcesRequired:null,fill:null,fillOpacity:cI,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:uI,g2:uI,glyphName:uI,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:cI,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:cI,horizOriginX:cI,horizOriginY:cI,id:null,ideographic:cI,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:cI,k:cI,k1:cI,k2:cI,k3:cI,k4:cI,kernelMatrix:dI,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:cI,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:cI,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:cI,overlineThickness:cI,paintOrder:null,panose1:null,path:null,pathLength:cI,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:lI,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:cI,pointsAtY:cI,pointsAtZ:cI,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:dI,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:dI,rev:dI,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:dI,requiredFeatures:dI,requiredFonts:dI,requiredFormats:dI,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:cI,specularExponent:cI,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:cI,strikethroughThickness:cI,string:null,stroke:null,strokeDashArray:dI,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:cI,strokeOpacity:cI,strokeWidth:null,style:null,surfaceScale:cI,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:dI,tabIndex:cI,tableValues:null,target:null,targetX:cI,targetY:cI,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:dI,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:cI,underlineThickness:cI,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:cI,values:null,vAlphabetic:cI,vMathematical:cI,vectorEffect:null,vHanging:cI,vIdeographic:cI,version:null,vertAdvY:cI,vertOriginX:cI,vertOriginY:cI,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:cI,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:vI}),bI=gI({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),xI=gI({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:yI}),SI=gI({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Goe={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Koe=/[A-Z]/g,CI=/-[a-z]/g,qoe=/^data[-\w.:]+$/i;function Joe(e,t){let n=nI(t),r=t,i=rI;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&qoe.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(CI,Xoe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!CI.test(e)){let n=e.replace(Koe,Yoe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=mI}return new i(r,t)}function Yoe(e){return`-`+e.toLowerCase()}function Xoe(e){return e.charAt(1).toUpperCase()}var Zoe=tI([_I,Uoe,bI,xI,SI],`html`),wI=tI([_I,Woe,bI,xI,SI],`svg`);function Qoe(e){return e.join(` `).trim()}var $oe=i(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
117
+ `},PN={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function FN(e){let{announcements:t=PN,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=NN}=e,{announce:a,announcement:o}=kN(),s=hN(`DndLiveRegion`),[c,l]=(0,p.useState)(!1);if((0,p.useEffect)(()=>{l(!0)},[]),jN((0,p.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=p.createElement(p.Fragment,null,p.createElement(DN,{id:r,value:i.draggable}),p.createElement(ON,{id:s,announcement:o}));return n?(0,m.createPortal)(u,n):u}var IN;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(IN||={});function LN(){}function RN(e,t){return(0,p.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function zN(){var e=[...arguments];return(0,p.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var BN=Object.freeze({x:0,y:0});function VN(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function HN(e,t){let n=SN(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function UN(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function WN(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function GN(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function KN(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function qN(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var JN=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=qN(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(WN)};function YN(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var XN=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&YN(r,a)){let n=GN(a).reduce((e,t)=>e+VN(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(UN)};function ZN(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function QN(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:BN}function $N(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var eP=$N(1);function tP(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function nP(e,t,n){let r=tP(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var rP={ignoreTransform:!1};function iP(e,t){t===void 0&&(t=rP);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=nN(e).getComputedStyle(e);t&&(n=nP(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function aP(e){return iP(e,{ignoreTransform:!0})}function oP(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function sP(e,t){return t===void 0&&(t=nN(e).getComputedStyle(e)),t.position===`fixed`}function cP(e,t){t===void 0&&(t=nN(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function lP(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(rN(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!iN(i)||aN(i)||n.includes(i))return n;let a=nN(e).getComputedStyle(i);return i!==e&&cP(i,a)&&n.push(i),sP(i,a)?n:r(i.parentNode)}return e?r(e):n}function uP(e){let[t]=lP(e,1);return t??null}function dP(e){return!$M||!e?null:eN(e)?e:tN(e)?rN(e)||e===oN(e).scrollingElement?window:iN(e)?e:null:null}function fP(e){return eN(e)?e.scrollX:e.scrollLeft}function pP(e){return eN(e)?e.scrollY:e.scrollTop}function mP(e){return{x:fP(e),y:pP(e)}}var hP;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(hP||={});function gP(e){return!$M||!e?!1:e===document.scrollingElement}function _P(e){let t={x:0,y:0},n=gP(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var vP={x:.2,y:.2};function yP(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=vP);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=_P(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=hP.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=hP.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=hP.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=hP.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function bP(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function xP(e){return e.reduce((e,t)=>_N(e,mP(t)),BN)}function SP(e){return e.reduce((e,t)=>e+fP(t),0)}function pae(e){return e.reduce((e,t)=>e+pP(t),0)}function CP(e,t){if(t===void 0&&(t=iP),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);uP(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var mae=[[`x`,[`left`,`right`],SP],[`y`,[`top`,`bottom`],pae]],wP=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=lP(t),r=xP(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of mae)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},TP=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function hae(e){let{EventTarget:t}=nN(e);return e instanceof t?e:oN(e)}function EP(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var DP;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(DP||={});function OP(e){e.preventDefault()}function gae(e){e.stopPropagation()}var kP;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(kP||={});var AP={start:[kP.Space,kP.Enter],cancel:[kP.Esc],end:[kP.Space,kP.Enter,kP.Tab]},_ae=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case kP.Right:return{...n,x:n.x+25};case kP.Left:return{...n,x:n.x-25};case kP.Down:return{...n,y:n.y+25};case kP.Up:return{...n,y:n.y-25}}},jP=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new TP(oN(t)),this.windowListeners=new TP(nN(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(DP.Resize,this.handleCancel),this.windowListeners.add(DP.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(DP.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&CP(n),t(BN)}handleKeyDown(e){if(bN(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=AP,coordinateGetter:a=_ae,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:BN;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=vN(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=_P(n),p=bP(n),m={x:Math.min(i===kP.Right?p.right-p.width/2:p.right,Math.max(i===kP.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===kP.Down?p.bottom-p.height/2:p.bottom,Math.max(i===kP.Down?p.top:p.top+p.height/2,u.y))},h=i===kP.Right&&!s||i===kP.Left&&!c,g=i===kP.Down&&!l||i===kP.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===kP.Right&&e<=d.x||i===kP.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===kP.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===kP.Down&&e<=d.y||i===kP.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===kP.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,_N(vN(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};jP.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=AP,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function MP(e){return!!(e&&`distance`in e)}function NP(e){return!!(e&&`delay`in e)}var PP=class{constructor(e,t,n){n===void 0&&(n=hae(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=oN(i),this.documentListeners=new TP(this.document),this.listeners=new TP(n),this.windowListeners=new TP(nN(i)),this.initialCoordinates=SN(r)??BN,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(DP.Resize,this.handleCancel),this.windowListeners.add(DP.DragStart,OP),this.windowListeners.add(DP.VisibilityChange,this.handleCancel),this.windowListeners.add(DP.ContextMenu,OP),this.documentListeners.add(DP.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(NP(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(MP(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(DP.Click,gae,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(DP.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=SN(e)??BN,s=vN(n,o);if(!t&&a){if(MP(a)){if(a.tolerance!=null&&EP(s,a.tolerance))return this.handleCancel();if(EP(s,a.distance))return this.handleStart()}if(NP(a)&&EP(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===kP.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},vae={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},FP=class extends PP{constructor(e){let{event:t}=e,n=oN(t.target);super(e,vae,n)}};FP.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var yae={move:{name:`mousemove`},end:{name:`mouseup`}},IP;(function(e){e[e.RightClick=2]=`RightClick`})(IP||={});var bae=class extends PP{constructor(e){super(e,yae,oN(e.event.target))}};bae.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===IP.RightClick?!1:(r?.({event:n}),!0)}}];var LP={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},xae=class extends PP{constructor(e){super(e,LP)}static setup(){return window.addEventListener(LP.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(LP.move.name,e)};function e(){}}};xae.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var RP;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(RP||={});var zP;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(zP||={});function Sae(e){let{acceleration:t,activator:n=RP.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=zP.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,m=wae({delta:d,disabled:!a}),[h,g]=lN(),_=(0,p.useRef)({x:0,y:0}),v=(0,p.useRef)({x:0,y:0}),y=(0,p.useMemo)(()=>{switch(n){case RP.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case RP.DraggableRect:return i}},[n,i,c]),b=(0,p.useRef)(null),x=(0,p.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,p.useMemo)(()=>s===zP.TreeOrder?[...l].reverse():l,[s,l]);(0,p.useEffect)(()=>{if(!a||!l.length||!y){g();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=yP(e,n,y,t,f);for(let e of[`x`,`y`])m[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){g(),b.current=e,h(x,o),_.current=a,v.current=i;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[t,x,r,g,a,o,JSON.stringify(y),JSON.stringify(m),h,l,S,u,JSON.stringify(f)])}var Cae={x:{[hP.Backward]:!1,[hP.Forward]:!1},y:{[hP.Backward]:!1,[hP.Forward]:!1}};function wae(e){let{delta:t,disabled:n}=e,r=pN(t);return dN(e=>{if(n||!r||!e)return Cae;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hP.Backward]:e.x[hP.Backward]||i.x===-1,[hP.Forward]:e.x[hP.Forward]||i.x===1},y:{[hP.Backward]:e.y[hP.Backward]||i.y===-1,[hP.Forward]:e.y[hP.Forward]||i.y===1}}},[n,t,r])}function Tae(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return dN(e=>t==null?null:r??e??null,[r,t])}function Eae(e,t){return(0,p.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var BP;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(BP||={});var VP;(function(e){e.Optimized=`optimized`})(VP||={});var HP=new Map;function Dae(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,p.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,p.useRef)(e),d=_(),f=uN(d),m=(0,p.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),h=(0,p.useRef)(null),g=dN(t=>{if(d&&!n)return HP;if(!t||t===HP||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new wP(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,p.useEffect)(()=>{u.current=e},[e]),(0,p.useEffect)(()=>{d||m()},[n,d]),(0,p.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,p.useEffect)(()=>{d||typeof s!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,d,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function _(){switch(l){case BP.Always:return!1;case BP.BeforeDragging:return n;default:return!n}}}function UP(e,t){return dN(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Oae(e,t){return UP(e,t)}function kae(e){let{callback:t,disabled:n}=e,r=cN(t),i=(0,p.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,p.useEffect)(()=>()=>i?.disconnect(),[i]),i}function WP(e){let{callback:t,disabled:n}=e,r=cN(t),i=(0,p.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,p.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Aae(e){return new wP(iP(e),e)}function GP(e,t,n){t===void 0&&(t=Aae);let[r,i]=(0,p.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=kae({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=WP({callback:a});return sN(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function jae(e){return QN(e,UP(e))}var KP=[];function Mae(e){let t=(0,p.useRef)(e),n=dN(n=>e?n&&n!==KP&&e&&t.current&&e.parentNode===t.current.parentNode?n:lP(e):KP,[e]);return(0,p.useEffect)(()=>{t.current=e},[e]),n}function Nae(e){let[t,n]=(0,p.useState)(null),r=(0,p.useRef)(e),i=(0,p.useCallback)(e=>{let t=dP(e.target);t&&n(e=>e?(e.set(t,mP(t)),new Map(e)):null)},[]);return(0,p.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=dP(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,mP(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{dP(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,p.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>_N(e,t),BN):xP(e):BN,[e,t])}function qP(e,t){t===void 0&&(t=[]);let n=(0,p.useRef)(null);return(0,p.useEffect)(()=>{n.current=null},t),(0,p.useEffect)(()=>{let t=e!==BN;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?vN(e,n.current):BN}function Pae(e){(0,p.useEffect)(()=>{if(!$M)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Fae(e,t){return(0,p.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function JP(e){return(0,p.useMemo)(()=>e?oP(e):null,[e])}var YP=[];function Iae(e,t){t===void 0&&(t=iP);let[n]=e,r=JP(n?nN(n):null),[i,a]=(0,p.useState)(YP);function o(){a(()=>e.length?e.map(e=>gP(e)?r:new wP(t(e),e)):YP)}let s=WP({callback:o});return sN(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function XP(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return iN(t)?t:e}function Lae(e){let{measure:t}=e,[n,r]=(0,p.useState)(null),i=WP({callback:(0,p.useCallback)(e=>{for(let{target:n}of e)if(iN(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=fN((0,p.useCallback)(e=>{let n=XP(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,p.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Rae=[{sensor:FP,options:{}},{sensor:jP,options:{}}],zae={current:{}},ZP={draggable:{measure:aP},droppable:{measure:aP,strategy:BP.WhileDragging,frequency:VP.Optimized},dragOverlay:{measure:iP}},QP=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Bae={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new QP,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:LN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ZP,measureDroppableContainers:LN,windowRect:null,measuringScheduled:!1},$P={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:LN,draggableNodes:new Map,over:null,measureDroppableContainers:LN},eF=(0,p.createContext)($P),tF=(0,p.createContext)(Bae);function Vae(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new QP}}}function Hae(e,t){switch(t.type){case IN.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case IN.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case IN.DragEnd:case IN.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case IN.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new QP(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case IN.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new QP(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case IN.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new QP(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Uae(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,p.useContext)(eF),a=pN(r),o=pN(n?.id);return(0,p.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!bN(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=TN(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function nF(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Wae(e){return(0,p.useMemo)(()=>({draggable:{...ZP.draggable,...e?.draggable},droppable:{...ZP.droppable,...e?.droppable},dragOverlay:{...ZP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Gae(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,p.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;sN(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=QN(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=uP(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var rF=(0,p.createContext)({...BN,scaleX:1,scaleY:1}),iF;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(iF||={});var Kae=(0,p.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Rae,collisionDetection:o=JN,measuring:s,modifiers:c,...l}=e,[u,d]=(0,p.useReducer)(Hae,void 0,Vae),[f,h]=MN(),[g,_]=(0,p.useState)(iF.Uninitialized),v=g===iF.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=u,C=y==null?null:b.get(y),w=(0,p.useRef)({initial:null,translated:null}),T=(0,p.useMemo)(()=>y==null?null:{id:y,data:C?.data??zae,rect:w},[y,C]),E=(0,p.useRef)(null),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(null),j=uN(l,Object.values(l)),M=hN(`DndDescribedBy`,t),N=(0,p.useMemo)(()=>S.getEnabled(),[S]),P=Wae(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=Dae(N,{dragging:v,dependencies:[x.x,x.y],config:P.droppable}),R=Tae(b,y),ee=(0,p.useMemo)(()=>k?SN(k):null,[k]),te=Ee(),z=Oae(R,P.draggable.measure);Gae({activeNode:y==null?null:b.get(y),config:te.layoutShiftCompensation,initialRect:z,measure:P.draggable.measure});let B=GP(R,P.draggable.measure,z),V=GP(R?R.parentElement:null),H=(0,p.useRef)({activatorEvent:null,active:null,activeNode:R,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),U=S.getNodeFor(H.current.over?.id),ne=Lae({measure:P.dragOverlay.measure}),re=ne.nodeRef.current??R,ie=v?ne.rect??B:null,ae=!!(ne.nodeRef.current&&ne.rect),oe=jae(ae?null:B),W=JP(re?nN(re):null),se=Mae(v?U??R:null),ce=Iae(se),le=nF(c,{transform:{x:x.x-oe.x,y:x.y-oe.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:B,containerNodeRect:V,draggingNodeRect:ie,over:H.current.over,overlayNodeRect:ne.rect,scrollableAncestors:se,scrollableAncestorRects:ce,windowRect:W}),ue=ee?_N(ee,x):null,de=Nae(se),fe=qP(de),pe=qP(de,[B]),me=_N(le,fe),he=ie?eP(ie,le):null,ge=T&&he?o({active:T,collisionRect:he,droppableRects:F,droppableContainers:N,pointerCoordinates:ue}):null,_e=KN(ge,`id`),[ve,ye]=(0,p.useState)(null),be=ZN(ae?le:_N(le,pe),ve?.rect??null,B),xe=(0,p.useRef)(null),Se=(0,p.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(E.current==null)return;let i=b.get(E.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:E.current,activeNode:i,event:a,options:r,context:H,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let n=b.get(t);if(!n)return;let{onDragStart:r}=j.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,m.unstable_batchedUpdates)(()=>{r?.(i),_(iF.Initializing),d({type:IN.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),O(xe.current),A(a)})},onMove(e){d({type:IN.DragMove,coordinates:e})},onEnd:o(IN.DragEnd),onCancel:o(IN.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=H.current,o=null;if(t&&i){let{cancelDrop:s}=j.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===IN.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=IN.DragCancel)}E.current=null,(0,m.unstable_batchedUpdates)(()=>{d({type:e}),_(iF.Uninitialized),ye(null),O(null),A(null),xe.current=null;let t=e===IN.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=j.current[t];e?.(o),f({type:t,event:o})}})}}},[b]),Ce=Eae(a,(0,p.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,Se(n,t))},[b,Se]));Pae(a),sN(()=>{B&&g===iF.Initializing&&_(iF.Initialized)},[B,g]),(0,p.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:n,collisions:r,over:i}=H.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,m.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,p.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=H.current;if(!e||E.current==null||!t||!i)return;let{onDragOver:a}=j.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,m.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),sN(()=>{H.current={activatorEvent:k,active:T,activeNode:R,collisionRect:he,collisions:ge,droppableRects:F,draggableNodes:b,draggingNode:re,draggingNodeRect:ie,droppableContainers:S,over:ve,scrollableAncestors:se,scrollAdjustedTranslate:me},w.current={initial:ie,translated:he}},[T,R,ge,he,b,re,ie,F,S,ve,se,me]),Sae({...te,delta:x,draggingRect:he,pointerCoordinates:ue,scrollableAncestors:se,scrollableAncestorRects:ce});let we=(0,p.useMemo)(()=>({active:T,activeNode:R,activeNodeRect:B,activatorEvent:k,collisions:ge,containerNodeRect:V,dragOverlay:ne,draggableNodes:b,droppableContainers:S,droppableRects:F,over:ve,measureDroppableContainers:I,scrollableAncestors:se,scrollableAncestorRects:ce,measuringConfiguration:P,measuringScheduled:L,windowRect:W}),[T,R,B,k,ge,V,ne,b,S,F,ve,I,se,ce,P,L,W]),Te=(0,p.useMemo)(()=>({activatorEvent:k,activators:Ce,active:T,activeNodeRect:B,ariaDescribedById:{draggable:M},dispatch:d,draggableNodes:b,over:ve,measureDroppableContainers:I}),[k,Ce,T,B,d,M,b,ve,I]);return p.createElement(AN.Provider,{value:h},p.createElement(eF.Provider,{value:Te},p.createElement(tF.Provider,{value:we},p.createElement(rF.Provider,{value:be},i)),p.createElement(Uae,{disabled:n?.restoreFocus===!1})),p.createElement(FN,{...n,hiddenTextDescribedById:M}));function Ee(){let e=D?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=v&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),qae=(0,p.createContext)(null),aF=`button`,Jae=`Draggable`;function oF(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=hN(Jae),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,p.useContext)(eF),{role:m=aF,roleDescription:h=`draggable`,tabIndex:g=0}=i??{},_=c?.id===t,v=(0,p.useContext)(_?rF:qae),[y,b]=fN(),[x,S]=fN(),C=Fae(o,t),w=uN(n);return sN(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,p.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":_&&m===aF?!0:void 0,"aria-roledescription":h,"aria-describedby":u.draggable}),[r,m,g,_,h,u.draggable]),isDragging:_,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function Yae(){return(0,p.useContext)(tF)}var Xae=`Droppable`,Zae={timeout:25};function sF(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=hN(Xae),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,p.useContext)(eF),u=(0,p.useRef)({disabled:n}),d=(0,p.useRef)(!1),f=(0,p.useRef)(null),m=(0,p.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={...Zae,...i},v=uN(g??r),y=WP({callback:(0,p.useCallback)(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{l(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!o}),[b,x]=fN((0,p.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=uN(t);return(0,p.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,p.useEffect)(()=>(s({type:IN.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:IN.UnregisterDroppable,key:a,id:r})),[r]),(0,p.useEffect)(()=>{n!==u.current.disabled&&(s({type:IN.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function Qae(e){let{animation:t,children:n}=e,[r,i]=(0,p.useState)(null),[a,o]=(0,p.useState)(null),s=pN(n);return!n&&!r&&s&&i(s),sN(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),p.createElement(p.Fragment,null,n,r?(0,p.cloneElement)(r,{ref:o}):null)}var $ae={x:0,y:0,scaleX:1,scaleY:1};function eoe(e){let{children:t}=e;return p.createElement(eF.Provider,{value:$P},p.createElement(rF.Provider,{value:$ae},t))}var toe={position:`fixed`,touchAction:`none`},noe=e=>bN(e)?`transform 250ms ease`:void 0,roe=(0,p.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=noe}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...toe,width:s.width,height:s.height,top:s.top,left:s.left,transform:CN.Transform.toString(d),transformOrigin:i&&r?HN(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return p.createElement(n,{className:o,style:f,ref:t},a)}),ioe={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:CN.Transform.toString(t)},{transform:CN.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function aoe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return cN((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=XP(a);if(!c)return;let{transform:l}=nN(a).getComputedStyle(a),u=tP(l);if(!u)return;let d=typeof t==`function`?t:ooe(t);return CP(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function ooe(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...ioe,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var cF=0;function soe(e){return(0,p.useMemo)(()=>{if(e!=null)return cF++,cF},[e])}var coe=p.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:m,draggableNodes:h,droppableContainers:g,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:x,windowRect:S}=Yae(),C=(0,p.useContext)(rF),w=soe(d?.id),T=nF(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:m,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:b,scrollableAncestorRects:x,transform:C,windowRect:S}),E=UP(f),D=aoe({config:r,draggableNodes:h,droppableContainers:g,measuringConfiguration:y}),O=E?_.setRef:void 0;return p.createElement(eoe,null,p.createElement(Qae,{animation:D},d&&w?p.createElement(roe,{key:w,id:d.id,ref:O,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:E,style:{zIndex:l,...i},transform:T},n):null))}),loe=3e4,lF=new Map,uF=new Map,dF=e=>!!(e&&Date.now()-e.timestamp<loe),fF=e=>{let t=lF.get(e);return{tool:e,models:t?.models??[],isLoading:!dF(t),error:null}},uoe=e=>{let t=uF.get(e);if(t)return t;let n=Rr(e).then(t=>(lF.set(e,{models:t,timestamp:Date.now()}),t)),r=()=>{uF.get(e)===n&&uF.delete(e)};return n.then(()=>{r()},()=>{r()}),uF.set(e,n),n},pF=e=>{let[t,n]=(0,p.useState)(()=>fF(e));(0,p.useEffect)(()=>{let t=lF.get(e);if(dF(t)){n({tool:e,models:t?.models??[],isLoading:!1,error:null});return}let r=!1;return n({tool:e,models:t?.models??[],isLoading:!0,error:null}),uoe(e).then(t=>{r||n({tool:e,models:t,isLoading:!1,error:null})}).catch(t=>{r||n({tool:e,models:lF.get(e)?.models??[],isLoading:!1,error:t instanceof Error?t:Error(String(t))})}),()=>{r=!0}},[e]);let r=t.tool===e?t:fF(e);return{models:r.models,isLoading:r.isLoading,error:r.error}},mF=async(e,t,n=null)=>{let r=new URLSearchParams({tool:e});n&&r.set(`project_id`,n);let i=await J(q(`/skills?${r.toString()}`),{signal:t,cache:`no-store`});return Array.isArray(i)?i.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.name==`string`&&typeof t.description==`string`}):[]},doe=new Set([`check_completion`,`automation_review`,`automation_commit`,`automation_push`,`automation_pull_request`]),foe=new Set([`not_required`,`policy_invalid`,`policy_drift`,`workspace_unavailable`,`intended_identity_mismatch`,`missing_evidence`,`target_mismatch`,`batch_not_completed`,`incomplete_evidence`,`duplicate_evidence`,`extra_evidence`,`definition_drift`,`attempt_failed`,`attempt_stale`,`target_busy`,`check_start_failed`]),poe=e=>{try{let t=JSON.parse(e);return t.type!==`required_check_gate_failure`||typeof t.boundaryKind!=`string`||!doe.has(t.boundaryKind)||t.reasonCodes!==void 0&&(!Array.isArray(t.reasonCodes)||t.reasonCodes.some(e=>typeof e!=`string`))?null:t}catch{return null}},hF=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,gF=e=>{let t=poe(e);if(!t)return null;let n=(t.reasonCodes??[]).filter(e=>foe.has(e)).map(e=>Wb.t(`common:ticketAutomation.pause.requiredChecks.reason.${e}`)),r=n.length>0?`${n.map((e,t)=>t===0?hF(e):e).join(`; `)}.`:`${hF(Wb.t(`common:ticketAutomation.pause.requiredChecks.fallbackReason`))}.`;return Wb.t(`common:ticketAutomation.pause.requiredChecks.failure`,{boundary:Wb.t(`common:ticketAutomation.pause.requiredChecks.boundary.${t.boundaryKind}`),explanation:r})},_F=240,moe=e=>{switch(e){case`precondition_failed`:return`ticketAutomation.pause.guidance.preconditionFailed`;case`stage_failed`:return`ticketAutomation.pause.guidance.stageFailed`;case`server_restart`:return`ticketAutomation.pause.guidance.serverRestart`;case`reconciliation_failed`:return`ticketAutomation.pause.guidance.reconciliationFailed`;case`side_effect_ambiguous`:return`ticketAutomation.pause.guidance.sideEffectAmbiguous`;case`manual_transition`:return`ticketAutomation.pause.guidance.manualTransition`;case`configuration_changed`:return`ticketAutomation.pause.guidance.configurationChanged`;case`target_busy`:return`ticketAutomation.pause.guidance.targetBusy`;case`required_checks_failed`:return`ticketAutomation.pause.guidance.requiredChecksFailed`;case`invalid_lineage`:return`ticketAutomation.pause.guidance.invalidLineage`;default:return`ticketAutomation.pause.guidance.generic`}},hoe=e=>{let t=e.trim().replace(/\s+/g,` `);return t.length<=_F?t:`${t.slice(0,_F-3)}...`},goe=e=>e.status===`disabled`?`ticketAutomation.pause.resumeDisabled.${e.reason}`:`ticketAutomation.pause.resumeOutcome.${e.outcome}`,vF=e=>{let{onResume:t,onDismiss:n,onResolveQuestions:r,onOpenChecks:i,onStop:a,showActions:o=!0,className:s}=e,{t:c}=K(`common`),[l,u]=(0,p.useState)(!1),d=(0,p.useRef)(!1),f=`ticket`in e?e.ticket.automation_paused_reason??null:e.pausedReason??null,m=`ticket`in e?e.ticket.automation_review_iteration_count??0:e.reviewIterationCount??0,h=`ticket`in e?e.ticket.automation_config?.reviewMaxIterations??null:e.maxIterations??null,g=`ticket`in e?e.ticket.automation_fix_loop_active===!0:e.fixLoopActive===!0,_=`ticket`in e?e.ticket.automation_paused_code??null:e.pausedCode??null,v=`ticket`in e?e.ticket.automation_pause_reason_code??null:e.pausedReasonCode??null,y=`ticket`in e?e.ticket.automation_config?.pauseOnOpenQuestions===!0:e.pauseOnOpenQuestions===!0,b=`ticket`in e?(e.ticket.build_open_questions??[]).filter(e=>e.status===`open`).length:e.openQuestionCount??0,x=`ticket`in e?e.ticket.build_open_question_batch_status??null:e.buildOpenQuestionBatchStatus??null,S=`ticket`in e?e.ticket.automation_resume_decision??null:e.automationResumeDecision??null;if(!f)return null;let C=g&&m>0&&h!==null,w=c(moe(v)),T=c(`ticketAutomation.pause.diagnostic`,{reason:gF(f)??hoe(f)}),E=C?c(`ticketAutomation.pause.iterationCounter`,{current:m,max:h}):null,D=_===`open_questions`,O=_===`required_checks`,k=x===`pending`||x===`running`,A=D&&!k&&y&&b>0,j=!D||!k&&(!y||b===0),M=S?.status===`hidden`?null:S,N=M?c(goe(M)):null,P=M?.status===`disabled`||l,F=S?.status===`disabled`&&(S.reason===`bundle_agent_running`||S.reason===`review_running`),I=O&&F&&!!a,L=j&&t&&M&&N?(0,Y.jsx)(vv,{content:l?c(`ticketAutomation.pause.resumePending`):N,contentClassName:`max-w-80 break-words`,children:(0,Y.jsx)(`span`,{className:`inline-flex`,tabIndex:P?0:void 0,children:(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,disabled:P,onClick:async e=>{if(e.stopPropagation(),!(d.current||M.status!==`enabled`)){d.current=!0,u(!0);try{await t()}finally{d.current=!1,u(!1)}}},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.resume`)})})}):null;return(0,Y.jsxs)(`div`,{className:Z(`flex flex-col gap-1.5`,s),children:[(0,Y.jsx)(vv,{content:T,contentClassName:`max-w-80 break-words`,children:(0,Y.jsx)(bC,{variant:`outline`,className:`w-fit gap-1.5 border-amber-500/30 bg-amber-500/12 text-amber-200`,children:c(`ticketAutomation.pause.label`)})}),(0,Y.jsx)(`p`,{className:`max-w-xl text-xs text-muted-foreground`,children:w}),E&&(0,Y.jsx)(bC,{variant:`outline`,className:`w-fit text-[10px] uppercase tracking-wide text-muted-foreground`,children:E}),o&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A&&r&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,onClick:e=>{e.stopPropagation(),r()},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.resolveQuestions`)}),L,O&&i&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,onClick:e=>{e.stopPropagation(),i()},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.openChecks`)}),I&&a&&(0,Y.jsx)(vv,{content:c(`ticketAutomation.pause.stopTooltip`),contentClassName:`max-w-80 break-words`,children:(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`destructive`,onClick:e=>{e.stopPropagation(),a()},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.stop`)})}),j&&!I&&n&&(0,Y.jsx)(vv,{content:c(`ticketAutomation.pause.abandonTooltip`),contentClassName:`max-w-80 break-words`,children:(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`ghost`,className:`text-muted-foreground`,onClick:e=>{e.stopPropagation(),n()},onPointerDown:e=>e.stopPropagation(),children:c(`ticketAutomation.pause.abandon`)})})]})]})},_oe={draft:`border-sky-400/30 bg-sky-500/15 text-sky-100`,open:`border-emerald-400/30 bg-emerald-500/15 text-emerald-100`,merged:`border-violet-400/30 bg-violet-500/15 text-violet-100`,closed:`border-slate-400/30 bg-slate-500/15 text-slate-200`},voe={draft:`PR Draft`,open:`PR Open`,merged:`PR Merged`,closed:`PR Closed`},yF=({pullRequest:e,asLink:t=!1,onClick:n,onPointerDown:r,showNumber:i=!1})=>{let a=i?`PR #${e.number} ${e.state}`:voe[e.state],o=(0,Y.jsx)(bC,{variant:`outline`,className:_oe[e.state],children:a});return t?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex underline underline-offset-2 decoration-current hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,onClick:n,onPointerDown:r,children:o}):o},bF=({className:e})=>(0,Y.jsx)(Lee,{"aria-hidden":`true`,className:e}),xF=({className:e})=>(0,Y.jsx)(kee,{"aria-hidden":`true`,className:e}),SF=({className:e})=>(0,Y.jsx)(Eee,{"aria-hidden":`true`,className:e}),CF=({className:e})=>(0,Y.jsx)(Oee,{"aria-hidden":`true`,className:e}),wF=({label:e,className:t})=>(0,Y.jsxs)(bC,{className:Z(`inline-flex w-fit items-center gap-2 px-3 py-1 text-xs font-medium text-primary-foreground`,t),children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-violet-300`}),e]}),TF=({status:e,showBuildGlyph:t=!1})=>{let{t:n}=K(`common`);return e===null?null:e===`queued`?(0,Y.jsx)(bC,{variant:`outline`,children:n(`statusBadge.queued`)}):e===`planning`?(0,Y.jsx)(wF,{label:n(`statusBadge.planning`)}):e===`building`?(0,Y.jsx)(bC,{variant:`warning`,children:n(t?`statusBadge.buildingWithGlyph`:`statusBadge.building`)}):e===`reviewing`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.reviewing`)}):e===`automation`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.automation`)}):e===`checks`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.checks`)}):e===`auto_fix`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.autoFix`)}):e===`commit`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.commit`)}):e===`push`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.push`)}):e===`pr`?(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.pr`)}):e===`done`?(0,Y.jsx)(bC,{variant:`success`,children:n(`statusBadge.done`)}):e===`error`?(0,Y.jsx)(bC,{variant:`destructive`,children:n(`statusBadge.error`)}):(0,Y.jsx)(bC,{variant:`warning`,children:n(`statusBadge.stopped`)})},EF=({title:e,stage:t,subjectLabel:n,onConfirm:r,onCancel:i})=>{let{t:a}=K(`common`);(0,p.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]);let o=n||a(`cardConfirmUndoModal.defaultSubjectLabel`),s=a(t===`review`?`cardConfirmUndoModal.headingReview`:`cardConfirmUndoModal.headingBuild`),c=a(t===`review`?`cardConfirmUndoModal.descriptionReview`:`cardConfirmUndoModal.descriptionBuild`,{subjectLabel:o});return(0,Y.jsxs)(gC,{onClose:i,overlayClassName:`bg-black/60`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,Y.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:s}),(0,Y.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:c}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:i,children:a(`cardConfirmUndoModal.cancel`)}),(0,Y.jsx)(Q,{type:`button`,variant:`destructive`,onClick:r,children:a(`cardConfirmUndoModal.confirm`)})]})]})},DF=({isRunning:e,isRunPending:t=!1,isStopPending:n=!1,runDisabled:r=!1,runDisabledReason:i,onRun:a,onStop:o,className:s})=>{let{t:c}=K(`common`);if(e)return o?(0,Y.jsxs)(Q,{type:`button`,size:`xs`,variant:`destructive`,disabled:n,"aria-busy":n,"aria-label":c(n?`runControl.stoppingAriaLabel`:`runControl.stopAriaLabel`),title:n?c(`runControl.stoppingTitle`):void 0,className:s,onClick:e=>{e.stopPropagation(),o()},onPointerDown:e=>e.stopPropagation(),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400 animate-pulse`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`flex w-3.5 justify-center`,children:n?(0,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`span`,{className:`min-w-[2.25rem] text-left`,children:c(`runControl.stop`)})]}):null;if(!a)return null;let l=c(t?`runControl.startingAriaLabel`:`runControl.runAriaLabel`);return(0,Y.jsxs)(Q,{type:`button`,size:`xs`,variant:`secondary`,disabled:t||r,"aria-busy":t,"aria-label":l,title:r?i??c(`runControl.disabledReason`):t?c(`runControl.startingTitle`):void 0,className:Z(`bg-sky-700 text-sky-50 hover:bg-sky-600 hover:text-white disabled:bg-slate-700 disabled:text-slate-400`,s),onClick:e=>{e.stopPropagation(),!r&&a()},onPointerDown:e=>e.stopPropagation(),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`h-2 w-2 flex-shrink-0 rounded-full invisible`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`flex w-3.5 justify-center`,children:t?(0,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin`}):(0,Y.jsx)(Fv,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`span`,{className:`min-w-[2.25rem] text-left`,children:c(`runControl.run`)})]})},OF=e=>e?.status===`queued`||e?.status===`running`||e?.status===`waiting`,kF=e=>OF(e)?`checks`:null,AF=(e,t)=>t?t===`automation`?e===`done`||e===`queued`?t:e:t:e,jF=e=>e.length===0?null:e.some(e=>e.agent_status===`running`&&e.review_follow_up_active===!0)?`building`:e.some(e=>e.agent_status===`running`)?`reviewing`:e.some(e=>e.agent_status===`error`)?`error`:e.some(e=>e.agent_status===`stopped`)?`stopped`:e.some(e=>e.agent_status===`done`)&&e.every(e=>e.agent_status===null||e.agent_status===`done`)?`done`:e.every(e=>e.agent_status===null)?`queued`:null,MF=(e,{allTickets:t=[],preferBundleReviewStatus:n=!1,automationStatus:r=null}={})=>{if(e.parked_at!==null)return null;let i=kF(e.post_build_check);if(i)return AF(i,r);if(e.state===`plan`){if(e.agent_status===`running`)return AF(`planning`,r);if(e.agent_status===null)return null;if(e.agent_status===`done`)return AF(`done`,r);if(e.agent_status===`error`)return AF(`error`,r);if(e.agent_status===`stopped`)return AF(`stopped`,r)}if(n&&e.worktree_bundle_id){let n=t.filter(t=>t.worktree_bundle_id===e.worktree_bundle_id),i=jF((n.length>0?n:[e]).filter(e=>e.state===`review`));if(i)return AF(i,r)}return e.agent_status===null?AF(`queued`,r):e.agent_status===`running`?AF(e.state===`review`&&e.review_follow_up_active!==!0?`reviewing`:`building`,r):e.agent_status===`done`?AF(`done`,r):e.agent_status===`error`?AF(`error`,r):e.agent_status===`stopped`?AF(`stopped`,r):null},NF=(e,t,{automationStatus:n=null}={})=>{if(t===`done`||e.every(e=>e.parked_at!==null))return null;let r=e.filter(e=>e.parked_at===null).map(e=>kF(e.post_build_check)).find(e=>e!==null);if(r)return AF(r,n);let i=e.filter(e=>e.state===`review`);if(t===`review`){let e=jF(i);if(e)return AF(e,n)}let a=jF(i.filter(e=>e.agent_status===`running`));return a?AF(a,n):t===`plan`&&e.some(e=>e.state===`plan`&&e.agent_status===`running`)?AF(`planning`,n):e.some(e=>e.agent_status===`running`)?AF(`building`,n):e.some(e=>e.agent_status===`error`)?AF(`error`,n):e.some(e=>e.agent_status===`stopped`)?AF(`stopped`,n):e.length>0&&e.every(e=>e.agent_status===`done`)?AF(`done`,n):e.some(e=>e.state===`build`)?AF(`queued`,n):null},yoe=e=>e===`claude`?`Claude`:`OpenCode`,PF=(e,t)=>e?.tool??t,FF=e=>e===`opencode`||e===`claude`,IF=(e,t)=>e?t.length===0?!0:t.some(t=>t.id===e):!1,LF=(e,t)=>e?.model?e.tool===null?IF(e.model,t)?e.model:``:e.model:``,boe=({bundleName:e,ticketCount:t,onConfirm:n,onCancel:r})=>((0,p.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,Y.jsxs)(gC,{onClose:r,overlayClassName:`bg-black/60`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,Y.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:`Delete bundle`}),(0,Y.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:e}),(0,Y.jsxs)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:[`This deletes the `,t,` ticket`,t===1?``:`s`,` `,`currently inside this wrapper.`]}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:r,children:`Cancel`}),(0,Y.jsx)(Q,{type:`button`,variant:`destructive`,onClick:n,children:`Delete`})]})]})),xoe=e=>e.find(e=>e.state===`review`&&e.undo?.stage===`review`&&e.undo.can_undo)??e.find(e=>e.state===`review`&&e.undo?.stage===`review`)??null,Soe=(e,t)=>t?.diff_stats===void 0?e.find(e=>e.diff_stats!==void 0)?.diff_stats:t.diff_stats,Coe=e=>e.length>0&&e.every(e=>yy(e)),RF=(0,p.memo)(({group:e,renderTicket:t,activeTool:n,modelsByTool:r,runDisabled:i=!1,onStopBuildTicket:a,onResumeBuildTicket:o,onInterruptReviewTicket:s,onBuildBundle:c,onReviewBundle:l,onUndoBundleReview:u,onRunBundle:d,onStopBundle:f,onParkBundleWrapper:m,onUnparkBundleWrapper:h,bundleActionState:g,onOpenBundleDetails:_,onOpenBundleFiles:v,onOpenBundleChanges:y,onOpenBundleVerification:b,onOpenBundleChecks:x,onOpenBundleIde:S,onRequestBundleRefresh:C,onDeleteBundleWrapper:w,onAddTicketToBundle:T,onStartChatFromBundle:E,undoInProgress:D=!1,overlay:O=!1,hoveredBundleId:k,onHoverBundleChange:A,multiColumnBundleIds:j,automationPausedReason:M,automationStatus:N,automationPausedCode:P,automationPauseReasonCode:F,automationReviewIterationCount:I,automationFixLoopActive:L,automationConfig:R,automationResumeDecision:ee,onResumeBundleAutomation:te,onDismissBundleAutomationPause:z,onOpenBuildQuestions:B})=>{let{t:V}=K(`common`),[H,U]=(0,p.useState)(!1),[ne,re]=(0,p.useState)(!1),{attributes:ie,listeners:ae,setNodeRef:oe,isDragging:W}=oF({id:By(e),disabled:O||D}),se=(0,p.useMemo)(()=>NF(e.tickets,e.column,{automationStatus:N}),[N,e.column,e.tickets]),ce=(0,p.useMemo)(()=>(0,Y.jsx)(TF,{status:se}),[se]),le=e.column===`plan`,ue=e.column===`build`&&e.tickets.every(e=>e.agent_status===`done`),de=(0,p.useMemo)(()=>xoe(e.tickets),[e.tickets]),fe=e.column===`review`&&de!==null,pe=de?.undo?.can_undo??!1,me=de?.undo?.reason??void 0,he=g??{build:!1,stopBuild:!1,resumeBuild:!1,review:!1,undoReview:!1,run:!1,stop:!1,followUp:!1},ge=he.review||he.followUp,_e=e.column===`review`&&!e.tickets.some(e=>e.agent_status===`running`)&&!ge&&e.tickets.some(e=>e.can_re_review),ve=_e?`Re-run review`:`Review Bundle`,ye=e.tickets.find(e=>e.is_running)??e.tickets.find(e=>e.session_id)??e.tickets.find(e=>e.has_worktree)??e.tickets[0],be=(0,p.useMemo)(()=>Soe(e.tickets,ye),[ye,e.tickets]),xe=(0,p.useMemo)(()=>Coe(e.tickets),[e.tickets]),Se=(0,p.useMemo)(()=>e.column!==`plan`&&be===void 0&&e.tickets.some(e=>e.diff_stats===void 0),[be,e.column,e.tickets]),Ce=xe||e.column===`done`,we=e.tickets.some(e=>e.is_running),Te=e.tickets.some(e=>e.has_run_config&&iy(e)),Ee=(0,p.useMemo)(()=>[...new Set(e.tickets.map(e=>LF(e,r[PF(e,n)]??[])).filter(e=>e.length>0))],[n,e.tickets,r]),De=Ee.length===1?Ee[0]:null,Oe=e.tickets.find(e=>hy(e)&&e.agent_status===`running`&&!!e.session_id)??null,ke=e.tickets.find(e=>hy(e)&&e.agent_status===`stopped`&&!!e.session_id)??null,Ae=Oe!==null,je=!Ae&&ke!==null,Me=e.tickets.find(e=>gy(e)&&e.agent_status===`running`)??null,Ne=e.tickets.length>0&&e.tickets.every(e=>Dy(e,`trash`)),Pe=e.column!==`done`&&e.tickets.length>0&&e.tickets.every(e=>Dy(e,`done`)),Fe=e.column===`done`&&e.tickets.length>0&&e.tickets.every(e=>e.state!==`plan`),Ie=e.tickets.length===1?`Return to ${e.tickets[0]?.state.charAt(0).toUpperCase()}${e.tickets[0]?.state.slice(1)}`:`Return to original columns`,Le=!!k&&e.bundle.id===k&&(j?.has(e.bundle.id)??!1),G=Le?`ring-inset ring-2 ring-primary/40 bg-primary/5`:``,Re=j?.has(e.bundle.id)??!1,ze=O?`border-violet-400`:Ce?`border-border/80 hover:border-border`:`border-border hover:border-primary/40`,Be=O||D?`pointer-events-none cursor-grabbing shadow-2xl`:`cursor-pointer`,Ve=W?`opacity-30`:Ce?`opacity-90`:`opacity-100`,He=Ce?`bg-card/60`:`bg-secondary/60`,Ue=Ce?`rounded-lg border border-border/60 bg-background/25 p-2.5`:`rounded-lg border border-border/60 bg-background/35 p-2.5`,We=Ce?`truncate text-sm font-medium text-foreground/70`:`truncate text-sm font-medium text-foreground`,Ge=Ce?`text-[11px] text-foreground/55`:`text-[11px] text-muted-foreground`,Ke=e.column===`done`,qe=!!(b&&ye?.project_id&&Iy(ye)),q=!O&&!Ke&&!!T,Je=new Set(e.tickets.filter(e=>e.state===`build`).map(e=>e.id)),Ye=(e.bundle.open_questions??[]).filter(e=>e.status===`open`&&Je.has(e.ticket_id)).length;return(0,Y.jsxs)(xC,{ref:oe,"data-testid":`bundle-card-${e.bundle.id}-${e.column}`,className:`relative shrink-0 select-none transition-colors ${ze} ${Be} ${Ve} ${He} ${G} gap-0 rounded-xl border shadow-none`,onMouseEnter:()=>{Re&&A?.(e.bundle.id??null)},onMouseLeave:()=>A?.(null),onClick:()=>{O||D||(C?.(e.bundle.id),_?.(e.bundle.id,e.column))},...ae,...ie,children:[D&&(0,Y.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-background/85 backdrop-blur-[1px]`,children:(0,Y.jsxs)(bC,{variant:`warning`,className:`gap-1.5`,children:[(0,Y.jsx)(tT,{className:`h-3.5 w-3.5 animate-spin`}),`Undo in progress...`]})}),(0,Y.jsxs)(EC,{className:`p-3`,children:[(0,Y.jsxs)(`div`,{className:`group/bundle mb-3 flex items-start justify-between gap-2 border-b pb-3 border-border/70`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 text-left`,children:[(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`div`,{className:`${We} min-w-0 ${Le?`font-semibold`:``}`,onMouseEnter:t=>{t.currentTarget.scrollWidth>t.currentTarget.clientWidth&&(t.currentTarget.title=Gy(e.bundle))},onMouseLeave:e=>{e.currentTarget.removeAttribute(`title`)},children:Gy(e.bundle)})}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`shrink-0 ${Ge}`,children:[e.tickets.length,` ticket`,e.tickets.length===1?``:`s`]}),ce,Ye>0&&B&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,"aria-label":V(`buildOpenQuestionsDialog.openActionAriaLabel`,{count:Ye}),onClick:t=>{t.stopPropagation(),B(e.bundle.id)},onPointerDown:e=>e.stopPropagation(),children:V(`buildOpenQuestionsDialog.count`,{count:Ye})}),e.bundle.pull_request&&(0,Y.jsx)(yF,{pullRequest:e.bundle.pull_request,asLink:!0,showNumber:!0,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()}),xe&&(0,Y.jsx)(bC,{variant:`outline`,className:`border-border/80 bg-card/60 text-muted-foreground`,children:`Stale`})]}),(by(e.column,be)||Se||De)&&(0,Y.jsxs)(`div`,{"data-testid":`bundle-card-metadata-${e.bundle.id}-${e.column}`,className:`mt-2 flex flex-col gap-1`,children:[(by(e.column,be)||Se)&&(0,Y.jsx)(kv,{stats:be,isLoading:Se,showFiles:!0,className:Ge}),De&&(0,Y.jsx)(`div`,{className:Ge,children:(0,Y.jsx)(`span`,{className:`truncate`,children:De})})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-shrink-0 items-start gap-1`,children:[(0,Y.jsx)(`div`,{className:`mr-1`,children:(0,Y.jsx)(DF,{isRunning:we,isRunPending:he.run,isStopPending:he.stop,runDisabled:i,onRun:!Te||Ke||!d?void 0:()=>d(e.bundle.id),onStop:f?()=>f(e.bundle.id):void 0})}),(0,Y.jsx)(`div`,{className:`flex size-7 items-start justify-center`,children:q?(0,Y.jsx)(vv,{content:V(`bundleCard.addTicketTooltip`),children:(0,Y.jsx)(Q,{type:`button`,"aria-label":V(`bundleCard.addTicketAriaLabel`,{bundleName:Gy(e.bundle)}),variant:`ghost`,size:`icon-xs`,className:`opacity-0 transition-all group-hover/bundle:opacity-100 group-focus-within/bundle:opacity-100`,onClick:t=>{t.stopPropagation(),T?.(e.bundle.id)},onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(wv,{className:`h-4 w-4`})})}):null}),(0,Y.jsx)(`div`,{className:`flex size-7 items-start justify-center`,children:(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,"aria-label":V(`bundleCard.openActionsAriaLabel`,{bundleName:Gy(e.bundle)}),variant:`ghost`,size:`icon-xs`,className:`opacity-0 transition-all group-hover/bundle:opacity-100 data-[state=open]:opacity-100`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(bF,{className:`h-4 w-4`})})}),(0,Y.jsxs)($y,{side:`right`,align:`start`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[Ne&&w&&(0,Y.jsxs)(eb,{className:`text-red-200 focus:bg-destructive/20 focus:text-red-100`,onSelect:()=>{U(!0)},children:[(0,Y.jsx)(kC,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:`Delete bundle`})]}),Fe&&h&&(0,Y.jsxs)(eb,{onSelect:()=>{h(e)},children:[(0,Y.jsx)(CF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:Ie})]}),le&&c&&(0,Y.jsxs)(eb,{disabled:he.build,onSelect:()=>{c(e.bundle.id)},children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.build?`Building Bundle...`:`Build Bundle`})]}),(ue||_e)&&l&&(0,Y.jsxs)(eb,{disabled:ge,onSelect:()=>{l(e.bundle.id)},children:[(0,Y.jsx)(xF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:ge?`Reviewing Bundle...`:ve})]}),fe&&u&&(0,Y.jsxs)(eb,{disabled:he.undoReview||!pe,title:pe?void 0:me,onSelect:()=>{pe&&re(!0)},children:[(0,Y.jsx)(tT,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.undoReview?`Undoing...`:`Undo Review`})]}),!we&&d&&(0,Y.jsxs)(eb,{disabled:he.run||i,onSelect:()=>{i||d(e.bundle.id)},children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.run?`Starting Run...`:`Run`})]}),we&&f&&(0,Y.jsxs)(eb,{disabled:he.stop,onSelect:()=>{f(e.bundle.id)},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.stop?`Stopping...`:`Stop Run`})]}),Ae&&Oe&&a&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,disabled:he.stopBuild,onSelect:()=>{a(Oe.id)},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.stopBuild?`Pausing Build...`:`Pause Build`})]}),je&&ke&&o&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,disabled:he.resumeBuild,onSelect:()=>{o(ke.id)},children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.resumeBuild?`Resuming Build...`:`Resume Build`})]}),Me&&s&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,disabled:he.stopBuild,onSelect:()=>{s(Me.id)},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:he.stopBuild?V(`cardActionsMenu.interruptingReview`):V(`cardActionsMenu.interruptReview`)})]}),E&&(0,Y.jsxs)(eb,{onSelect:()=>{E?.(e.bundle.id)},children:[(0,Y.jsx)(SE,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:V(`cardActionsMenu.startChat`)})]}),(0,Y.jsxs)(eb,{disabled:!v,onSelect:()=>{v?.(e.bundle.id)},children:[(0,Y.jsx)(jv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:V(`cardActionsMenu.files`)})]}),(0,Y.jsxs)(eb,{disabled:!y,onSelect:()=>{y?.(e.bundle.id)},children:[(0,Y.jsx)(Mv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:V(`cardActionsMenu.changes`)})]}),qe&&(0,Y.jsxs)(eb,{onSelect:()=>{b?.(e.bundle.id)},children:[(0,Y.jsx)(Av,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:V(`bundleCard.verification`)})]}),(0,Y.jsxs)(eb,{disabled:!S,onSelect:()=>{S?.(e.bundle.id)},children:[(0,Y.jsx)(Nv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:`Open IDE`})]}),Pe&&m&&(0,Y.jsxs)(eb,{onSelect:()=>{m(e)},children:[(0,Y.jsx)(SF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:`Done`})]})]})]})})]})]}),M&&(0,Y.jsx)(`div`,{className:`mb-3`,children:(0,Y.jsx)(vF,{pausedReason:M,pausedCode:P,pausedReasonCode:F,reviewIterationCount:I,maxIterations:R?.reviewMaxIterations??null,fixLoopActive:L,pauseOnOpenQuestions:R?.pauseOnOpenQuestions===!0,openQuestionCount:Ye,buildOpenQuestionBatchStatus:e.bundle.build_open_question_batch_status,automationResumeDecision:ee,onResume:te?()=>te(e.bundle.id):void 0,onDismiss:z?()=>z(e.bundle.id):void 0,onResolveQuestions:B?()=>B(e.bundle.id):void 0,onOpenChecks:x?()=>x(e.bundle.id):void 0,onStop:f?()=>f(e.bundle.id):void 0,showActions:!0})}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2 ${Ue}`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:e.tickets.map(e=>(0,Y.jsx)(p.Fragment,{children:t(e)},e.id))}),H&&(0,Y.jsx)(boe,{bundleName:Gy(e.bundle),ticketCount:e.tickets.length,onConfirm:()=>{U(!1),w?.(e)},onCancel:()=>U(!1)}),ne&&de?.undo?.stage&&(0,Y.jsx)(EF,{title:Gy(e.bundle),stage:de.undo.stage,subjectLabel:`bundle`,onConfirm:()=>{re(!1),u?.(e.bundle.id)},onCancel:()=>re(!1)})]})]})}),zF=({className:e})=>(0,Y.jsx)(Yee,{"aria-hidden":`true`,className:e}),woe=({title:e,canDelete:t,undo:n,undoInProgress:r,runDisabled:i,isRunPending:a,isStopPending:o,showVerificationAction:s,showOpenFilesAction:c,showOpenChangesAction:l,showOpenIdeAction:u,showAddTicketToBundleAction:d,showStartChatFromBundleAction:f,showRunAction:p,showStopRunAction:m,showAdvanceAction:h,advanceLabel:g,canAdvance:_,showParkAction:v,showReturnAction:y,returnLabel:b,showBuildChainAction:x,showPauseBuildAction:S,showResumeBuildAction:C,showInterruptReviewAction:w,showStopBuildChainAction:T,onDelete:E,onConfirmDelete:D,onConfirmUndo:O,onOpenVerification:k,onOpenFiles:A,onOpenChanges:j,onOpenIde:M,onAddTicketToBundle:N,onStartChatFromBundle:P,onAdvance:F,onPark:I,onUnpark:L,onBuildChain:R,onRun:ee,onStop:te,onStopBuild:z,onResumeBuild:B,onInterruptReview:V,onStopBuildChain:H})=>{let{t:U}=K(`common`);return(0,Y.jsxs)(Zy,{children:[(0,Y.jsx)(Qy,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,"aria-label":U(`cardActionsMenu.openAriaLabel`,{title:e}),variant:`ghost`,size:`icon-xs`,className:`opacity-0 transition-all group-hover/card:opacity-100 data-[state=open]:opacity-100`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(bF,{className:`h-4 w-4`})})}),(0,Y.jsxs)($y,{side:`right`,align:`start`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[E&&(0,Y.jsxs)(eb,{disabled:!t,className:`text-red-200 focus:bg-destructive/20 focus:text-red-100 data-[disabled]:text-muted-foreground`,onSelect:()=>{t&&D()},children:[(0,Y.jsx)(kC,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.delete`)})]}),n?.stage&&(0,Y.jsxs)(eb,{disabled:!n.can_undo,title:n.can_undo?void 0:n.reason??void 0,onSelect:()=>{r||!n.can_undo||O()},children:[(0,Y.jsx)(tT,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:n.stage===`review`?U(`cardActionsMenu.undoReview`):U(`cardActionsMenu.undoBuild`)})]}),h&&g&&(0,Y.jsxs)(eb,{disabled:!_,onSelect:()=>{_&&F?.()},children:[(0,Y.jsx)(xF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:g})]}),y&&b&&(0,Y.jsxs)(eb,{onSelect:()=>{L?.()},children:[(0,Y.jsx)(CF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:b})]}),x&&(0,Y.jsxs)(eb,{onSelect:()=>{R?.()},children:[(0,Y.jsx)(zF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.buildChain`)})]}),d&&(0,Y.jsxs)(eb,{onSelect:()=>N?.(),children:[(0,Y.jsx)(wv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.addTicketToBundle`)})]}),f&&(0,Y.jsxs)(eb,{onSelect:()=>P?.(),children:[(0,Y.jsx)(SE,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.startChat`)})]}),p&&(0,Y.jsxs)(eb,{disabled:i||a,onSelect:()=>{i||a||ee?.()},children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(a?`cardActionsMenu.startingRun`:`cardActionsMenu.run`)})]}),m&&(0,Y.jsxs)(eb,{disabled:o,className:`text-red-200 focus:bg-destructive/20 focus:text-red-100`,onSelect:()=>{o||te?.()},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(o?`cardActionsMenu.stopping`:`cardActionsMenu.stopRun`)})]}),S&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,onSelect:()=>z?.(),children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.pauseBuild`)})]}),C&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,onSelect:()=>B?.(),children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.resumeBuild`)})]}),w&&(0,Y.jsxs)(eb,{className:`text-amber-200 focus:bg-amber-500/20 focus:text-amber-100`,onSelect:()=>V?.(),children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.interruptReview`)})]}),c&&(0,Y.jsxs)(eb,{onSelect:()=>A?.(),children:[(0,Y.jsx)(jv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.files`)})]}),l&&(0,Y.jsxs)(eb,{onSelect:()=>j?.(),children:[(0,Y.jsx)(Mv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.changes`)})]}),s&&(0,Y.jsxs)(eb,{onSelect:()=>k?.(),children:[(0,Y.jsx)(Av,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.verification`)})]}),u&&(0,Y.jsxs)(eb,{onSelect:()=>M?.(),children:[(0,Y.jsx)(Nv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.openIde`)})]}),T&&(0,Y.jsxs)(eb,{className:`text-red-200 focus:bg-destructive/20 focus:text-red-100`,onSelect:()=>{H?.()},children:[(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.stopBuildChain`)})]}),v&&(0,Y.jsxs)(eb,{onSelect:()=>{I?.()},children:[(0,Y.jsx)(SF,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:U(`cardActionsMenu.done`)})]})]})]})},Toe=({title:e,bundleName:t=null,onConfirm:n,onCancel:r})=>{let{t:i}=K(`common`);return(0,p.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,Y.jsxs)(gC,{onClose:r,overlayClassName:`bg-black/60`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,Y.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:i(`cardConfirmDeleteModal.heading`)}),(0,Y.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:t?i(`cardConfirmDeleteModal.descriptionInBundle`,{bundleName:t}):i(`cardConfirmDeleteModal.descriptionStandalone`)}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:r,children:i(`cardConfirmDeleteModal.cancel`)}),(0,Y.jsx)(Q,{type:`button`,variant:`destructive`,onClick:n,children:i(`cardConfirmDeleteModal.confirm`)})]})]})},BF=({description:e,descriptionClass:t,isExpanded:n,collapsedState:r,useStaleLikeStyling:i,onExpand:a,onCollapse:o})=>{if(!e)return null;let s=`ml-1 inline h-auto px-0 py-0 align-baseline text-xs lowercase ${i?`text-foreground/75`:`text-foreground/70`}`;return(0,Y.jsx)(`div`,{className:`mb-2 text-xs leading-relaxed ${i?`text-foreground/55`:`text-muted-foreground`}`,children:n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:t,children:e}),(0,Y.jsx)(Q,{type:`button`,variant:`link`,size:`xs`,className:s,onClick:e=>{e.stopPropagation(),o()},onPointerDown:e=>e.stopPropagation(),children:`show less`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:t,children:r.text}),r.truncated&&(0,Y.jsx)(Q,{type:`button`,variant:`link`,size:`xs`,className:s,onClick:e=>{e.stopPropagation(),a()},onPointerDown:e=>e.stopPropagation(),children:`show more`})]})})},Eoe=({ticket:e,hideStatusBadge:t,isStale:n,runControl:r,onRetry:i,undoInProgress:a,isChainStart:o,automationBadge:s,automationStatus:c,onOpenBuildQuestions:l})=>{let{t:u}=K(`common`),d=e.state===`plan`&&(e.planning_context?.open_questions.length??0)>0,f=e.state===`build`?(e.build_open_questions??[]).filter(e=>e.status===`open`).length:0,p=MF(e,{automationStatus:c}),m=c!=null&&c!==`automation`,h=t&&!m||e.state===`plan`&&e.agent_status===null;return(0,Y.jsxs)(Y.Fragment,{children:[n&&(0,Y.jsx)(`div`,{className:`mb-2`,children:(0,Y.jsx)(bC,{variant:`outline`,className:`border-border/80 bg-card/60 text-muted-foreground`,children:u(`cardStatusBadges.stale`)})}),(!t||m)&&p!==null&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(TF,{status:p,showBuildGlyph:!0}),p===`error`&&i&&!a&&(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:e=>{e.stopPropagation(),i()},onPointerDown:e=>e.stopPropagation(),children:(0,Y.jsx)(tT,{className:`w-3.5 h-3.5`})}),r]}),h&&r,d&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(bC,{variant:`warning`,children:u(`cardStatusBadges.openQuestions`)})}),f>0&&l&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,"aria-label":u(`buildOpenQuestionsDialog.openActionAriaLabel`,{count:f}),onClick:e=>{e.stopPropagation(),l()},onPointerDown:e=>e.stopPropagation(),children:u(`buildOpenQuestionsDialog.count`,{count:f})})}),o&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsxs)(bC,{variant:`secondary`,className:`gap-1.5 border-violet-500/25 bg-violet-500/12 text-violet-200`,children:[(0,Y.jsx)(zF,{className:`h-3.5 w-3.5`}),u(`cardStatusBadges.chainStart`)]})}),s&&(0,Y.jsx)(`div`,{className:`mt-2`,children:s})]})},VF=(e,t)=>J(Ye(`/tickets/${e}/terminal`,t),{method:`POST`,fallbackErrorMessage:`Unable to open the terminal right now.`}),Doe=e=>J(q(`/projects/${e}/terminal`),{method:`POST`,fallbackErrorMessage:`Unable to open the project terminal right now.`}),HF=e=>{let t=q(`/terminals/${e}/destroy`);if(typeof navigator<`u`&&typeof navigator.sendBeacon==`function`){let e=new Blob([`{}`],{type:`application/json`});if(navigator.sendBeacon(t,e))return}fetch(t,{method:`POST`,keepalive:!0,headers:{"Content-Type":`application/json`},body:`{}`}).catch(()=>{})},UF=2,Ooe=e=>e.length===0?`No skills`:e.length<=UF?e.join(`, `):`${e.slice(0,UF).join(`, `)} +${e.length-UF}`,WF=({skills:e,availableSkills:t,onSkillsChange:n,selectId:r,label:i=`Skills`,triggerAriaLabel:a,disabled:o=!1,className:s,triggerClassName:c,showSelectedBadges:l=!0})=>{let u=e.map(e=>t.find(t=>t.name===e)?.name??e).filter(Boolean),d=u.slice(0,UF),f=Math.max(0,u.length-d.length);return(0,Y.jsxs)(`div`,{className:Z(`flex flex-col gap-2`,s),children:[(0,Y.jsx)(Vw,{label:i,triggerLabel:Ooe(u),triggerAriaLabel:a??`Skills`,selectId:r,selectedValues:e,onToggle:t=>{n(e.includes(t)?e.filter(e=>e!==t):[...e,t])},disabled:o,contentClassName:`min-w-[22rem]`,triggerClassName:c,groups:[{label:``,options:t.map(e=>({value:e.name,label:e.name}))}]}),l&&u.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[d.map(e=>(0,Y.jsx)(bC,{variant:`outline`,className:`border-border/80 bg-background/70 text-[11px] text-foreground`,children:e},e)),f>0&&(0,Y.jsxs)(bC,{variant:`ghost`,className:`px-1.5 text-[11px] text-muted-foreground`,children:[`+`,f,` more`]})]})]})},koe=({model:e,variant:t,skills:n,selectedModel:r,defaultModelLabel:i,defaultVariantLabel:a,skillCountLabel:o,showCompleteSummary:s})=>{let c=[];return(e||s)&&c.push(e?r?.label??e:i),(t||s)&&c.push(t||a),(n.length>0||s)&&c.push(o),c.length===0?`AI defaults`:c.join(` / `)},GF=({model:e,variant:t,skills:n,showModelSelector:r,showSkillsSelector:i,availableModels:a,availableSkills:o,selectedModel:s,onModelChange:c,onVariantChange:l,onSkillsChange:u,modelSelectId:d,variantSelectId:f,skillsSelectId:p,disabled:m=!1,className:h,showCompleteSummary:g=!1,modelSelectorNotice:_})=>{let{t:v}=K(`common`),y=r&&s!==null&&s.variants.length>0,b=koe({model:e,variant:t,skills:n,selectedModel:s,defaultModelLabel:v(`ticketPlanDetails.defaultModel`),defaultVariantLabel:v(`ticketPlanDetails.defaultVariant`),skillCountLabel:v(`ticketPlanDetails.skillCount`,{count:n.length}),showCompleteSummary:g});return!r&&!i&&!g&&!_?null:(0,Y.jsxs)(Y_,{children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,disabled:m,className:Z(`max-w-full w-fit justify-start gap-2 text-left sm:max-w-80`,h),"aria-label":`AI settings`,children:[(0,Y.jsx)(cb,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`truncate`,children:b})]})}),(0,Y.jsx)(Z_,{align:`start`,className:`w-80 max-w-[calc(100vw-2rem)] p-3`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,children:`AI settings`})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(uv,{model:e,showModelSelector:r,availableModels:a,onModelChange:c,selectId:d,disabled:m,notice:_}),(0,Y.jsx)(dv,{variant:t,selectedModel:s,showVariantSelector:y,onVariantChange:l,selectId:f,disabled:m}),i&&(0,Y.jsx)(WF,{skills:n,availableSkills:o,onSkillsChange:u,selectId:p,disabled:m,showSelectedBadges:!1})]})]})})]})},KF=({tool:e,className:t})=>{if(!e)return null;let n=yoe(e),r=`Locked to ${n}`;return(0,Y.jsx)(vv,{content:r,children:(0,Y.jsx)(bC,{variant:`outline`,"aria-label":r,className:Z(`border-violet-500/25 bg-violet-500/10 text-violet-100`,e===`claude`&&`border-orange-500/25 bg-orange-500/10 text-orange-100`,t),children:n})})},Aoe=e=>{if(!Number.isFinite(e))return`0`;if(e>=1e6){let t=e/1e6,n=t<10?2:1;return`${t.toFixed(n)}M`}return e>=1e3?`${(e/1e3).toFixed(1)}K`:`${Math.round(e)}`},joe=({totalTokens:e,contextWindow:t})=>!Number.isFinite(e)||!Number.isFinite(t)||t<=0?null:Math.round(e/t*100),Moe=({model:e,availableModels:t,fallbackContextWindow:n})=>(t.find(t=>t.id===e)??null)?.context_window??n,qF=({totalTokens:e,contextWindow:t,cost:n,tool:r,model:i,availableModels:a,fallbackContextWindow:o=null,hideCost:s=!1})=>{let c=e;if(c===null)return null;let l=Moe({tool:r,model:i,availableModels:a,fallbackContextWindow:t??o});if(l===null)return null;let u=joe({totalTokens:c,contextWindow:l});if(u===null)return null;let d=n,f=typeof d==`number`&&d>0,p=`${Aoe(c)} (${u}%)`;return(0,Y.jsx)(`div`,{"data-testid":`context-usage-badge`,className:`inline-flex items-center rounded-full border border-border/80 bg-muted/40 px-2 py-0.5 text-[11px] font-medium text-foreground`,children:!s&&f?`${p} · $${d.toFixed(2)}`:p})},JF=[`manual`,`auto_review`,`auto_commit`,`auto_push`,`auto_pr`],YF=(e,t)=>JF.indexOf(e)>=JF.indexOf(t),Noe=({resolvedDepth:e,resolvedFixEnabled:t,depthOverride:n,fixOverride:r,resolvedMaxIterations:i,maxIterationsOverride:a,resolvedPauseOnOpenQuestions:o=!1,pauseOnOpenQuestionsOverride:s=null,reviewerConfig:c,reviewerModelOverride:l,reviewerVariantOverride:u,availableReviewerModels:d,isLoadingReviewerModels:f,showClaudeTicketProvenance:m,isGitHubConnected:h,onChange:g,isPending:_=!1,className:v})=>{let{t:y}=K(`common`),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(()=>String(a??i)),w=(0,p.useRef)(null),T=(0,p.useRef)(!1),E=n!=null,D=r!=null,O=s!=null,k=a!=null,A=l!=null;(0,p.useEffect)(()=>{C(String(a??i)),w.current=null},[a,i]);let j=(t={})=>({automation_depth:E?e:null,automation_review_fix_enabled:D?r:null,automation_pause_on_open_questions:s,automation_review_max_iterations:a,reviewer_model:l,reviewer_variant:l?u:null,...t}),M=e=>{if(w.current===e)return;w.current=e;let t=Number(e);if(!(/^\d+$/.test(e)&&Number.isInteger(t)&&t>=1&&t<=10)){C(String(a??i));return}C(String(t)),a!==t&&g(j({automation_review_max_iterations:t}))},N=y(E||D||O||k?`ticketAutomation.override.summaryOverride`:`ticketAutomation.override.summaryInherited`),P=y(e===`manual`?`ticketAutomation.depth.manual`:`ticketAutomation.depth.${e}`),F=c.source!==`fallback`&&c.model?d.find(e=>e.id===c.model)?.label??c.model:y(`ticketAutomation.reviewer.fallback`),I=c.source===`fallback`?y(`ticketAutomation.reviewer.perTicketVariant`):c.variant??y(`ticketAutomation.reviewer.defaultVariant`);return(0,Y.jsxs)(Y_,{open:b,onOpenChange:x,children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,className:Z(`max-w-full w-fit justify-start gap-2 text-left`,v),"aria-label":y(`ticketAutomation.override.ariaLabel`),"aria-busy":_,disabled:_,children:[_&&(0,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:y(`ticketAutomation.override.summaryLabel`,{depth:P,source:N})})]})}),(0,Y.jsx)(Z_,{align:`start`,className:`w-[36rem] max-w-[calc(100vw-2rem)] p-3`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,children:y(`ticketAutomation.override.title`)}),_&&(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y(`ticketAutomation.override.saving`)})]}),(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-background/40 px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:y(`ticketAutomation.reviewer.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.reviewer.effective`,{model:F,variant:I})})]}),(0,Y.jsx)(bC,{variant:`outline`,className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:y(`ticketAutomation.reviewer.sources.${c.source}`)})]}),(0,Y.jsxs)(Rw,{type:`single`,value:A?`override`:`__inherit__`,onValueChange:e=>{_||!e||g(j({reviewer_model:e===`override`?c.model??d[0]?.id??null:null,reviewer_variant:e===`override`&&c.model?c.variant:null}))},variant:`outline`,spacing:0,className:`mt-3 flex w-full flex-wrap`,"aria-label":y(`ticketAutomation.reviewer.sourceAriaLabel`),children:[(0,Y.jsx)(zw,{value:`__inherit__`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.inherit`)}),(0,Y.jsx)(zw,{value:`override`,disabled:_||d.length===0,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.overrideSetting`)})]}),m&&(0,Y.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.reviewer.claudeTicketProvenance`)}),A&&(0,Y.jsx)(fv,{model:l,variant:u??``,availableModels:d,isLoadingModels:f,onModelChange:e=>{let t=(d.find(t=>t.id===e)??null)?.variants.includes(u??``)?u:null;g(j({reviewer_model:e||null,reviewer_variant:e?t:null}))},onVariantChange:e=>g(j({reviewer_variant:e||null})),modelSelectId:`bundle-reviewer-model`,variantSelectId:`bundle-reviewer-variant`,title:y(`ticketAutomation.reviewer.title`),description:y(`ticketAutomation.reviewer.description`),loadingDescription:y(`ticketAutomation.reviewer.loading`),unavailableDescription:y(`ticketAutomation.reviewer.unavailable`),modelLabel:y(`ticketAutomation.reviewer.modelLabel`),variantLabel:y(`ticketAutomation.reviewer.variantLabel`),defaultModelLabel:y(`ticketAutomation.reviewer.clearOverride`),defaultVariantLabel:y(`ticketAutomation.reviewer.defaultVariant`),availableVariantsLabel:y(`ticketAutomation.reviewer.availableVariants`),className:`mt-3 border-0 bg-transparent p-0`,compact:!0,showHeader:!1,disabled:_})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(Rw,{type:`single`,value:E?e:`__inherit__`,onValueChange:e=>{if(!(_||!e)){if(e===`__inherit__`){g(j({automation_depth:null}));return}g(j({automation_depth:e}))}},variant:`outline`,spacing:0,className:`flex w-full flex-wrap`,"aria-label":y(`ticketAutomation.override.depthAriaLabel`),children:[(0,Y.jsx)(zw,{value:`__inherit__`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.inherit`)}),(0,Y.jsx)(zw,{value:`manual`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.manual`)}),(0,Y.jsx)(zw,{value:`auto_review`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.auto_review`)}),(0,Y.jsx)(zw,{value:`auto_commit`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.auto_commit`)}),(0,Y.jsx)(zw,{value:`auto_push`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.auto_push`)}),(0,Y.jsx)(zw,{value:`auto_pr`,disabled:_||!h,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.depth.auto_pr`)})]}),!h&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`ticketAutomation.override.autoPrDisabledHint`)}),E&&(0,Y.jsx)(bC,{variant:`outline`,className:`w-fit text-[10px] uppercase tracking-wide text-muted-foreground`,children:y(`ticketAutomation.override.overridingProject`)})]}),YF(e,`auto_review`)&&(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-background/40 px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:y(`ticketAutomation.override.fixToggleLabel`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.override.fixToggleDescription`)})]}),(0,Y.jsx)(Iw,{"aria-label":y(`ticketAutomation.override.fixToggleAriaLabel`),checked:t,disabled:_,onCheckedChange:e=>{g(j({automation_review_fix_enabled:e}))}})]}),D&&(0,Y.jsx)(bC,{variant:`outline`,className:`mt-2 text-[10px] uppercase tracking-wide text-muted-foreground`,children:y(`ticketAutomation.override.overridingProject`)})]}),YF(e,`auto_review`)&&t&&(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-background/40 px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:y(`ticketAutomation.override.maxIterationsLabel`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.override.maxIterationsDescription`)}),(0,Y.jsxs)(Rw,{type:`single`,value:k?`override`:`__inherit__`,onValueChange:e=>{_||!e||g(j({automation_review_max_iterations:e===`override`?i:null}))},variant:`outline`,spacing:0,className:`mt-3 flex w-full flex-wrap`,"aria-label":y(`ticketAutomation.override.maxIterationsAriaLabel`),children:[(0,Y.jsx)(zw,{value:`__inherit__`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.inheritProjectSetting`)}),(0,Y.jsx)(zw,{value:`override`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.overrideSetting`)})]}),k&&(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,Y.jsx)(`label`,{htmlFor:`ticket-automation-max-iterations`,className:`text-xs text-muted-foreground`,children:y(`ticketAutomation.override.maxIterationsInputLabel`)}),(0,Y.jsx)(F_,{id:`ticket-automation-max-iterations`,type:`number`,min:1,max:10,"aria-label":y(`ticketAutomation.override.maxIterationsInputAriaLabel`),value:S,disabled:_,onChange:e=>{w.current=null,C(e.target.value)},onBlur:()=>{if(T.current){T.current=!1;return}M(S)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T.current=!0,M(S),window.setTimeout(()=>{T.current=!1},0))},className:`w-20`})]})]}),(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-background/40 px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:y(`ticketAutomation.override.openQuestionsLabel`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:y(`ticketAutomation.override.openQuestionsDescription`)}),(0,Y.jsxs)(Rw,{type:`single`,value:O?String(o):`__inherit__`,onValueChange:e=>{_||!e||g(j({automation_pause_on_open_questions:e===`__inherit__`?null:e===`true`}))},variant:`outline`,spacing:0,className:`mt-3 flex w-full flex-wrap`,"aria-label":y(`ticketAutomation.override.openQuestionsAriaLabel`),children:[(0,Y.jsx)(zw,{value:`__inherit__`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.inherit`)}),(0,Y.jsx)(zw,{value:`true`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.enabled`)}),(0,Y.jsx)(zw,{value:`false`,disabled:_,className:`px-2.5 py-1.5 text-xs`,children:y(`ticketAutomation.override.disabled`)})]})]})]})})]})},Poe=({bundle:e,availableModels:t,className:n})=>{let{t:r}=K(`common`),i=e.reviewer_config??{model:null,variant:null,source:`fallback`},a=i.source!==`fallback`&&i.model?t.find(e=>e.id===i.model)?.label??i.model:r(`ticketAutomation.reviewer.fallback`),o=i.source===`fallback`?r(`ticketAutomation.reviewer.perTicketVariant`):i.variant??r(`ticketAutomation.reviewer.defaultVariant`);return(0,Y.jsx)(`div`,{className:Z(`rounded-xl border border-border/70 bg-background/30 px-3 py-2`,n),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`ticketAutomation.reviewer.effective`,{model:a,variant:o})}),(0,Y.jsx)(bC,{variant:`outline`,className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:r(`ticketAutomation.reviewer.sources.${i.source}`)})]})})},XF=({bundle:e,isGitHubConnected:t,onChange:n,isPending:r,className:i,availableReviewerModels:a=[],isLoadingReviewerModels:o=!1,showClaudeTicketProvenance:s=!1})=>{if(e.kind===`project_root`)return(0,Y.jsx)(Poe,{bundle:e,availableModels:a,className:i});let c=e.automation_config?.depth??`manual`,l=e.automation_config?.reviewFixEnabled??!1,u=e.automation_config?.reviewMaxIterations??3,d=e.automation_config?.pauseOnOpenQuestions??!1;return(0,Y.jsx)(Noe,{resolvedDepth:c,resolvedFixEnabled:l,depthOverride:e.automation_depth??null,fixOverride:e.automation_review_fix_enabled==null?null:!!e.automation_review_fix_enabled,resolvedMaxIterations:u,maxIterationsOverride:e.automation_review_max_iterations??null,resolvedPauseOnOpenQuestions:d,pauseOnOpenQuestionsOverride:e.automation_pause_on_open_questions==null?null:!!e.automation_pause_on_open_questions,reviewerConfig:e.reviewer_config??{model:null,variant:null,source:`fallback`},reviewerModelOverride:e.reviewer_model??null,reviewerVariantOverride:e.reviewer_variant??null,availableReviewerModels:a,isLoadingReviewerModels:o,showClaudeTicketProvenance:s,isGitHubConnected:t,onChange:n,isPending:r,className:i})},Foe=e=>{if(e.provider===`github`){let t=e.metadata?.issue_number;if(typeof t==`number`||typeof t==`string`&&t.trim()!==``)return`#${t}`;let n=e.external_key.lastIndexOf(`#`);return n>=0&&n<e.external_key.length-1?`#${e.external_key.slice(n+1)}`:e.external_key}return e.external_key},ZF=({externalSource:e=null,className:t})=>{let{t:n}=K(`common`);if(!e||e.provider!==`jira`&&e.provider!==`github`)return null;let r=Foe(e),i=e.provider===`jira`?n(`externalSourceBadge.tooltip.jira`,{key:e.external_key}):n(`externalSourceBadge.tooltip.github`,{key:e.external_key}),a=(0,Y.jsx)(bC,{variant:`outline`,className:Z(`border-ticket-link/30 bg-ticket-link/15 text-ticket-link`,t),children:r});return e.external_url?(0,Y.jsx)(`a`,{href:e.external_url,target:`_blank`,rel:`noreferrer`,title:i,className:`inline-flex underline underline-offset-2 decoration-current hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:a}):(0,Y.jsx)(`span`,{title:i,children:a})};function Ioe(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Loe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Roe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zoe={};function QF(e,t){return((t||zoe).jsx?Roe:Loe).test(e)}var Boe=/[ \t\n\f\r]/g;function Voe(e){return typeof e==`object`?e.type===`text`?$F(e.value):!1:$F(e)}function $F(e){return e.replace(Boe,``)===``}var eI=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};eI.prototype.normal={},eI.prototype.property={},eI.prototype.space=void 0;function tI(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new eI(n,r,t)}function nI(e){return e.toLowerCase()}var rI=class{constructor(e,t){this.attribute=t,this.property=e}};rI.prototype.attribute=``,rI.prototype.booleanish=!1,rI.prototype.boolean=!1,rI.prototype.commaOrSpaceSeparated=!1,rI.prototype.commaSeparated=!1,rI.prototype.defined=!1,rI.prototype.mustUseProperty=!1,rI.prototype.number=!1,rI.prototype.overloadedBoolean=!1,rI.prototype.property=``,rI.prototype.spaceSeparated=!1,rI.prototype.space=void 0;var iI=r({boolean:()=>aI,booleanish:()=>oI,commaOrSpaceSeparated:()=>dI,commaSeparated:()=>uI,number:()=>cI,overloadedBoolean:()=>sI,spaceSeparated:()=>lI}),Hoe=0,aI=fI(),oI=fI(),sI=fI(),cI=fI(),lI=fI(),uI=fI(),dI=fI();function fI(){return 2**++Hoe}var pI=Object.keys(iI),mI=class extends rI{constructor(e,t,n,r){let i=-1;if(super(e,t),hI(this,`space`,r),typeof n==`number`)for(;++i<pI.length;){let e=pI[i];hI(this,pI[i],(n&iI[e])===iI[e])}}};mI.prototype.defined=!0;function hI(e,t,n){n&&(e[t]=n)}function gI(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new mI(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[nI(r)]=r,n[nI(a.attribute)]=r}return new eI(t,n,e.space)}var _I=gI({properties:{ariaActiveDescendant:null,ariaAtomic:oI,ariaAutoComplete:null,ariaBusy:oI,ariaChecked:oI,ariaColCount:cI,ariaColIndex:cI,ariaColSpan:cI,ariaControls:lI,ariaCurrent:null,ariaDescribedBy:lI,ariaDetails:null,ariaDisabled:oI,ariaDropEffect:lI,ariaErrorMessage:null,ariaExpanded:oI,ariaFlowTo:lI,ariaGrabbed:oI,ariaHasPopup:null,ariaHidden:oI,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lI,ariaLevel:cI,ariaLive:null,ariaModal:oI,ariaMultiLine:oI,ariaMultiSelectable:oI,ariaOrientation:null,ariaOwns:lI,ariaPlaceholder:null,ariaPosInSet:cI,ariaPressed:oI,ariaReadOnly:oI,ariaRelevant:null,ariaRequired:oI,ariaRoleDescription:lI,ariaRowCount:cI,ariaRowIndex:cI,ariaRowSpan:cI,ariaSelected:oI,ariaSetSize:cI,ariaSort:null,ariaValueMax:cI,ariaValueMin:cI,ariaValueNow:cI,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function vI(e,t){return t in e?e[t]:t}function yI(e,t){return vI(e,t.toLowerCase())}var Uoe=gI({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:uI,acceptCharset:lI,accessKey:lI,action:null,allow:null,allowFullScreen:aI,allowPaymentRequest:aI,allowUserMedia:aI,alt:null,as:null,async:aI,autoCapitalize:null,autoComplete:lI,autoFocus:aI,autoPlay:aI,blocking:lI,capture:null,charSet:null,checked:aI,cite:null,className:lI,cols:cI,colSpan:null,content:null,contentEditable:oI,controls:aI,controlsList:lI,coords:cI|uI,crossOrigin:null,data:null,dateTime:null,decoding:null,default:aI,defer:aI,dir:null,dirName:null,disabled:aI,download:sI,draggable:oI,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:aI,formTarget:null,headers:lI,height:cI,hidden:sI,high:cI,href:null,hrefLang:null,htmlFor:lI,httpEquiv:lI,id:null,imageSizes:null,imageSrcSet:null,inert:aI,inputMode:null,integrity:null,is:null,isMap:aI,itemId:null,itemProp:lI,itemRef:lI,itemScope:aI,itemType:lI,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:aI,low:cI,manifest:null,max:null,maxLength:cI,media:null,method:null,min:null,minLength:cI,multiple:aI,muted:aI,name:null,nonce:null,noModule:aI,noValidate:aI,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:aI,optimum:cI,pattern:null,ping:lI,placeholder:null,playsInline:aI,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:aI,referrerPolicy:null,rel:lI,required:aI,reversed:aI,rows:cI,rowSpan:cI,sandbox:lI,scope:null,scoped:aI,seamless:aI,selected:aI,shadowRootClonable:aI,shadowRootDelegatesFocus:aI,shadowRootMode:null,shape:null,size:cI,sizes:null,slot:null,span:cI,spellCheck:oI,src:null,srcDoc:null,srcLang:null,srcSet:null,start:cI,step:null,style:null,tabIndex:cI,target:null,title:null,translate:null,type:null,typeMustMatch:aI,useMap:null,value:oI,width:cI,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lI,axis:null,background:null,bgColor:null,border:cI,borderColor:null,bottomMargin:cI,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:aI,declare:aI,event:null,face:null,frame:null,frameBorder:null,hSpace:cI,leftMargin:cI,link:null,longDesc:null,lowSrc:null,marginHeight:cI,marginWidth:cI,noResize:aI,noHref:aI,noShade:aI,noWrap:aI,object:null,profile:null,prompt:null,rev:null,rightMargin:cI,rules:null,scheme:null,scrolling:oI,standby:null,summary:null,text:null,topMargin:cI,valueType:null,version:null,vAlign:null,vLink:null,vSpace:cI,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:aI,disableRemotePlayback:aI,prefix:null,property:null,results:cI,security:null,unselectable:null},space:`html`,transform:yI}),Woe=gI({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:dI,accentHeight:cI,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:cI,amplitude:cI,arabicForm:null,ascent:cI,attributeName:null,attributeType:null,azimuth:cI,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:cI,by:null,calcMode:null,capHeight:cI,className:lI,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:cI,diffuseConstant:cI,direction:null,display:null,dur:null,divisor:cI,dominantBaseline:null,download:aI,dx:null,dy:null,edgeMode:null,editable:null,elevation:cI,enableBackground:null,end:null,event:null,exponent:cI,externalResourcesRequired:null,fill:null,fillOpacity:cI,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:uI,g2:uI,glyphName:uI,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:cI,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:cI,horizOriginX:cI,horizOriginY:cI,id:null,ideographic:cI,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:cI,k:cI,k1:cI,k2:cI,k3:cI,k4:cI,kernelMatrix:dI,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:cI,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:cI,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:cI,overlineThickness:cI,paintOrder:null,panose1:null,path:null,pathLength:cI,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:lI,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:cI,pointsAtY:cI,pointsAtZ:cI,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:dI,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:dI,rev:dI,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:dI,requiredFeatures:dI,requiredFonts:dI,requiredFormats:dI,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:cI,specularExponent:cI,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:cI,strikethroughThickness:cI,string:null,stroke:null,strokeDashArray:dI,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:cI,strokeOpacity:cI,strokeWidth:null,style:null,surfaceScale:cI,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:dI,tabIndex:cI,tableValues:null,target:null,targetX:cI,targetY:cI,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:dI,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:cI,underlineThickness:cI,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:cI,values:null,vAlphabetic:cI,vMathematical:cI,vectorEffect:null,vHanging:cI,vIdeographic:cI,version:null,vertAdvY:cI,vertOriginX:cI,vertOriginY:cI,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:cI,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:vI}),bI=gI({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),xI=gI({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:yI}),SI=gI({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Goe={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Koe=/[A-Z]/g,CI=/-[a-z]/g,qoe=/^data[-\w.:]+$/i;function Joe(e,t){let n=nI(t),r=t,i=rI;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&qoe.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(CI,Xoe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!CI.test(e)){let n=e.replace(Koe,Yoe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=mI}return new i(r,t)}function Yoe(e){return`-`+e.toLowerCase()}function Xoe(e){return e.charAt(1).toUpperCase()}var Zoe=tI([_I,Uoe,bI,xI,SI],`html`),wI=tI([_I,Woe,bI,xI,SI],`svg`);function Qoe(e){return e.join(` `).trim()}var $oe=i(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
118
118
  `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),ese=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t($oe());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),tse=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),nse=i(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ese()),r=tse();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),TI=DI(`end`),EI=DI(`start`);function DI(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function rse(e){let t=EI(e),n=TI(e);if(t&&n)return{start:t,end:n}}function OI(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?AI(e.position):`start`in e||`end`in e?AI(e):`line`in e||`column`in e?kI(e):``}function kI(e){return jI(e&&e.line)+`:`+jI(e&&e.column)}function AI(e){return kI(e&&e.start)+`-`+kI(e&&e.end)}function jI(e){return e&&typeof e==`number`?e:1}var MI=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=OI(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};MI.prototype.file=``,MI.prototype.name=``,MI.prototype.reason=``,MI.prototype.message=``,MI.prototype.stack=``,MI.prototype.column=void 0,MI.prototype.line=void 0,MI.prototype.ancestors=void 0,MI.prototype.cause=void 0,MI.prototype.fatal=void 0,MI.prototype.place=void 0,MI.prototype.ruleId=void 0,MI.prototype.source=void 0;var ise=e(nse(),1),NI={}.hasOwnProperty,ase=new Map,ose=/[A-Z]/g,sse=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),cse=new Set([`td`,`th`]),PI=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function lse(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=_se(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=gse(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?wI:Zoe,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=FI(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function FI(e,t,n){if(t.type===`element`)return use(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return dse(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return pse(e,t,n);if(t.type===`mdxjsEsm`)return fse(e,t);if(t.type===`root`)return mse(e,t,n);if(t.type===`text`)return hse(e,t)}function use(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=wI,e.schema=i),e.ancestors.push(t);let a=zI(e,t.tagName,!1),o=vse(e,t),s=RI(e,t);return sse.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Voe(e):!0})),II(e,o,a,t),LI(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function dse(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}BI(e,t.position)}function fse(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);BI(e,t.position)}function pse(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=wI,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:zI(e,t.name,!0),o=yse(e,t),s=RI(e,t);return II(e,o,a,t),LI(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function mse(e,t,n){let r={};return LI(r,RI(e,t)),e.create(t,e.Fragment,r,n)}function hse(e,t){return t.value}function II(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function LI(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function gse(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function _se(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=EI(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function vse(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&NI.call(t.properties,i)){let a=bse(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&cse.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function yse(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else BI(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else BI(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function RI(e,t){let n=[],r=-1,i=e.passKeys?new Map:ase;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=FI(e,a,o);s!==void 0&&n.push(s)}return n}function bse(e,t,n){let r=Joe(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ioe(n):Qoe(n)),r.property===`style`){let t=typeof n==`object`?n:xse(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Sse(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Goe[r.property]||r.property:r.attribute,n]}}function xse(e,t){try{return(0,ise.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new MI("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=PI+`#cannot-parse-style-attribute`,r}}function zI(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=QF(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=QF(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return NI.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);BI(e)}function BI(e,t){let n=new MI("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=PI+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Sse(e){let t={},n;for(n in e)NI.call(e,n)&&(t[Cse(n)]=e[n]);return t}function Cse(e){let t=e.replace(ose,wse);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function wse(e){return`-`+e.toLowerCase()}var VI={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Tse={};function HI(e,t){let n=t||Tse;return UI(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function UI(e,t,n){if(GI(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return WI(e.children,t,n)}return Array.isArray(e)?WI(e,t,n):``}function WI(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=UI(e[i],t,n);return r.join(``)}function GI(e){return!!(e&&typeof e==`object`)}var KI=document.createElement(`i`);function qI(e){let t=`&`+e+`;`;KI.innerHTML=t;let n=KI.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function JI(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function YI(e,t){return e.length>0?(JI(e,e.length,0,t),e):t}var XI={}.hasOwnProperty;function ZI(e){let t={},n=-1;for(;++n<e.length;)QI(t,e[n]);return t}function QI(e,t){let n;for(n in t){let r=(XI.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){XI.call(r,a)||(r[a]=[]);let e=i[a];$I(r[a],Array.isArray(e)?e:e?[e]:[])}}}function $I(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);JI(e,0,0,r)}function eL(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function tL(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var nL=mL(/[A-Za-z]/),rL=mL(/[\dA-Za-z]/),iL=mL(/[#-'*+\--9=?A-Z^-~]/);function aL(e){return e!==null&&(e<32||e===127)}var oL=mL(/\d/),sL=mL(/[\dA-Fa-f]/),cL=mL(/[!-/:-@[-`{-~]/);function lL(e){return e!==null&&e<-2}function uL(e){return e!==null&&(e<0||e===32)}function dL(e){return e===-2||e===-1||e===32}var fL=mL(/\p{P}|\p{S}/u),pL=mL(/\s/);function mL(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function hL(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&rL(e.charCodeAt(n+1))&&rL(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function gL(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return dL(r)?(e.enter(n),s(r)):t(r)}function s(r){return dL(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var _L={tokenize:vL};function vL(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),gL(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return lL(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var yL={tokenize:xL},bL={tokenize:SL};function xL(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return JI(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bL,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(bL,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return lL(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;JI(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function SL(e,t,n){return gL(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function CL(e){if(e===null||uL(e)||pL(e))return 1;if(fL(e))return 2}function wL(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var TL={name:`attention`,resolveAll:EL,tokenize:DL};function EL(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};OL(d,-c),OL(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=YI(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=YI(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=YI(l,wL(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=YI(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=YI(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,JI(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function DL(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=CL(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=CL(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function OL(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var kL={name:`autolink`,tokenize:AL};function AL(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return nL(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||rL(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||rL(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||aL(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):iL(t)?(e.consume(t),l):n(t)}function u(e){return rL(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||rL(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var jL={partial:!0,tokenize:ML};function ML(e,t,n){return r;function r(t){return dL(t)?gL(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||lL(e)?t(e):n(e)}}var NL={continuation:{tokenize:FL},exit:IL,name:`blockQuote`,tokenize:PL};function PL(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return dL(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function FL(e,t,n){let r=this;return i;function i(t){return dL(t)?gL(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(NL,t,n)(r)}}function IL(e){e.exit(`blockQuote`)}var LL={name:`characterEscape`,tokenize:RL};function RL(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return cL(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var zL={name:`characterReference`,tokenize:BL};function BL(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=rL,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=sL,u):(e.enter(`characterReferenceValue`),a=7,o=oL,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===rL&&!qI(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var VL={partial:!0,tokenize:WL},HL={concrete:!0,name:`codeFenced`,tokenize:UL};function UL(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),dL(t)?gL(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||lL(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(VL,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||lL(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):dL(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),gL(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||lL(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||lL(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&dL(t)?gL(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||lL(t)?e.check(VL,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||lL(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),dL(t)?gL(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),dL(t)?gL(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||lL(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function WL(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var GL={name:`codeIndented`,tokenize:qL},KL={partial:!0,tokenize:JL};function qL(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),gL(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):lL(t)?e.attempt(KL,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||lL(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function JL(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):lL(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):gL(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):lL(e)?i(e):n(e)}}var YL={name:`codeText`,previous:ZL,resolve:XL,tokenize:QL};function XL(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ZL(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function QL(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):lL(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||lL(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var $L=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&eR(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),eR(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),eR(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);eR(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);eR(this.left,t.reverse())}}};function eR(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function tR(e){let t={},n=-1,r,i,a,o,s,c,l,u=new $L(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,nR(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return JI(e,0,1/0,u.slice(0)),!l}function nR(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var rR={resolve:aR,tokenize:oR},iR={partial:!0,tokenize:sR};function aR(e){return tR(e),e}function oR(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):lL(t)?e.check(iR,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function sR(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),gL(e,a,`linePrefix`)}function a(i){if(i===null||lL(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function cR(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||aL(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||lL(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||uL(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||aL(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function lR(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):lL(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||lL(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!dL(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function uR(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):lL(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),gL(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||lL(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function dR(e,t){let n;return r;function r(i){return lL(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):dL(i)?gL(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var fR={name:`definition`,tokenize:mR},pR={partial:!0,tokenize:hR};function mR(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return lR.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=tL(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return uL(t)?dR(e,l)(t):l(t)}function l(t){return cR(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(pR,d,d)(t)}function d(t){return dL(t)?gL(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||lL(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function hR(e,t,n){return r;function r(t){return uL(t)?dR(e,i)(t):n(t)}function i(t){return uR(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return dL(t)?gL(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||lL(e)?t(e):n(e)}}var gR={name:`hardBreakEscape`,tokenize:_R};function _R(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return lL(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var vR={name:`headingAtx`,resolve:yR,tokenize:bR};function yR(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},JI(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function bR(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||uL(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||lL(n)?(e.exit(`atxHeading`),t(n)):dL(n)?gL(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||uL(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var xR=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),SR=[`pre`,`script`,`style`,`textarea`],CR={concrete:!0,name:`htmlFlow`,resolveTo:ER,tokenize:DR},wR={partial:!0,tokenize:kR},TR={partial:!0,tokenize:OR};function ER(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function DR(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):nL(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):nL(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return nL(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||uL(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&SR.includes(l)?(i=1,r.interrupt?t(s):O(s)):xR.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||rL(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return dL(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||nL(t)?(e.consume(t),b):dL(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||rL(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):dL(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):dL(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||lL(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||uL(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||dL(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||lL(t)?O(t):dL(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):lL(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(wR,R,k)(t)):t===null||lL(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(TR,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||lL(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return SR.includes(n)?(e.consume(t),L):O(t)}return nL(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||lL(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function OR(e,t,n){let r=this;return i;function i(t){return lL(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function kR(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(jL,t,n)}}var AR={name:`htmlText`,tokenize:jR};function jR(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):nL(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):nL(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):lL(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):lL(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):lL(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):lL(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return nL(t)?(e.consume(t),S):n(t)}function S(t){return t===45||rL(t)?(e.consume(t),S):C(t)}function C(t){return lL(t)?(o=C,N(t)):dL(t)?(e.consume(t),C):M(t)}function w(t){return t===45||rL(t)?(e.consume(t),w):t===47||t===62||uL(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||nL(t)?(e.consume(t),E):lL(t)?(o=T,N(t)):dL(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||rL(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):lL(t)?(o=D,N(t)):dL(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):lL(t)?(o=O,N(t)):dL(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):lL(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||uL(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||uL(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return dL(t)?gL(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var MR={name:`labelEnd`,resolveAll:IR,resolveTo:LR,tokenize:RR},NR={tokenize:zR},PR={tokenize:BR},FR={tokenize:VR};function IR(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&JI(e,0,e.length,n),e}function LR(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=YI(s,e.slice(a+1,a+r+3)),s=YI(s,[[`enter`,u,t]]),s=YI(s,wL(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=YI(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=YI(s,e.slice(o+1)),s=YI(s,[[`exit`,c,t]]),JI(e,a,e.length,s),e}function RR(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(tL(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(NR,u,o?u:d)(t):t===91?e.attempt(PR,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(FR,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function zR(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return uL(t)?dR(e,a)(t):a(t)}function a(t){return t===41?u(t):cR(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return uL(t)?dR(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?uR(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return uL(t)?dR(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function BR(e,t,n){let r=this;return i;function i(t){return lR.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(tL(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function VR(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var HR={name:`labelStartImage`,resolveAll:MR.resolveAll,tokenize:UR};function UR(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var WR={name:`labelStartLink`,resolveAll:MR.resolveAll,tokenize:GR};function GR(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var KR={name:`lineEnding`,tokenize:qR};function qR(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),gL(e,t,`linePrefix`)}}var JR={name:`thematicBreak`,tokenize:YR};function YR(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||lL(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),dL(t)?gL(e,s,`whitespace`)(t):s(t))}}var XR={continuation:{tokenize:ez},exit:nz,name:`list`,tokenize:$R},ZR={partial:!0,tokenize:rz},QR={partial:!0,tokenize:tz};function $R(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:oL(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(JR,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return oL(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(jL,r.interrupt?n:u,e.attempt(ZR,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return dL(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function ez(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(jL,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,gL(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!dL(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(QR,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,gL(e,e.attempt(XR,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function tz(e,t,n){let r=this;return gL(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function nz(e){e.exit(this.containerState.type)}function rz(e,t,n){let r=this;return gL(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!dL(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var iz={name:`setextUnderline`,resolveTo:az,tokenize:oz};function az(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function oz(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),dL(t)?gL(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||lL(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var sz={tokenize:cz};function cz(e){let t=this,n=e.attempt(jL,r,e.attempt(this.parser.constructs.flowInitial,i,gL(e,e.attempt(this.parser.constructs.flow,i,e.attempt(rR,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var lz={resolveAll:pz()},uz=fz(`string`),dz=fz(`text`);function fz(e){return{resolveAll:pz(e===`text`?mz:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function pz(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function mz(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var hz=r({attentionMarkers:()=>Cz,contentInitial:()=>_z,disable:()=>wz,document:()=>gz,flow:()=>yz,flowInitial:()=>vz,insideSpan:()=>Sz,string:()=>bz,text:()=>xz}),gz={42:XR,43:XR,45:XR,48:XR,49:XR,50:XR,51:XR,52:XR,53:XR,54:XR,55:XR,56:XR,57:XR,62:NL},_z={91:fR},vz={[-2]:GL,[-1]:GL,32:GL},yz={35:vR,42:JR,45:[iz,JR],60:CR,61:iz,95:JR,96:HL,126:HL},bz={38:zL,92:LL},xz={[-5]:KR,[-4]:KR,[-3]:KR,33:HR,38:zL,42:TL,60:[kL,AR],91:WR,92:[gR,LL],93:MR,95:TL,96:YL},Sz={null:[TL,lz]},Cz={null:[42,95]},wz={null:[]};function Tz(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=YI(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=wL(a,l.events,l),l.events):[]}function f(e,t){return Dz(p(e),t)}function p(e){return Ez(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){lL(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&JI(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ez(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Dz(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
119
119
  `;break;case-3:o=`\r
120
120
  `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Oz(e){let t={constructs:ZI([hz,...(e||{}).extensions||[]]),content:n(_L),defined:[],document:n(yL),flow:n(sz),lazy:{},string:n(uz),text:n(dz)};return t;function n(e){return n;function n(n){return Tz(t,e,n)}}}function kz(e){for(;!tR(e););return e}var Az=/[\0\t\n\r]/g;function jz(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Az.lastIndex=u,c=Az.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Mz=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Nz(e){return e.replace(Mz,Pz)}function Pz(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return eL(n.slice(t?2:1),t?16:10)}return qI(n)||e}var Fz={}.hasOwnProperty;function Iz(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Lz(n)(kz(Oz(n).document().write(jz()(e,t,!0))))}function Lz(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ue),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(W),blockQuote:a(ne),characterEscape:T,characterReference:T,codeFenced:a(re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(re,o),codeText:a(ie,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ae),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(oe),hardBreakEscape:a(se),hardBreakTrailing:a(se),htmlFlow:a(ce,o),htmlFlowData:T,htmlText:a(ce,o),htmlTextData:T,image:a(le),label:o,link:a(ue),listItem:a(fe),listItemValue:f,listOrdered:a(de,d),listUnordered:a(de),paragraph:a(pe),reference:ee,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(W),strong:a(me),thematicBreak:a(ge)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:U,autolinkProtocol:H,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:B,characterReference:V,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:I,resourceTitleString:L,resource:R,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};zz(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Fz.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Vz).call(a,void 0,e[0])}for(r.position={start:Rz(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Rz(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Rz(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Vz).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+OI({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Rz(e.end)}function u(){return HI(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tL(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=he(),n.position={start:Rz(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Rz(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Rz(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Nz(t),n.identifier=tL(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function R(){this.data.inReference=void 0}function ee(){this.data.referenceType=`collapsed`}function te(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tL(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function z(e){this.data.characterReferenceType=e.type}function B(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=eL(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=qI(t);let i=this.stack[this.stack.length-1];i.value+=r}function V(e){let t=this.stack.pop();t.position.end=Rz(e.end)}function H(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function U(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ne(){return{type:`blockquote`,children:[]}}function re(){return{type:`code`,lang:null,meta:null,value:``}}function ie(){return{type:`inlineCode`,value:``}}function ae(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function oe(){return{type:`emphasis`,children:[]}}function W(){return{type:`heading`,depth:0,children:[]}}function se(){return{type:`break`}}function ce(){return{type:`html`,value:``}}function le(){return{type:`image`,title:null,url:``,alt:null}}function ue(){return{type:`link`,title:null,url:``,children:[]}}function de(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function fe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function pe(){return{type:`paragraph`,children:[]}}function me(){return{type:`strong`,children:[]}}function he(){return{type:`text`,value:``}}function ge(){return{type:`thematicBreak`}}}function Rz(e){return{line:e.line,column:e.column,offset:e.offset}}function zz(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?zz(e,r):Bz(e,r)}}function Bz(e,t){let n;for(n in t)if(Fz.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Vz(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+OI({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+OI({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+OI({start:t.start,end:t.end})+`) is still open`)}function Hz(e){let t=this;t.parser=n;function n(n){return Iz(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Uz(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Wz(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
@@ -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 zH(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=IU.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function KU(){return{exit:{taskListCheckValueChecked:JU,taskListCheckValueUnchecked:JU,paragraph:YU}}}function qU(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:XU}}}function JU(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function YU(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 XU(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=IU.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 ZU(){return[rH(),DH(),MH(),LU(),KU()]}function QU(e){return{extensions:[iH(),OH(e),NH(),GU(e),qU()]}}var $U={tokenize:pW,partial:!0},eW={tokenize:mW,partial:!0},tW={tokenize:hW,partial:!0},nW={tokenize:gW,partial:!0},rW={tokenize:_W,partial:!0},iW={name:`wwwAutolink`,tokenize:dW,previous:vW},aW={name:`protocolAutolink`,tokenize:fW,previous:yW},oW={name:`emailAutolink`,tokenize:uW,previous:bW},sW={};function cW(){return{text:sW}}for(var lW=48;lW<123;)sW[lW]=oW,lW++,lW===58?lW=65:lW===91&&(lW=97);sW[43]=oW,sW[45]=oW,sW[46]=oW,sW[95]=oW,sW[72]=[oW,aW],sW[104]=[oW,aW],sW[87]=[oW,iW],sW[119]=[oW,iW];function uW(e,t,n){let r=this,i,a;return o;function o(t){return!xW(t)||!bW.call(r,r.previous)||SW(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return xW(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(rW,u,l)(t):t===45||t===95||rL(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&&nL(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function dW(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!vW.call(r,r.previous)||SW(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check($U,e.attempt(eW,e.attempt(tW,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function fW(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&yW.call(r,r.previous)&&!SW(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(nL(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)||uL(t)||pL(t)||fL(t)?n(t):e.attempt(eW,e.attempt(tW,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function pW(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 mW(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(nW,c,s)(t):t===null||uL(t)||pL(t)||t!==45&&fL(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 hW(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(nW,t,a)(o):o===null||uL(o)||pL(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function gW(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||uL(o)||pL(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||uL(e)||pL(e)?t(e):r(e)}function a(e){return nL(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):nL(t)?(e.consume(t),o):n(t)}}function _W(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return rL(e)?n(e):t(e)}}function vW(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||uL(e)}function yW(e){return!nL(e)}function bW(e){return!(e===47||xW(e))}function xW(e){return e===43||e===45||e===46||e===95||rL(e)}function SW(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 CW={tokenize:jW,partial:!0};function wW(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:OW,continuation:{tokenize:kW},exit:AW}},text:{91:{name:`gfmFootnoteCall`,tokenize:DW},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:TW,resolveTo:EW}}}}function TW(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=tL(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 EW(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 DW(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||uL(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(tL(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return uL(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 OW(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||uL(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=tL(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return uL(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),gL(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function kW(e,t,n){return e.check(jL,t,e.attempt(CW,t,n))}function AW(e){e.exit(`gfmFootnoteDefinition`)}function jW(e,t,n){let r=this;return gL(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function MW(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&JI(o,o.length,0,wL(s,e.slice(r+1,n),t)),JI(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),JI(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=CL(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=CL(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var NW=class{constructor(){this.map=[]}add(e,t,n){PW(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 PW(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 FW(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 IW(){return{flow:{null:{name:`table`,tokenize:LW,resolveAll:RW}}}}function LW(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):lL(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):dL(t)?gL(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||uL(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,dL(t)?gL(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 dL(t)?gL(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||lL(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 dL(t)?gL(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||lL(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||lL(n)?(e.exit(`tableRow`),t(n)):dL(n)?gL(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||uL(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 RW(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 NW;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(BW(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=zW(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=zW(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=zW(f,t,o,i,n,d)):(o[0]=o[1],d=zW(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&BW(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=FW(t.events,n))}return e}function zW(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},VW(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=VW(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=VW(t.events,n[2]),a=VW(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({},VW(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function BW(e,t,n,r,i){let a=[],o=VW(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 VW(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var HW={name:`tasklistCheck`,tokenize:WW};function UW(){return{text:{91:HW}}}function WW(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 uL(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 lL(r)?t(r):dL(r)?e.check({tokenize:GW},t,n)(r):n(r)}}function GW(e,t,n){return gL(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function KW(e){return ZI([cW(),wW(),MW(e),IW(),UW()])}var qW={};function JW(e){let t=this,n=e||qW,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(KW(n)),a.push(ZU()),o.push(QU(n))}function YW(e){ZV(e,[/\r?\n|\r/g,XW])}function XW(){return{type:`break`}}function ZW(){return function(e){YW(e)}}var QW=/^\[(?:X|x| )\]\s+/,$W=e=>{let t=e.split(`
146
146
  `).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0&&t.every(e=>QW.test(e))},eG=e=>$W(e)?e.split(`
147
- `).map(e=>e.trim()).filter(e=>e.length>0):[],tG=`modulepreload`,nG=function(e){return`/`+e},rG={},iG=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=nG(t,n),t in rG)return;rG[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`:tG,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,`"`),oG=({mermaid:e,className:t,onClick:n})=>{let{t:r}=K(`common`),[i,a]=(0,p.useState)({kind:`loading`}),o=`mermaid-${(0,p.useId)().replace(/:/g,``)}`;(0,p.useEffect)(()=>{let t=!1;if(a({kind:`loading`}),!e){a({kind:`error`,rawText:``});return}return(async()=>{try{let n=await iG(()=>import(`./mermaid.core-C_NlQFLU.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,Y.jsx)(`div`,{className:`flex items-center justify-center py-8 ${t??``}`,children:(0,Y.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,Y.jsxs)(`div`,{className:t,children:[(0,Y.jsx)(`div`,{className:`mb-2 text-xs text-amber-400`,children:r(`specView.artifactPanel.mermaidParseError`)}),(0,Y.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,Y.jsx)(`div`,{className:`py-4 text-sm text-muted-foreground ${t??``}`,children:r(`specView.artifactPanel.noDiagram`)}):(0,Y.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})},sG=({className:e})=>(0,Y.jsx)(rte,{"aria-hidden":`true`,className:e}),cG=24,lG=4,uG=1.25,dG=1,fG={width:800,height:600},pG=e=>e.replace(/\\"/g,`"`),mG=e=>Number.isFinite(e)&&e>0,hG=e=>{if(!e||e.trim().endsWith(`%`))return null;let t=Number.parseFloat(e);return mG(t)?t:null},gG=e=>{let t=e.getAttribute(`viewBox`)?.trim().split(/[\s,]+/).map(Number);if(t?.length===4&&mG(t[2])&&mG(t[3]))return{width:t[2],height:t[3]};let n=hG(e.getAttribute(`width`)),r=hG(e.getAttribute(`height`));if(n&&r)return{width:n,height:r};let i=e.getBoundingClientRect();if(mG(i.width)&&mG(i.height))return{width:i.width,height:i.height};try{let t=e.getBBox();if(mG(t.width)&&mG(t.height))return{width:t.width,height:t.height}}catch{}return fG},_G=(e,t)=>{let n=Math.max(dG,t.width-cG*2),r=Math.max(dG,t.height-cG*2),i=Math.min(1,n/e.width,r/e.height);return mG(i)?i:1},vG=(e,t,n)=>{let r=e.width*n,i=e.height*n,a=Math.max(t.width,r+cG*2),o=Math.max(t.height,i+cG*2);return{width:a,height:o,diagramWidth:r,diagramHeight:i,diagramLeft:Math.max(cG,(a-r)/2),diagramTop:Math.max(cG,(o-i)/2)}},yG=(e,t,n)=>Math.min(n,Math.max(t,e)),bG=(0,p.memo)(({svg:e,stageRef:t})=>(0,Y.jsx)(`div`,{ref:t,"data-testid":`mermaid-preview-stage`,className:`relative shrink-0`,dangerouslySetInnerHTML:{__html:e}})),xG=({mermaid:e,open:t,onClose:n})=>{let{t:r}=K(`common`),[i,a]=(0,p.useState)({kind:`loading`}),[o,s]=(0,p.useState)(null),[c,l]=(0,p.useState)(null),u=(0,p.useRef)(null),d=(0,p.useRef)(null),f=(0,p.useRef)(null),m=(0,p.useRef)(null),h=(0,p.useRef)(null),g=(0,p.useRef)(null),_=(0,p.useRef)(null),v=`mermaid-preview-${(0,p.useId)().replace(/:/g,``)}`,y=(0,p.useCallback)((e,t=!0)=>{let n=u.current,r=_.current;!r||e!==void 0&&r.pointerId!==e||(t&&n?.hasPointerCapture?.(r.pointerId)&&n.releasePointerCapture(r.pointerId),document.body.style.userSelect=r.previousUserSelect,n?.removeAttribute(`data-dragging`),_.current=null)},[]),b=(0,p.useCallback)((e,t=null)=>{let n=u.current,r=d.current,i=r?.querySelector(`svg`),a=f.current,o=m.current,c=g.current;if(!n||!r||!i||!a||!o||c===null)return;let p=yG(e,c,lG),_=vG(a,o,p);r.style.width=`${_.width}px`,r.style.height=`${_.height}px`,r.dataset.diagramWidth=`${_.diagramWidth}`,r.dataset.diagramHeight=`${_.diagramHeight}`,i.setAttribute(`width`,`${_.diagramWidth}`),i.setAttribute(`height`,`${_.diagramHeight}`),i.style.width=`${_.diagramWidth}px`,i.style.height=`${_.diagramHeight}px`,i.style.maxWidth=`none`,i.style.maxHeight=`none`,i.style.position=`absolute`,i.style.left=`${_.diagramLeft}px`,i.style.top=`${_.diagramTop}px`;let v=Math.max(0,_.width-o.width),y=Math.max(0,_.height-o.height),b=t?_.diagramLeft+t.x*p-o.width/2:v/2,x=t?_.diagramTop+t.y*p-o.height/2:y/2;n.scrollLeft=yG(b,0,v),n.scrollTop=yG(x,0,y),h.current=p,s(p),l(c)},[]),x=(0,p.useCallback)(()=>{let e=u.current,t=f.current,n=m.current,r=h.current;if(!e||!t||!n||r===null)return null;let i=vG(t,n,r);return{x:(e.scrollLeft+n.width/2-i.diagramLeft)/r,y:(e.scrollTop+n.height/2-i.diagramTop)/r}},[]),S=(0,p.useCallback)(()=>{let e=f.current,t=m.current;if(!e||!t)return;let n=_G(e,t);g.current=n,b(n)},[b]),C=e=>{let t=h.current;t!==null&&b(t*e,x())};(0,p.useEffect)(()=>{if(!t)return;let n=!1;return a({kind:`loading`}),(async()=>{try{let t=await iG(()=>import(`./mermaid.core-C_NlQFLU.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=pG(e);if(await r.parse(i),n)return;let{svg:o}=await r.render(v,i);if(n)return;a({kind:`rendered`,svg:o})}catch{n||a({kind:`error`,rawText:e})}})(),()=>{n=!0}},[e,v,t]),(0,p.useLayoutEffect)(()=>{if(!t||i.kind!==`rendered`)return;let e=d.current?.querySelector(`svg`);if(!e)return;let n=gG(e);return f.current=n,e.dataset.intrinsicWidth=`${n.width}`,e.dataset.intrinsicHeight=`${n.height}`,m.current&&S(),()=>{y(),f.current=null,h.current=null,g.current=null,s(null),l(null)}},[y,t,S,i]),(0,p.useLayoutEffect)(()=>{if(!t||i.kind!==`rendered`)return;let e=u.current;if(!e)return;let n=()=>{let t=e.clientWidth,n=e.clientHeight;if(!mG(t)||!mG(n))return;let r=m.current,i=f.current,a=h.current,o=g.current,s=r&&i&&a!==null?x():null,c={width:t,height:n};if(m.current=c,!i)return;let l=_G(i,c);g.current=l;let u=a===null||o===null||Math.abs(a-o)<1e-4;b(u?l:a,u?null:s)},r=new ResizeObserver(n);return r.observe(e),n(),()=>{r.disconnect(),m.current=null}},[b,x,t,i.kind]),(0,p.useEffect)(()=>()=>{y()},[y]);let w=e=>{if(e.pointerType!==`mouse`||e.button!==0||o===null)return;let t=e.currentTarget;y(),_.current={pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,previousUserSelect:document.body.style.userSelect},document.body.style.userSelect=`none`,t.dataset.dragging=`true`,t.setPointerCapture(e.pointerId),e.preventDefault()},T=e=>{let t=_.current,n=f.current,r=m.current,i=h.current;if(!t||t.pointerId!==e.pointerId||!n||!r||i===null)return;let a=vG(n,r,i);e.currentTarget.scrollLeft=yG(t.scrollLeft-(e.clientX-t.clientX),0,Math.max(0,a.width-r.width)),e.currentTarget.scrollTop=yG(t.scrollTop-(e.clientY-t.clientY),0,Math.max(0,a.height-r.height)),e.preventDefault()},E=e=>{y(e.pointerId)},D=e=>{y(e.pointerId,!1)},O=o===null?0:Math.round(o*100);return(0,Y.jsx)(O_,{open:t,onOpenChange:e=>{e||n()},children:(0,Y.jsxs)(A_,{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,Y.jsx)(N_,{className:`sr-only`,children:r(`mermaidPreviewDialog.title`)}),(0,Y.jsx)(P_,{className:`sr-only`,children:r(`mermaidPreviewDialog.description`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b border-border/70 px-4 py-2.5 sm:px-5`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 truncate text-sm font-semibold text-foreground sm:text-base`,children:r(`mermaidPreviewDialog.title`)}),(0,Y.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-1`,"aria-label":r(`mermaidPreviewDialog.controlsAriaLabel`),children:[o!==null&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.zoomOutAriaLabel`),variant:`ghost`,size:`icon-sm`,disabled:c!==null&&o<=c+1e-4,onClick:()=>C(1/uG),children:(0,Y.jsx)(sG,{className:`h-4 w-4`})}),(0,Y.jsx)(`span`,{className:`w-12 text-center text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,"aria-label":r(`mermaidPreviewDialog.zoomLevelAriaLabel`,{zoom:O}),children:r(`mermaidPreviewDialog.zoomLevel`,{zoom:O})}),(0,Y.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.zoomInAriaLabel`),variant:`ghost`,size:`icon-sm`,disabled:o>=lG-1e-4,onClick:()=>C(uG),children:(0,Y.jsx)(wv,{className:`h-4 w-4`})}),(0,Y.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.resetViewAriaLabel`),variant:`ghost`,size:`icon-sm`,onClick:S,children:(0,Y.jsx)(Yb,{className:`h-4 w-4`})})]}),(0,Y.jsx)(k_,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(Xb,{className:`h-4 w-4`})})})]})]}),(0,Y.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,Y.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`}),i.kind===`error`&&(0,Y.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,Y.jsx)(`div`,{ref:u,"data-testid":`mermaid-preview-viewport`,"aria-label":r(`mermaidPreviewDialog.canvasAriaLabel`),className:`h-full w-full cursor-grab overflow-auto data-[dragging=true]:cursor-grabbing`,onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerCancel:E,onLostPointerCapture:D,children:(0,Y.jsx)(bG,{svg:i.svg,stageRef:d})})]})]})})},SG=`*, *::before, *::after { box-sizing: border-box; }
147
+ `).map(e=>e.trim()).filter(e=>e.length>0):[],tG=`modulepreload`,nG=function(e){return`/`+e},rG={},iG=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=nG(t,n),t in rG)return;rG[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`:tG,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,`"`),oG=({mermaid:e,className:t,onClick:n})=>{let{t:r}=K(`common`),[i,a]=(0,p.useState)({kind:`loading`}),o=`mermaid-${(0,p.useId)().replace(/:/g,``)}`;(0,p.useEffect)(()=>{let t=!1;if(a({kind:`loading`}),!e){a({kind:`error`,rawText:``});return}return(async()=>{try{let n=await iG(()=>import(`./mermaid.core-BngDHztH.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,Y.jsx)(`div`,{className:`flex items-center justify-center py-8 ${t??``}`,children:(0,Y.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,Y.jsxs)(`div`,{className:t,children:[(0,Y.jsx)(`div`,{className:`mb-2 text-xs text-amber-400`,children:r(`specView.artifactPanel.mermaidParseError`)}),(0,Y.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,Y.jsx)(`div`,{className:`py-4 text-sm text-muted-foreground ${t??``}`,children:r(`specView.artifactPanel.noDiagram`)}):(0,Y.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})},sG=({className:e})=>(0,Y.jsx)(rte,{"aria-hidden":`true`,className:e}),cG=24,lG=4,uG=1.25,dG=1,fG={width:800,height:600},pG=e=>e.replace(/\\"/g,`"`),mG=e=>Number.isFinite(e)&&e>0,hG=e=>{if(!e||e.trim().endsWith(`%`))return null;let t=Number.parseFloat(e);return mG(t)?t:null},gG=e=>{let t=e.getAttribute(`viewBox`)?.trim().split(/[\s,]+/).map(Number);if(t?.length===4&&mG(t[2])&&mG(t[3]))return{width:t[2],height:t[3]};let n=hG(e.getAttribute(`width`)),r=hG(e.getAttribute(`height`));if(n&&r)return{width:n,height:r};let i=e.getBoundingClientRect();if(mG(i.width)&&mG(i.height))return{width:i.width,height:i.height};try{let t=e.getBBox();if(mG(t.width)&&mG(t.height))return{width:t.width,height:t.height}}catch{}return fG},_G=(e,t)=>{let n=Math.max(dG,t.width-cG*2),r=Math.max(dG,t.height-cG*2),i=Math.min(1,n/e.width,r/e.height);return mG(i)?i:1},vG=(e,t,n)=>{let r=e.width*n,i=e.height*n,a=Math.max(t.width,r+cG*2),o=Math.max(t.height,i+cG*2);return{width:a,height:o,diagramWidth:r,diagramHeight:i,diagramLeft:Math.max(cG,(a-r)/2),diagramTop:Math.max(cG,(o-i)/2)}},yG=(e,t,n)=>Math.min(n,Math.max(t,e)),bG=(0,p.memo)(({svg:e,stageRef:t})=>(0,Y.jsx)(`div`,{ref:t,"data-testid":`mermaid-preview-stage`,className:`relative shrink-0`,dangerouslySetInnerHTML:{__html:e}})),xG=({mermaid:e,open:t,onClose:n})=>{let{t:r}=K(`common`),[i,a]=(0,p.useState)({kind:`loading`}),[o,s]=(0,p.useState)(null),[c,l]=(0,p.useState)(null),u=(0,p.useRef)(null),d=(0,p.useRef)(null),f=(0,p.useRef)(null),m=(0,p.useRef)(null),h=(0,p.useRef)(null),g=(0,p.useRef)(null),_=(0,p.useRef)(null),v=`mermaid-preview-${(0,p.useId)().replace(/:/g,``)}`,y=(0,p.useCallback)((e,t=!0)=>{let n=u.current,r=_.current;!r||e!==void 0&&r.pointerId!==e||(t&&n?.hasPointerCapture?.(r.pointerId)&&n.releasePointerCapture(r.pointerId),document.body.style.userSelect=r.previousUserSelect,n?.removeAttribute(`data-dragging`),_.current=null)},[]),b=(0,p.useCallback)((e,t=null)=>{let n=u.current,r=d.current,i=r?.querySelector(`svg`),a=f.current,o=m.current,c=g.current;if(!n||!r||!i||!a||!o||c===null)return;let p=yG(e,c,lG),_=vG(a,o,p);r.style.width=`${_.width}px`,r.style.height=`${_.height}px`,r.dataset.diagramWidth=`${_.diagramWidth}`,r.dataset.diagramHeight=`${_.diagramHeight}`,i.setAttribute(`width`,`${_.diagramWidth}`),i.setAttribute(`height`,`${_.diagramHeight}`),i.style.width=`${_.diagramWidth}px`,i.style.height=`${_.diagramHeight}px`,i.style.maxWidth=`none`,i.style.maxHeight=`none`,i.style.position=`absolute`,i.style.left=`${_.diagramLeft}px`,i.style.top=`${_.diagramTop}px`;let v=Math.max(0,_.width-o.width),y=Math.max(0,_.height-o.height),b=t?_.diagramLeft+t.x*p-o.width/2:v/2,x=t?_.diagramTop+t.y*p-o.height/2:y/2;n.scrollLeft=yG(b,0,v),n.scrollTop=yG(x,0,y),h.current=p,s(p),l(c)},[]),x=(0,p.useCallback)(()=>{let e=u.current,t=f.current,n=m.current,r=h.current;if(!e||!t||!n||r===null)return null;let i=vG(t,n,r);return{x:(e.scrollLeft+n.width/2-i.diagramLeft)/r,y:(e.scrollTop+n.height/2-i.diagramTop)/r}},[]),S=(0,p.useCallback)(()=>{let e=f.current,t=m.current;if(!e||!t)return;let n=_G(e,t);g.current=n,b(n)},[b]),C=e=>{let t=h.current;t!==null&&b(t*e,x())};(0,p.useEffect)(()=>{if(!t)return;let n=!1;return a({kind:`loading`}),(async()=>{try{let t=await iG(()=>import(`./mermaid.core-BngDHztH.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=pG(e);if(await r.parse(i),n)return;let{svg:o}=await r.render(v,i);if(n)return;a({kind:`rendered`,svg:o})}catch{n||a({kind:`error`,rawText:e})}})(),()=>{n=!0}},[e,v,t]),(0,p.useLayoutEffect)(()=>{if(!t||i.kind!==`rendered`)return;let e=d.current?.querySelector(`svg`);if(!e)return;let n=gG(e);return f.current=n,e.dataset.intrinsicWidth=`${n.width}`,e.dataset.intrinsicHeight=`${n.height}`,m.current&&S(),()=>{y(),f.current=null,h.current=null,g.current=null,s(null),l(null)}},[y,t,S,i]),(0,p.useLayoutEffect)(()=>{if(!t||i.kind!==`rendered`)return;let e=u.current;if(!e)return;let n=()=>{let t=e.clientWidth,n=e.clientHeight;if(!mG(t)||!mG(n))return;let r=m.current,i=f.current,a=h.current,o=g.current,s=r&&i&&a!==null?x():null,c={width:t,height:n};if(m.current=c,!i)return;let l=_G(i,c);g.current=l;let u=a===null||o===null||Math.abs(a-o)<1e-4;b(u?l:a,u?null:s)},r=new ResizeObserver(n);return r.observe(e),n(),()=>{r.disconnect(),m.current=null}},[b,x,t,i.kind]),(0,p.useEffect)(()=>()=>{y()},[y]);let w=e=>{if(e.pointerType!==`mouse`||e.button!==0||o===null)return;let t=e.currentTarget;y(),_.current={pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,previousUserSelect:document.body.style.userSelect},document.body.style.userSelect=`none`,t.dataset.dragging=`true`,t.setPointerCapture(e.pointerId),e.preventDefault()},T=e=>{let t=_.current,n=f.current,r=m.current,i=h.current;if(!t||t.pointerId!==e.pointerId||!n||!r||i===null)return;let a=vG(n,r,i);e.currentTarget.scrollLeft=yG(t.scrollLeft-(e.clientX-t.clientX),0,Math.max(0,a.width-r.width)),e.currentTarget.scrollTop=yG(t.scrollTop-(e.clientY-t.clientY),0,Math.max(0,a.height-r.height)),e.preventDefault()},E=e=>{y(e.pointerId)},D=e=>{y(e.pointerId,!1)},O=o===null?0:Math.round(o*100);return(0,Y.jsx)(O_,{open:t,onOpenChange:e=>{e||n()},children:(0,Y.jsxs)(A_,{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,Y.jsx)(N_,{className:`sr-only`,children:r(`mermaidPreviewDialog.title`)}),(0,Y.jsx)(P_,{className:`sr-only`,children:r(`mermaidPreviewDialog.description`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b border-border/70 px-4 py-2.5 sm:px-5`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 truncate text-sm font-semibold text-foreground sm:text-base`,children:r(`mermaidPreviewDialog.title`)}),(0,Y.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-1`,"aria-label":r(`mermaidPreviewDialog.controlsAriaLabel`),children:[o!==null&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.zoomOutAriaLabel`),variant:`ghost`,size:`icon-sm`,disabled:c!==null&&o<=c+1e-4,onClick:()=>C(1/uG),children:(0,Y.jsx)(sG,{className:`h-4 w-4`})}),(0,Y.jsx)(`span`,{className:`w-12 text-center text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,"aria-label":r(`mermaidPreviewDialog.zoomLevelAriaLabel`,{zoom:O}),children:r(`mermaidPreviewDialog.zoomLevel`,{zoom:O})}),(0,Y.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.zoomInAriaLabel`),variant:`ghost`,size:`icon-sm`,disabled:o>=lG-1e-4,onClick:()=>C(uG),children:(0,Y.jsx)(wv,{className:`h-4 w-4`})}),(0,Y.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.resetViewAriaLabel`),variant:`ghost`,size:`icon-sm`,onClick:S,children:(0,Y.jsx)(Yb,{className:`h-4 w-4`})})]}),(0,Y.jsx)(k_,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(Xb,{className:`h-4 w-4`})})})]})]}),(0,Y.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,Y.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`}),i.kind===`error`&&(0,Y.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,Y.jsx)(`div`,{ref:u,"data-testid":`mermaid-preview-viewport`,"aria-label":r(`mermaidPreviewDialog.canvasAriaLabel`),className:`h-full w-full cursor-grab overflow-auto data-[dragging=true]:cursor-grabbing`,onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerCancel:E,onLostPointerCapture:D,children:(0,Y.jsx)(bG,{svg:i.svg,stageRef:d})})]})]})})},SG=`*, *::before, *::after { box-sizing: border-box; }
148
148
  html, body {
149
149
  margin: 0;
150
150
  padding: 16px;
@@ -271,5 +271,5 @@ ${s.join(`
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
  `)},bde=e=>e?.status?[Wb.t(`common:chatChangesPanel.fileStatus.${e.status}`),e.staged&&Wb.t(`common:chatChangesPanel.fileStatus.staged`),e.unstaged&&Wb.t(`common:chatChangesPanel.fileStatus.unstaged`),e.conflicted&&Wb.t(`common:chatChangesPanel.fileStatus.conflicted`)].filter(Boolean).join(`, `):j6(`tracked`),xde=({file:e,viewMode:t,comments:n,canComment:r,searchMatches:i,activeSearchMatchIndex:a,onAddComment:o})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:Z(`flex min-h-0 flex-1 flex-col`,t===`preview`&&`hidden`),children:(0,Y.jsx)(ide,{file:e,comments:n,canComment:r,isActive:t===`source`,searchMatches:i,activeSearchMatchIndex:a,onAddComment:o})}),t===`preview`&&(0,Y.jsx)(rde,{content:e.content})]}),Sde=({projectId:e,target:t,isActive:n,canAddComments:r,comments:i,onCommentsChange:a,requestedPath:o=null,onRequestedPathHandled:s,onViewChanges:c,headerControls:l})=>{let[u,d]=(0,p.useState)(null),[f,m]=(0,p.useState)(null),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(``),y=(0,p.useDeferredValue)(_),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(new Set),[w,T]=(0,p.useState)(null),[E,D]=(0,p.useState)(`source`),[O,k]=(0,p.useState)({kind:`empty`}),[A,j]=(0,p.useState)(!1),[M,N]=(0,p.useState)(``),[P,F]=(0,p.useState)(-1),I=(0,p.useRef)(new Map),L=(0,p.useRef)(null),R=(0,p.useRef)(null),ee=(0,p.useRef)(o),te=(0,p.useRef)(i),z=(0,p.useRef)(null),B=(0,p.useRef)(null),V=(0,p.useRef)(null),H=(0,p.useRef)(0),U=(0,p.useRef)(0),ne=(0,p.useRef)(0),re=(0,p.useRef)(null),ie=(0,p.useRef)(null),ae=(0,p.useRef)(!1),oe=(0,p.useMemo)(()=>{if(!u)return[];let e=y.trim().toLocaleLowerCase();return u.entries.filter(t=>{let n=!e||t.path.toLocaleLowerCase().includes(e),r=!b||t.status!==null;return n&&r})},[u,y,b]);L.current=u,R.current=w,ee.current=o,te.current=i;let W=(0,p.useCallback)(e=>{te.current=e,a(e)},[a]),se=(0,p.useCallback)(()=>{j(!1),N(``),F(-1)},[]),ce=e?k6(e,t):null;(0,p.useEffect)(()=>{if(!e||!ce||z.current===ce||(z.current=ce,te.current.length>0))return;let n=gde(localStorage.getItem(ce),t);n.length>0&&(W(n),A6(e,n).then(e=>{let t=new Map(e.map(e=>[e.id,e.stale])),n=te.current,r=n.map(e=>{let n=t.get(e.id);return n===void 0?e:{...e,stale:n}});r.some((e,t)=>e.stale!==n[t]?.stale)&&W(r)}))},[W,e,ce,t]),(0,p.useEffect)(()=>{if(ce){if(i.length===0){localStorage.removeItem(ce);return}localStorage.setItem(ce,JSON.stringify(i))}},[i,ce]);let le=(0,p.useCallback)(async(n,r=!1)=>{if(!e)return;B.current?.abort(),U.current+=1;let i=U.current;if((L.current?.entries.find(e=>e.path===n)??null)?.status===`deleted`){k({kind:`unsupported`,path:n,reason:`deleted`,message:M6(`deleted`)});return}let a=I.current.get(n);if(a&&!r){k({kind:`content`,content:a});return}let o=new AbortController;B.current=o,k({kind:`loading`,path:n});try{let a=await b6(e,t,n,o.signal,r);if(i!==U.current)return;for(I.current.delete(n),I.current.set(n,a);I.current.size>_de;){let e=I.current.keys().next().value;if(typeof e!=`string`)break;I.current.delete(e)}k({kind:`content`,content:a});let s=te.current,c=s.map(e=>e.filePath===n?{...e,stale:e.contentSignature!==a.content_signature}:e);c.some((e,t)=>e.stale!==s[t]?.stale)&&W(c)}catch(e){if(i!==U.current||Xe(e))return;if(e instanceof Ke){let t=vde(e);if(t){k({kind:`unsupported`,path:n,reason:t.reason,message:M6(t.reason)});return}}k({kind:`error`,path:n,message:e instanceof Error?e.message:j6(`contentError`)})}},[W,e,t]),ue=(0,p.useCallback)(e=>{se(),R.current=e,T(e),D(N6(e)?`preview`:`source`),le(e)},[le,se]),de=(0,p.useCallback)(async(n=!1)=>{if(!e){m(j6(`noProject`));return}let r=new AbortController;V.current?.abort(),V.current=r,H.current+=1;let i=H.current;g(!0),m(null);try{let a=await Gue(e,t,r.signal,n);if(i!==H.current)return;let o=L.current?.workspace_signature,s=o!==void 0&&o!==a.workspace_signature;L.current=a,d(a),s&&I.current.clear();let c=R.current;if(!c){let e=a.entries.filter(e=>e.status!==`deleted`);!ee.current&&e.length===1&&ue(e[0].path);return}if(!a.entries.some(e=>e.path===c)){B.current?.abort(),U.current+=1,R.current=null,T(null),D(`source`),k({kind:`empty`}),se();return}(s||n)&&(I.current.delete(c),le(c,!0))}catch(e){i===H.current&&!Xe(e)&&m(e instanceof Error?e.message:j6(`manifestError`))}finally{i===H.current&&g(!1)}},[le,e,se,ue,t]);(0,p.useEffect)(()=>{if(!n){V.current?.abort(),B.current?.abort(),H.current+=1,U.current+=1;return}de(),re.current?.focus()},[n,de]),(0,p.useEffect)(()=>()=>{V.current?.abort(),B.current?.abort(),H.current+=1,U.current+=1},[]),(0,p.useEffect)(()=>{if(!o||!u)return;let e=u.entries.find(e=>e.path===o);if(!e||e.status===`deleted`){s?.(o);return}let t=o.split(`/`);C(e=>{let n=new Set(e);for(let e=1;e<t.length;e+=1)n.add(t.slice(0,e).join(`/`));return n}),ue(o),s?.(o)},[u,s,o,ue]),(0,p.useEffect)(()=>{oe.length===1&&w===null&&ue(oe[0].path)},[oe,w,ue]),(0,p.useEffect)(()=>{n&&!ae.current&&!o&&re.current?.focus(),ae.current=n},[n,o]);let fe=u?.entries.find(e=>e.path===w)??null,pe=N6(w)&&O.kind===`content`&&O.content.path===w,me=pe&&O.content.content.length>1e5,he=me?`source`:E,ge=(0,p.useMemo)(()=>{if(!A||O.kind!==`content`||M.length===0||/[\r\n]/.test(M))return[];let e=M.toLocaleLowerCase(),t=[];return O.content.content.split(`
273
273
  `).forEach((n,r)=>{let i=n.toLocaleLowerCase(),a=i.indexOf(e);for(;a!==-1;)t.push({lineIndex:r,start:a,end:a+M.length}),a=i.indexOf(e,a+M.length)}),t},[M,O,A]),_e=ge.length>0?Math.min(Math.max(P,0),ge.length-1):-1,ve=(0,p.useMemo)(()=>i.filter(e=>e.filePath===w),[i,w]),ye=(0,p.useMemo)(()=>{let e=new Map;return i.forEach(t=>e.set(t.filePath,(e.get(t.filePath)??0)+1)),e},[i]),be=(0,p.useCallback)((e,n)=>{if(O.kind!==`content`)return;let r=O.content.content.split(`
274
- `);ne.current+=1,W([...te.current,{kind:`source`,id:`${O.content.path}:${e}:${Date.now()}:${ne.current}`,target:t,filePath:O.content.path,lineNumber:e,lineContent:r[e-1]??``,sourceContext:yde(O.content.content,e),contentSignature:O.content.content_signature,comment:n,stale:!1}])},[W,O,t]);(0,p.useEffect)(()=>{me&&D(`source`)},[me]);let xe=(0,p.useCallback)(()=>{O.kind===`content`&&(D(`source`),j(!0))},[O.kind]),Se=(0,p.useCallback)(e=>{ge.length!==0&&F(t=>((t<0?0:Math.min(t,ge.length-1))+e+ge.length)%ge.length)},[ge.length]);return(0,p.useEffect)(()=>{A&&ie.current?.focus({preventScroll:!0})},[A]),(0,p.useEffect)(()=>{let e=e=>{if(!(!n||O.kind!==`content`||e.defaultPrevented)){if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLocaleLowerCase()===`f`){e.preventDefault(),xe(),requestAnimationFrame(()=>ie.current?.focus({preventScroll:!0}));return}A&&e.key===`Escape`&&(e.preventDefault(),se())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O.kind,n,A,xe,se]),(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 overflow-hidden rounded-xl border border-border`,"aria-label":`Files mode`,children:[(0,Y.jsxs)(`aside`,{className:`flex w-80 shrink-0 flex-col border-r border-border bg-muted/10`,"aria-label":j6(`fileBrowser`),children:[(0,Y.jsxs)(`div`,{className:`space-y-3 border-b border-border p-3`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs text-muted-foreground`,children:[j6(`searchFiles`),(0,Y.jsx)(F_,{ref:re,type:`search`,className:`mt-1 h-8`,value:_,onChange:e=>v(e.target.value),placeholder:j6(`searchPlaceholder`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-foreground`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked)}),j6(`changedOnly`)]}),(0,Y.jsx)(vv,{content:j6(`refreshFiles`),children:(0,Y.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":j6(`refreshFiles`),disabled:h,onClick:()=>{de(!0)},children:h?(0,Y.jsx)(Pv,{className:`size-3.5 animate-spin`}):(0,Y.jsx)(Yb,{className:`size-3.5`})})})]})]}),h&&!u&&(0,Y.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:j6(`loadingManifest`)}),f&&(0,Y.jsxs)(`div`,{className:`space-y-3 p-4 text-sm text-destructive`,children:[(0,Y.jsx)(`p`,{children:f}),(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void de(),children:j6(`retry`)})]}),u&&(0,Y.jsxs)(Y.Fragment,{children:[u.truncated&&(0,Y.jsx)(`div`,{className:`border-b border-border px-3 py-2 text-xs text-amber-300`,children:j6(`truncated`)}),(0,Y.jsx)(mde,{entries:u.entries,search:y,changedOnly:b,expandedPaths:S,selectedPath:w,commentCounts:ye,onExpandedPathsChange:C,onSelectPath:ue})]})]}),(0,Y.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate font-mono text-xs text-foreground`,children:w??j6(`selectFile`)}),fe&&(0,Y.jsx)(`div`,{className:`mt-0.5 text-[11px] capitalize text-muted-foreground`,children:bde(fe)})]}),(O.kind===`content`||pe||l||w&&fe?.status&&c)&&(0,Y.jsxs)(`div`,{"data-testid":`workspace-file-header-actions`,className:`flex shrink-0 flex-wrap items-center justify-end gap-2 pr-10`,children:[pe&&(0,Y.jsxs)(`div`,{className:`flex items-center rounded-lg border border-border bg-muted/20 p-0.5`,role:`group`,"aria-label":j6(`viewMode.ariaLabel`),children:[(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:he===`preview`?`secondary`:`ghost`,"aria-pressed":he===`preview`,disabled:me,onClick:()=>{D(`preview`)},children:j6(`viewMode.preview`)}),(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:he===`source`?`secondary`:`ghost`,"aria-pressed":he===`source`,onClick:()=>{D(`source`)},children:j6(`viewMode.source`)})]}),me&&(0,Y.jsx)(`p`,{className:`text-xs text-amber-200`,role:`status`,children:j6(`viewMode.sourceRequiredLargeFile`)}),O.kind===`content`&&!A&&(0,Y.jsx)(vv,{content:j6(`source.search.open`),children:(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":j6(`source.search.open`),onClick:xe,children:(0,Y.jsx)(Wue,{className:`size-4`})})}),O.kind===`content`&&A&&(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-lg border border-border bg-muted/20 p-1`,role:`search`,children:[(0,Y.jsx)(F_,{ref:ie,type:`search`,className:`h-7 w-40 rounded-md px-2 text-xs sm:w-56`,"aria-label":j6(`source.search.inputLabel`),placeholder:j6(`source.search.placeholder`),value:M,onChange:e=>{N(e.target.value),F(0)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Se(e.shiftKey?-1:1))}}),(0,Y.jsx)(`output`,{className:`min-w-12 whitespace-nowrap px-1 text-center text-[11px] text-muted-foreground`,"aria-live":`polite`,children:ge.length>0?j6(`source.search.matchCount`,{current:_e+1,total:ge.length}):j6(`source.search.noMatches`)}),(0,Y.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":j6(`source.search.previous`),disabled:ge.length===0,onClick:()=>Se(-1),children:(0,Y.jsx)(Cv,{className:`size-3.5 rotate-180`})}),(0,Y.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":j6(`source.search.next`),disabled:ge.length===0,onClick:()=>Se(1),children:(0,Y.jsx)(Cv,{className:`size-3.5`})}),(0,Y.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":j6(`source.search.close`),onClick:se,children:(0,Y.jsx)(Xb,{className:`size-3.5`})})]}),w&&fe?.status&&c&&(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>c(w),children:j6(`viewChanges`)}),l]})]}),O.kind===`empty`&&(0,Y.jsx)(`div`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:j6(`empty`)}),O.kind===`loading`&&(0,Y.jsx)(`div`,{className:`m-auto text-sm text-muted-foreground`,children:j6(`loadingFile`,{path:O.path})}),O.kind===`unsupported`&&(0,Y.jsxs)(`div`,{className:`m-auto max-w-md space-y-2 text-center`,children:[(0,Y.jsx)(bC,{variant:`outline`,className:`capitalize`,children:O.reason.replace(/_/g,` `)}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O.message})]}),O.kind===`error`&&(0,Y.jsxs)(`div`,{className:`m-auto max-w-md space-y-3 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:O.message}),(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void le(O.path,!0),children:j6(`retry`)})]}),O.kind===`content`&&(0,Y.jsx)(xde,{file:O.content,viewMode:he,comments:ve,canComment:r,searchMatches:ge,activeSearchMatchIndex:_e,onAddComment:be})]})]})},P6=r({WorkspaceReviewModal:()=>I6}),F6=e=>Wb.t(`common:workspaceReviewModal.${e}`),Cde=({activeMode:e,availableModes:t,onModeChange:n})=>(0,Y.jsx)(`div`,{role:`tablist`,"aria-label":F6(`modeAriaLabel`),className:`flex items-center gap-1 rounded-lg border border-border/80 bg-muted/30 p-1`,children:t.map(t=>(0,Y.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,Y.jsx)(jv,{className:`h-4 w-4`}):(0,Y.jsx)(Mv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:F6(t)})]},t))}),I6=({target:e,initialMode:t=`changes`,reviewMode:n,onReviewModeChange:r,enabledModes:i=[`changes`],filesView:a,fileTarget:o,bundleTargetName:s=null,onClose:c,title:l,mode:u,onModeChange:d,canToggleMode:f=!1,...m})=>{let[h,g]=(0,p.useState)(t),_=n??h,v=i.includes(_)?i:[_,...i],[y]=(0,p.useState)(e),[b,x]=(0,p.useState)(null),[S,C]=(0,p.useState)(null),[w,T]=(0,p.useState)([]),[E,D]=(0,p.useState)([]),O=(0,p.useRef)(E),[k,A]=(0,p.useState)(null);O.current=E;let j=(0,p.useCallback)(e=>{O.current=e,D(e)},[]),M=(0,p.useCallback)(()=>{O.current=[],D([])},[]),N=v.length>1,P=N&&a===void 0,[F]=(0,p.useState)(s),[I]=(0,p.useState)(()=>o??(y.scope===`project_root`?m.targetKind===`bundle`&&m.reviewCommentsBundleId?{kind:`bundle`,bundle_id:m.reviewCommentsBundleId,ticket_id:null}:{kind:`repo_root`,bundle_id:null,ticket_id:null}:m.reviewCommentsBundleId?{kind:`bundle`,bundle_id:m.reviewCommentsBundleId,ticket_id:null}:{kind:`ticket`,bundle_id:null,ticket_id:y.ticketId})),L=I.kind===`repo_root`?Wb.t(`common:workspaceFiles.repositoryRoot`):I.kind===`bundle`?Wb.t(`common:workspaceFiles.bundleTarget`,{name:F||I.bundle_id}):Wb.t(`common:workspaceFiles.ticketTarget`,{id:I.ticket_id}),R=I.kind===`ticket`?l:L,ee=(0,p.useCallback)(async()=>{if(!m.projectId||E.length===0)return E;let e=await A6(m.projectId,E),t=new Map(e.map(e=>[e.id,e.stale])),n=O.current.map(e=>{let n=t.get(e.id);return n===void 0?e:{...e,stale:n}});return j(n),n},[m.projectId,E,j]),te=(0,p.useCallback)(()=>{m.projectId&&localStorage.removeItem(k6(m.projectId,I)),M()},[m.projectId,M,I]),z=(0,p.useCallback)(e=>{r?.(e),n===void 0&&g(e)},[r,n]),B=(0,p.useCallback)(e=>{x(e),z(`changes`)},[z]),V=(0,p.useCallback)(e=>{C(e),z(`files`)},[z]),H=(0,p.useCallback)(e=>{x(t=>t===e?null:t)},[]),U=(0,p.useCallback)(e=>{C(t=>t===e?null:t)},[]),ne=(0,p.useCallback)(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u!==void 0&&d&&(0,Y.jsx)($Y,{value:u,disabled:!f||m.isUpdatingMode,onChange:d,planInactiveTooltip:(0,Y.jsx)(lX,{label:Wb.t(`common:ticketChangesModal.switchToPlan`)}),buildInactiveTooltip:(0,Y.jsx)(lX,{label:Wb.t(`common:ticketChangesModal.switchToBuild`)})}),(0,Y.jsx)(T3,{reviewComments:w,reviewFindings:e.reviewFindings,githubComments:e.githubComments,pendingFixCount:e.pendingFixCount,canSendReview:e.canSendReview,isSubmittingReview:e.isSubmittingReview,reviewSubmitDisabledReason:e.reviewSubmitDisabledReason,onClearPendingFixes:e.onClearPendingFixes,onSubmitReview:e.onSubmitReview,onUpdateReviewComment:e.onUpdateReviewComment,onRemoveReviewComment:e.onRemoveReviewComment})]}),[f,m.isUpdatingMode,u,d,w]),re=(0,p.useCallback)(()=>k?ne(k):null,[ne,k]);return(0,p.useEffect)(()=>{if(!d||u===void 0)return;let e=e=>{!oX(e)||!f||(e.preventDefault(),d(aX(u)))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[f,u,d]),(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(gC,{onClose:c,overlayClassName:`z-[70] bg-black/30 p-[5vh]`,panelClassName:`flex h-[92vh] w-full max-w-none flex-col overflow-hidden rounded-2xl border border-border bg-card p-6 shadow-2xl`,closeButtonLabel:F6(`closeAriaLabel`),renderContent:({closeButton:e})=>{let t=N?(0,Y.jsx)(Cde,{activeMode:_,availableModes:v,onModeChange:z}):null,n=N?(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:t}):null,r=y.scope===`ticket`?(0,Y.jsx)(v6,{...m,...y,projectId:m.projectId,title:l,onClose:c,mode:u,onModeChange:d,canToggleMode:f,headerControls:n,isActive:_===`changes`,onPendingReviewCommentsChange:T,onReviewControlsStateChange:A,renderReviewControls:ne,showReviewControls:!N||_===`changes`,sourceReviewComments:E,onSourceReviewCommentsChange:j,onClearSourceReviewComments:M,onSourceReviewCommentsSubmitted:te,onValidateSourceReviewComments:ee,requestedDiffPath:b,onRequestedDiffPathHandled:H,onViewCurrentFile:P?V:void 0}):(0,Y.jsx)(v6,{...m,scope:`project_root`,projectId:m.projectId,title:l,onClose:c,mode:u,onModeChange:d,canToggleMode:f,headerControls:n,isActive:_===`changes`,onPendingReviewCommentsChange:T,onReviewControlsStateChange:A,renderReviewControls:ne,showReviewControls:!N||_===`changes`,sourceReviewComments:E,onSourceReviewCommentsChange:j,onClearSourceReviewComments:M,onSourceReviewCommentsSubmitted:te,onValidateSourceReviewComments:ee,requestedDiffPath:b,onRequestedDiffPathHandled:H,onViewCurrentFile:P?V:void 0}),i=N?(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[_===`files`&&(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-4`,children:[(0,Y.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-lg font-semibold text-foreground`,children:R}),(0,Y.jsx)(`div`,{"data-testid":`workspace-review-files-header-actions`,className:`flex min-w-0 max-w-full items-center gap-2 pr-10`,children:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:t})})]}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(`div`,{id:`workspace-review-changes-panel`,role:`tabpanel`,hidden:_!==`changes`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":_===`changes`,children:r}),(0,Y.jsx)(`div`,{id:`workspace-review-files-panel`,role:`tabpanel`,hidden:_!==`files`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":_===`files`,children:a??(0,Y.jsx)(Sde,{projectId:m.projectId,target:I,isActive:_===`files`,canAddComments:m.canAddReviewComments??!1,comments:E,onCommentsChange:j,requestedPath:S,onRequestedPathHandled:U,onViewChanges:B,headerControls:_===`files`&&k?re():void 0})})]})]}):r;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`absolute right-4 top-4 z-10 mt-2`,children:e}),i]})}})})},wde=e=>!(e instanceof Ke)||e.status!==409||typeof e.data!=`object`||e.data===null?!1:`code`in e.data&&e.data.code===`build_open_questions_changed`,Tde=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))},Ede=e=>e.flatMap(e=>e.questions.map(e=>`${e.id}:${e.updated_at}`)).join(`|`),Dde=({details:e,onClose:t,onRefresh:n,onSubmit:r})=>{let{t:i}=K(`common`),a=(0,p.useMemo)(()=>Tde(e),[e]),o=(0,p.useMemo)(()=>a.flatMap(e=>e.questions),[a]),s=(0,p.useMemo)(()=>Ede(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,Y.jsx)(O_,{open:!0,onOpenChange:e=>{e||t()},children:(0,Y.jsx)(A_,{showCloseButton:!1,className:`max-h-[calc(100vh-2rem)] gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:(0,Y.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(wde(e)){try{await n()}catch{_(i(`buildOpenQuestionsDialog.refreshFailedError`))}h(!0),_(e=>e??i(`buildOpenQuestionsDialog.conflictError`))}else _(e instanceof Ke?e.message:i(`buildOpenQuestionsDialog.submitError`))}finally{f(!1)}}},className:`flex min-h-0 flex-col`,children:[(0,Y.jsxs)(j_,{className:`border-b border-border/70 px-5 py-4 sm:px-6`,children:[(0,Y.jsx)(N_,{children:i(`buildOpenQuestionsDialog.title`)}),(0,Y.jsx)(P_,{children:i(`buildOpenQuestionsDialog.description`)})]}),(0,Y.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,Y.jsxs)(`section`,{"aria-labelledby":`build-question-ticket-${e.ticket.id}`,children:[(0,Y.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,Y.jsx)(`div`,{className:`mt-2 space-y-3`,children:e.questions.map(e=>{let t=l[e.id]??{mode:null,answer:``};return(0,Y.jsxs)(`article`,{className:`min-w-0 rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,Y.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-foreground`,children:e.question_text}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Y.jsxs)(J_,{className:`flex cursor-pointer items-center gap-2 text-sm`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`decision-${e.id}`,checked:t.mode===`answer`,onChange:()=>x(e.id,{mode:`answer`})}),i(`buildOpenQuestionsDialog.answerOption`)]}),(0,Y.jsxs)(J_,{className:`flex cursor-pointer items-center gap-2 text-sm`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`mt-3`,children:[(0,Y.jsx)(J_,{htmlFor:`answer-${e.id}`,className:`sr-only`,children:i(`buildOpenQuestionsDialog.answerLabel`,{question:e.question_text})}),(0,Y.jsx)(I_,{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,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`buildOpenQuestionsDialog.empty`)})]}),(0,Y.jsxs)(M_,{className:`items-start border-t border-border/70 px-5 py-4 sm:items-center sm:px-6`,children:[(0,Y.jsxs)(`div`,{className:`mr-auto min-w-0 text-xs leading-5 text-muted-foreground`,"aria-live":`polite`,children:[g&&(0,Y.jsx)(`p`,{className:`text-destructive`,children:g}),!g&&b&&(0,Y.jsx)(`p`,{children:i(`buildOpenQuestionsDialog.dismissSummary`)}),!g&&!y&&!b&&(0,Y.jsx)(`p`,{children:i(`buildOpenQuestionsDialog.incompleteSummary`)})]}),m&&(0,Y.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>{h(!1),_(null)},children:i(`buildOpenQuestionsDialog.reviewRefreshed`)}),(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:t,children:i(`buildOpenQuestionsDialog.cancel`)}),(0,Y.jsx)(Q,{type:`submit`,disabled:!v||m||d,children:i(d?`buildOpenQuestionsDialog.submitting`:`buildOpenQuestionsDialog.submit`)})]})]})})})},L6={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`}},Ode=e=>ry(e)?`ready`:`blocked`,R6=180,kde=560,z6=88,B6=12,V6=18,H6=`dependency-overlay-clip`,U6=(e,t,n)=>Math.min(Math.max(e,t),n),Ade=(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(` `)}`},jde=(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}),Mde=(e,t)=>{let n=U6(Math.round(e.length*7.2)+24,R6,kde),r=Math.max(R6,t-B6*2);return Math.min(n,r)},Nde=(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}=cy(t,o??{left:e.pointer.x,top:e.pointer.y,width:0,height:0}),d=jde(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=Mde(c,d.width);return{text:c,x:o&&s?U6(f.x-p/2,B6,Math.max(B6,d.width-p-B6)):(()=>{let e=f.x+V6,t=f.x-V6-p;return e+p<=d.width-B6?e:t>=B6?t:U6(e,B6,Math.max(B6,d.width-p-B6))})(),y:U6(f.y,B6,Math.max(B6,d.height-z6-B6)),width:p}},W6=({blockerRect:e,dependentRect:t,className:n,testId:r,markerEnd:i})=>{let{start:a,end:o}=cy(e,t),{path:s}=tne(a,o);return(0,Y.jsx)(`g`,{"data-testid":r,children:(0,Y.jsx)(`path`,{d:s,className:n,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,markerEnd:i})})},Pde=({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=Nde(e,i,n,t,r);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W6,{blockerRect:i,dependentRect:a,className:L6.preview.className,testId:`dependency-preview`,markerEnd:`url(#${L6.preview.markerId})`}),(e=>o?(0,Y.jsx)(`foreignObject`,{x:o.x,y:o.y,width:o.width,height:z6,"data-testid":`dependency-preview-label`,children:e}):null)((0,Y.jsx)(`div`,{className:`pointer-events-none flex h-full w-full items-start`,children:(0,Y.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})}))]})},Fde=({dependencies:e,cardRects:t,clipRects:n=[],preview:r,ticketsById:i,overlaySize:a})=>{let o=Ade(a,n);return(0,Y.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 z-10 h-full w-full overflow-visible`,children:[(0,Y.jsxs)(`defs`,{children:[Object.values(L6).map(e=>(0,Y.jsx)(`marker`,{id:e.markerId,markerWidth:`8`,markerHeight:`8`,refX:`7`,refY:`4`,orient:`auto`,markerUnits:`userSpaceOnUse`,children:(0,Y.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,Y.jsx)(`clipPath`,{id:H6,children:(0,Y.jsx)(`path`,{d:o,clipRule:`evenodd`})})]}),(0,Y.jsxs)(`g`,{"data-testid":`dependency-overlay-content`,clipPath:o?`url(#${H6})`: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=L6[Ode(n)];return!a||!o?null:(0,Y.jsx)(W6,{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,Y.jsx)(Pde,{preview:r,cardRects:t,ticketsById:i,overlaySize:a})]})]})},Ide=({onOpenProjectExecutionSettings:e})=>{let{t}=K(`common`);return(0,Y.jsxs)(`p`,{className:`mt-2 w-full max-w-none text-xs leading-relaxed text-amber-200/90`,role:`status`,children:[t(`modelSelector.dockerSandboxNotice`),e&&(0,Y.jsx)(Q,{type:`button`,variant:`link`,size:`xs`,className:`ml-1 h-auto align-baseline px-0 text-xs font-medium text-amber-100`,onClick:e,children:t(`modelSelector.openExecutionSettings`)})]})},Lde=({onSubmit:e,bundles:t,projectId:n=null,projectBranchState:r=null,tool:i,showModelSelector:a=!1,showSkillsSelector:o=!1,availableModels:s=[],availableSkills:c=[],initialModel:l=``,initialVariant:u=``,initialSkills:d=[],initialWorktreeBundleId:f=null,initialImportedDraft:p=null,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,showDockerSandboxModelNotice:_=!1,onOpenProjectExecutionSettings:v,onClose:y})=>{let{t:b}=K(`common`),{jiraImportState:x,importFromJira:S}=Jw(n),{gitHubImportState:C,importFromGitHub:w}=vw(n),T=[{key:`jira`,label:b(`jiraImportField.label`),placeholder:b(`jiraImportField.placeholder`),state:x,onImport:S},{key:`github`,label:b(`githubImportField.label`),placeholder:b(`githubImportField.placeholder`),state:C,onImport:w}];return(0,Y.jsx)(gC,{onClose:y,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:x})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`absolute right-4 top-4 z-10 sm:right-5 sm:top-5 lg:right-6 lg:top-6`,children:x}),(0,Y.jsx)(KY,{heading:b(`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:T,onCancel:y,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,modelSelectorNotice:_?(0,Y.jsx)(Ide,{onOpenProjectExecutionSettings:v}):void 0,titleInputId:`title`,descriptionInputId:`description`,bundleSelectId:`new-ticket-bundle`,modelSelectId:`new-model`,variantSelectId:`new-variant`,skillsSelectId:`new-skills`,showEmptyBundleOption:!0,planAction:i?{label:b(`newTicketModal.actions.plan`),onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`plan`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}}:void 0,primaryAction:{label:b(`newTicketModal.actions.createTicket`),variant:`subtle`,onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`create`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}},secondaryAction:{label:b(`newTicketModal.actions.createAndBuild`),variant:`brand`,showAdvanceIcon:!0,onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`build`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}}})]})})},Rde=({className:e=``})=>{let{setNodeRef:t,isOver:n}=sF({id:`trash`});return(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(bC,{variant:`destructive`,className:`text-[11px] uppercase tracking-[0.28em]`,children:`Delete`}),(0,Y.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:n?`Release to delete`:`Drop here to delete`})]}),(0,Y.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,Y.jsx)(kC,{className:`h-5 w-5 transition-colors ${n?`text-red-100`:`text-red-300/70`}`})})]})},zde=(e,t)=>J(Ye(`/ticket-dependencies`,e),{signal:t}),Bde=(e,t)=>J(Ye(`/ticket-dependencies`,e),{method:`POST`,body:t,fallbackErrorMessage:`Unable to create the dependency right now.`}),Vde=(e,t,n)=>Qe(Ye(`/ticket-dependencies/${t}/${n}`,e),{method:`DELETE`,fallbackErrorMessage:`Unable to remove the dependency right now.`}),Hde=(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},Ude=(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,Wde=(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,Gde=({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=>Ude(e,r)?e:r),C.current=n,c(e=>Hde(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=>{Wde(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}},[]),ee=(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},[]),te=(0,p.useCallback)(async t=>{if(e)try{await Vde(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 Ke?e.message:`Unable to remove the dependency right now.`,{id:`board-dependency-error`})}},[e,r]),z=(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:ee(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=ee(a.x,a.y,t),s=o?ny(n,t,o):null;if(D.current?.(),D.current=null,F(null),!(!o||!s)){if(!s.valid){$.error(Zte(s.reason),{id:`board-dependency-error`});return}try{let n=await Bde(e,{blocker_ticket_id:t,dependent_ticket_id:o});r(e=>ey(e,n))}catch(e){$.error(e instanceof Ke?e.message:`Unable to create the dependency right now.`,{id:`board-dependency-error`})}}};D.current=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),I()},window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0})},[e,I,n,ee,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 B=(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=ny(n,r,e.id);i.set(e.id,t.valid?`valid`:`idle`)}return i},[e,n,g,j,t]),V=(0,p.useCallback)(e=>{if(!B||!g)return`idle`;let t=B.get(e)??`idle`;return e===g.hoveredTicketId&&t===`idle`?`invalid`:t},[B,g]),H=(0,p.useMemo)(()=>!g||g.projectId!==e||!j.has(g.blockerTicketId)?null:{blockerTicketId:g.blockerTicketId,hoveredTicketId:g.hoveredTicketId,pointer:g.pointer},[e,g,j]);return{boardViewportRef:v,boardContentRef:y,registerTicketNode:N,registerDependencyClipNodes:P,measuredCardRects:(0,p.useMemo)(()=>{if(!i)return s;let e=s[i.id];return e?m?.ticketId===i.id?{...s,[i.id]:m.rect}:{...s,[i.id]:{...e,left:e.left+o.x,top:e.top+o.y}}:s},[m,i,s,o.x,o.y]),dependencyClipRects:l,overlayPreview:H,overlaySize:d,getDependencyTargetState:V,handleDependencyStart:z,handleDeleteDependency:te}},Kde=`[data-terminal-pane="true"]`,qde=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},Jde=e=>e instanceof HTMLElement?e.closest(Kde)!==null:!1,Yde=e=>qde(e)||Jde(e),Xde=(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])},G6=new Set([`queued`,`running`]),Zde={check_batch:`checks`,check_repair:`auto_fix`,automation_review_fix:`auto_fix`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pr`},K6=e=>{if(!e.id)return null;let t=Date.parse(e.updated_at);return Number.isFinite(t)?t:null},Qde=e=>{let t=e.source_reference;if(e.kind!==`automation_progression`||e.status!==`waiting`&&!G6.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=K6(e);return!n||r===null?null:{bundleId:n,id:e.id,isActive:G6.has(e.status),updatedAt:r}},$de=e=>{let t=Zde[e.kind],n=K6(e);return!t||!G6.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}},q6=(e,t)=>e.updatedAt===t.updatedAt?e.id.localeCompare(t.id)>0:e.updatedAt>t.updatedAt,efe=e=>{let t=new Map,n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=Qde(r);if(e){let n=t.get(e.bundleId);(!n||q6(e,n))&&t.set(e.bundleId,e);continue}let i=$de(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||q6(e,n))&&a.set(t,e)}for(let[e,t]of a)i.set(e,t.status);return i},J6={runs:[],events:[],isLoading:!1,isLoadingMore:!1,hasMoreRuns:!1,hasMoreEvents:!1,error:null},Y6=(0,p.createContext)({state:new Map,loadMoreProject:()=>void 0,refreshProject:()=>void 0,subscribeProject:()=>()=>void 0}),tfe=[`queued`,`waiting`,`running`],nfe=(e,t,n,r)=>Mce(e,{cursor:t,limit:200,signal:n,statuses:r}),rfe=(e,t,n)=>Nce(e,{cursor:t,limit:200,signal:n}),ife=(e,t)=>{let n=t.created_at.localeCompare(e.created_at);return n===0?t.id.localeCompare(e.id):n},afe=(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},X6=(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(ife)},Z6=(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(afe)},ofe=async(e,t,n)=>{let r=null,i=[];do{let a=await e(t,r,n,tfe);i=X6(i,a.runs),r=a.next_cursor}while(r);return i},sfe=({socket:e,fetchRunsPage:t,fetchEventsPage:n,children:r})=>{let i=bq(),a=e??i,o=t??nfe,s=n??rfe,[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)??J6;return n.set(e,{...r,isLoading:!0,isLoadingMore:!1,error:null}),n}),Promise.all([o(e,null,t.signal),ofe(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:X6(X6(n.runs,r),a.runs),events:Z6(i.events,a.events),isLoading:!1,isLoadingMore:!1,hasMoreRuns:!!n.next_cursor,hasMoreEvents:!!i.next_cursor,error:null}),o})}).catch(t=>{Xe(t)||l(n=>{let r=new Map(n),i=r.get(e)??J6;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)??J6;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)??J6;return i.set(e,{...a,runs:X6(a.runs,t.runs),events:Z6(a.events,r.events),isLoadingMore:!1,hasMoreRuns:!!t.next_cursor,hasMoreEvents:!!r.next_cursor,error:null}),i}))}).catch(t=>{Xe(t)||l(n=>{let r=new Map(n),i=r.get(e)??J6;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=X6(t.runs,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??J6;return n.set(e.project_id,{...r,runs:X6(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=Z6(t.events,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??J6;return n.set(e.project_id,{...r,events:Z6(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,Y.jsx)(Y6.Provider,{value:x,children:r})},Q6=e=>{let{loadMoreProject:t,refreshProject:n,state:r,subscribeProject:i}=(0,p.useContext)(Y6);(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)??J6:J6,loadMore:o,refresh:a}},$6=e=>({...e,messages:void 0,agent_log:void 0,streaming_response:void 0}),e8=(e,t)=>e?e.state!==t.state||e.parked_at!==t.parked_at||e.worktree_bundle_id!==t.worktree_bundle_id:!0,t8=(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}},n8=(e,t)=>{let n=e=>_y(t)?_y(e):e.state===t.state&&!_y(e),r=e.findIndex(e=>n(e));if(r===-1)return[...e,t];let i=[...e];return i.splice(r,0,t),i},r8=(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)]},i8=(e,t)=>{let n=e.find(e=>e.id===t.id);if(!n)return[...e,t];let r=t8(n,t);return e.map(e=>e.id===t.id?r:e)},a8=(e,t)=>{let n=t8(e.find(e=>e.id===t.id),t);return n8(o8(e,t.id),n)},cfe=(e,t)=>{if(e.length===0)return[...t];let n=[...e];for(let e of t)n=e8(n.find(t=>t.id===e.id),e)?a8(n,e):i8(n,e);let r=new Set(t.map(e=>e.id));return n.filter(e=>r.has(e.id))},o8=(e,t)=>e.filter(e=>e.id!==t),s8=(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=o8(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 n8(s,o)},lfe=new Set([`findings`,`pull-requests`,`deployments`,`incidents`]),c8=e=>encodeURIComponent(e),ufe=e=>{try{let t=decodeURIComponent(e);return t.length>0?t:null}catch{return null}},l8=(e,t)=>t.every((t,n)=>e[n]===t),u8=(e,t)=>e.length<=t.length&&l8(t,e),d8=e=>e===`files`||e===`changes`,dfe=(e,t=lfe)=>{let n=[...e.map(e=>e.namespace),...Array.from(t,e=>[e])];for(let e of n)if(e.length===0||e.some(e=>e.length===0))throw Error(`Desktop route namespaces must contain non-empty segments`);for(let e=0;e<n.length;e+=1)for(let t=e+1;t<n.length;t+=1){let r=n[e],i=n[t];if(u8(r,i)||u8(i,r))throw Error(`Duplicate or prefix-ambiguous desktop route namespace: ${r.join(`/`)} and ${i.join(`/`)}`)}return{build:t=>{if(t.projectId.length===0)throw Error(`Desktop routes require a project ID`);let n=e.flatMap(e=>{let n=e.build(t);return n?[[...e.namespace,...n]]:[]});if(n.length!==1)throw Error(`Desktop route kind must be owned by exactly one descriptor: ${t.kind}`);if(n[0].some(e=>e.length===0))throw Error(`Desktop route segments must be non-empty: ${t.kind}`);return`/app/projects/${c8(t.projectId)}/${n[0].map(c8).join(`/`)}`},isModal:t=>{let n=e.filter(e=>e.build(t)!==null);if(n.length!==1)throw Error(`Desktop route must have exactly one descriptor: ${t.kind}`);return n[0].isModal(t)},parse:t=>{let n=t.startsWith(`/`)?t.slice(1).split(`/`):[];if(n.length<4||n[0]!==`app`||n[1]!==`projects`)return null;let r=n.slice(2).map(ufe);if(r.some(e=>e===null))return null;let[i,...a]=r,o=e.find(e=>l8(a,e.namespace));if(!o)return null;let s=null;try{s=o.parse(i,a.slice(o.namespace.length))}catch{return null}return s||null},parent:t=>{let n=e.filter(e=>e.build(t)!==null);if(n.length!==1)throw Error(`Desktop route must have exactly one descriptor: ${t.kind}`);return n[0].parent(t)}}},f8=e=>({namespace:[e],parse:(t,n)=>n.length===0?{kind:`workspace`,projectId:t,workspace:e}:e===`board`&&n.length===2&&n[0]===`tickets`?{kind:`ticket`,projectId:t,ticketId:n[1]}:e===`board`&&n.length===2&&n[0]===`bundles`?{kind:`bundle`,projectId:t,bundleId:n[1]}:e===`chat`&&n.length===2&&n[0]===`sessions`?{kind:`chat-session`,projectId:t,chatSessionId:n[1]}:e===`spec`&&n.length===2&&n[0]===`sessions`?{kind:`spec-session`,projectId:t,specSessionId:n[1]}:e===`spec`&&n.length===4&&n[0]===`sessions`&&n[2]===`snapshots`?{kind:`spec-snapshot`,projectId:t,specSessionId:n[1],specSnapshotId:n[3]}:null,build:t=>t.kind===`workspace`?t.workspace===e?[]:null:e===`board`&&t.kind===`ticket`?[`tickets`,t.ticketId]:e===`board`&&t.kind===`bundle`?[`bundles`,t.bundleId]:e===`chat`&&t.kind===`chat-session`?[`sessions`,t.chatSessionId]:e===`spec`&&t.kind===`spec-session`?[`sessions`,t.specSessionId]:e===`spec`&&t.kind===`spec-snapshot`?[`sessions`,t.specSessionId,`snapshots`,t.specSnapshotId]:null,isModal:e=>e.kind===`ticket`||e.kind===`bundle`,parent:e=>e.kind===`ticket`||e.kind===`bundle`?{kind:`workspace`,projectId:e.projectId,workspace:`board`}:e.kind===`chat-session`?{kind:`workspace`,projectId:e.projectId,workspace:`chat`}:e.kind===`spec-session`||e.kind===`spec-snapshot`?{kind:`workspace`,projectId:e.projectId,workspace:`spec`}:null}),p8=dfe([f8(`board`),f8(`chat`),f8(`spec`),f8(`memory`),{namespace:[`repository`],parse:(e,t)=>t.length===1&&d8(t[0])?{kind:`repository-inspection`,projectId:e,mode:t[0]}:null,build:e=>e.kind===`repository-inspection`?[e.mode]:null,isModal:e=>e.kind===`repository-inspection`,parent:e=>e.kind===`repository-inspection`?{kind:`workspace`,projectId:e.projectId,workspace:`board`}:null},{namespace:[`bundles`],parse:(e,t)=>t.length===2&&d8(t[1])?{kind:`bundle-inspection`,projectId:e,bundleId:t[0],mode:t[1]}:null,build:e=>e.kind===`bundle-inspection`?[e.bundleId,e.mode]:null,isModal:e=>e.kind===`bundle-inspection`,parent:e=>e.kind===`bundle-inspection`?{kind:`bundle`,projectId:e.projectId,bundleId:e.bundleId}:null},{namespace:[`tickets`],parse:(e,t)=>t.length===2&&d8(t[1])?{kind:`ticket-inspection`,projectId:e,ticketId:t[0],mode:t[1]}:null,build:e=>e.kind===`ticket-inspection`?[e.ticketId,e.mode]:null,isModal:e=>e.kind===`ticket-inspection`,parent:e=>e.kind===`ticket-inspection`?{kind:`ticket`,projectId:e.projectId,ticketId:e.ticketId}:null},{namespace:[`activity`],parse:(e,t)=>t.length===2&&t[0]===`runs`?{kind:`activity-run`,projectId:e,runId:t[1]}:t.length===4&&t[0]===`runs`&&t[2]===`events`?{kind:`activity-run`,projectId:e,runId:t[1],eventId:t[3]}:null,build:e=>e.kind===`activity-run`?e.eventId?[`runs`,e.runId,`events`,e.eventId]:[`runs`,e.runId]:null,isModal:e=>e.kind===`activity-run`,parent:e=>e.kind===`activity-run`?{kind:`workspace`,projectId:e.projectId,workspace:`board`}:null},{namespace:[`checks`],parse:(e,t)=>t.length===1?{kind:`checks`,projectId:e,batchRunId:t[0]}:t.length===3&&t[1]===`attempts`?{kind:`checks`,projectId:e,batchRunId:t[0],attemptRunId:t[2]}:null,build:e=>e.kind===`checks`?e.attemptRunId?[e.batchRunId,`attempts`,e.attemptRunId]:[e.batchRunId]:null,isModal:e=>e.kind===`checks`,parent:e=>e.kind===`checks`?{kind:`workspace`,projectId:e.projectId,workspace:`board`}:null}]),m8=p8.build;p8.parse,p8.parent;var h8=`archon:completion-notifications:v1`,g8=`${h8}:emitted:`,_8=`archon:completion-notification-events:v1`,ffe=`archon:completion-notifications:v1`,pfe=50,mfe=500,hfe=10080*60*1e3,gfe=256,_fe=256,v8=()=>({emitted:{},leases:{}}),y8=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,b8=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`candidate`&&typeof t.key==`string`&&typeof t.tabId==`string`&&typeof t.expiresAt==`number`||t.type===`emitted`&&typeof t.key==`string`&&typeof t.emittedAt==`number`},vfe=()=>{if(typeof window>`u`)return null;try{let e=window.localStorage;return{publish:t=>{e.setItem(_8,JSON.stringify({event:t,nonce:y8()}))},subscribe:e=>{let t=t=>{if(!(t.key!==_8||!t.newValue))try{let n=JSON.parse(t.newValue);b8(n.event)&&e(n.event)}catch{}};return window.addEventListener(`storage`,t),()=>window.removeEventListener(`storage`,t)}}}catch{return null}},yfe=()=>{if(typeof window>`u`)return null;let e=vfe();if(typeof window.BroadcastChannel!=`function`)return e;try{let t=new window.BroadcastChannel(ffe);return{publish:n=>{if(t){t.postMessage(n);return}e?.publish(n)},subscribe:n=>{let r=e=>{b8(e.data)&&n(e.data)};try{t?.addEventListener(`message`,r)}catch{return t?.close(),t=null,e?.subscribe(n)??(()=>{})}return()=>{t?.removeEventListener(`message`,r),t?.close(),t=null}}}}catch{return e}},bfe=((e={})=>{let t=e.tabId??y8(),n=e.storage===void 0?(()=>{try{return typeof window>`u`?null:window.localStorage}catch{return null}})():e.storage,r=e.transport===void 0?yfe():e.transport,i=e.now??Date.now,a=e.wait??(e=>new Promise(t=>window.setTimeout(t,e))),o=e.electionMs??pfe,s=e.leaseMs??mfe,c=e.retentionMs??hfe,l=e.maxEmittedKeys??gfe,u=e.maxCandidateKeys??_fe,d=new Map,f=new Map,p=new Map,m=e=>{let t=Array.from(f).filter(([,t])=>e-t<=c).sort((e,t)=>t[1]-e[1]).slice(0,l);f.clear();for(let[e,n]of t)f.set(e,n);let n=Array.from(d).map(([t,n])=>[t,new Map(Array.from(n).filter(([,t])=>t>e).sort((e,t)=>t[1]-e[1]).slice(0,u))]).filter(([,e])=>e.size>0).sort((e,t)=>Math.max(...t[1].values())-Math.max(...e[1].values())).slice(0,u);d.clear();for(let[e,t]of n)d.set(e,t)},h=()=>{if(!n)return v8();try{let e=n.getItem(h8);if(!e)return v8();let t=JSON.parse(e);return{emitted:t.emitted&&typeof t.emitted==`object`?t.emitted:{},leases:t.leases&&typeof t.leases==`object`?t.leases:{}}}catch{return v8()}},g=(e,t)=>{let n=Object.entries(e.emitted).filter(([,e])=>typeof e==`number`&&t-e<=c).sort((e,t)=>t[1]-e[1]).slice(0,l),r=Object.fromEntries(Object.entries(e.leases).filter(([,e])=>e&&typeof e.owner==`string`&&typeof e.expiresAt==`number`&&e.expiresAt>t));return{emitted:Object.fromEntries(n),leases:r}},_=e=>{if(!n)return!1;try{return n.setItem(h8,JSON.stringify(e)),!0}catch{return!1}},v=e=>{let t=d.get(e.key)??new Map;t.set(e.tabId,e.expiresAt),d.set(e.key,t)},y=e=>{if(m(i()),e.type===`candidate`){v(e),m(i());return}f.set(e.key,e.emittedAt),m(i())},b=()=>{};try{b=r?.subscribe(y)??b}catch{}let x=(e,t)=>{m(t);let r=f.get(e);if(r!==void 0&&t-r<=c)return!0;let i;if(n)try{let t=n.getItem(`${g8}${e}`),r=t===null?NaN:Number(t);Number.isFinite(r)&&(i=r)}catch{}return i??=h().emitted[e],i!==void 0&&t-i<=c},S=(e,n)=>{let i={type:`candidate`,key:e,tabId:t,expiresAt:n+o+s};v(i),m(n);try{r?.publish(i)}catch{}},C=(e,n)=>{m(n);let r=d.get(e);return r?Array.from(r).filter(([,e])=>e>n).map(([e])=>e).sort()[0]??t:t},w=(e,r)=>{if(!n)return!0;let i=g(h(),r);if(i.emitted[e]!==void 0)return!1;let a=i.leases[e];return a&&a.owner!==t?!1:(i.leases[e]={owner:t,expiresAt:r+s},_(i)?h().leases[e]?.owner===t:!0)},T=(e,r)=>{if(!n)return!0;let i=g(h(),r);return i.emitted[e]!==void 0||i.leases[e]?.owner!==t?!1:(i.leases[e]={owner:t,expiresAt:r+s},_(i)&&h().leases[e]?.owner===t)},E=(e,t)=>{f.set(e,t);try{n?.setItem(`${g8}${e}`,String(t))}catch{}try{r?.publish({type:`emitted`,key:e,emittedAt:t})}catch{}},D=async(e,n)=>{if(x(e,i()))return!1;for(let r=0;r<2;r+=1){S(e,i()),await a(o);let r=i();if(x(e,r))return!1;if(C(e,r)!==t||!w(e,r)){if(await a(s),x(e,i()))return!1;continue}let c=window.setInterval(()=>{T(e,i())},Math.max(1,Math.floor(s/2)));try{await n()}catch{return!1}finally{window.clearInterval(c)}return E(e,i()),!0}return!1};return{coordinate:async(e,t)=>{let n=p.get(e);if(n)return await n,!1;let r=D(e,t);p.set(e,r);try{return await r}finally{p.get(e)===r&&p.delete(e)}},close:b,tabId:t}})(),xfe=`/notification-service-worker.js`,Sfe=`archon:get-notification-client-id`,Cfe=async e=>{let t=new MessageChannel;return new Promise(n=>{let r=window.setTimeout(()=>n(null),1e3);t.port1.onmessage=e=>{window.clearTimeout(r);let t=e.data;n(typeof t?.clientId==`string`?t.clientId:null)},e.postMessage({type:Sfe},[t.port2])})},x8=async()=>{if(!(`serviceWorker`in navigator))return null;try{return await navigator.serviceWorker.register(xfe,{scope:`/`})}catch{return null}},S8=e=>typeof e==`string`&&e.length>0,wfe=({projectId:e,ticketId:t,agentMessageId:n})=>S8(n)?`v1:ticket:${e}:${t}:message:${n}`:null,Tfe=({projectId:e,chatSessionId:t,agentMessageId:n})=>S8(n)?`v1:chat:${e}:${t}:message:${n}`:null,Efe=({projectId:e,specSessionId:t,agentMessageId:n,latestSnapshotId:r})=>S8(n)?`v1:spec:${e}:${t}:message:${n}`:S8(r)?`v1:spec:${e}:${t}:snapshot:${r}`:null,C8=async({title:e,body:t,key:n,destination:r})=>{if(!(`Notification`in window)||Notification.permission===`denied`)return!1;if(Notification.permission===`default`)try{await Notification.requestPermission()}catch{return!1}return Notification.permission!==`granted`||!(`serviceWorker`in navigator)?!1:bfe.coordinate(n,async()=>{if(!await x8())throw Error(`Notification service worker unavailable`);let i=await navigator.serviceWorker.ready;if(!i.active)throw Error(`Notification service worker inactive`);let a=await Cfe(i.active);await i.showNotification(e,{body:t,tag:n,requireInteraction:!1,data:{url:m8(r),clientId:a}})})},w8=(0,p.createContext)(null),Dfe=15*1e3,Ofe=1e3,kfe=async(e,t)=>{let n=wfe({projectId:t,ticketId:e.id,agentMessageId:e.agent_message_id});if(!n)return;let r=e.worktree_bundle_id!==null&&e.state!==`plan`?{kind:`bundle`,projectId:t,bundleId:e.worktree_bundle_id}:{kind:`ticket`,projectId:t,ticketId:e.id};await C8({title:`Ticket done`,body:e.title,key:n,destination:r})},T8=e=>$6(e),Afe=(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,jfe=({activeProjectId:e,refreshKey:t=0,onLoadedProjectIdChange:n,onProjectUsageChange:r,onBundlesChange:i,onBundlesLoadingChange:a,children:o})=>{let s=bq(),[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,E]=(0,p.useState)(null),D=(0,p.useRef)(0),O=(0,p.useRef)(0),k=(0,p.useRef)(new Map),A=(0,p.useRef)(new Map),j=(0,p.useRef)([]),M=(0,p.useRef)(e),N=(0,p.useRef)(new Map),P=(0,p.useRef)(new Map),F=(0,p.useRef)(new Map),I=(0,p.useCallback)((e,t)=>{let n=P.current.get(t.id);return!n||!e||t.state===n?t:e},[]),L=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(P.current);for(let r of e)n.set(r,t);P.current=n},[]),R=(0,p.useCallback)(e=>{if(e.length===0||P.current.size===0)return;let t=new Map(P.current);for(let n of e)t.delete(n);P.current=t},[]),ee=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(F.current);for(let r of e)n.set(r,t);F.current=n},[]),te=(0,p.useCallback)(e=>{if(e.length===0||F.current.size===0)return;let t=new Map(F.current);for(let n of e)t.delete(n);F.current=t},[]),z=(0,p.useCallback)((e,t)=>{if(N.current.has(t.id))return null;let n=I(e,t);return F.current.has(t.id)?{...n,parked_at:F.current.get(t.id)??null}:n},[I]),B=(0,p.useCallback)((e,t)=>{if(N.current.size===0&&P.current.size===0&&F.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 an(e,t,{detail:`board`});return Array.isArray(n)?(!t?.aborted&&M.current===e&&l(e=>cfe(e,B(e,n).map(T8))),n):null},[B]),H=(0,p.useCallback)(async(e,t)=>{await V(e,t)},[V]),U=(0,p.useCallback)(async(e,t)=>{let n=++O.current,r=await on(e,t);if(!Array.isArray(r)||t?.aborted||M.current!==e||O.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}))},[]),ne=(0,p.useCallback)(e=>e.some(e=>e.is_stale===void 0),[]),re=(0,p.useCallback)(async e=>{let t=M.current;if(!t)return null;try{let n=await sn(e,t);if(M.current!==t)return null;let r=A.current.get(n.id),i=z(r,n);if(!i)return null;let a=T8(i),o=e8(r,a);return l(e=>o?a8(e,a):i8(e,a)),n}catch{return null}},[z]),ie=(0,p.useCallback)(async t=>{if(!e){m([]);return}m(await X(e,t))},[e]),ae=(0,p.useMemo)(()=>new Map(c.map(e=>[e.id,e])),[c]),oe=(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:T}},[T,c]);(0,p.useEffect)(()=>{if(A.current=ae,j.current.length===0)return;let e=[],t=[];for(let n of j.current){let r=ae.get(n.blocker_ticket_id),i=ae.get(n.dependent_ticket_id);r&&i&&r.project_id===M.current&&i.project_id===M.current?e.push(n):t.push(n)}j.current=t,e.length>0&&d(t=>e.reduce((e,t)=>ey(e,t),t))},[ae]),(0,p.useEffect)(()=>{M.current=e,N.current.clear(),j.current=[],P.current.clear(),F.current.clear(),E(null),g(null),k.current.clear()},[e]),(0,p.useEffect)(()=>{n?.(x?null:_)},[_,x,n]),(0,p.useEffect)(()=>{if(i){if(!e){i(null,[]);return}if(y!==e){i(e,[]);return}i(e,f)}},[e,f,y,i]),(0,p.useEffect)(()=>{if(a){if(!e){a(null,!1);return}a(e,C===e)}},[e,C,a]),(0,p.useEffect)(()=>{let t=new AbortController,n=++D.current,r=null,i=async()=>{try{if(!e){l([]),d([]),m([]),v(null),b(null),S(null);return}l([]),d([]),m([]),v(null),b(null),S(e),w(e);let i=V(e,t.signal).finally(()=>{!t.signal.aborted&&D.current===n&&(v(e),S(null))}),a=zde(e,t.signal).then(e=>(!t.signal.aborted&&D.current===n&&d(e),e)),o=X(e,t.signal).then(e=>(!t.signal.aborted&&D.current===n&&m(e),e)).finally(()=>{!t.signal.aborted&&D.current===n&&(b(e),w(null))}),[s,c,u]=await Promise.allSettled([i,a,o]);if(t.signal.aborted)return;s.status!==`fulfilled`&&!Xe(s.reason)&&l([]),c.status===`fulfilled`?d(c.value):Xe(c.reason)||d([]),u.status===`fulfilled`?m(u.value):Xe(u.reason)||m([]),s.status===`fulfilled`&&s.value!==null&&ne(s.value)&&(r=window.setTimeout(()=>{t.signal.aborted||U(e,t.signal)},Ofe))}finally{!t.signal.aborted&&D.current===n&&(S(null),w(null))}},a=t=>{t.project_id===e&&(g(t),!N.current.has(t.id)&&(t.bundle&&m(e=>r8(e,t.bundle)),l(e=>a8(e,T8(t)))))},o=t=>{if(t.project_id===e&&g(t),l(n=>{if(t.project_id!==e)return o8(n,t.id);let r=n.find(e=>e.id===t.id),i=z(r,t);if(!i)return n;let a=T8(i);return e8(r,a)?a8(n,a):i8(n,a)}),t.project_id!==e){d(e=>$v(e,t.id));return}t.bundle&&m(e=>r8(e,t.bundle))},c=({id:e})=>{N.current.delete(e),F.current.delete(e),P.current.delete(e),l(t=>o8(t,e)),d(t=>$v(t,e))},u=({project_id:e,bundle_id:t,pull_request:n})=>{e===M.current&&(m(e=>e.map(e=>e.id===t?{...e,pull_request:n}:e)),l(e=>e.map(e=>e.worktree_bundle_id!==t||!e.bundle?e:{...e,bundle:{...e.bundle,pull_request:n}})),g(e=>e?.worktree_bundle_id!==t||!e.bundle?e:{...e,bundle:{...e.bundle,pull_request:n}}))},f=e=>{if(!e)return;let t=A.current.get(e.blocker_ticket_id),n=A.current.get(e.dependent_ticket_id);if(!t||!n){j.current.push(e);return}t.project_id!==M.current||n.project_id!==M.current||d(t=>ey(t,e))},p=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(`bundle-pull-request:updated`,u),s.on(`ticket-dependency:created`,f),s.on(`ticket-dependency:deleted`,p),()=>{t.abort(),r!==null&&window.clearTimeout(r),s.off(`ticket:created`,a),s.off(`ticket:updated`,o),s.off(`ticket:deleted`,c),s.off(`bundle-pull-request:updated`,u),s.off(`ticket-dependency:created`,f),s.off(`ticket-dependency:deleted`,p)}},[e,U,t,ne,V,z,s]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=()=>{document.visibilityState===`visible`&&Promise.allSettled([V(e,t.signal),ie(t.signal)]).then(n=>{n[0]?.status===`fulfilled`&&n[0].value!==null&&ne(n[0].value)&&U(e,t.signal)}).catch(()=>{})},r=window.setInterval(n,Dfe),i=ax(n);return()=>{t.abort(),window.clearInterval(r),i()}},[e,ie,U,ne,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)(()=>{if(e)for(let t of c){let n=k.current.get(t.id),r=Afe(t,n);r&&E(r),n!==void 0&&n===`running`&&t.agent_status===`done`&&(t.state===`plan`||t.state===`build`||t.state===`review`)&&kfe(t,e),k.current.set(t.id,t.agent_status)}},[e,c]);let W=(0,p.useCallback)(()=>{g(null)},[]),se=(0,p.useMemo)(()=>({tickets:c,setTickets:l,dependencies:u,setDependencies:d,bundles:f,setBundles:m,latestDetailedTicketUpdate:h,clearLatestDetailedTicketUpdate:W,loadedProjectId:_,bundlesLoadedProjectId:y,loadingProjectId:x,activeProjectIdRef:M,pendingDeletedTicketsRef:N,pendingOptimisticMovesRef:P,pendingParkedTicketsRef:F,refreshTickets:H,requestSingleTicketRefresh:re,refreshBundles:ie,resolvePendingTicket:z,resolvePendingTickets:B,markPendingOptimisticMoves:L,clearPendingOptimisticMoves:R,markPendingParkedTickets:ee,clearPendingParkedTickets:te,liveActivity:oe}),[f,y,W,R,te,u,oe,_,h,x,L,ee,ie,H,re,z,B,c]);return(0,Y.jsx)(w8.Provider,{value:se,children:o})},E8=()=>{let e=(0,p.useContext)(w8);if(!e)throw Error(`useProjectWorkspace must be used inside ProjectWorkspaceProvider`);return e},D8=(0,p.lazy)(()=>iG(()=>import(`./VerificationDialog-DXoUeYip.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),O8=`archon.last-model-selection`,k8=`archon.last-variant-selection`,A8=`archon.last-skills-selection`,Mfe=()=>{try{let e=window.localStorage.getItem(A8),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}},j8=[`plan`,`build`,`review`],M8=`done`,N8=()=>({build:!1,stopBuild:!1,resumeBuild:!1,review:!1,undoReview:!1,run:!1,stop:!1,followUp:!1,bundleRefresh:!1}),Nfe=(e,t,n)=>{e?window.localStorage.setItem(O8,e):window.localStorage.removeItem(O8),t?window.localStorage.setItem(k8,t):window.localStorage.removeItem(k8),n.length>0?window.localStorage.setItem(A8,JSON.stringify(n)):window.localStorage.removeItem(A8)},P8=(e,t={})=>Ry(e,t),Pfe=()=>({model:window.localStorage.getItem(O8)??``,variant:window.localStorage.getItem(k8)??``,skills:Mfe()}),F8=(e,t)=>{let n=o8(e,t.ticket.id),r=Math.max(0,Math.min(t.index,n.length));return n.splice(r,0,t.ticket),n},Ffe=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,activeRun:r,activeTool:i,onPreviewReviewCapabilityChange:a,onRunStopped:o,onRunStatusChange:s,onViewSourceSpec:c,onNavigateToLifecycleSource:l,onStartChatFromBundle:u,refreshKey:d=0,boardFilterState:f,onBoardFilterStateChange:m,initialTicketId:h=null,onInitialTicketNavigationConsumed:g,onInitialTicketNavigationUnavailable:_,routedTicketId:v,onTicketOpen:y,onTicketClose:b,routedBundleId:x,routedInspection:S=null,routedInspectionReviewCapability:C,inspectionOnly:w=!1,onBundleOpen:T,onBundleClose:E,onInspectionOpen:D,onInspectionModeChange:O,onInspectionClose:k,onInspectionUnavailable:A,initialImportedDraft:j=null,onInitialImportedDraftConsumed:M,onOpenProjectExecutionSettings:N})=>{let{t:P}=K(`common`),F=zN(RN(FP,{activationConstraint:{distance:5}})),{tickets:I,setTickets:L,dependencies:R,setDependencies:ee,bundles:te,setBundles:z,latestDetailedTicketUpdate:B,clearLatestDetailedTicketUpdate:V,loadedProjectId:H,bundlesLoadedProjectId:U,loadingProjectId:ne,activeProjectIdRef:re,pendingDeletedTicketsRef:ie,requestSingleTicketRefresh:ae,refreshBundles:oe,resolvePendingTicket:W,markPendingOptimisticMoves:se,clearPendingOptimisticMoves:ce,markPendingParkedTickets:le,clearPendingParkedTickets:ue}=E8(),{runs:de}=Q6(e),fe=(0,p.useMemo)(()=>{let e=efe(de);for(let t of I)t.worktree_bundle_id&&t.automation_paused_reason&&e.delete(t.worktree_bundle_id);return e},[de,I]),[pe,me]=(0,p.useState)(null),[he,ge]=(0,p.useState)(null),[_e,ve]=(0,p.useState)(null),ye=(0,p.useCallback)(e=>ve(e),[]),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)({x:0,y:0}),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)([]),[Oe,ke]=(0,p.useState)(null),Ae=pF(`opencode`),je=pF(`claude`),Me=(0,p.useMemo)(()=>({opencode:Ae.models,claude:je.models}),[Ae.models,je.models]),Ne=(0,p.useCallback)(e=>{let n=Me[e]??[];return t?.build_execution_provider===`docker_sandbox`?Kre(n,Oe?Oe.approved_providers?.[e]??[]:[]):n},[t?.build_execution_provider,Oe,Me]),Pe=(0,p.useMemo)(()=>({opencode:Ne(`opencode`),claude:Ne(`claude`)}),[Ne]);(0,p.useEffect)(()=>{if(!e||t?.build_execution_provider!==`docker_sandbox`){ke(null);return}let n=new AbortController;return ke(null),Kb(e,n.signal).then(e=>{n.signal.aborted||ke(e)}).catch(e=>{!Xe(e)&&!n.signal.aborted&&ke(null)}),()=>n.abort()},[t?.build_execution_provider,e]);let Fe=(0,p.useMemo)(()=>{if(t?.build_execution_provider!==`docker_sandbox`)return Ee;let e=Oe?.available_skills?.opencode;if(!e)return[];let n=new Map(Ee.map(e=>[e.name,e]));return e.map(e=>n.get(e)??{name:e,description:``})},[t?.build_execution_provider,Ee,Oe?.available_skills?.opencode]),[Ie,Le]=(0,p.useState)(!1),[G,Re]=(0,p.useState)(!1),[ze,Be]=(0,p.useState)(!1),[Ve,He]=(0,p.useState)(null),[Ue,We]=(0,p.useState)(null),[Ge,qe]=(0,p.useState)(null),q=(0,p.useRef)(null),Je=v===void 0?h:v,Ye=(0,p.useRef)(null),Ze=(0,p.useRef)(null),[Qe,J]=(0,p.useState)(null),$e=(0,p.useRef)(null),[et,tt]=(0,p.useState)(null),[nt,rt]=(0,p.useState)(null),[it,at]=(0,p.useState)(null),[ot,st]=(0,p.useState)(null),ct=(0,p.useRef)(0),[lt,ut]=(0,p.useState)(null),[dt,ft]=(0,p.useState)(null),[pt,mt]=(0,p.useState)(null),[ht,gt]=(0,p.useState)(!1),[X,vt]=(0,p.useState)(N8()),[yt,St]=(0,p.useState)(0),[Ct,wt]=(0,p.useState)(()=>({query:``,hideStaleTickets:!1,hideBundlesWithPullRequests:!1})),At=f??Ct,jt=e=>{let t={...At,...e};if(m){m(t);return}wt(t)},Mt=FF(i)||FF(Ge?.tool)||!!nt?.tickets.some(e=>FF(PF(e,i))),zt=FF(i)&&(Ne(i).length>0||t?.build_execution_provider===`docker_sandbox`&&Me[i].length>0),Bt=FF(PF(Ge,i))&&Ne(PF(Ge,i)).length>0,Vt=!!nt?.tickets.some(e=>FF(PF(e,i)))&&(Pe.opencode.length>0||Pe.claude.length>0),Ht=(0,p.useRef)(null),[Ut,Wt]=(0,p.useState)(null),Gt=I.find(e=>e.is_running)??null,Kt=Gt?fy(Gt):null,qt=r?.context_key??null,Jt=r?.kind===`ticket`?rne(r,I)??Kt:Kt,Yt=r?.kind===`project`,Xt=Jt??Ut,Zt=(0,p.useCallback)(e=>ine({bundleId:e,activeRunContextKey:Xt,isProjectRootRunActive:Yt}),[Xt,Yt]),Qt=pe!==null&&Dy(pe,`trash`)||he!==null&&Sy(he),$t=ne===e,en=(0,p.useMemo)(()=>t?Ow(t):[],[t]),tn=(0,p.useMemo)(()=>jw(en),[en]),nn=(0,p.useMemo)(()=>t?kw(t):[],[t]),rn=(0,p.useMemo)(()=>t?Aw(t):[],[t]),an=tn.length>0,on=(0,p.useMemo)(()=>new Map(I.map(e=>[e.id,e])),[I]);(0,p.useEffect)(()=>{Wt(null)},[e]),(0,p.useEffect)(()=>{Ut!==null&&(Yt||Jt!==null)&&Wt(null)},[Jt,Yt,Ut]),(0,p.useEffect)(()=>{if(!Ue){qe(null);return}let e=on.get(Ue)??null;e&&qe(t=>!t||t.id!==Ue?e:my(t,e))},[Ue,on]),(0,p.useEffect)(()=>{B&&(qe(e=>!e||e.id!==B.id?e:my(e,B)),rt(e=>{if(!e)return e;let t=B.worktree_bundle_id;if(!t||e.bundle.id!==t)return e;let n=e.tickets.some(e=>e.id===B.id)?e.tickets.map(e=>e.id===B.id?my(e,B):e):[...e.tickets,B];return{...e,tickets:n}}))},[B]),(0,p.useEffect)(()=>{B===null||Ue!==null||Qe!==null||V()},[V,B,Qe,Ue]);let sn=(0,p.useCallback)(async e=>{let t=await ae(e);if(!t)return null;let n=on.get(e),r=n?my(t,n):t;return qe(t=>t&&t.id!==e||Ue&&Ue!==e?t:r),r},[ae,Ue,on]),ln=(0,p.useCallback)(e=>{qe(e),We(e.id),sn(e.id),y?.(e.id)},[y,sn]),dn=(0,p.useCallback)(()=>{$e.current=null,J(null),tt(null),rt(null),gt(!1),vt(N8())},[]),fn=(0,p.useMemo)(()=>new Map(te.map(e=>[e.id,e])),[te]),pn=(0,p.useMemo)(()=>{if(!nt)return null;let e=nt.bundle.id,t=B?.worktree_bundle_id===e?B:null,n=I.filter(t=>t.worktree_bundle_id===e),r=new Map(n.map(e=>[e.id,e])),i=nt.tickets.filter(e=>!ie.current.has(e.id)).map(e=>t&&e.id===t.id?my(e,t):e);t&&!i.some(e=>e.id===t.id)&&!ie.current.has(t.id)&&i.push(t);let a=i.map(e=>my(e,r.get(e.id)));for(let e of n)a.some(t=>t.id===e.id)||a.push(e);a=v3(a);let o=nt.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=Py(a),p=a.find(e=>e.id===nt.review_owner_ticket_id&&e.state===`review`)??a.find(e=>e.state===`review`)??null,m=Ry(a,{targetTicketId:nt.target_ticket_id,reviewOwnerTicketId:p?.id??nt.review_owner_ticket_id,latestSessionTicketId:f?.id??nt.latest_session_ticket_id});return{...nt,bundle:fn.get(e)??nt.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:nt.has_completed_review,has_follow_up_since_last_review:l?d.has_follow_up_since_last_review:nt.has_follow_up_since_last_review,can_re_review:l?d.can_re_review:nt.can_re_review}},[fn,B,ie,nt,I]),mn=(0,p.useMemo)(()=>I.filter(e=>{if(At.hideStaleTickets&&yy(e))return!1;if(At.hideBundlesWithPullRequests&&e.worktree_bundle_id){let t=fn.get(e.worktree_bundle_id);if(t&&t.pull_request!==void 0?t.pull_request:e.bundle?.pull_request)return!1}return one(At.query,e)}),[At,fn,I]),hn=(0,p.useMemo)(()=>Vy(mn),[mn]),gn=(0,p.useMemo)(()=>mn.filter(e=>_y(e)),[mn]),_n=(0,p.useMemo)(()=>zy(gn,te,M8),[te,gn]),{boardViewportRef:vn,boardContentRef:yn,registerTicketNode:Fn,registerDependencyClipNodes:Ln,measuredCardRects:Bn,dependencyClipRects:Vn,overlayPreview:Hn,overlaySize:Un,getDependencyTargetState:Wn,handleDependencyStart:Gn,handleDeleteDependency:Kn}=Gde({activeProjectId:e,tickets:I,dependencies:R,setDependencies:ee,activeTicket:pe,activeOverlayNode:be,dragOffset:Se}),qn=Pfe(),Jn=!!t?.run_ide?.trim(),Yn=(0,p.useCallback)((e,t,n=I)=>{let r=zy(n,te,t).find(t=>t.kind===`bundle`&&t.group.bundle.id===e);return r?.kind===`bundle`?r.group:null},[te,I]),Xn=(0,p.useCallback)(e=>{let n=PF(e,i);return(0,Y.jsx)(u3,{ticket:e,allTickets:I,dependencies:R,bundles:te,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:e.worktree_bundle_id?fe.get(e.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:FF(n)&&Ne(n).length>0,availableModels:Ne(n),runDisabled:!0,hideBundleScopedControls:!0})},[t?.memory_enabled,i,fe,te,R,Ne,I]),Zn=(0,p.useCallback)(t=>Iy(t)?t.project_id===e?Jn:!!t.has_run_ide:!1,[Jn,e]),Qn=(0,p.useCallback)(e=>!!e.project_id&&!!(e.bundle?.branch??e.branch)&&Iy(e),[]),$n=(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?Zn(t):!1},[Zn]),er=(0,p.useCallback)(e=>{let t=v3(I.filter(t=>t.worktree_bundle_id===e));return nt?.bundle.id===e?P8(v3(nt.tickets.map(e=>t.find(t=>t.id===e.id)??e)),{targetTicketId:nt.target_ticket_id,reviewOwnerTicketId:nt.review_owner_ticket_id,latestSessionTicketId:nt.latest_session_ticket_id}):P8(t)},[nt,I]),tr=(0,p.useCallback)(e=>{let t=er(e),n=te.some(t=>t.id===e&&t.has_prepared_worktree===!0)||I.some(t=>t.worktree_bundle_id===e&&Iy(t))||!!(nt?.bundle.id===e&&nt.tickets.some(Iy));return!!(t?.project_id&&(t.bundle?.branch??t.branch)&&n)},[te,er,nt,I]),nr=(0,p.useCallback)(e=>{let t=fn.get(e),n=er(e),r=nt?.bundle.id===e?[...I,...nt.tickets]:I;return!!(t&&n?.project_id&&Ly(t,r))},[fn,er,nt,I]);(0,p.useEffect)(()=>{Re(!1),Be(!1),ut(null),mt(null)},[e,d]),(0,p.useEffect)(()=>{if(!Mt){De([]);return}let t=new AbortController;return(async()=>{try{De(await mF(`opencode`,t.signal,e))}catch(e){Xe(e)||De([])}})(),()=>{t.abort()}},[e,Mt]);let rr=({active:e})=>{Le(!1),xe(null),Ce({x:0,y:0}),ve(null);let t=Hy(String(e.id));if(t){ge(Yn(t.bundleId,t.column)),me(null);return}ge(null),me(I.find(t=>t.id===e.id)??null)},ir=()=>{Le(!1),xe(null),Ce({x:0,y:0}),me(null),ge(null),ve(null)},ar=(0,p.useCallback)(e=>{L(t=>e.reduce((e,t)=>a8(e,t),t))},[L]),or=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=e[0]?.state;n&&L(r=>e.reduce((e,r)=>s8(e,r.id,t,Ey(r,n,t)),r))},[L]),sr=(0,p.useCallback)((e,t=I)=>!e.worktree_bundle_id||!e.project_id||e.state!==`build`?[]:v3(t.filter(t=>t.project_id===e.project_id&&t.worktree_bundle_id===e.worktree_bundle_id&&t.state===`build`&&t.parked_at===null)),[I]),cr=async({active:e,over:t})=>{let n=Hy(String(e.id)),r=I.find(t=>t.id===e.id),i=n?Yn(n.bundleId,n.column):null,a=t?.id===`trash`&&(r!==void 0&&Dy(r,`trash`)||i!==null&&Sy(i)),o=t?.id&&j8.includes(t.id)?t.id:null;if(Le(a),xe(null),Ce({x:0,y:0}),me(null),ge(null),t){if(n){if(t.id===`trash`){if(!i||!Sy(i))return;await br(i);return}if(t.id===M8){if(!i||!lne(i))return;await _r(i);return}if(o){if(n.column===M8){if(!i||!Cy(i))return;await vr(i);return}await ci(n.bundleId,n.column,o)}return}if(t.id===`trash`){if(!r||!Dy(r,`trash`))return;Sr(e.id);return}if(t.id===M8){if(!r||!Dy(r,M8))return;await hr(e.id);return}if(o){if(r&&cne(r,o)){await gr(e.id);return}if(!(!r||!Dy(r,o)))try{await pr(r,o,{optimistic:!0})}catch(e){$.error(e instanceof Ke?e.message:P(`board.errors.moveTicket`),{id:`board-move-error`})}}}},lr=async(t,n,r,i,a,o,s)=>{let c=await cn({title:t,description:n,model:i,variant:a,skills:o,project_id:e,...s});if(Nfe(i,a,o),L(e=>a8(e,$6(c))),c.bundle&&z(e=>r8(e,c.bundle)),r===`build`)try{await pr(c,`build`)}catch(e){$.error(e instanceof Ke?e.message:P(`board.errors.moveTicket`),{id:`board-move-error`})}r===`plan`&&zn(c.id,c.project_id)},ur=async t=>{if(!e)throw Error(P(`board.errors.createBundleWithoutProject`));let n=await _t(e,{name:t,prepare:!0});return z(e=>r8(e,n)),n},dr=(0,p.useCallback)((e,t={})=>{let n=$6(e);L(e=>t.reorderInState?a8(e,n):i8(e,n)),qe(t=>!t||t.id!==e.id?t:my(e,n)),e.bundle&&z(t=>r8(t,e.bundle))},[z,L]),fr=(0,p.useCallback)(e=>{z(t=>r8(t,e)),L(t=>t.map(t=>t.worktree_bundle_id===e.id?{...t,bundle:e}:t)),rt(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)})},[z,rt,L]),pr=async(e,t,n={})=>{let r=I.findIndex(t=>t.id===e.id),i=t===`review`?sr(e):[],a=t===`review`&&i.length>1,o=n.optimistic?a?i.map(e=>e.id):[e.id]:[];n.optimistic&&(se(o,t),a?or(i,t):L(n=>s8(n,e.id,t,wy(e,t))));try{if(a&&e.project_id&&e.worktree_bundle_id){let t=await Et(e.project_id,e.worktree_bundle_id);Hr(t);let n=t.tickets.find(t=>t.id===e.id);if(!n)throw Error(P(`board.errors.missingBundleReviewTicket`));return ce(o),n}let n=await un(e.id,e.project_id,t);return L(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:e8(i,n)?a8(r,n):i8(r,n)}),n.bundle&&z(e=>r8(e,n.bundle)),ce(o),n}catch(t){throw n.optimistic&&(a?ar(i):L(t=>s8(t,e.id,e.state,{agent_status:e.agent_status,agent_log:e.agent_log,build_completed_at:e.build_completed_at},{preferredIndex:r})),ce(o)),t}},mr=(e,t)=>{L(n=>n.map(n=>n.id===e?{...n,...t}:n))},hr=async t=>{let n=I.find(e=>e.id===t);if(n)try{let r=new Date().toISOString();le([t],r),mr(t,{parked_at:r}),dr(await wn(t,n.project_id??e),{reorderInState:!0}),ue([t])}catch(e){ue([t]),mr(t,{parked_at:n.parked_at}),$.error(e instanceof Ke?e.message:P(`board.errors.parkTicket`),{id:`board-park-error`})}},gr=async t=>{let n=I.find(e=>e.id===t);if(n)try{le([t],null),mr(t,{parked_at:null}),dr(await Tn(t,n.project_id??e),{reorderInState:!0}),ue([t])}catch(e){ue([t]),mr(t,{parked_at:n.parked_at}),$.error(e instanceof Ke?e.message:P(`board.errors.returnTicket`),{id:`board-unpark-error`})}},_r=(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();le(e.tickets.map(e=>e.id),r),L(e=>e.map(e=>t.has(e.id)?{...e,parked_at:r}:e));let i=await Promise.allSettled(e.tickets.map(e=>wn(e.id,e.project_id??re.current))),a=new Set;if(i.forEach((t,n)=>{if(t.status===`fulfilled`){ue([t.value.id]),dr(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&a.add(r.id)}),a.size===0)return;ue([...a]),L(e=>e.map(e=>{if(!a.has(e.id))return e;let t=n.find(t=>t.id===e.id);return t?{...e,parked_at:t.parked_at}:e}));let o=i.find(e=>e.status===`rejected`),s=a.size===e.tickets.length?o?.reason instanceof Ke?o.reason.message:P(`board.errors.moveBundleToDone`):P(`board.toasts.movedBundleToDonePartial`,{movedCount:e.tickets.length-a.size,totalCount:e.tickets.length});$.error(s,{id:`board-bundle-park-error`})},[re,dr,ue,le,L,P]),vr=(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}));le(e.tickets.map(e=>e.id),null),L(e=>e.map(e=>t.has(e.id)?{...e,parked_at:null}:e));let r=await Promise.allSettled(e.tickets.map(e=>Tn(e.id,e.project_id??re.current))),i=new Set;if(r.forEach((t,n)=>{if(t.status===`fulfilled`){ue([t.value.id]),dr(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&i.add(r.id)}),i.size===0)return;ue([...i]),L(e=>e.map(e=>{if(!i.has(e.id))return e;let t=n.find(t=>t.id===e.id);return t?{...e,parked_at:t.parked_at}:e}));let a=r.find(e=>e.status===`rejected`),o=i.size===e.tickets.length?a?.reason instanceof Ke?a.reason.message:P(`board.errors.restoreBundle`):P(`board.toasts.restoredBundlePartial`,{restoredCount:e.tickets.length-i.size,totalCount:e.tickets.length});$.error(o,{id:`board-bundle-unpark-error`})},[re,dr,ue,le,L,P]),yr=async t=>{e&&(await Ft(e,t),z(e=>e.filter(e=>e.id!==t)))},br=(0,p.useCallback)(async t=>{let n=t.tickets.map(e=>({ticket:e,index:I.findIndex(t=>t.id===e.id)})).filter(e=>e.index!==-1);if(n.length===0)return;for(let e of n)ie.current.set(e.ticket.id,e);let r=new Set(n.map(e=>e.ticket.id));L(e=>e.filter(e=>!r.has(e.id))),ee(e=>e.filter(e=>!r.has(e.blocker_ticket_id)&&!r.has(e.dependent_ticket_id)));let i=await Promise.allSettled(n.map(async t=>(await Sn(t.ticket.id,t.ticket.project_id??e),ie.current.delete(t.ticket.id),t.ticket.id)));t.tickets.some(e=>e.project_id===re.current)&&oe().catch(()=>{});let a=n.filter((e,t)=>i[t]?.status===`rejected`);if(a.length===0)return;for(let e of a)ie.current.delete(e.ticket.id);a.some(e=>e.ticket.project_id===re.current)&&L(e=>[...a].sort((e,t)=>e.index-t.index).reduce((e,t)=>F8(e,t),e));let o=i.find(e=>e.status===`rejected`),s=a.length===n.length?o?.reason instanceof Ke?o.reason.message:P(`board.errors.deleteBundleTickets`):P(`board.toasts.deletedBundleTicketsPartial`,{deletedCount:n.length-a.length,totalCount:n.length});$.error(s,{id:`board-delete-bundle-wrapper-error`})},[e,re,ie,oe,ee,L,I,P]),xr=e=>{let t=on.get(e.id);dr(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&&z(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===re.current&&oe().catch(()=>{})},Sr=async t=>{let n=I.find(e=>e.id===t),r=I.findIndex(e=>e.id===t);if(!(!n||r===-1)){ie.current.set(t,{ticket:n,index:r}),L(e=>o8(e,t)),ee(e=>$v(e,t));try{await Sn(t,n.project_id??e),n.project_id===re.current&&oe().catch(()=>{}),ie.current.delete(t)}catch(e){let n=ie.current.get(t);ie.current.delete(t),n&&n.ticket.project_id===re.current&&(L(e=>F8(e,n)),$.error(e instanceof Ke?e.message:P(`board.errors.deleteTicket`),{id:`board-delete-error`}))}}},Cr=async t=>{let n=I.find(e=>e.id===t);if(!n)return;let r=n.state===`review`?`review`:`build`;try{if(He(r),n.project_id&&n.worktree_bundle_id&&n.state===`review`){Hr(await Ot(n.project_id,n.worktree_bundle_id));return}dr(await Cn(t,n.project_id??e),{reorderInState:!0})}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.undoTicket`),{id:`board-undo-error`}),e}finally{He(e=>e===r?null:e)}},wr=t=>{Dn(t,I.find(e=>e.id===t)?.project_id??e)},Tr=async t=>{let n=I.find(e=>e.id===t),r=n?fy(n):t;try{Wt(r),await On(t,n?.project_id??e),s?.()}catch(e){Wt(e=>e===r?null:e),$.error(e instanceof Ke?e.message:P(`board.errors.startRun`),{id:`board-run-error`})}},Er=(0,p.useCallback)(async t=>{let n=I.find(e=>e.id===t);try{await kn(t,n?.project_id??e)}catch(e){$.error(e instanceof Ke?e.message:P(`board.errors.openIde`),{id:`board-open-ide-error`})}},[e,P,I]),Dr=async t=>{let n=I.find(e=>e.id===t),i=r?.kind===`ticket`&&n&&Jt===fy(n)?qt:null;try{await An(t,n?.project_id??e),o?.(i),s?.()}catch{}},Or=t=>{jn(t,I.find(e=>e.id===t)?.project_id??e).then(()=>{L(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e))})},kr=async t=>{let n=I.find(e=>e.id===t);try{await Mn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:P(`reviewInterrupt.error`))}},Ar=t=>{Nn(t,I.find(e=>e.id===t)?.project_id??e).then(()=>{L(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e))})},jr=(0,p.useCallback)(e=>{let t=er(e);!t||!Zn(t)||Er(t.id)},[Zn,er,Er]),Mr=(0,p.useCallback)((e,t)=>{let n=er(e),r=t===`files`?nr(e):tr(e);if(!(!n||!r)){if(D){D({kind:`bundle`,bundleId:e},t);return}ft({target:{kind:`bundle`,bundleId:e,ticketId:n.id},projectId:n.project_id,title:n.bundle?Gy(n.bundle):n.title,bundleTargetName:n.bundle&&Gy(n.bundle)||null,initialMode:t,followUpMode:`build`})}},[nr,tr,er,D]),Nr=(0,p.useCallback)((e,t)=>{let n=er(e);if(!n?.project_id||!Iy(n))return;let r=n.latest_check_gate_evaluation?.id??I.find(t=>t.worktree_bundle_id===e&&t.latest_check_gate_evaluation)?.latest_check_gate_evaluation?.id??null;if(en.length===0&&!r)return;let i=te.find(t=>t.id===e)??n.bundle;i&&mt({bundleId:e,label:Gy(i),requestedInitialTab:t,gateEvaluationId:r,requiredCheckPolicy:i.required_check_policy??null})},[te,er,en.length,I]),Pr=(0,p.useCallback)((e,t)=>{let n=I.find(t=>t.id===e);if(!(!n||!Qn(n))){if(D){D({kind:`ticket`,ticketId:e},t);return}ft({target:{kind:`ticket`,ticketId:n.id},projectId:n.project_id,title:n.title,bundleTargetName:null,initialMode:t,followUpMode:`build`})}},[Qn,D,I]),Fr=(0,p.useCallback)(e=>Mr(e,`files`),[Mr]),Ir=(0,p.useCallback)(e=>Mr(e,`changes`),[Mr]),Lr=(0,p.useCallback)(e=>Pr(e,`files`),[Pr]),Rr=(0,p.useCallback)(e=>Pr(e,`changes`),[Pr]),zr=(0,p.useCallback)(e=>{let t=I.find(t=>t.id===e);!t?.project_id||!Iy(t)||ut({ticketId:t.id,label:t.title})},[I]),Br=(0,p.useCallback)(async(t,n,r=`build`,i)=>{let a=I.find(e=>e.id===t);if(a)try{dr(a.state===`plan`?await Rn(t,a.project_id??e,n):await Pn(t,a.project_id??e,n,r,i))}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.sendFollowUp`),{id:`board-follow-up-error`}),e}},[e,dr,P,I]),Vr=(0,p.useCallback)(e=>{L(t=>e.reduce((e,t)=>{let n=e.find(e=>e.id===t.id),r=W(n,t);if(!r)return e;let i=$6(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 e8(n,i)?a8(e,i):i8(e,i)},t))},[W,L]),Hr=(0,p.useCallback)(e=>{rt(e),z(t=>r8(t,e.bundle)),Vr(e.tickets)},[Vr,z]),Ur=(0,p.useCallback)((e,t)=>{Array.isArray(t.tickets)&&rt(n=>{if(!n||n.bundle.id!==e)return n;let r=ane(n.tickets,t.tickets),i=n.tickets.find(e=>e.id===n.review_owner_ticket_id&&e.state===`review`&&e.agent_status===`running`&&e.updated_at>=(t.tickets.find(t=>t.id===e.id)?.updated_at??``))??null;return{...n,tickets:r,execution_order_ticket_ids:t.execution_order_ticket_ids,latest_session_ticket_id:t.latest_session_ticket_id,latest_session_id:t.latest_session_id,review_owner_ticket_id:t.review_owner_ticket_id??i?.id??null,target_ticket_id:i?.id??t.target_ticket_id}})},[]),Wr=(0,p.useCallback)(async e=>{let t=re.current;if(!t)return null;let n=await bt(t,e);return re.current!==t||$e.current!==e?null:(Hr(n),n)},[re,Hr]),Gr=(0,p.useCallback)(async()=>{let e=ot?.bundle.id,t=re.current;if(!e||!t)return null;let n=++ct.current,r=await bt(t,e);return n!==ct.current||re.current!==t?null:(Hr(r),st(r),r)},[re,Hr,ot?.bundle.id]),Kr=(0,p.useCallback)(async t=>{if(!e)return;at(t),st(null);let n=++ct.current;try{let r=await bt(e,t);if(re.current!==e||n!==ct.current)return;Hr(r),st(r)}catch{if(n!==ct.current||re.current!==e)return;at(null),$.error(P(`buildOpenQuestionsDialog.refreshFailedError`),{id:`board-build-open-questions-load-error`})}},[e,re,Hr,P]),qr=(0,p.useCallback)(async t=>{let n=ot?.bundle.id;if(!e||!n)return;let r=++ct.current;await Rt(e,n,t),r===ct.current&&(at(null),st(null))},[e,ot?.bundle.id]),Jr=ot?.bundle.id??null;(0,p.useEffect)(()=>{if(!Jr)return;let e=new Map(I.map(e=>[e.id,e])),t=te.find(e=>e.id===Jr);st(n=>!n||n.bundle.id!==Jr?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})})},[te,Jr,I]);let Yr=(0,p.useCallback)(async e=>{let t=re.current;if(!t)return null;let n=await xt(t,e);return re.current!==t||$e.current!==e?null:(Ur(e,n),n)},[re,Ur]),Xr=(0,p.useCallback)(async(e,t=null)=>{let n=re.current;if(!n)return;$e.current=e,We(null),qe(null),J(e),tt(t),vt(N8());let r=fn.get(e)??null,i=I.filter(t=>t.worktree_bundle_id===e);if(r&&i.length>0){let e=Py(i),t=Ry(i,{reviewOwnerTicketId:i.find(e=>e.state===`review`)?.id??null,latestSessionTicketId:e?.id??null});rt({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 rt(null);gt(!0);try{await Yr(e)}catch(t){if(t instanceof Ke&&t.status===404&&x===e){dn(),A?.();return}}finally{re.current===n&&gt(!1)}},[re,fn,dn,A,Yr,x,I]),Zr=(0,p.useCallback)((e,t=null)=>{Xr(e,t),T?.(e)},[T,Xr]),Qr=(0,p.useCallback)(async(e,t)=>{vt(t=>({...t,[e]:!0}));try{return await t()}finally{vt(t=>({...t,[e]:!1}))}},[]),$r=(0,p.useCallback)(async t=>{await Qr(`stopBuild`,async()=>{let n=I.find(e=>e.id===t);await jn(t,n?.project_id??e),L(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e)),n?.worktree_bundle_id&&await Wr(n.worktree_bundle_id)})},[e,Wr,Qr,L,I]),ei=(0,p.useCallback)(async t=>{await Qr(`stopBuild`,async()=>{let n=I.find(e=>e.id===t);try{await Mn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:P(`reviewInterrupt.error`))}})},[e,Qr,P,I]),ti=(0,p.useCallback)(async t=>{await Qr(`resumeBuild`,async()=>{let n=I.find(e=>e.id===t);await Nn(t,n?.project_id??e),L(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e)),n?.worktree_bundle_id&&await Wr(n.worktree_bundle_id)})},[e,Wr,Qr,L,I]),ni=(0,p.useCallback)(async t=>{if(e)try{Hr(await Qr(`build`,()=>Tt(e,t))),Qe===t&&tt(`build`),s?.()}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.buildBundle`),{id:`board-bundle-build-error`}),e}},[e,Hr,s,Qr,Qe,P]),ri=(0,p.useCallback)(async t=>{if(e)try{Hr(await Qr(`review`,()=>Et(e,t))),Qe===t&&tt(`review`)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.reviewBundle`),{id:`board-bundle-review-error`}),e}},[e,Hr,Qr,Qe,P]),ii=(0,p.useCallback)(async t=>{if(e)try{Hr(await Qr(`review`,()=>Dt(e,t))),Qe===t&&tt(`review`)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.continueBundleReview`),{id:`board-bundle-continue-review-error`}),e}},[e,Hr,Qr,Qe,P]),ai=(0,p.useCallback)(async t=>{if(e)try{He(`review`),Hr(await Qr(`undoReview`,()=>Ot(e,t))),Qe===t&&tt(`build`)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.undoBundleReview`),{id:`board-bundle-undo-review-error`}),e}finally{He(e=>e===`review`?null:e)}},[e,Hr,Qr,Qe,P]),oi=(0,p.useCallback)(async t=>{if(e)try{Hr(await It(e,t))}catch(e){$.error(e instanceof Ke?e.message:`Unable to resume the automation right now.`,{id:`board-bundle-resume-automation-error`})}},[e,Hr]),si=(0,p.useCallback)(async t=>{if(e)try{Hr(await Lt(e,t))}catch(e){$.error(e instanceof Ke?e.message:`Unable to dismiss the automation pause right now.`,{id:`board-bundle-dismiss-automation-error`})}},[e,Hr]),ci=(0,p.useCallback)(async(e,t,n)=>{if(t===M8||n===M8)return;let r=Ty(t,n);if(!r)return;let i=I.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);se(a,n),or(i,n);try{if(r===`build`){await ni(e),ce(a);return}if(r===`review`){await ri(e),ce(a);return}await ai(e),ce(a)}catch(e){ar(i),ce(a),$.error(e instanceof Ke?e.message:P(`board.errors.moveBundle`),{id:`board-bundle-move-error`})}},[ce,ni,ri,ai,se,or,ar,I,P]),li=async t=>{e&&(Hr(await Qr(`run`,()=>Nt(e,t))),s?.())},ui=async t=>{if(!e)return;let n=r?.kind===`ticket`&&Jt===t?qt:null,i=await Qr(`stop`,()=>Pt(e,t));o?.(n),Hr(i),s?.()},di=(0,p.useCallback)(async(t,n,r=`build`,i)=>{e&&Hr(await Qr(`followUp`,()=>kt(e,t,n,r,i)))},[e,Hr,Qr]);(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:P(`board.preview.disabledProjectRoot`),submitPrompt:null});return}let e=I.find(e=>e.id===r.ticket_id);if(!e){a({target:null,canSelect:!1,disabledReason:P(`board.preview.disabledBuildCapable`),submitPrompt:null});return}if(e.state===`plan`){a({target:{kind:`ticket`,id:e.id},canSelect:!1,disabledReason:P(`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:P(`board.preview.followUpBundlePlaceholder`),submitPrompt:t=>di(e.worktree_bundle_id,t)});return}a({target:{kind:`ticket`,id:e.id},canSelect:!0,disabledReason:null,promptPlaceholder:P(`board.preview.followUpTicketPlaceholder`),submitPrompt:t=>Br(e.id,t)})},[r,Br,di,a,P,I]);let fi=async t=>{let n=I.find(e=>e.id===t),r=n?uy(n.state):null;if(n)try{if(n.state===`review`&&n.can_re_review&&n.agent_status!==`running`){let t=await In(n.id,n.project_id??e);dr(t),t.worktree_bundle_id&&await Wr(t.worktree_bundle_id);return}if(!r)return;if(n.worktree_bundle_id&&r===`review`){await ri(n.worktree_bundle_id);return}await pr(n,r)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.moveTicket`),{id:`board-move-error`}),e}},pi=async t=>{let n=I.find(e=>e.id===t);try{dr(await bn(t,n?.project_id??e))}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.startBuildChain`),{id:`board-build-chain-error`}),e}},mi=async t=>{let n=I.find(e=>e.id===t);try{await xn(t,n?.project_id??e)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.stopBuildChain`),{id:`board-stop-build-chain-error`}),e}},hi=async()=>{if(!(!e||ze)){Be(!0);try{let t=await En(e);L(e=>e.filter(e=>!t.deleted_ticket_ids.includes(e.id))),ee(e=>t.deleted_ticket_ids.reduce($v,e)),await oe(),Re(!1),t.failed_count>0?$.error(P(`board.toasts.deleteDonePartial`,{count:t.deleted_count,deletedCount:t.deleted_count,failedCount:t.failed_count}),{id:`board-delete-parked-error`}):$.success(P(`board.toasts.deleteDoneSuccess`,{count:t.deleted_count}),{id:`board-delete-parked-success`})}catch(e){$.error(e instanceof Ke?e.message:P(`board.errors.emptyDone`),{id:`board-delete-parked-error`})}finally{Be(!1)}}},gi=({delta:e})=>{Ce(e)},_i=(0,p.useCallback)((t=null)=>{e&&Te({initialWorktreeBundleId:t})},[e]);(0,p.useEffect)(()=>{!j||!e||(Te({initialWorktreeBundleId:null,initialImportedDraft:j}),M?.())},[j,e,M]),(0,p.useEffect)(()=>{if(!Je||!e){q.current=null;return}let t=`${e}:${Je}`;if(H!==e||q.current===t)return;q.current=t;let n=on.get(Je);n?ln(n):_?.(),v===void 0&&g?.()},[e,H,g,_,ln,Je,v,on]),(0,p.useEffect)(()=>{v===void 0||v||!Ge||(We(null),qe(null))},[v,Ge]),(0,p.useEffect)(()=>{!v||!e||H!==e||q.current!==`${e}:${v}`||Ue!==v||on.has(v)||(We(null),qe(null),_?.())},[e,H,_,v,Ue,on]),(0,p.useEffect)(()=>{if(!x){let e=S?.target.kind===`bundle`?S.target.bundleId:null,t=e!==null&&$e.current===e;Ye.current&&!t&&(Ye.current=null,e===null&&dn());return}let t=`${e}:${x}`;if(!(!e||H!==e||U!==e||Ye.current===t)){if(Ye.current=t,!fn.has(x)){A?.();return}Xr(x)}},[e,fn,U,dn,H,A,Xr,x,S,nt,Qe]),(0,p.useEffect)(()=>{!x||!e||H!==e||U!==e||Ye.current!==`${e}:${x}`||Qe!==x||fn.has(x)||(dn(),A?.())},[e,fn,U,dn,H,A,x,Qe]),(0,p.useEffect)(()=>{if(!S){Ze.current=null,ft(e=>e?.isRouteOwned?null:e);return}let t=S?.target.kind===`bundle`?H===e&&U===e:H===e;if(!e||!t)return;let n=`${e}:${S.target.kind===`ticket`?`ticket:${S.target.ticketId}`:`bundle:${S.target.bundleId}`}`;if(Ze.current===n)return;if(Ze.current=n,We(null),qe(null),S.target.kind===`ticket`&&dn(),ft(e=>e?.isRouteOwned?null:e),S.target.kind===`ticket`){let e=on.get(S.target.ticketId);if(!e||!Qn(e)){A?.();return}ft({target:{kind:`ticket`,ticketId:e.id},projectId:e.project_id,title:e.title,bundleTargetName:null,initialMode:S.mode,followUpMode:`build`,isRouteOwned:!0});return}let{bundleId:r}=S.target,i=er(r),a=S.mode===`files`?nr(r):tr(r);if(!i||!a){A?.();return}let o=fn.get(r)??i.bundle??null;ft({target:{kind:`bundle`,bundleId:r,ticketId:i.id},projectId:i.project_id,title:o?Gy(o):i.title,bundleTargetName:o&&Gy(o)||null,initialMode:S.mode,followUpMode:`build`,isRouteOwned:!0})},[e,fn,U,nr,tr,Qn,dn,er,H,A,S,nt,Qe,on]),(0,p.useEffect)(()=>{let t=S?.target.kind===`bundle`?H===e&&U===e:H===e;if(!S||!e||!t)return;let n=S.target.kind===`ticket`?`ticket:${S.target.ticketId}`:`bundle:${S.target.bundleId}`;if(Ze.current!==`${e}:${n}`||!dt?.isRouteOwned)return;if(S.target.kind===`ticket`){if(dt.target.kind!==`ticket`||dt.target.ticketId!==S.target.ticketId)return;let e=on.get(S.target.ticketId);(!e||!Qn(e))&&(ft(null),A?.());return}if(dt.target.kind!==`bundle`||dt.target.bundleId!==S.target.bundleId)return;let{bundleId:r}=S.target,i=er(r),a=S.mode===`files`?nr(r):tr(r);if(!i||!a){ft(null),A?.();return}if(dt.target.ticketId!==i.id){let e=fn.get(r)??i.bundle??null;ft(t=>t?.isRouteOwned?{...t,target:{kind:`bundle`,bundleId:r,ticketId:i.id},projectId:i.project_id,title:e?Gy(e):i.title,bundleTargetName:e&&Gy(e)||null}:t)}},[e,fn,U,nr,tr,Qn,er,H,A,S,dt,on]);let vi=(0,p.useCallback)(()=>{Ht.current?.focus({preventScroll:!0})},[]);return Xde([{key:`n`,onKeyDown:_i,disabled:!e},{key:`k`,ctrlKey:!0,onKeyDown:vi}],{isBlocked:Yde}),(0,Y.jsxs)(Y.Fragment,{children:[!w&&(0,Y.jsxs)(Kae,{sensors:F,collisionDetection:XN,onDragStart:rr,onDragMove:gi,onDragCancel:ir,onDragEnd:cr,children:[(0,Y.jsx)(`div`,{className:`relative flex min-h-0 flex-1 overflow-hidden`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 overflow-hidden p-6`,children:[(0,Y.jsx)(gle,{query:At.query,inputRef:Ht,hideStaleTickets:At.hideStaleTickets,hideBundlesWithPullRequests:At.hideBundlesWithPullRequests,onQueryChange:e=>jt({query:e}),onClear:()=>{jt({query:``}),Ht.current?.focus()},onHideStaleTicketsChange:e=>jt({hideStaleTickets:e}),onHideBundlesWithPullRequestsChange:e=>jt({hideBundlesWithPullRequests:e})}),(0,Y.jsx)(`div`,{ref:vn,className:`flex min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,children:(0,Y.jsxs)(`div`,{ref:yn,className:`relative flex min-h-0 w-max min-w-full gap-4`,children:[(0,Y.jsx)(Fde,{dependencies:R,cardRects:Bn,clipRects:Vn,preview:Hn,ticketsById:on,overlaySize:Un}),j8.map(t=>{let n=I.filter(e=>e.state===t&&!_y(e)),r=mn.filter(e=>e.state===t&&!_y(e)),a=zy(r,te,t),o=$t&&n.length===0?t===`plan`?1:t===`build`?2:0:0;return(0,Y.jsx)(d3,{id:t,title:P(`card.columnLabels.${t}`),items:a,ticketCount:r.length,allTickets:I,dependencies:R,bundles:te,activeTool:i,modelsByTool:Pe,availableSkills:Fe,activeRunContextKey:Xt,automationStatuses:fe,isProjectRootRunActive:Yt,isBundleRunDisabled:Zt,getDependencyTargetState:Wn,onDependencyStart:Gn,onDeleteDependency:Kn,onRegisterTicketNode:Fn,onRegisterDependencyClipNodes:Ln,onAddTicket:t===`plan`&&e?_i:void 0,onCreateBundle:t===`plan`&&e?ur:void 0,onDeleteBundle:t===`plan`&&e?yr:void 0,onDeleteBundleWrapper:br,onRefreshBundles:t===`plan`&&e?oe:void 0,onUpdateTicket:xr,onDeleteTicket:Sr,onUndoTicket:Cr,undoingColumn:Ve,onRetryTicket:wr,onAdvanceTicket:fi,onParkTicket:hr,onUnparkTicket:gr,onBuildChainTicket:pi,onRunTicket:Tr,onOpenVerificationTicket:en.length>0?zr:void 0,canOpenChangesForTicket:Qn,onOpenFilesTicket:Lr,onOpenChangesTicket:Rr,canOpenIdeForTicket:Zn,onOpenIdeTicket:Er,onStopTicket:Dr,onStopBuildTicket:Or,onStopBuildChainTicket:mi,onResumeBuildTicket:Ar,onInterruptReviewTicket:kr,onOpenBundleFiles:Fr,onOpenBundleChanges:Ir,canOpenReviewForBundle:tr,canOpenFilesForBundle:nr,onOpenBundleVerification:en.length>0?e=>Nr(e):void 0,onOpenBundleChecks:e=>Nr(e,`checks`),hasConfiguredChecks:en.length>0,onOpenBundleIde:jr,onAddTicketToBundle:_i,onStartChatFromBundle:u,onFollowUpTicket:Br,bundleActionState:X,onBuildBundle:ni,onReviewBundle:ri,onUndoBundleReview:ai,onRunBundle:li,onStopBundle:ui,onParkBundleWrapper:_r,onUnparkBundleWrapper:vr,onOpenTicketDetails:ln,onOpenBundleDetails:(e,t)=>{Zr(e,t)},onRequestBundleRefresh:e=>{Qr(`bundleRefresh`,()=>Wr(e))},onRequestTicketRefresh:ae,hoveredBundleId:_e,onHoverBundleChange:ye,multiColumnBundleIds:hn,onResumeBundleAutomation:oi,onDismissBundleAutomationPause:si,onOpenBuildQuestions:e=>{Kr(e)},loadingSkeletonCount:o},t)}),(0,Y.jsx)(d3,{id:M8,title:P(`card.columnLabels.done`),items:_n,ticketCount:gn.length,allTickets:I,dependencies:R,activeTool:i,modelsByTool:Pe,availableSkills:Fe,bundles:te,activeRunContextKey:Xt,automationStatuses:fe,isProjectRootRunActive:Yt,isBundleRunDisabled:Zt,getDependencyTargetState:Wn,onDependencyStart:Gn,onDeleteDependency:Kn,onRegisterTicketNode:Fn,onRegisterDependencyClipNodes:Ln,onUpdateTicket:xr,onDeleteTicket:Sr,onUndoTicket:Cr,undoingColumn:Ve,onRetryTicket:wr,onAdvanceTicket:fi,onParkTicket:hr,onUnparkTicket:gr,onBuildChainTicket:pi,onRunTicket:Tr,onOpenVerificationTicket:en.length>0?zr:void 0,canOpenChangesForTicket:Qn,onOpenFilesTicket:Lr,onOpenChangesTicket:Rr,canOpenIdeForTicket:Zn,onOpenIdeTicket:Er,onStopTicket:Dr,onStopBuildTicket:Or,onStopBuildChainTicket:mi,onResumeBuildTicket:Ar,onInterruptReviewTicket:kr,onOpenBundleFiles:Fr,onOpenBundleChanges:Ir,canOpenReviewForBundle:tr,canOpenFilesForBundle:nr,onOpenBundleVerification:en.length>0?e=>Nr(e):void 0,onOpenBundleChecks:e=>Nr(e,`checks`),hasConfiguredChecks:en.length>0,onOpenBundleIde:jr,onAddTicketToBundle:_i,onStartChatFromBundle:u,onFollowUpTicket:Br,bundleActionState:X,onBuildBundle:ni,onReviewBundle:ri,onUndoBundleReview:ai,onRunBundle:li,onStopBundle:ui,onParkBundleWrapper:_r,onUnparkBundleWrapper:vr,onOpenTicketDetails:ln,onOpenBundleDetails:(e,t)=>{Zr(e,t)},onRequestBundleRefresh:e=>{Qr(`bundleRefresh`,()=>Wr(e))},onRequestTicketRefresh:ae,hoveredBundleId:_e,onHoverBundleChange:ye,multiColumnBundleIds:hn,onResumeBundleAutomation:oi,onDismissBundleAutomationPause:si,onOpenBuildQuestions:e=>{Kr(e)},className:`min-w-[272px] max-w-[272px] flex-[0.98] bg-card/65`,headerAccessory:(0,Y.jsxs)(Q,{type:`button`,variant:`destructive`,size:`xs`,className:`gap-1.5`,disabled:gn.length===0||ze,onClick:()=>Re(!0),children:[(0,Y.jsx)(kC,{className:`h-3.5 w-3.5`}),(0,Y.jsx)(`span`,{children:P(`board.doneColumn.emptyAction`)})]})})]})})]})}),(0,Y.jsxs)(coe,{zIndex:5,dropAnimation:Ie?null:void 0,children:[pe&&(0,Y.jsx)(u3,{ticket:pe,allTickets:I,dependencies:R,bundles:te,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:pe.worktree_bundle_id?fe.get(pe.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:(()=>{let e=PF(pe,i);return FF(e)&&Ne(e).length>0})(),availableModels:Ne(PF(pe,i)),runDisabled:py(pe,Xt,Yt,P(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:py(pe,Xt,Yt,P(`board.errors.runBlockedByActive`)),onDependencyStart:Gn,onDeleteDependency:Kn,onRegisterOverlayNode:xe,onCreateBundle:ur,onDeleteBundle:yr,onRefreshBundles:oe,onUpdate:xr,onDelete:()=>Sr(pe.id),onUndo:()=>Cr(pe.id),undoInProgress:Ve===pe.state&&(pe.state===`build`||pe.state===`review`),onRetry:()=>wr(pe.id),onAdvance:()=>fi(pe.id),onPark:()=>hr(pe.id),onUnpark:()=>gr(pe.id),onBuildChain:()=>pi(pe.id),onRun:pe.worktree_bundle_id===null&&Iy(pe)&&pe.has_run_config?()=>Tr(pe.id):void 0,onOpenIde:pe.worktree_bundle_id===null&&Zn(pe)?()=>Er(pe.id):void 0,onStop:pe.worktree_bundle_id===null?()=>Dr(pe.id):void 0,onStopBuild:()=>Or(pe.id),onStopBuildChain:()=>mi(pe.id),onResumeBuild:()=>Ar(pe.id),onInterruptReview:()=>void kr(pe.id),onFollowUp:e=>Br(pe.id,e),onRequestTicketRefresh:ae}),!pe&&he&&(0,Y.jsx)(RF,{group:he,activeTool:i,modelsByTool:Pe,automationStatus:fe.get(he.bundle.id),overlay:!0,renderTicket:Xn})]}),Qt&&(0,Y.jsx)(Rde,{className:`pointer-events-auto fixed left-1/2 top-4 z-20 w-[min(14rem,calc(100vw-2rem))] -translate-x-1/2`})]}),we&&(()=>{let r=Ne(i),a=zt&&qn.model&&IF(qn.model,r),o=a?qn.model:``,s=a?qn.variant:``;return(0,Y.jsx)(Lde,{onSubmit:lr,bundles:te,projectId:e,projectBranchState:n,tool:i,showModelSelector:zt,showSkillsSelector:i===`opencode`,showDockerSandboxModelNotice:t?.build_execution_provider===`docker_sandbox`,onOpenProjectExecutionSettings:N,availableModels:r,availableSkills:Fe,initialModel:o,initialVariant:s,initialSkills:zt&&i===`opencode`?qn.skills:[],initialWorktreeBundleId:we.initialWorktreeBundleId,initialImportedDraft:we.initialImportedDraft,onCreateBundle:ur,onDeleteBundle:yr,onRefreshBundles:oe,onClose:()=>Te(null)})})(),G&&(0,Y.jsx)(_le,{ticketCount:gn.length,isDeleting:ze,onCancel:()=>Re(!1),onConfirm:()=>{hi()}}),Ge&&(0,Y.jsx)(l3,{ticket:Ge,allTickets:I,dependencies:R,bundles:te,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:Ge.automation_paused_reason?null:Ge.worktree_bundle_id?fe.get(Ge.worktree_bundle_id):null,projectBranchState:n,onClose:()=>{let e=Ge.id;We(null),qe(null),L(t=>t.map(t=>t.id===e?$6(t):t)),b?.()},showModelSelector:Bt,showSkillsSelector:PF(Ge,i)===`opencode`,activeTool:i,availableModels:Ne(PF(Ge,i)),availableReviewerModels:Me.opencode,availableSkills:Fe,runDisabled:py(Ge,Xt,Yt,P(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:py(Ge,Xt,Yt,P(`board.errors.runBlockedByActive`)),onDeleteDependency:Kn,onCreateBundle:ur,onDeleteBundle:yr,onRefreshBundles:oe,onUpdate:xr,onAdvance:()=>fi(Ge.id),onBuildChain:()=>pi(Ge.id),onRun:Iy(Ge)&&Ge.has_run_config?()=>Tr(Ge.id):void 0,onOpenIde:Zn(Ge)?()=>Er(Ge.id):void 0,onStop:()=>Dr(Ge.id),onStopBuild:()=>Or(Ge.id),onStopBuildChain:()=>mi(Ge.id),onResumeBuild:()=>Ar(Ge.id),onInterruptReview:()=>void kr(Ge.id),onFollowUp:(e,t)=>Br(Ge.id,e,t),onReviewFollowUp:(e,t)=>Ge.worktree_bundle_id?di(Ge.worktree_bundle_id,e,t,`changes`):Br(Ge.id,e,t,`changes`),onProjectMemorySuggestionsChanged:()=>{St(e=>e+1)},onRequestTicketRefresh:e=>{sn(e)},onWorkspaceReviewOpen:D?e=>{D({kind:`ticket`,ticketId:Ge.id},e)}:void 0,onViewSourceSpec:c,onNavigateToLifecycleSource:l,onOpenBuildQuestions:e=>{Kr(e)},onOpenChecks:Ge.worktree_bundle_id&&(en.length>0||Ge.latest_check_gate_evaluation)?()=>{Nr(Ge.worktree_bundle_id,`checks`)}:void 0,onStopAutomation:Ge.worktree_bundle_id?()=>ui(Ge.worktree_bundle_id):void 0}),lt&&e&&t&&(()=>{let t=I.find(e=>e.id===lt.ticketId);if(!t)return null;let n=!!t.worktree_bundle_id,r=t.worktree_bundle_id?fn.get(t.worktree_bundle_id)?.required_check_policy??t.bundle?.required_check_policy:void 0,i=r?.required_check_definition_ids??nn,a=r?.pre_review_check_definition_ids??rn,o=n?{projectId:e,targetKind:`bundle`,targetBundleId:t.worktree_bundle_id}:null,s={scope:`ticket`,ticketId:t.id,projectId:t.project_id};return(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(D8,{targetLabel:lt.label,definitions:en,requiredDefinitionIds:i,preReviewDefinitionIds:a,checksTarget:o,testsTarget:s,onClose:()=>ut(null),requestedInitialTab:lt.requestedInitialTab})})})(),dt&&(()=>{let{target:e}=dt,t=I.find(t=>t.id===e.ticketId),n=e.kind===`bundle`,r=n?I.some(t=>t.worktree_bundle_id===e.bundleId):!!t,i=n?I.some(t=>t.worktree_bundle_id===e.bundleId&&t.agent_status===`running`):t?.agent_status===`running`,a=n?r&&!i:!!t&&!i,o=!!(dt.isRouteOwned&&C!==void 0),s=o?C:null,l=o?s?.canSubmitReviewPrompt??!1:a,u=i?P(`board.changes.reviewPromptDisabledReason`):r?!n&&t?o3(t).disabledReason??void 0:void 0:P(`board.changes.targetUnavailableReason`),d=!i&&(n||t?.state===`build`||t?.state===`review`),f=n?fn.get(e.bundleId):void 0;return(0,Y.jsx)(I6,{target:{scope:`ticket`,ticketId:e.ticketId,onTicketUpdate:xr,onRequestTicketRefresh:ae},initialMode:dt.initialMode,reviewMode:dt.isRouteOwned?S?.mode:void 0,onReviewModeChange:dt.isRouteOwned?O:void 0,enabledModes:[`changes`,`files`],projectId:dt.projectId,reviewCommentsBundleId:n?e.bundleId:null,title:dt.title,bundleTargetName:dt.bundleTargetName,fileTarget:f?.kind===`project_root`?{kind:`repo_root`,bundle_id:null,ticket_id:null}:void 0,onSubmitReviewPrompt:o?s?.submitPrompt:t=>n?di(e.bundleId,t,dt.followUpMode,`changes`):Br(e.ticketId,t,dt.followUpMode,`changes`),canSubmitReviewPrompt:l,reviewSubmitDisabledReason:o?s?.reviewSubmitDisabledReason??P(`workspaceReviewModal.chatRequired`):u,canAddReviewComments:l,canModifyChanges:a,changesDisabledReason:i?P(`board.changes.modifyChangesDisabledReason`):u,mode:o?s?.mode:dt.followUpMode,onModeChange:o?s?.onModeChange:e=>{ft(t=>t&&{...t,followUpMode:e})},canToggleMode:o?s?.canSubmitReviewPrompt??!1:d,isUpdatingMode:s?.isUpdatingMode??!1,onClose:()=>{if(ft(null),dt.isRouteOwned&&k?.(),n){Wr(e.bundleId);return}sn(e.ticketId)},onViewSourceSpec:c,originSpecSessionId:t?.origin_spec_session_id??null,originSpecSnapshotId:t?.origin_spec_snapshot_id??null})})(),pt&&e&&t&&(()=>{let t=fn.get(pt.bundleId)?.required_check_policy??pt.requiredCheckPolicy,n=t?.required_check_definition_ids??nn,r=t?.pre_review_check_definition_ids??rn;return(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(D8,{targetLabel:pt.label,definitions:en,requiredDefinitionIds:n,preReviewDefinitionIds:r,checksTarget:{projectId:e,targetKind:`bundle`,targetBundleId:pt.bundleId,gateEvaluationId:pt.gateEvaluationId},testsTarget:an?{scope:`project`,projectId:e,targetKind:`bundle`,targetBundleId:pt.bundleId}:null,onClose:()=>mt(null),requestedInitialTab:pt.requestedInitialTab})})})(),Qe&&pn&&(0,Y.jsx)(Dle,{details:pn,activeColumn:et,isLoading:ht||X.bundleRefresh,actionState:X,canOpenIde:$n(pn),projectMemoryEnabled:!!t?.memory_enabled,memorySuggestionsRefreshKey:yt,automationStatus:pn.tickets.some(e=>e.automation_paused_reason)?null:fe.get(pn.bundle.id),runDisabled:Zt(pn.bundle.id),showModelSelector:Vt,activeTool:i,modelsByTool:Pe,availableSkills:Fe,onClose:()=>{let e=pn.bundle.id;J(null),tt(null),rt(null),gt(!1),vt(N8()),L(t=>t.map(t=>t.worktree_bundle_id===e&&t.id!==Ue?$6(t):t)),E?.()},onOpenTicketDetails:ln,onNavigateToLifecycleSource:l,onUpdateTicket:xr,onOpenIde:()=>{let e=pn.tickets.find(e=>e.id===pn.target_ticket_id)??pn.tickets.find(e=>e.has_worktree);e&&Er(e.id)},onOpenVerification:en.length>0?()=>{Nr(pn.bundle.id)}:void 0,onOpenChecks:en.length>0||pn.tickets.some(e=>e.latest_check_gate_evaluation)?()=>{Nr(pn.bundle.id,`checks`)}:void 0,onRefresh:e=>{Qr(`bundleRefresh`,()=>Wr(e))},onWorkspaceReviewOpen:D?e=>{D({kind:`bundle`,bundleId:pn.bundle.id},e)}:void 0,onUpdateBundle:fr,onBuildBundle:ni,onStopBuildTicket:$r,onResumeBuildTicket:ti,onInterruptReviewTicket:ei,onReviewBundle:ri,onContinueReviewBundle:ii,onUndoBundleReview:ai,onRunBundle:li,onStopBundle:ui,onFollowUpBundle:di,onOpenBuildQuestions:e=>{Kr(e)},onResumeBundleAutomation:oi,onDismissBundleAutomationPause:si}),it&&ot&&(0,Y.jsx)(Dde,{details:ot,onClose:()=>{ct.current+=1,at(null),st(null)},onRefresh:Gr,onSubmit:qr})]})},I8=({count:e,title:t,isDeleting:n,onConfirm:r,onCancel:i,labels:a})=>{let o=e>1;return(0,Y.jsxs)(gC,{onClose:i,overlayClassName:`bg-black/60`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,Y.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:o?a.bulkTitle:a.title}),t?(0,Y.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:t}):null,(0,Y.jsx)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:o?a.bulkDescription(e):a.description}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:i,disabled:n,children:a.cancel}),(0,Y.jsx)(Q,{type:`button`,variant:`destructive`,onClick:r,disabled:n,children:n?a.deleting:a.delete})]})]})},L8=({label:e})=>(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),R8=({label:e})=>(0,Y.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,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6`,children:(0,Y.jsxs)(xC,{className:`w-full max-w-lg border-dashed border-border/70 bg-card/40`,children:[(0,Y.jsxs)(SC,{children:[(0,Y.jsx)(CC,{children:e}),(0,Y.jsx)(wC,{children:t})]}),(0,Y.jsx)(EC,{children:(0,Y.jsx)(Q,{type:`button`,onClick:r,disabled:!i,children:n})})]})}),Ife=({className:e})=>(0,Y.jsx)(zg,{"aria-hidden":`true`,className:e}),Lfe=({className:e})=>(0,Y.jsx)(ate,{"aria-hidden":`true`,className:e}),Rfe=({className:e})=>(0,Y.jsx)(ote,{"aria-hidden":`true`,className:e}),B8=({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)},[]),ee=(0,p.useCallback)(()=>{R(),L.current=window.setTimeout(()=>{I.current=!1,L.current=null},0)},[R]),te=(0,p.useCallback)(()=>{F.current&&(F.current=null,ee())},[ee]),z=(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]),B=(0,p.useCallback)(e=>{let t=F.current;!t||e.pointerId!==t.pointerId||te()},[te]);return(0,p.useEffect)(()=>{if(!h){te();return}return window.addEventListener(`pointerup`,B),window.addEventListener(`pointercancel`,B),()=>{window.removeEventListener(`pointerup`,B),window.removeEventListener(`pointercancel`,B),te(),R()}},[R,B,h,te]),(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-start gap-2 border-b border-border/70 px-4 py-3.5`,children:[(0,Y.jsxs)(Q,{type:`button`,size:`sm`,className:`gap-2`,onClick:l,disabled:u||d,children:[(0,Y.jsx)(wv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:N.newSession}),f]}),(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":N.collapseAriaLabel,"aria-expanded":a,className:`ml-auto`,onClick:o,children:(0,Y.jsx)(Lfe,{className:`h-4 w-4`})})]}),e.length>0?(0,Y.jsx)(`div`,{className:`px-4 py-2.5`,children:h?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.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,Y.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,Y.jsx)(`div`,{className:`flex justify-end text-xs font-medium text-muted-foreground`,children:N.selectedCount(_)})]}):v?(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2 text-xs`,onClick:b,children:[(0,Y.jsx)(Ife,{className:`h-3.5 w-3.5`}),N.select]}):null}):null,(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2`,children:i&&e.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground`,children:N.loadingSessions}):e.length===0?(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground`,children:N.noSessions}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-3`,children:t.map(e=>(0,Y.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,Y.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,Y.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},z(t))},onPointerMove:e=>{let n=F.current;!n||n.pointerId!==e.pointerId||z(t)},children:[(0,Y.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,Y.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,Y.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,Y.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,Y.jsx)(kC,{className:`h-4 w-4`})})]},t)})]},e.key))})})]}):(0,Y.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,Y.jsx)(vv,{content:m,side:`right`,children:(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":N.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,Y.jsx)(wv,{className:`h-4 w-4`})})}):(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":N.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,Y.jsx)(wv,{className:`h-4 w-4`})}),(0,Y.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,Y.jsx)(Rfe,{className:`h-4 w-4`})})]})})},V8=({isInterrupting:e,onStop:t,interruptLabel:n,interruptingLabel:r})=>(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:e,onClick:t,children:[e?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:e?r:n})]}),H8=4,zfe=5e3,U8=(e,t)=>Wb.t(`common:chatChangesPanel.${e}`,t),W8=e=>e.replace(/^[ab]\//,``),G8=e=>{let t=`oldPath`in e&&typeof e.oldPath==`string`?W8(e.oldPath):``,n=`newPath`in e&&typeof e.newPath==`string`?W8(e.newPath):``;return[...new Set([n,t].filter(e=>e&&e!==`/dev/null`))]},K8=e=>{let[t,n]=G8(e);return!t&&!n?U8(`unknownFile`):t&&n&&t!==n?`${n} -> ${t}`:t??n??U8(`unknownFile`)},q8=e=>{let t=DG((()=>{let[t,n]=G8(e);return t??n??null})());if(!t)return null;try{return vj(e.hunks,{highlight:!0,refractor:SK.default,language:t,enhancers:[gj(e.hunks)]})}catch{return null}},J8=(e,t)=>e instanceof Error?e.message:t,Bfe=(e,t)=>{if(!t)return e;let n=K8(t);return[t,...e.filter(e=>K8(e)!==n)]},Vfe=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}),Hfe=({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}))},Y8=e=>{let t=e.split(/[\\/]/);return t[t.length-1]||e},Ufe={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`},Wfe=e=>U8(`fileStatus.${e}`),Gfe=({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`?U8(`picker.diff`):s?Y8(s.path):U8(`picker.file`):e===`all`?U8(`picker.allChanges`):s?Y8(s.path):e;return(0,Y.jsxs)(Y_,{open:a,onOpenChange:o,children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.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":U8(`picker.openChangedFilesAriaLabel`),title:e===`all`?void 0:s?.path??e,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:c}),r===`full`&&(0,Y.jsx)(bC,{variant:`outline`,className:`shrink-0 text-[10px] uppercase tracking-wide`,children:U8(`picker.fileCount`,{count:t.length})}),(0,Y.jsx)(Cv,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,Y.jsxs)(Z_,{align:`start`,className:`z-[90] w-[28rem] max-w-[calc(100vw-2rem)] p-0`,children:[(0,Y.jsx)(`div`,{className:`border-b border-border/80 px-4 py-3`,children:(0,Y.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:U8(`picker.title`)})}),(0,Y.jsx)(`div`,{className:`max-h-[min(28rem,calc(100vh-10rem))] overflow-y-auto p-3`,children:(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.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`,K3(e===`all`),`justify-between`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:U8(`picker.allChanges`)}),(0,Y.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground transition-colors group-hover:text-foreground/70`,children:U8(`picker.allChangesDescription`)})]}),n&&(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-[11px]`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground transition-colors group-hover:text-foreground/70`,children:U8(`picker.fileCount`,{count:n.files_changed})}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,n.additions]}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,n.deletions]})]})]}),t.map(t=>(0,Y.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`,K3(e===t.path)),children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:Y8(t.path)}),(0,Y.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,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-[11px]`,children:[(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,t.additions]}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,t.deletions]})]})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[t.status&&(0,Y.jsx)(bC,{variant:`outline`,className:Ufe[t.status],children:Wfe(t.status)}),t.staged&&(0,Y.jsx)(bC,{variant:`outline`,children:U8(`fileStatus.staged`)}),t.unstaged&&(0,Y.jsx)(bC,{variant:`outline`,children:U8(`fileStatus.unstaged`)}),t.conflicted&&(0,Y.jsx)(bC,{variant:`destructive`,children:U8(`fileStatus.conflicted`)}),t.originalPath&&(0,Y.jsx)(`span`,{className:`break-all font-mono text-[11px] text-muted-foreground transition-colors group-hover:text-foreground/70`,children:t.status===`renamed`?U8(`fileStatus.renamedFrom`,{path:t.originalPath}):t.originalPath})]})]})},`${t.path}:${t.originalPath??``}`))]})})]})]})},X8=(0,p.memo)(({projectId:e,chatSessionId:t=null,canSubmitReviewPrompt:n,reviewSubmitDisabledReason:r,onSubmitReviewPrompt:i,state:a,onStateChange:o,isResizing:s=!1,onClose:c,desktopWidth:l,panelElementRef:u})=>{let[d,f]=(0,p.useState)(null),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(!1),[,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(new Map),[C,w]=(0,p.useState)(!1),T=(0,p.useRef)(0),E=(0,p.useRef)(0),D=(0,p.useRef)(null),O=(0,p.useRef)(null),k=a.selectedDiffPath,A=a.activeReviewTarget,j=a.editingReviewCommentKey,M=A?.commentKey??j??`chat`,N=a.reviewDraftInput,P=(0,p.useMemo)(()=>new Map(a.reviewComments.map(e=>[Fj(e.filePath,e.changeKey),e])),[a.reviewComments]),F=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await PM(e,t):await rr(e)},[t,e]),I=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await FM(e,t):await ur(e)},[t,e]);(0,p.useEffect)(()=>{D.current=d},[d]),(0,p.useEffect)(()=>{O.current=m},[m]);let L=(0,p.useCallback)(async()=>{if(!e){E.current+=1,f(null),h(null),_(null),y(!1),b(!1);return}let t=T.current+1,n=E.current+1;T.current=t,E.current=n,y(!0),b(!0);let r=F().then(e=>{T.current===t&&(D.current=e,f(e),_(null))}).catch(e=>{T.current===t&&_(J8(e,U8(`errors.loadDiff`)))}).finally(()=>{T.current===t&&E.current===n&&y(!1)}),i=I().then(e=>{T.current===t&&(O.current=e,h(e))}).catch(()=>{}).finally(()=>{T.current===t&&b(!1)});await Promise.allSettled([r,i])},[F,I,e]),R=(0,p.useCallback)(async(t={})=>{if(!e)return;let{broadcastOnSignatureChange:n=!1}=t,r=T.current+1;T.current=r,b(!0);try{let t=await I();if(T.current!==r)return;let i=O.current?.workspace_signature??null,a=t.workspace_signature??null,o=!D.current||i!==a;if(O.current=t,h(t),!o){E.current+=1,y(!1);return}let s=!D.current,c=E.current+1;E.current=c,s&&y(!0);try{let t=await F();if(T.current!==r)return;D.current=t,f(t),_(null),n&&i!==a&&$3(e)}catch(e){if(T.current!==r)return;D.current||_(J8(e,U8(`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 e6(t=>{t===e&&R()})},[e,R]),(0,p.useEffect)(()=>{if(!e)return;let t=ax(()=>{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})},zfe);return()=>{window.clearInterval(t)}},[e,R]);let ee=(0,p.useMemo)(()=>{let e=typeof d?.diff==`string`?d.diff:``;return e.trim()?YE(e,{nearbySequences:`zip`}).map(e=>({...e,pathCandidates:G8(e)})):[]},[d]),te=(0,p.useMemo)(()=>{let e=new Map;for(let t of ee)for(let n of t.pathCandidates)e.has(n)||e.set(n,t);return e},[ee]),z=(0,p.useMemo)(()=>Hfe({diffResponse:d,gitStatus:m}),[d,m]);(0,p.useEffect)(()=>{if(k!==`all`&&!(!d&&!m)){if(z.length===0){o(e=>({...e,selectedDiffPath:`all`}));return}z.some(e=>e.path===k)||o(e=>({...e,selectedDiffPath:`all`}))}},[d,m,o,k,z]);let B=k===`all`?null:te.get(k)??null,V=(0,p.useMemo)(()=>Bfe(ee,B),[ee,B]),H=(0,p.useMemo)(()=>k===`all`?ee:B?[B]:[],[ee,k,B]);(0,p.useEffect)(()=>{S(new Map)},[ee]),(0,p.useEffect)(()=>{if(V.length===0)return;let e=!1,t=null,n=0,r=()=>{if(e)return;let i=V.slice(n,n+H8);i.length!==0&&(S(e=>{let t=new Map(e);for(let e of i){let n=K8(e);t.has(n)||t.set(n,q8(e))}return t}),n+=H8,n<V.length&&(t=window.setTimeout(r,0)))};return t=window.setTimeout(r,0),()=>{e=!0,t!==null&&window.clearTimeout(t)}},[V]);let U=(0,p.useMemo)(()=>{let e=new Map;for(let t of V.slice(0,H8))e.set(K8(t),q8(t));return e},[V]),ne=(0,p.useMemo)(()=>H.map(e=>({...e,tokens:x.get(K8(e))??U.get(K8(e))??null})),[U,x,H]),re=(0,p.useMemo)(()=>ee.map(e=>({...e,tokens:null})),[ee]),ie=(0,p.useMemo)(()=>Vfe(a.reviewComments),[a.reviewComments]),ae=ie.length,oe=n&&!C&&ae>0,W=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}))},[o]),se=(0,p.useCallback)(({filePath:e,changeKey:t,commentKey:r})=>{let i=P.get(r);if(i){o(e=>({...e,selectedDiffPath:i.filePath,activeReviewTarget:null,editingReviewCommentKey:r,reviewDraftInput:i.comment}));return}n&&o(n=>({...n,activeReviewTarget:{filePath:e,changeKey:t,commentKey:r},editingReviewCommentKey:null,reviewDraftInput:``}))},[n,o,P]),ce=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``}))},[o]),le=(0,p.useCallback)(e=>{let t=P.has(e.commentKey);if(!n&&!t)return;let r=N.trim();if(!r)return;let i=e.change.type===`insert`?null:`oldLineNumber`in e.change?e.change.oldLineNumber:e.change.lineNumber,a=e.change.type===`delete`?null:`newLineNumber`in e.change?e.change.newLineNumber:e.change.lineNumber;o(t=>{let n=new Map(t.reviewComments.map(e=>[Fj(e.filePath,e.changeKey),e]));return n.set(e.commentKey,{scope:`uncommitted`,filePath:e.filePath,changeKey:e.changeKey,changeType:e.change.type,oldLineNumber:i,newLineNumber:a,hunkHeader:e.hunk.content,lineContent:e.change.content,diffSnippet:Ij(e.hunk,e.change),comment:r}),{...t,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[...n.values()]}})},[n,o,P,N]),ue=(0,p.useCallback)(e=>{let t=P.get(e);t&&o(n=>({...n,selectedDiffPath:t.filePath,activeReviewTarget:null,editingReviewCommentKey:e,reviewDraftInput:t.comment}))},[o,P]),de=(0,p.useCallback)(e=>{o(t=>({...t,activeReviewTarget:t.activeReviewTarget?.commentKey===e?null:t.activeReviewTarget,editingReviewCommentKey:t.editingReviewCommentKey===e?null:t.editingReviewCommentKey,reviewDraftInput:t.activeReviewTarget?.commentKey===e||t.editingReviewCommentKey===e?``:t.reviewDraftInput,reviewComments:t.reviewComments.filter(t=>Fj(t.filePath,t.changeKey)!==e)}))},[o]),fe=(0,p.useCallback)(async()=>{if(!oe)return;w(!0);let e=Gj({drafts:ie,findings:[],githubComments:[],uncommittedFiles:ee});try{await i(e),W(),$.success(U8(`toasts.sendChangesSuccess`),{id:`chat-diff-review-submit-success`})}catch(e){$.error(J8(e,U8(`errors.sendChanges`)),{id:`chat-diff-review-submit-error`})}finally{w(!1)}},[oe,W,i,ee,ie]),pe=(0,p.useCallback)(e=>(0,Y.jsx)(T3,{reviewComments:ie,pendingFixCount:ae,triggerMode:e===`wide`?`full`:`compact`,canSendReview:oe,isSubmittingReview:C,reviewSubmitDisabledReason:r??void 0,onClearPendingFixes:W,onSubmitReview:()=>{fe()}}),[oe,W,fe,C,ae,ie,r]),me=c?(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":U8(`closeAriaLabel`),className:`text-muted-foreground hover:text-foreground`,onClick:c,children:(0,Y.jsx)(Xb,{className:`h-4 w-4`})}):null,he=l?{"--chat-changes-panel-width":`${l}px`}:void 0;return(0,Y.jsx)(`aside`,{"data-testid":`chat-changes-panel`,"data-desktop-width":l?String(l):void 0,ref:u,style:he,className:Z(`flex h-[26rem] min-h-0 w-full shrink-0 flex-col overflow-hidden border-t border-border/70 bg-background/20 xl:h-full xl:border-l xl:border-t-0`,l?`xl:w-[var(--chat-changes-panel-width)]`:`xl:w-[32rem]`),children:(0,Y.jsx)(G3,{selectedDiffPath:k,sidebarFiles:z,diffResponse:d,isDiffLoading:v,diffError:g,allDiffFiles:re,renderedFiles:ne,viewType:`unified`,onViewTypeChange:()=>{},onRetry:()=>{L()},activeReviewTarget:A,editingReviewCommentKey:j,reviewDraftInstanceKey:M,reviewDraftInput:N,reviewComments:ie,reviewFindings:[],githubComments:[],selectedReviewFindingIds:[],selectedGitHubCommentIds:[],canSelectReviewTarget:n,canEditActiveReviewDraft:n,reviewFindingsError:null,gitHubCommentsError:null,hasStaleReviewFindings:!1,onSelectReviewTarget:se,onToggleReviewFindingSelection:()=>{},onToggleGitHubCommentSelection:()=>{},onReviewDraftInputChange:e=>{o(t=>({...t,reviewDraftInput:e}))},onCancelReviewDraft:ce,onEditReviewDraft:ue,onRemoveReviewDraft:de,onSaveReviewDraft:le,diffThemeClassName:q3,resolveFilePath:K8,normalizeDiffPath:W8,emptyStateTitle:U8(`emptyStateTitle`),emptyStateDescription:U8(`emptyStateDescription`),filePickerControl:e=>(0,Y.jsx)(Gfe,{selectedDiffPath:k,sidebarFiles:z,diffStats:d?.stats??null,triggerMode:e===`wide`?`full`:`compact`,onSelectDiffPath:e=>{o(t=>({...t,selectedDiffPath:e}))}}),reviewSummaryControl:pe,extraHeaderControl:me,surfaceVariant:`flat`,showViewTypeToggle:!1,gutterVariant:`compact`,isResizing:s,resizePlaceholderLineThreshold:200})})});X8.displayName=`ChatChangesPanel`;var Z8=({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:ee=null,onFollowUpPromptChange:te,onFollowUpKeyDown:z,onFollowUpPaste:B,onUploadAttachments:V,onRemoveAttachment:H,onFollowUpSubmit:U})=>(0,Y.jsx)(XJ,{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:ee,hidePendingAgentTitle:b,onFollowUpPromptChange:te,onFollowUpKeyDown:z,onFollowUpPaste:B,onUploadAttachments:V,onRemoveAttachment:H,onFollowUpSubmit:U}),Q8=({disabled:e=!1,onClick:t})=>{let n=Wb.t(`chatView.startBuilding.label`);return(0,Y.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":Wb.t(`chatView.startBuilding.ariaLabel`),disabled:e,onClick:t,children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:n})]})},Kfe=`mt-1 flex min-h-5 flex-wrap items-center gap-2 text-xs text-muted-foreground`,qfe=({label:e})=>(0,Y.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}),$8=({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,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`truncate text-sm font-semibold text-foreground`,children:e}),(0,Y.jsxs)(`div`,{className:Kfe,children:[(0,Y.jsx)(KF,{tool:t,className:`text-[11px]`}),n?(0,Y.jsx)(`p`,{children:n}):null,r?(0,Y.jsx)(qfe,{label:i}):null,a?(0,Y.jsx)(qF,{totalTokens:a.totalTokens,contextWindow:a.contextWindow,cost:a.cost,tool:a.tool,model:a.model,availableModels:a.availableModels}):null,o]})]}),s]}),c]}),e5=({projectId:e,suggestions:t,title:n,description:r,emptyState:i=null,onSuggestionsChanged:a})=>(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(n||r)&&(0,Y.jsxs)(`div`,{children:[n&&(0,Y.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-[0.2em] text-muted-foreground`,children:n}),r&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r})]}),t.length>0?(0,Y.jsx)(mT,{projectId:e,suggestions:t,onChanged:(e,t)=>a?.(e,t)}):i&&(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground`,children:i})]}),t5=()=>({selectedDiffPath:`all`,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}),Jfe=[{key:`today`,label:`Today`},{key:`yesterday`,label:`Yesterday`},{key:`last_7_days`,label:`Last 7 Days`},{key:`older`,label:`Older`}],Yfe=e=>{if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t},n5=e=>e.activity_at??e.last_user_message_at??e.created_at,Xfe=(e,t)=>{let n=n5(e),r=n5(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)},r5=e=>[...e].sort(Xfe),Zfe=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Qfe=(e,t=new Date)=>{let n=Yfe(n5(e));if(!n)return`older`;let r=Zfe(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`},i5=(e,t=new Date)=>{let n=new Map;for(let r of r5(e)){let e=Qfe(r,t);n.set(e,[...n.get(e)??[],r])}return Jfe.flatMap(e=>{let t=n.get(e.key)??[];return t.length===0?[]:[{key:e.key,label:e.label,sessions:t}]})},a5=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},o5=e=>e===`claude`?Wb.t(`chatView.tool.claude`):Wb.t(`chatView.tool.opencode`),s5=e=>new Map(e.map(e=>[e.id,e.label])),c5=({availableModelsById:e,model:t})=>t?e.get(t)??t:null,l5=({modelLabel:e,tool:t})=>e??o5(t),u5=()=>Wb.t(`chatView.user.you`),d5=`archon.chat-draft`,f5=({projectId:e,tool:t,chatSessionId:n})=>n?`${d5}:${e}:session:${n}`:`${d5}:${e}:draft:${t}`,p5=e=>{if(!e)return``;try{return window.localStorage.getItem(e)??``}catch{return``}},m5=({storageKey:e,value:t})=>{if(e)try{if(t){window.localStorage.setItem(e,t);return}window.localStorage.removeItem(e)}catch{}},h5=({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,g5=({session:e,activeProject:t,activeProjectBranchState:n})=>e.target_kind===`bundle`?e.target_label_snapshot||Wb.t(`common:chatView.targets.bundleFallback`):!t||t.active_target_kind===`bundle`||n?.status!==`ready`||!n.branch||!e.target_branch_snapshot||n.branch===e.target_branch_snapshot?null:Wb.t(`common:chatView.targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}),_5=e=>e.target_kind===`bundle`?e.target_label_snapshot||Wb.t(`common:chatView.targets.bundleFallback`):e.target_branch_snapshot?Wb.t(`common:chatView.targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}):Wb.t(`common:chatView.targets.repoRoot`),v5=({activeProject:e,activeProjectBranchState:t})=>e?e.active_target_kind===`bundle`?Wb.t(`common:chatView.targets.selectedBundleTarget`):t?.branch?Wb.t(`common:chatView.targets.repoRootWithBranch`,{branch:t.branch}):Wb.t(`common:chatView.targets.repoRoot`):Wb.t(`common:chatView.targets.currentTarget`),y5=(e,t)=>Wb.t(`chatView.${e}`,t),$fe=1500,epe=`archon.chat-run-config`,tpe=`archon.chat-changes-panel-layout`,npe=`archon.chat-session-list-layout`,b5=512,x5=360,rpe=.6,ipe=6,S5=`/`,ape=`Slash`,ope=`NumpadDivide`,spe=600,C5=4,w5=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):b5;if(!Number.isFinite(t))return Math.max(x5,n);let r=Math.max(x5,Math.round(t*rpe));return Math.max(x5,Math.min(r,n))},cpe=e=>y5(e===`plan`?`mode.plan`:`mode.build`),T5=e=>y5(e===`plan`?`placeholders.plan`:`placeholders.build`),E5=e=>y5(`pendingMemorySuggestions`,{count:e}),lpe=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===S5||e.code===ape||e.code===ope),D5=({modifierLabel:e,keys:t,ariaHidden:n=!1})=>(0,Y.jsxs)(`span`,{"aria-hidden":n,className:`flex items-center gap-0.5 text-[10px] leading-none`,children:[(0,Y.jsx)(eX,{"aria-hidden":n,children:e}),t.map(e=>(0,Y.jsxs)(`span`,{className:`contents`,children:[(0,Y.jsx)(`span`,{children:`+`}),(0,Y.jsx)(eX,{"aria-hidden":n,children:e})]},e))]}),upe=({label:e,modifierLabel:t,keys:n})=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{children:e}),(0,Y.jsx)(D5,{modifierLabel:t,keys:n,ariaHidden:!0})]}),O5=({projectId:e,tool:t})=>`${epe}:${e}:${t}`,k5=e=>`${tpe}:${e}`,A5=e=>`${npe}:${e}`,dpe=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t):[],j5=e=>{if(!e)return{isOpen:!0,width:b5};try{let t=window.localStorage.getItem(k5(e));if(!t)return{isOpen:!0,width:b5};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(x5,Math.round(n.width)):b5;return{isOpen:n.isOpen!==!1,width:r}}catch{return{isOpen:!0,width:b5}}},M5=e=>{if(!e)return{isOpen:!0};try{let t=window.localStorage.getItem(A5(e));return t?{isOpen:JSON.parse(t).isOpen!==!1}:{isOpen:!0}}catch{return{isOpen:!0}}},fpe=({projectId:e,isOpen:t,width:n})=>{if(e)try{window.localStorage.setItem(k5(e),JSON.stringify({isOpen:t,width:n}))}catch{}},ppe=({projectId:e,isOpen:t})=>{if(e)try{window.localStorage.setItem(A5(e),JSON.stringify({isOpen:t}))}catch{}},N5=({projectId:e,tool:t})=>{if(!e||t!==`opencode`&&t!==`claude`)return null;try{let n=window.localStorage.getItem(O5({projectId:e,tool:t}));if(!n)return null;let r=JSON.parse(n),i=(typeof r.model==`string`?r.model.trim():``)||null,a=r.mode===`plan`||r.mode===`build`?r.mode:null;return!i&&!a?null:{model:i,variant:i&&typeof r.variant==`string`&&r.variant.trim()||null,mode:a,skills:dpe(r.skills)}}catch{return null}},P5=({projectId:e,tool:t,model:n,variant:r,mode:i,skills:a})=>{if(!(!e||t!==`opencode`&&t!==`claude`||!n&&!i))try{window.localStorage.setItem(O5({projectId:e,tool:t}),JSON.stringify({model:n,variant:n?r:null,mode:i,skills:a}))}catch{}},mpe=({projectId:e,tool:t})=>{let n=N5({projectId:e,tool:t});!n||n.skills.length===0||P5({projectId:e,tool:t,...n,skills:[]})},F5=({projectId:e,tool:t})=>N5({projectId:e,tool:t})?.mode??`plan`,I5=({activeProjectId:e,helperModel:t,helperVariant:n,activeTool:r,availableModels:i,availableSkills:a})=>{let o=N5({projectId:e,tool:r}),s=t??``,c=o?.model??``,l=IF(c,i)?c:IF(s,i)?s:``,u=l===c?o?.variant??null:l&&l===s?n??null:null,d=i.find(e=>e.id===l)??null,f=d?d.variants.includes(u??``)?u??``:``:l?u??``:``,p=new Set(a.map(e=>e.name));return{model:l,variant:f,mode:o?.mode??`plan`,skills:r===`opencode`?(o?.skills??[]).filter(e=>p.has(e)):[]}},L5=e=>e&&e.replace(/\s+/g,` `).trim()||null,hpe=e=>{let t=L5(e.first_user_message_preview);if(t)return t;let n=e.messages?.find(e=>e.role===`user`)?.content;return L5(n)},gpe=({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}),_pe=({session:e,instruction:t,attachments:n,createdAt:r})=>({...e,messages:[...e.messages??[],gpe({chatSessionId:e.id,instruction:t,attachments:n,createdAt:r})],activity_at:r,last_user_message_at:r,updated_at:r}),vpe=e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),R5=e=>e.agent_status===`running`?y5(`sidebar.deleteDisabledReason`):null,ype=({proposals:e,isApplying:t,onApply:n})=>e.status===`applied`?(0,Y.jsxs)(`div`,{className:`w-full rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-3 text-sm`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-foreground`,children:y5(`ticketProposal.createdTitle`)}),(0,Y.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:y5(`ticketProposal.createdDescription`,{count:e.created_tickets.length})}),e.created_tickets.length>0?(0,Y.jsx)(`ul`,{className:`mt-3 space-y-1 text-foreground`,children:e.created_tickets.map(e=>(0,Y.jsx)(`li`,{children:e.title},e.ticket_id))}):null]}):(0,Y.jsxs)(`div`,{className:`w-full rounded-md border border-sky-500/30 bg-sky-500/10 px-3 py-3 text-sm`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-foreground`,children:y5(`ticketProposal.proposedTitle`)}),(0,Y.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:y5(`ticketProposal.proposedDescription`)}),(0,Y.jsx)(`ul`,{className:`mt-3 space-y-3`,children:e.tickets.map(e=>(0,Y.jsxs)(`li`,{className:`rounded border border-border/60 bg-background/80 px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-foreground`,children:e.title}),(0,Y.jsx)(`div`,{className:`mt-1 whitespace-pre-wrap text-muted-foreground`,children:e.description})]},e.key))}),e.dependencies.length>0?(0,Y.jsx)(`div`,{className:`mt-3 text-muted-foreground`,children:y5(`ticketProposal.dependenciesLabel`,{value:e.dependencies.map(e=>`${e.blocker_key} -> ${e.dependent_key}`).join(`, `)})}):null,(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsx)(Q,{type:`button`,size:`sm`,onClick:n,disabled:t,children:y5(t?`ticketProposal.creating`:`ticketProposal.create`)})})]}),bpe=({activeProjectId:e,activeProject:t,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c=async()=>!1,onSelectRepoRootTarget:l=async()=>!1,activeTool:u,routedChatSessionId:d,onRoutedChatNavigationUnavailable:f,onSessionNavigation:m,initialDraftOpen:h=!1,onInitialDraftOpenConsumed:g,initialSpecDraft:_=null,onInitialSpecDraftConsumed:v,onViewSourceSpec:y,onNavigateToLifecycleSource:b,onRestoreSessionTarget:x,onReviewCapabilityChange:S,isExternallyResizing:C=!1,showChangesPanel:w=!0})=>{let T=bq(),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(null),M=OF(A?.post_build_check),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[ee,te]=(0,p.useState)(()=>F5({projectId:e,tool:u})),[z,B]=(0,p.useState)({}),[V,H]=(0,p.useState)({}),[U,ne]=(0,p.useState)({}),[re,ie]=(0,p.useState)([]),[ae,oe]=(0,p.useState)(``),[W,se]=(0,p.useState)(``),[ce,le]=(0,p.useState)([]),[ue,de]=(0,p.useState)(!1),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)([]),[we,Te]=(0,p.useState)(()=>new Set),[Ee,De]=(0,p.useState)(!1),[Oe,ke]=(0,p.useState)(()=>new Set),[Ae,je]=(0,p.useState)(!1),[Me,Ne]=(0,p.useState)(!1),[Pe,Fe]=(0,p.useState)(null),[Ie,Le]=(0,p.useState)(null),[G,Re]=(0,p.useState)([]),[ze,Be]=(0,p.useState)(!1),[Ve,He]=(0,p.useState)(!1),[Ue,K]=(0,p.useState)(0),[We,Ge]=(0,p.useState)(t5),[q,Je]=(0,p.useState)(()=>M5(e).isOpen),[Ye,Ze]=(0,p.useState)(()=>j5(e).isOpen),[Qe,J]=(0,p.useState)(!1),[$e,et]=(0,p.useState)(!1),[tt,nt]=(0,p.useState)(()=>j5(e).width),[rt,it]=(0,p.useState)(0),[at,ot]=(0,p.useState)(null),[st,ct]=(0,p.useState)(()=>new Set),lt=(0,p.useRef)({model:``,variant:``,skills:[],showModelSelector:!1}),ut=(0,p.useRef)(!1),dt=(0,p.useRef)(L),ft=(0,p.useRef)(null),pt=(0,p.useRef)(null),mt=(0,p.useRef)(new Set),ht=(0,p.useRef)(0),gt=(0,p.useRef)(0),X=(0,p.useRef)(d),_t=(0,p.useRef)(!1),vt=(0,p.useRef)(null),yt=(0,p.useRef)(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)(!1),Tt=(0,p.useRef)(!1),Et=(0,p.useRef)(0),Dt=(0,p.useRef)(b5),Ot=(0,p.useRef)(b5),kt=(0,p.useRef)(!1),At=(0,p.useRef)(0),jt=(0,p.useRef)({id:null,status:null}),Mt=(0,p.useRef)(new Map),Nt=(0,p.useRef)({}),Pt=(0,p.useRef)({}),Ft=(0,p.useRef)(new Set),It=(0,p.useRef)(!1),Lt=e?f5({projectId:e,tool:F?u:A?.tool??u,chatSessionId:F?null:O}):null,Rt=Lt?z[Lt]??``:``,zt=F?u:A?.tool??u,Bt=A?V[A.id]??[]:[],Vt=(A?U[A.id]??0:0)>0,{models:Ht,isLoading:Ut}=pF(zt),Wt=(0,p.useCallback)(()=>{le([]),mpe({projectId:e,tool:u})},[e,u]);(0,p.useEffect)(()=>{ut.current=F},[F]),(0,p.useEffect)(()=>{Nt.current=z},[z]),(0,p.useEffect)(()=>{Pt.current=V},[V]),X.current=d,(0,p.useEffect)(()=>{if(!(d===void 0||!fe)){if(!d){ut.current||Wt(),P(null),xe(null),k(null),j(null),I(!0);return}if(!(E.some(e=>e.id===d)||A?.id===d)){k(null),j(null),I(!1),f?.();return}O!==d&&(P(null),xe(null),k(d),j(null),I(!1),kt.current=!0)}},[A?.id,O,fe,f,Wt,d,E]),(0,p.useEffect)(()=>{if(!Lt||Ft.current.has(Lt))return;Ft.current.add(Lt);let e=p5(Lt);e&&B(t=>Object.prototype.hasOwnProperty.call(t,Lt)?t:{...t,[Lt]:e})},[Lt]),(0,p.useEffect)(()=>{!Lt||!Object.prototype.hasOwnProperty.call(z,Lt)||m5({storageKey:Lt,value:z[Lt]??``})},[Lt,z]),(0,p.useEffect)(()=>{if(!F){ft.current=null;return}let e=ft.current;!e||!Lt||Rt||B(t=>t[Lt]?t:{...t,[Lt]:e})},[F,Lt,Rt]),(0,p.useEffect)(()=>{pt.current=O},[O]),(0,p.useEffect)(()=>{dt.current=L},[L]);let Gt=(0,p.useCallback)(()=>{gt.current+=1},[]),Kt=(0,p.useCallback)(e=>{Gt(),j(e)},[Gt]);(0,p.useEffect)(()=>{if(!It.current){It.current=!0;return}let t=j5(e),n=M5(e);ut.current=!1,kt.current=!1,Ft.current=new Set,mt.current.clear(),k(null),Kt(null),I(!1),B({}),H({}),ne({}),xe(null),Ce([]),Te(new Set),De(!1),ke(new Set),ot(null),Re([]),He(!1),pe(!1),Ge(t5()),ct(new Set),Mt.current=new Map,Ot.current=t.width,Je(n.isOpen),nt(t.width),Ze(t.isOpen)},[e,Kt]),(0,p.useEffect)(()=>{Qe||(Ot.current=tt,bt.current&&(bt.current.style.setProperty(`--chat-changes-panel-width`,`${tt}px`),bt.current.setAttribute(`data-desktop-width`,String(tt))))},[tt,Qe]),(0,p.useEffect)(()=>{if(!w||!vt.current)return;let e=vt.current.getBoundingClientRect().width;if(e<=0)return;let t=w5(tt,e);t!==tt&&(Ot.current=t,nt(t))},[tt,w]),(0,p.useEffect)(()=>{ppe({projectId:e,isOpen:q})},[e,q]),(0,p.useEffect)(()=>{w&&fpe({projectId:e,isOpen:Ye,width:tt})},[e,tt,Ye,w]),(0,p.useEffect)(()=>{He(!1)},[O,F]);let qt=(0,p.useCallback)(e=>{let t=a5(e);D(e=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return r5([...e,t]);let r=[...e];return r[n]=t,r5(r)})},[]),Jt=(0,p.useCallback)((t,n={})=>{let r=Array.from(new Set(t));if(r.length===0)return;let i=new Set(r),a=pt.current,o=n.preserveDraftRoute===!0,s=!!(o&&a&&i.has(a)&&X.current===a),c=!!(!o&&a&&i.has(a)),l=c?E.find(e=>!i.has(e.id))??null:null;s&&(Wt(),m?.(null)),c&&(l||Wt(),m?.(l?.id??null));let d=e?r.map(t=>f5({projectId:e,tool:u,chatSessionId:t})):[];B(e=>{let t=d.filter(t=>Object.prototype.hasOwnProperty.call(e,t));if(t.length===0)return e;let n={...e};for(let e of t)delete n[e];return n}),H(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e}),ne(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e});for(let e of d)m5({storageKey:e,value:``});D(e=>{let t=e.filter(e=>!i.has(e.id));if(a&&i.has(a)){if(X.current===a)return o?(k(null),Kt(null),I(!0),t):(k(null),Kt(null),I(l===null),Re([]),Be(!1),He(!1),t);let e=t[0]??null;k(e?.id??null),Kt(null),I(e===null),Re([]),Be(!1),He(!1)}return t}),ct(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),ot(e=>e&&i.has(e.parentId)?null:e),xe(e=>e&&i.has(e)?null:e),Ce(e=>e.filter(e=>!i.has(e))),Te(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),ke(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,u,m,Kt,Wt,E]),Yt=(0,p.useCallback)((e,t)=>{Jt([e],t)},[Jt]),Xt=(0,p.useCallback)((e,t)=>{e&&B(n=>n[e]===t?n:{...n,[e]:t})},[]),Zt=(0,p.useCallback)(e=>{e&&(B(t=>t[e]===``?t:{...t,[e]:``}),m5({storageKey:e,value:``}))},[]),Qt=(0,p.useCallback)((e,t)=>{H(n=>{if(t.length===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),$t=(0,p.useCallback)(e=>{H(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),ne(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),en=(0,p.useCallback)((e,t)=>{ne(n=>{let r=Math.max(0,(n[e]??0)+t);if(r===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:r}})},[]),tn=(0,p.useCallback)(({fromStorageKey:e,toStorageKey:t})=>{if(!e||!t||e===t)return;let n=Object.prototype.hasOwnProperty.call(Nt.current,e)?Nt.current[e]??``:p5(e);B(r=>{let i={...r,[t]:n};return delete i[e],i}),m5({storageKey:t,value:n}),m5({storageKey:e,value:``})},[]),nn=(0,p.useCallback)((e,t)=>{D(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n[r];if(i.pending_memory_suggestion_count===t)return n;let a=[...n];return a[r]={...i,pending_memory_suggestion_count:t},a}),j(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:(gt.current+=1,{...n,pending_memory_suggestion_count:t}))},[]),rn=(0,p.useCallback)(async r=>{if(!e){D([]),k(null),Kt(null),I(!1),pe(!1);return}de(!0);try{let i=await CM(e,r);if(r?.aborted)return;let a=r5(i.map(a5)),o=a[0]??null,s=t?.active_target_kind===`bundle`||n?.status!==`loading`;D(a),pe(!0),k(e=>d===void 0?ut.current?null:e&&a.some(t=>t.id===e)?e:e?a[0]?.id??null:kt.current?null:o?s?(kt.current=!0,h5({activeProject:t,activeProjectBranchState:n,session:o})?o.id:null):null:(kt.current=!0,null):e),a.length===0&&!d&&!ut.current&&(Wt(),I(!0))}catch(e){Xe(e)||$.error(e instanceof Error?e.message:y5(`errors.loadSessions`))}finally{r?.aborted||de(!1)}},[t,n,e,Wt,Kt,d]),an=(0,p.useCallback)(async(t,n)=>{if(!e){Kt(null);return}he(!0);let r=ht.current+1;ht.current=r;let i=gt.current;try{let a=await TM(e,t,n);if(n?.aborted)return;let o=gt.current!==i,s=ht.current===r,c=pt.current===t&&!ut.current;if(!s||o||!c)return;Kt(a),qt(a)}catch(e){e instanceof Ke&&e.status===404&&X.current===t&&pt.current===t?f?.():Xe(e)||$.error(e instanceof Error?e.message:y5(`errors.loadSession`))}finally{n?.aborted||he(!1)}},[e,f,Kt,qt]),on=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){Re([]),Be(!1);return}Be(!0);try{let t=await Ar(e,null,r,n);if(r?.aborted)return;Re(t.suggestions),nn(n,t.suggestions.length)}catch(e){Xe(e)||$.error(e instanceof Error?e.message:y5(`errors.loadMemorySuggestions`))}finally{r?.aborted||Be(!1)}},[t?.memory_enabled,e,nn]),sn=(0,p.useCallback)(e=>{Re(t=>{let n=t.filter(t=>t.id!==e);return O&&nn(O,n.length),n}),K(e=>e+1),rn(),O&&an(O)},[O,an,rn,nn]);(0,p.useEffect)(()=>{let e=new AbortController;return rn(e.signal),()=>{e.abort()}},[rn]),(0,p.useEffect)(()=>{if(d!==void 0||ut.current||F||O||kt.current||E.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;kt.current=!0;let e=E[0]??null;e&&h5({activeProject:t,activeProjectBranchState:n,session:e})&&k(e.id)},[t,n,O,F,d,E]),(0,p.useEffect)(()=>{if(zt!==`opencode`&&zt!==`claude`){ie([]),Ne(!1);return}if(zt!==`opencode`){ie([]);return}let t=new AbortController;return(async()=>{Ne(!0);try{ie(await mF(zt,t.signal,e))}catch(e){Xe(e)||ie(e=>e)}finally{t.signal.aborted||Ne(!1)}})(),()=>{t.abort()}},[e,zt]),(0,p.useEffect)(()=>{if(F||!O){Kt(null);return}if(A?.id===O)return;Kt(null);let e=new AbortController;return an(O,e.signal),()=>{e.abort()}},[A,O,F,an,Kt]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||F||!O){Re([]),Be(!1);return}let e=new AbortController;return on(O,e.signal),()=>{e.abort()}},[t?.memory_enabled,O,F,on,Ue]),(0,p.useEffect)(()=>{!Ve||ze||G.length>0||He(!1)},[ze,Ve,G.length]),(0,p.useEffect)(()=>{if(!O||A?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([rn(e.signal),an(O,e.signal)])},$fe);return()=>{e.abort(),window.clearInterval(t)}},[A?.agent_status,O,an,rn]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(t.id===O&&Kt(t),vpe(t)&&qt(t))},n=t=>{if(!t||t.project_id!==e)return;let n=mt.current.delete(t.id);Yt(t.id,n?{preserveDraftRoute:!0}:void 0)},r=()=>{rn();let e=pt.current;e&&!ut.current&&an(e)};return T.on(`connect`,r),T.on(`chat-session:created`,t),T.on(`chat-session:updated`,t),T.on(`chat-session:deleted`,n),()=>{T.off(`connect`,r),T.off(`chat-session:created`,t),T.off(`chat-session:updated`,t),T.off(`chat-session:deleted`,n)}},[e,O,an,rn,Yt,Kt,T,qt]),(0,p.useEffect)(()=>{F&&(dt.current||te(F5({projectId:e,tool:u})))},[e,u,F]),(0,p.useEffect)(()=>{if(zt!==`opencode`&&zt!==`claude`){oe(``),se(``),le([]);return}if(F){let n=I5({activeProjectId:e,helperModel:t?.helper_model??null,helperVariant:t?.helper_variant??null,activeTool:zt,availableModels:Ht,availableSkills:re});oe(n.model),se(n.variant),le(n.skills);return}oe(A?.model??``),se(A?.variant??``)},[e,t?.helper_model,t?.helper_variant,A?.id,A?.model,A?.variant,Ht,re,zt,F]),(0,p.useEffect)(()=>{if(zt!==`opencode`){le([]);return}F||le(A?.skills??[])},[A?.skills,zt,F]),(0,p.useEffect)(()=>{let e=Ht.find(e=>e.id===ae)??null;se(t=>e?e.variants.includes(t)?t:``:t)},[Ht,ae]),(0,p.useEffect)(()=>{if(zt!==`opencode`||!F||!ae||W)return;let n=I5({activeProjectId:e,helperModel:t?.helper_model??null,helperVariant:t?.helper_variant??null,activeTool:zt,availableModels:Ht,availableSkills:re});n.model===ae&&n.variant&&se(n.variant)},[e,t?.helper_model,t?.helper_variant,zt,Ht,re,F,ae,W]),(0,p.useEffect)(()=>{if(!be)return;let e=A?.id===be?A:E.find(e=>e.id===be)??null;(!e||e.agent_status!==`running`)&&xe(null)},[A,be,E]),(0,p.useEffect)(()=>{let e=jt.current,n=A?.id??null,r=A?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&K(e=>e+1),jt.current={id:n,status:r}},[t?.memory_enabled,e,A?.agent_status,A?.id,A?.title]),(0,p.useEffect)(()=>{O&&ct(e=>{if(!e.has(O))return e;let t=new Set(e);return t.delete(O),t})},[O]),(0,p.useEffect)(()=>{at&&(at.parentId===O&&(ve||A?.agent_status===`running`)||ot(null))},[A?.agent_status,O,ve,at]),(0,p.useEffect)(()=>{let e=Mt.current,t=new Map,n=[];for(let r of E){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&a===`done`&&r.id!==O&&n.push(r),t.set(r.id,a)}Mt.current=t,ct(e=>{let t=new Set(e),r=!1,i=new Set(E.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of E){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===O||i!==`done`)&&t.delete(e.id)){r=!0;continue}a&&!t.has(e.id)&&(t.add(e.id),r=!0)}return r?t:e})},[e,O,E]);let cn=(0,p.useMemo)(()=>s5(Ht),[Ht]),ln=(0,p.useMemo)(()=>i5(E),[E]),un=(0,p.useMemo)(()=>Se.length===0?[]:Se.flatMap(e=>{let t=E.find(t=>t.id===e)??(A?.id===e?A:null);return t?[t]:[]}),[A,Se,E]),dn=un.length===1?un[0]?.title??null:null;(0,p.useEffect)(()=>{Se.length>0&&un.length!==Se.length&&Ce(un.map(e=>e.id))},[Se,un]),(0,p.useEffect)(()=>{let e=new Set(E.filter(e=>!R5(e)&&!we.has(e.id)).map(e=>e.id));ke(t=>{let n=new Set(Array.from(t).filter(t=>e.has(t)));return n.size===t.size?t:n})},[we,E]),(0,p.useEffect)(()=>{!Ee||q||(De(!1),ke(new Set))},[q,Ee]);let fn=(0,p.useMemo)(()=>A?l5({modelLabel:c5({availableModelsById:cn,model:A.model}),tool:A.tool}):null,[A,cn]),pn=(0,p.useMemo)(()=>A?(A.messages??[]).map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],ticket_proposals:e.ticket_proposals??null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,responseTiming:e.response_timing?nq(e.response_timing):null,created_at:e.created_at,displayTitle:e.role===`assistant`?fn??o5(A.tool):u5()})):[],[A,fn]),mn=(0,p.useMemo)(()=>[...A?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[A]),hn=!!mn,gn=(0,p.useCallback)(async(t,n)=>{if(!e||!A||Ie)return;let r=$J({parentType:`chat`,parentId:A.id,setId:n.set_id});Le(n.set_id);try{let r=await kM(e,A.id,t,n);Kt(r),qt(r)}catch(e){if(e instanceof Ke&&e.status===409){tY(r);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?(Kt(t),qt(t)):await an(A.id)}throw $.error(e instanceof Error?e.message:y5(`errors.resolveQuestions`)),e}finally{Le(null)}},[e,A,an,Kt,Ie,qt]),_n=(0,p.useCallback)(e=>{let t=e.metadata?.ask_question;if(e.role!==`assistant`||!t||!A)return;let n=$J({parentType:`chat`,parentId:A.id,setId:t.id});return(0,Y.jsx)(cY,{messageContent:e.content,questionSet:t,storageKey:n,isActive:t.status===`pending`&&mn?.id===e.id,isDisabled:A.agent_status===`running`||Ie===t.id,onResolve:t=>gn(e.id,t)})},[A,mn?.id,gn,Ie]),vn=A?.id&&A.agent_status===`running`&&at?.parentId===A.id?at.turnKey:null,yn=(zt===`opencode`||zt===`claude`)&&Ht.length>0,bn=(zt===`opencode`||zt===`claude`)&&!yn&&(Me||Ut);(0,p.useEffect)(()=>{lt.current={model:ae,variant:W,skills:ce,showModelSelector:yn}},[ae,ce,W,yn]);let xn=(0,p.useMemo)(()=>Ht.find(e=>e.id===ae)??null,[Ht,ae]),Sn=F?ee:A?.mode??`build`,Cn=F?y5(`composer.newChatTitle`):A?.title??y5(`composer.chatTitle`),wn=F?u:A?.tool??u,Tn=(0,p.useMemo)(()=>iX(),[]),En=yn?ae||null:A?.model??null,Dn=wn===`opencode`||wn===`claude`,On=c5({availableModelsById:cn,model:En}),kn=F?`draft:${e??`none`}:${u}`:A?.id,An=(0,p.useCallback)(({model:t=ae,variant:n=W,skills:r=ce}={})=>{F&&P5({projectId:e,tool:u,model:yn&&t||null,variant:yn&&t&&n||null,mode:ee,skills:yn&&u===`opencode`?r:[]})},[e,u,ee,F,ae,ce,W,yn]),jn=(0,p.useCallback)(()=>{ut.current=!0,I(!0),Wt(),te(F5({projectId:e,tool:u})),P(null),k(null),Kt(null),xe(null),De(!1),ke(new Set),ot(null),R(null),ft.current=null,m?.(null)},[e,u,m,Kt,Wt]);(0,p.useEffect)(()=>{_&&(jn(),te(`build`),R({specSessionId:_.specSessionId,specSnapshotId:_.specSnapshotId}),ft.current=_.text,v?.())},[_,jn,v]),(0,p.useEffect)(()=>{h&&(jn(),g?.())},[h,jn,g]);let Mn=(0,p.useCallback)((e,t=null)=>{ut.current=!1,I(!1),P(null),k(e),Kt(t),R(null),m?.(e)},[m,Kt]),Nn=(0,p.useCallback)(async()=>{if(!(!A||!x)){P(A.id);try{await x(A)}catch(e){$.error(e instanceof Error?e.message:y5(`errors.restoreTarget`))}finally{P(e=>e===A.id?null:e)}}},[A,x]),Pn=!!(A&&A.target_available!==!1&&!F&&!h5({activeProject:t,activeProjectBranchState:n,session:A})),Fn=Pn&&A?y5(`review.mismatchReason`,{sessionTarget:_5(A),currentTarget:v5({activeProject:t,activeProjectBranchState:n})}):null,In=Pn&&N===null,Ln=(0,p.useCallback)(async r=>{P(r.id);let i=r;if(e)try{let t=await TM(e,r.id);i=t,qt(t)}catch(e){$.error(e instanceof Error?e.message:y5(`errors.loadSession`)),P(e=>e===r.id?null:e);return}if(i.target_available===!1){Mn(i.id,i);return}if(!h5({activeProject:t,activeProjectBranchState:n,session:i})&&x)try{if(!await x(i)){P(e=>e===i.id?null:e);return}}catch(e){$.error(e instanceof Error?e.message:y5(`errors.restoreTarget`)),P(e=>e===i.id?null:e);return}Mn(i.id,i)},[t,n,e,x,Mn,qt]),Rn=(0,p.useCallback)(()=>{it(e=>e+1)},[]),zn=(0,p.useCallback)(async t=>{if(F){let n=lt.current;return te(t),P5({projectId:e,tool:u,model:n.showModelSelector&&n.model||null,variant:n.showModelSelector&&n.model&&n.variant||null,mode:t,skills:n.showModelSelector?n.skills:[]}),Rn(),null}if(!e||!A||A.mode===t||Ae||hn)return null;je(!0);try{let n=await DM(e,A.id,{mode:t});return P5({projectId:e,tool:n.tool,model:n.model,variant:n.variant,mode:n.mode,skills:n.skills}),Kt(n),qt(n),Rn(),n}catch(e){return $.error(e instanceof Error?e.message:y5(`errors.updateMode`)),null}finally{je(!1)}},[e,A,u,Rn,hn,F,Ae,Kt,qt]),Bn=(0,p.useCallback)(async({instruction:t,attachments:n,targetSession:r,startedAt:i})=>{if(!e)return null;let a=lt.current;At.current+=1;let o={parentType:`chat`,parentId:r.id,turnKey:`${r.id}:${At.current}`,startedAt:i};ot(o);try{let i=await OM(e,r.id,{instruction:t,...n.length>0?{attachment_ids:n.map(e=>e.id)}:{},tool:r.tool,model:a.showModelSelector&&a.model||null,variant:a.showModelSelector&&a.model&&a.variant||null,skills:a.showModelSelector?a.skills:[]});return P5({projectId:e,tool:i.tool,model:i.model,variant:i.variant,mode:i.mode,skills:i.skills}),ut.current=!1,Kt(i),k(i.id),I(!1),qt(i),i}catch(e){throw ot(e=>e?.turnKey===o.turnKey?null:e),e}},[e,Kt,qt]),Vn=(0,p.useCallback)(async({fromStorageKey:t})=>{if(!e)return null;let n=lt.current,r=dt.current,i=await wM(e,{mode:Sn,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});ut.current=!1,I(!1),k(i.id),Kt(i),m?.(i.id),R(null);let a=f5({projectId:e,tool:i.tool,chatSessionId:i.id});return tn({fromStorageKey:t,toStorageKey:a}),{session:i,storageKey:a}},[e,u,Sn,tn,m,Kt]),Hn=(0,p.useCallback)(async(t,n={})=>{let r=n.targetSession??A,i=!r||r.messages?.length===0;if(!e||ve||ge||Vt||r?.agent_status===`running`||OF(r?.post_build_check)||r?.target_available===!1||In||hn)return!1;let a=t.trim(),o=n.preserveComposerDraft===!0,s=o?[]:r?Pt.current[r.id]??[]:[];if(!a&&s.length===0)return!1;ye(!0);let c=null,l=r,u=performance.now(),d=e&&r?f5({projectId:e,tool:r.tool,chatSessionId:r.id}):null,f=s;try{let t=r;if(!t){_e(!0);let e=await Vn({fromStorageKey:Lt});c=e?.session??null,t=c,d=e?.storageKey??null,f=c?Pt.current[c.id]??[]:[]}if(!t)return!1;o||Zt(d??Lt);let n=_pe({session:t,instruction:a,attachments:f,createdAt:new Date().toISOString()});Kt(n),k(n.id),qt(n);let s=await Bn({instruction:a,attachments:f,targetSession:t,startedAt:u});return s&&i&&P5({projectId:e,tool:s.tool,model:s.model,variant:s.variant,mode:s.mode,skills:[]}),o||Zt(s&&e?f5({projectId:e,tool:s.tool,chatSessionId:s.id}):d),s&&!o&&$t(s.id),!0}catch(e){o||Xt(d??Lt,a);let t=qe(e,`chat_session`);if(t?(ut.current=!1,Kt(t),k(t.id),I(!1),qt(t)):c?(Kt(c),k(c.id),I(!1),qt(c)):l&&(Kt(l),qt(l)),e instanceof Ke&&e.status===409&&!t){let e=c?.id??l?.id;e&&await an(e)}throw e}finally{_e(!1),ye(!1)}},[e,A,$t,Zt,Vn,Lt,hn,ge,ve,Vt,an,Kt,Bn,Xt,In,qt]),Un=(0,p.useCallback)(async()=>{if(!(!A||!rX(A,hn)||_t.current)){_t.current=!0;try{let e=await zn(`build`);if(!e)return;await Hn(nX,{preserveComposerDraft:!0,targetSession:e})}catch(e){$.error(e instanceof Error?e.message:y5(`errors.sendPrompt`))}finally{_t.current=!1}}},[A,zn,hn,Hn]),Wn=(0,p.useCallback)(e=>{ut.current=!0,I(!0),Wt(),te(e),P(null),k(null),Kt(null),xe(null),ot(null)},[Kt,Wt]),Gn=(0,p.useCallback)(async t=>{if(e){mt.current.add(t.id);try{await NM(e,t.id),Yt(t.id,{preserveDraftRoute:!0}),Wn(t.mode)}catch(e){throw mt.current.delete(t.id),e}}},[e,Wn,Yt]),Kn=(0,p.useCallback)(async t=>{if(!e||t.length===0||zt!==`opencode`&&zt!==`claude`)return;let n=t.slice(0,C5);if(n.length===0)return;let r=null,i=A;try{if(i||=(_e(!0),r=await Vn({fromStorageKey:Lt}),r?.session??null),!i)return;if((Pt.current[i.id]??[]).length+n.length>C5){$.error(`You can attach up to 4 images per turn.`);return}en(i.id,1);let t=await AM(e,i.id,n),a=Pt.current[i.id]??[];Qt(i.id,[...a,...t.attachments])}catch(e){if(r&&!Rt.trim())try{await Gn(r.session)}catch{}$.error(e instanceof Error?e.message:y5(`errors.uploadAttachments`))}finally{i&&en(i.id,-1),_e(!1)}},[e,A,Vn,Gn,Rt,Lt,en,Qt,zt]),qn=(0,p.useCallback)(async t=>{if(!e||!A)return;let n=(Pt.current[A.id]??[]).filter(e=>e.id!==t);try{await jM(e,A.id,t),Qt(A.id,n),n.length===0&&!Rt.trim()&&(A.messages?.length??0)===0&&await Gn(A)}catch(e){$.error(e instanceof Error?e.message:y5(`errors.removeAttachment`))}},[e,A,Gn,Rt,Qt]),Jn=(0,p.useCallback)(e=>{if(zt!==`opencode`&&zt!==`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(),Kn(t))},[zt,Kn]),Yn=(0,p.useCallback)(async e=>{await Hn(e)},[Hn]),Xn=!!(e&&(F||A&&A.target_available!==!1&&!In)),Zn=A?.agent_status===`running`,Qn=A?.agent_status===`stopped`,$n=Zn&&be===A?.id,er=Xn&&!hn&&!Zn&&!M&&!ve&&!ge&&!Vt,tr=Xn?A?.target_available===!1?A.target_unavailable_reason??y5(`review.unavailableTarget`):In?Fn??y5(`review.restoreTargetFallback`):hn?Wb.t(`common:questionSet.waitForResolution`):Zn?y5(`review.waitTurn`):M?Wb.t(`common:postBuildChecks.blockedReason`):Vt?y5(`review.waitUpload`):ge||ve?y5(`review.waitPrompt`):null:y5(`review.missingTarget`),nr=(0,p.useCallback)(async()=>{if(!(!e||!A||A.agent_status!==`running`||$n)){xe(A.id);try{await MM(e,A.id)}catch(e){xe(e=>e===A.id?null:e),$.error(e instanceof Error?e.message:y5(`errors.interruptResponse`))}}},[e,A,$n]),rr=(0,p.useCallback)(async()=>{if(!e||Se.length===0||we.size>0)return;let t=Array.from(new Set(Se)),n=Ee||t.length>1;Te(new Set(t));let r=await Promise.allSettled(t.map(async t=>(await NM(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&&Jt(i),Te(new Set),a.length===0){Ce([]),n&&(De(!1),ke(new Set),$.success(y5(`toasts.deleteSelectedSuccess`,{count:i.length})));return}let o=a.map(e=>e.sessionId);if(Ce(o),n&&ke(new Set(o)),i.length>0){$.error(y5(`toasts.deleteSelectedPartial`,{count:i.length,deletedCount:i.length,failedCount:a.length}));return}$.error(a[0]?.message??y5(`errors.deleteSession`))},[e,Se,we,Ee,Jt]),ir=(0,p.useMemo)(()=>E.some(e=>!R5(e)),[E]),ar=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:e.agent_status===`stopped`?`interrupted`:!t&&st.has(e.id)?`finished`:null,[st]),or=(0,p.useCallback)((e,n)=>[e.title,cpe(e.mode),o5(e.tool),t?.memory_enabled&&e.pending_memory_suggestion_count>0?E5(e.pending_memory_suggestion_count):null,n===`running`?y5(`sidebar.running`):n===`interrupted`?y5(`sidebar.interrupted`):n===`finished`?y5(`sidebar.finished`):null].filter(Boolean).join(` `),[t]),sr=(0,p.useCallback)(({session:e,isActive:r,activityState:i})=>{let a=hpe(e),o=g5({session:e,activeProject:t,activeProjectBranchState:n}),s=i===`interrupted`?null:i;return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o?(0,Y.jsx)(`div`,{className:`mb-1 truncate text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground/75`,children:o}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[13px] font-medium leading-5`,children:e.title}),t?.memory_enabled&&e.pending_memory_suggestion_count>0?(0,Y.jsx)(oT,{tone:r?`default`:`muted`,className:`shrink-0`,"aria-label":E5(e.pending_memory_suggestion_count),title:E5(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null]}),a?(0,Y.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,Y.jsx)(`div`,{className:`mt-1 line-clamp-1 text-[11px] leading-4 text-amber-200/90`,children:e.target_unavailable_reason??y5(`sidebar.targetUnavailable`)}):null]}),(0,Y.jsx)(tb,{state:s,className:`mt-1`})]})},[t,n]),cr=(0,p.useMemo)(()=>({ariaLabel:y5(`sidebar.ariaLabel`),newSession:y5(`sidebar.newSession`),collapseAriaLabel:y5(`sidebar.collapseAriaLabel`),openAriaLabel:y5(`sidebar.openAriaLabel`),cancelSelection:y5(`sidebar.cancelSelection`),deleteSelected:y5(`sidebar.deleteSelected`),selectedCount:e=>y5(`sidebar.selectedCount`,{count:e}),select:y5(`sidebar.select`),loadingSessions:y5(`sidebar.loadingSessions`),noSessions:y5(`sidebar.noSessions`),deleteSessionAriaLabel:y5(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>y5(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>y5(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>y5(`sidebar.deleteSessionTitle`,{title:e})}),[]),lr=(0,p.useMemo)(()=>({title:y5(`deleteSessionModal.title`),bulkTitle:y5(`deleteSessionModal.bulkTitle`),description:y5(`deleteSessionModal.description`),bulkDescription:e=>y5(`deleteSessionModal.bulkDescription`,{count:e}),cancel:y5(`deleteSessionModal.cancel`),delete:y5(`deleteSessionModal.delete`),deleting:y5(`deleteSessionModal.deleting`)}),[]),ur=(0,p.useMemo)(()=>(0,Y.jsx)(D5,{modifierLabel:Tn,keys:[S5],ariaHidden:!0}),[Tn]),dr=(0,p.useMemo)(()=>(0,Y.jsx)(upe,{label:y5(`shortcuts.startNewSession`),modifierLabel:Tn,keys:[S5]}),[Tn]),fr=(0,p.useCallback)((e,t)=>{ke(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),pr=(0,p.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)($Y,{value:Sn,planInactiveTooltip:(0,Y.jsx)(lX,{label:y5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,Y.jsx)(lX,{label:y5(`shortcuts.switchToBuild`)}),disabled:Ae||hn,onChange:e=>{zn(e)}}),Zn?(0,Y.jsx)(V8,{isInterrupting:$n,onStop:()=>{nr()},interruptLabel:y5(`review.interrupt`),interruptingLabel:y5(`review.interrupting`)}):null]}),[Sn,nr,zn,hn,$n,Zn,Ae]),mr=(0,p.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)($Y,{value:Sn,planInactiveTooltip:(0,Y.jsx)(lX,{label:y5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,Y.jsx)(lX,{label:y5(`shortcuts.switchToBuild`)}),disabled:Ae||hn,onChange:e=>{zn(e)}}),A&&rX(A,hn)&&(0,Y.jsx)(Q8,{disabled:ve||Ae,onClick:()=>void Un()}),F&&t&&(0,Y.jsx)(Jy,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:Wb.t(`common:projectTargetSelector.newChatAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l}),Zn&&(0,Y.jsx)(V8,{isInterrupting:$n,onStop:()=>{nr()},interruptLabel:y5(`review.interrupt`),interruptingLabel:y5(`review.interrupting`)})]}),[t,n,A,Sn,nr,zn,Un,hn,F,$n,ve,Zn,a,o,Ae,c,l,s,i,r]),hr=(0,p.useMemo)(()=>yn?(0,Y.jsx)(OY,{model:ae,variant:W,skills:ce,showModelSelector:!0,showSkillsSelector:re.length>0,availableModels:Ht,availableSkills:re,selectedModel:xn,onModelChange:e=>{let t=Ht.find(t=>t.id===e)??null,n=t&&t.variants.includes(W)?W:``;oe(e),se(n),An({model:e,variant:n})},onVariantChange:e=>{se(e),An({variant:e})},onSkillsChange:e=>{le(e),An({skills:e})},modelSelectId:`project-chat-model-selector`,variantSelectId:`project-chat-variant-selector`,skillsSelectId:`project-chat-skills-selector`,disabled:ve||ge||A?.agent_status===`running`}):bn?(0,Y.jsx)(DY,{dataTestId:`chat-model-selector-skeleton`}):null,[A?.agent_status,Ht,re,ge,ve,An,xn,ae,ce,W,yn,bn]);(0,p.useEffect)(()=>{if(S)return()=>{S(null)}},[S]),(0,p.useEffect)(()=>{if(S){if(!e||!Xn){S(null);return}S({chatSessionId:A?.id??null,canSubmitReviewPrompt:er,reviewSubmitDisabledReason:tr,mode:Sn,onModeChange:async e=>{await zn(e)},isUpdatingMode:Ae,promptPlaceholder:T5(Sn),promptComposerControls:pr,promptComposerInlineControls:hr,submitPrompt:Yn})}},[e,A,er,Sn,zn,Yn,Xn,Ae,S,pr,hr,tr]);let gr=async()=>{if(!(!Rt.trim()&&Bt.length===0||Vt||hn||M))try{if(!await Hn(Rt))return}catch(e){$.error(e instanceof Error?e.message:y5(`errors.sendPrompt`))}},_r=e=>{e.key!==`Enter`||e.shiftKey||A?.agent_status===`running`||M||ge||ve||Vt||hn||(e.preventDefault(),gr())};(0,p.useEffect)(()=>{let t=t=>{if(lpe(t)){if(!e||ge||ve)return;t.preventDefault(),jn(),Rn();return}oX(t)&&(!e||!F&&!A||(t.preventDefault(),zn(aX(Sn))))};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,A,Sn,Rn,jn,zn,ge,F,ve]);let vr=(0,p.useCallback)(async t=>{if(!(!e||!A)){Fe(t);try{let n=await IM(e,A.id,t);Kt(n.chatSession),qt(n.chatSession),$.success(y5(`ticketProposal.createdFromChat`,{count:n.created_tickets.length}))}catch(e){$.error(e instanceof Error?e.message:y5(`errors.createTickets`))}finally{Fe(e=>e===t?null:e)}}},[e,A,Kt,qt]),yr=(0,p.useCallback)(e=>e.ticket_proposals?(0,Y.jsx)(ype,{proposals:e.ticket_proposals,isApplying:Pe===e.id,onApply:()=>{vr(e.id)}}):null,[Pe,vr]),br=(0,p.useCallback)(e=>{if(!vt.current)return;let t=vt.current.getBoundingClientRect().width,n=w5(e,t);Ot.current=n,bt.current&&(bt.current.style.setProperty(`--chat-changes-panel-width`,`${n}px`),bt.current.setAttribute(`data-desktop-width`,String(n)))},[]),xr=(0,p.useCallback)(()=>{Ct.current?.(),Ct.current=null},[]),Sr=(0,p.useCallback)(e=>{let t=xt.current,n=St.current,r=wt.current;if(t!==null){if(xt.current=null,St.current=null,wt.current=!1,J(!1),et(!1),xr(),e!==null&&typeof yt.current?.hasPointerCapture==`function`&&yt.current.hasPointerCapture(e)&&typeof yt.current.releasePointerCapture==`function`&&yt.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;nt(Ot.current),Ze(!0);return}nt(Ot.current)}},[xr]),Cr=(0,p.useCallback)((e,t)=>{if(xt.current!==e)return;let n=t-Et.current,r=Dt.current-n;if(St.current===`collapsed`){if(!wt.current&&r<ipe)return;wt.current||(wt.current=!0,Tt.current=!0,et(!0),J(!0))}br(r)},[br]),wr=(0,p.useCallback)((e,t)=>{if(xt.current===e){if(t!==null&&(St.current===`inline`||wt.current)){let e=t-Et.current;br(Dt.current-e)}Sr(e)}},[Sr,br]),Tr=(0,p.useCallback)(e=>{if(!w)return;e.preventDefault(),xt.current=e.pointerId,St.current=Ye?`inline`:`collapsed`,wt.current=!1,Tt.current=!1,Et.current=e.clientX,Dt.current=Ye?Ot.current:0,J(Ye),xr(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{Cr(e.pointerId,e.clientX)},n=e=>{wr(e.pointerId,e.clientX)},r=e=>{wr(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Ct.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[wr,Cr,Ye,w,xr]),Er=(0,p.useCallback)(e=>{Cr(e.pointerId,e.clientX)},[Cr]),Dr=(0,p.useCallback)(e=>{wr(e.pointerId,e.clientX)},[wr]),Or=(0,p.useCallback)(e=>{wr(e.pointerId,e.clientX)},[wr]),kr=(0,p.useCallback)(e=>{xt.current===e.pointerId&&Sr(e.pointerId)},[Sr]),jr=(0,p.useCallback)(()=>{if(Tt.current){Tt.current=!1;return}Ze(!0)},[]),Mr=(0,p.useCallback)(()=>{Ze(!1)},[]),Nr=(0,p.useCallback)(e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),jr())},[jr]);(0,p.useEffect)(()=>{w||(xt.current=null,St.current=null,wt.current=!1,Tt.current=!1,J(!1),et(!1),xr())},[w,xr]),(0,p.useEffect)(()=>()=>{xr()},[xr]);let Pr=!!O,Fr=A?.target_available===!1,Ir=Fr?A?.target_unavailable_reason??y5(`review.unavailableTarget`):null,Lr=F||!!(A&&A.target_available!==!1&&!In),Rr=!!(t?.memory_enabled&&A&&(G.length>0||ze)),zr=w&&(F||Pr)&&!Fr&&!In,Br=zr&&!Ye&&!$e,Vr=zr&&(Ye||$e),Hr=`${kn??`none`}:${zr?`changes-enabled`:`changes-disabled`}:${Vr?`panel-visible`:`panel-hidden`}`,Ur=(0,p.useCallback)(e=>{ft.current=null,Xt(Lt,e)},[Lt,Xt]),Wr=A||F?(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(Z8,{projectId:e,agentRunParentType:A?`chat`:null,agentRunParentId:A?.id??null,messages:A?pn:[],internalLog:A?.agent_log??null,currentThinkingMessageId:A?.agent_message_id??null,previousThinkingLog:A?.previous_agent_log??null,previousThinkingMessageId:A?.previous_agent_message_id??null,pendingAgentTitle:fn,streamingResponse:A?.streaming_response??null,isRunning:A?.agent_status===`running`,isLoading:!F&&me,canShowComposer:Lr,cardClassName:`border-t-0`,isExternallyResizing:C||Qe,pendingAgentRevealKey:vn,pendingAgentRevealDelayMs:spe,liveResponseTiming:at,composerFocusNonce:rt,header:(0,Y.jsx)($8,{title:Cn,tool:F?null:A?.tool??null,modelLabel:On,interrupted:Qn,interruptedLabel:y5(`sidebar.interrupted`),usage:{totalTokens:A?.usage_snapshot_total_tokens??null,contextWindow:A?.usage_snapshot_context_window??null,cost:A?.usage_snapshot_cost??null,tool:wn,model:En,availableModels:Ht},metadataExtra:(0,Y.jsxs)(Y.Fragment,{children:[A?.external_source?(0,Y.jsx)(ZF,{externalSource:A.external_source}):null,A?.origin_spec_session_id&&A.origin_spec_snapshot_id&&y?(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`ghost`,className:`h-6 px-2 text-[11px] text-violet-200 hover:text-violet-100`,onClick:()=>{y(A.origin_spec_session_id,A.origin_spec_snapshot_id)},children:Wb.t(`common:specView.provenance.viewSourceSpec`)}):null]}),actions:A&&e?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Rr&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>He(!0),children:ze?y5(`composer.loadingMemory`):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:y5(`composer.memorySuggestions`)}),(0,Y.jsx)(oT,{children:G.length})]})}),(0,Y.jsx)(r3,{projectId:e,scope:{type:`chat`,id:A.id},size:`xs`,onNavigateToLifecycleSource:b})]}):null,warnings:In&&Fn?(0,Y.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,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`div`,{children:Fn}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{Nn()},children:y5(`composer.switchBack`)}),(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:jn,children:y5(`composer.startNewSession`)})]})]})}):Fr&&Ir?(0,Y.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:Ir}):null}),composerControls:mr,composerInlineControls:hr,composerTheme:Sn,layoutKey:kn,scrollLayoutKey:Hr,followUpPrompt:Rt,draftAttachments:Bt,followUpPlaceholder:T5(Sn),emptyStateText:null,renderMessageFooter:yr,renderMessageBody:_n,isSendingFollowUp:ve||ge,isComposerSubmitDisabled:hn||M,postBuildCheck:A?.post_build_check,isUploadingAttachments:Vt,canAttachImages:Dn,followUpDisabledReason:Fr?Ir??void 0:A?.agent_status===`running`?y5(`review.waitTurnShort`):M?Wb.t(`common:postBuildChecks.blockedReason`):Vt?y5(`review.waitUpload`):hn?Wb.t(`common:questionSet.waitForResolution`):void 0,onFollowUpPromptChange:Ur,onFollowUpKeyDown:_r,onFollowUpPaste:Jn,onUploadAttachments:e=>{Kn(e)},onRemoveAttachment:e=>{qn(e)},onFollowUpSubmit:()=>{gr()}})}):Pr?(0,Y.jsx)(L8,{label:y5(`composer.loadingSession`)}):!fe||ue?(0,Y.jsx)(R8,{label:y5(`sidebar.loadingSessions`)}):(0,Y.jsx)(z8,{title:y5(`composer.noSessionSelectedTitle`),description:y5(`composer.noSessionSelectedDescription`),startNewSessionLabel:y5(`composer.startNewSession`),onStartNewSession:jn,canStartNewSession:!!e&&!ge&&!ve}),Gr=zr?(0,Y.jsx)(`div`,{ref:yt,"aria-label":y5(Br?`composer.openDiff`:`composer.resizeDiffPanel`),"aria-orientation":Br?void 0:`vertical`,className:Z(Br?`group flex h-8 w-full shrink-0 touch-none select-none items-center justify-center border-t border-border/70 bg-background/90 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground xl:h-auto xl:w-7 xl:cursor-col-resize xl:border-l xl:border-t-0`:`group hidden w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 transition-colors xl:flex`,Qe&&!Br&&`bg-background`),"data-testid":Br?`collapsed-changes-rail`:void 0,onLostPointerCapture:kr,onPointerCancel:Or,onPointerDown:Tr,onPointerMove:Er,onPointerUp:Dr,onClick:Br?jr:void 0,onKeyDown:Br?Nr:void 0,role:Br?`button`:`separator`,tabIndex:Br?0:void 0,children:Br?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`hidden h-full w-full items-center justify-center xl:flex`,children:(0,Y.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,Y.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,Y.jsx)(Mv,{className:`h-3 w-3 shrink-0`})}),(0,Y.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,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium xl:hidden`,children:[(0,Y.jsx)(Mv,{className:`h-3.5 w-3.5`}),(0,Y.jsx)(`span`,{children:y5(`composer.diff`)})]})]}):(0,Y.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,Qe?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})}):null,Kr=Ve&&e&&t?.memory_enabled?(0,Y.jsx)(gC,{onClose:()=>He(!1),overlayClassName:`bg-background/45 p-4 backdrop-blur-sm`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,Y.jsxs)(xC,{size:`sm`,className:`max-h-[calc(100vh-2rem)] w-full gap-0 overflow-hidden border-border/80 bg-card/95 shadow-2xl`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/80 pb-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(CC,{children:y5(`composer.memorySuggestionsTitle`)}),(0,Y.jsx)(wC,{children:y5(`composer.memorySuggestionsDescription`)})]}),(0,Y.jsx)(TC,{children:t})]}),(0,Y.jsx)(EC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,Y.jsx)(e5,{projectId:e,suggestions:G,emptyState:y5(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:sn})})]}),closeButtonLabel:y5(`composer.closeMemorySuggestions`)}):null,qr=un.length>0?(0,Y.jsx)(I8,{count:un.length,title:dn,isDeleting:we.size>0,onConfirm:()=>{rr()},onCancel:()=>{we.size>0||Ce([])},labels:lr}):null;return(0,Y.jsxs)(`div`,{"data-testid":`chat-view-shell`,className:`relative flex min-h-0 flex-1 overflow-hidden border-t border-border/70`,children:[(0,Y.jsx)(B8,{sessions:E,sessionGroups:ln,activeSessionId:O,isDraftOpen:F,isLoadingSessions:ue,isOpen:q,onToggleOpen:()=>{Je(e=>!e)},testId:`chat-sessions-sidebar`,railTestId:`chat-sessions-rail`,onDraftOpen:jn,isCreatingSession:ge||!e,isSendingPrompt:ve,newSessionShortcutHint:ur,newSessionTooltip:dr,isSelectionMode:Ee,selectedSessionIds:Oe,selectedSessionCount:Oe.size,hasDeletableSessions:ir,deletingSessionIds:we,onEnterSelectionMode:()=>{De(!0),ke(new Set)},onExitSelectionMode:()=>{De(!1),ke(new Set)},onToggleSessionSelection:e=>{ke(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:fr,onConfirmDeleteSelectedSessions:()=>{Ce(Array.from(Oe))},onSessionSelect:e=>{Ln(e)},onConfirmDeleteSession:e=>{Ce([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:R5,getActivityState:ar,getRowAriaLabel:or,renderRowContent:sr,labels:cr}),(0,Y.jsxs)(`div`,{ref:vt,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden xl:flex-row`,children:[(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:Wr}),zr?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(vv,{content:y5(`composer.openDiff`),disabled:!Br,side:`left`,children:Gr}),Vr?(0,Y.jsx)(X8,{projectId:e,chatSessionId:F?null:O,canSubmitReviewPrompt:er,reviewSubmitDisabledReason:tr,onSubmitReviewPrompt:Yn,state:We,onStateChange:Ge,isResizing:Qe,onClose:Mr,desktopWidth:tt,panelElementRef:bt}):null]}):null]}),Kr,qr]})},xpe=({className:e})=>(0,Y.jsx)(ite,{"aria-hidden":`true`,className:e}),Spe=({activeProject:e,onNavigateToSource:t})=>{let{t:n}=K(`projects`);return e?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-6`,children:(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col gap-5`,children:[(0,Y.jsx)(`div`,{className:`border-b border-border/60 pb-4`,children:(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground`,children:n(`memory.workspace.title`)}),(0,Y.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:e.name})]})}),(0,Y.jsx)(UT,{mode:`edit`,projectId:e.id,memoryEnabled:e.memory_enabled,persistedMemoryEnabled:e.memory_enabled,onMemoryEnabledChange:()=>{},showActivationControls:!1,archiveLayout:!0,onNavigateToSource:t})]})}):(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:n(`memory.workspace.selectProject`)})},Cpe=(e,t,n,r)=>J(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{method:`POST`,body:r,fallbackErrorMessage:`Unable to start the spec review right now.`}),wpe=(e,t,n)=>J(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the spec review right now.`}),z5=(e,t,n,r)=>J(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{signal:r,fallbackErrorMessage:`Unable to load the spec review right now.`}),Tpe=(e,t,n,r)=>J(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review-runs/${r}/revision-draft`),{method:`POST`,fallbackErrorMessage:`Unable to build the revision draft right now.`}),Epe=(e,t)=>!!t&&e===t,Dpe=({suggestion:e,isRecommended:t,recommendedLabel:n,onPick:r})=>(0,Y.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,Y.jsx)(`span`,{className:`truncate`,children:e.label}),t?(0,Y.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]}),Ope=({question:e,labels:t})=>(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm font-medium leading-relaxed text-foreground`,children:e.question}),e.rationale?(0,Y.jsxs)(`p`,{className:`whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-semibold`,children:[t.rationaleLabel,`: `]}),e.rationale]}):null]}),B5=({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&&DE(s.current)},[a]),!t)return(0,Y.jsx)(Ope,{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,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(cb,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-amber-300`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm font-medium leading-relaxed text-foreground`,children:e.question}),e.rationale?(0,Y.jsxs)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-semibold`,children:[i.rationaleLabel,`: `]}),e.rationale]}):null]})]}),e.suggestions.length>0?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:i.suggestionsLabel}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.suggestions.map(e=>(0,Y.jsx)(Dpe,{suggestion:e,isRecommended:Epe(e.id,l),recommendedLabel:i.recommendedSuggestionLabel,onPick:u},e.id))})]}):null,(0,Y.jsx)(I_,{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,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,disabled:!c,onClick:d,children:n?i.submittingLabel:i.submitLabel})})]})},kpe=({className:e})=>(0,Y.jsx)(Vee,{"aria-hidden":`true`,className:e}),Ape=[`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(` `),jpe=[`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(` `),V5=({on:e,disabled:t=!1,onToggle:n,tooltipContent:r,ariaLabelOn:i,ariaLabelOff:a,className:o})=>(0,Y.jsx)(vv,{content:r,children:(0,Y.jsx)(`span`,{className:`inline-flex`,children:(0,Y.jsx)(Q,{type:`button`,size:`icon`,variant:e?`warning`:`ghost`,"aria-pressed":e,"aria-label":e?i:a,disabled:t,className:Z(e?Ape:jpe,o),onClick:()=>{t||n(!e)},children:(0,Y.jsx)(kpe,{className:`h-5 w-5`})})})}),Mpe=({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:ee,onFollowUpPaste:te,onUploadAttachments:z,onRemoveAttachment:B,onFollowUpSubmit:V})=>(0,Y.jsx)(XJ,{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:ee,onFollowUpPaste:te,onUploadAttachments:z,onRemoveAttachment:B,onFollowUpSubmit:V}),H5=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},U5=new Set([`deterministic`,`structural_heuristic`,`historical_heuristic`]),W5=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Npe=e=>W5(e)&&typeof e.seed_path==`string`&&typeof e.candidate_path==`string`&&U5.has(e.evidence_class)&&typeof e.depth==`number`&&Array.isArray(e.edge_ids),G5=e=>W5(e)&&typeof e.path==`string`&&typeof e.is_test==`boolean`&&U5.has(e.evidence_class)&&Array.isArray(e.chains)&&e.chains.length>0&&e.chains.every(Npe),Ppe=e=>!W5(e)||e.version!==1||![`complete`,`stale`,`truncated`,`unavailable`].includes(e.capture_state)||!Array.isArray(e.affected_files)||!Array.isArray(e.affected_tests)||!e.affected_files.every(G5)||!e.affected_tests.every(G5)?null:e,Fpe=e=>e.likely_files.length>0,K5=({evidenceClass:e})=>{let{t}=K(`common`);return(0,Y.jsx)(bC,{variant:`outline`,className:`shrink-0 px-1.5 py-0 text-[10px] ${e===`deterministic`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e===`structural_heuristic`?`border-amber-400/30 bg-amber-500/10 text-amber-200`:`border-sky-400/30 bg-sky-500/10 text-sky-200`}`,children:t(`specView.artifactPanel.repositoryEvidence.class.${e}`)})},Ipe=({candidate:e})=>{let{t}=K(`common`),n=e.chains.slice(0,2);return(0,Y.jsxs)(`details`,{className:`group mt-2 border-t border-border/40 pt-2`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer list-none rounded-sm text-xs font-medium text-violet-300 outline-none hover:text-violet-200 focus-visible:ring-2 focus-visible:ring-ring/60 [&::-webkit-details-marker]:hidden`,children:t(`specView.artifactPanel.repositoryEvidence.showChains`,{count:n.length})}),(0,Y.jsx)(`ol`,{className:`mt-2 space-y-2`,children:n.map((e,n)=>(0,Y.jsxs)(`li`,{className:`min-w-0 rounded-md bg-background/35 px-2.5 py-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-foreground`,children:t(`specView.artifactPanel.repositoryEvidence.chainLabel`,{number:n+1})}),(0,Y.jsx)(K5,{evidenceClass:e.evidence_class})]}),(0,Y.jsx)(`p`,{className:`mt-1 break-words text-xs leading-relaxed text-muted-foreground`,children:t(`specView.artifactPanel.repositoryEvidence.chainSummary`,{seed:e.seed_path,candidate:e.candidate_path,count:e.depth})})]},`${e.seed_path}:${e.candidate_path}:${e.edge_ids.join(`:`)}`))})]})},Lpe=({row:e,affectedTest:t=!1})=>{let{t:n}=K(`common`);return(0,Y.jsxs)(`li`,{className:`min-w-0 overflow-hidden rounded-md border border-border/50 bg-surface-hover px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`code`,{className:`min-w-0 break-all text-xs font-medium text-foreground`,children:e.path}),e.isNew&&(0,Y.jsx)(bC,{variant:`success`,className:`shrink-0 px-1.5 py-0 text-[10px]`,children:n(`specView.artifactPanel.newFile`)})]}),(0,Y.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:n(`specView.artifactPanel.repositoryEvidence.origin.${e.origin}`)}),t&&(0,Y.jsx)(bC,{variant:`outline`,className:`px-1.5 py-0 text-[10px] text-violet-200`,children:n(`specView.artifactPanel.repositoryEvidence.affectedTest`)}),e.candidate&&(0,Y.jsx)(K5,{evidenceClass:e.candidate.evidence_class})]}),e.reason&&(0,Y.jsx)(`p`,{className:`mt-1 break-words text-xs leading-relaxed text-muted-foreground`,children:e.reason}),e.candidate&&(0,Y.jsx)(Ipe,{candidate:e.candidate})]})},q5=e=>e.replace(/\\/g,`/`),Rpe=({snapshot:e,onMermaidClick:t})=>{let{t:n}=K(`common`);Ppe(e.repository_evidence);let r=[],i=[],a=new Map(i.map(e=>[q5(e.path),e])),o=e.likely_files.filter(e=>e.origin!==`graph`),s=new Map(o.map(e=>[e.normalized_path??q5(e.path),e])),c=o.flatMap(e=>{let t=e.normalized_path??q5(e.path);return a.has(t)?[]:[{path:e.path,reason:e.reason||null,isNew:e.is_new,origin:e.origin??`planner`,candidate:null}]}),l=r.map(e=>{let t=s.get(q5(e.path));return{path:t?.path??e.path,reason:null,isNew:!1,origin:t?`both`:`graph`,candidate:e}}),u=new Set(r.map(e=>q5(e.path)));for(let t of e.likely_files.filter(e=>e.origin===`graph`)){let e=t.normalized_path??q5(t.path);u.has(e)||l.push({path:t.path,reason:t.reason||null,isNew:t.is_new,origin:`graph`,candidate:null})}return i.map(e=>{let t=s.get(q5(e.path));return{path:t?.path??e.path,reason:t?.reason??null,isNew:t?.is_new??!1,origin:t?`both`:`graph`,candidate:e}}),(0,Y.jsxs)(`section`,{children:[c.length>0&&(0,Y.jsx)(`ul`,{className:`space-y-1.5`,children:c.map(e=>(0,Y.jsx)(Lpe,{row:e},`${e.origin}:${e.path}`))}),!1,!1]})},J5=({className:e})=>(0,Y.jsx)(Rg,{"aria-hidden":`true`,className:e}),zpe=({className:e})=>(0,Y.jsx)(Ng,{"aria-hidden":`true`,className:e}),Y5=({className:e})=>(0,Y.jsx)(Pee,{"aria-hidden":`true`,className:e}),X5=({heading:e,open:t,onOpenChange:n,children:r})=>(0,Y.jsxs)(iw,{open:t,onOpenChange:n,children:[(0,Y.jsx)(aw,{asChild:!0,children:(0,Y.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,Y.jsx)(Cv,{className:`h-3 w-3 shrink-0 transition-transform ${t?``:`-rotate-90`}`}),e]})}),(0,Y.jsx)(ow,{children:r})]}),Bpe=({actions:e})=>{let{t}=K(`common`);return e.hasExistingTicketsFromSnapshot?(0,Y.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,Y.jsx)(lb,{className:`h-3.5 w-3.5 text-emerald-400`}),t(`specView.actions.ticketsCreated`)]}):(0,Y.jsxs)(Q,{type:`button`,size:`sm`,onClick:e.onCreateTickets,disabled:!!e.unavailableReason||e.isCreatingTickets||e.isImplementingInChat||e.isExporting,title:e.unavailableReason??void 0,className:`w-full justify-center gap-1.5 border-violet-300/70 bg-violet-500/15 text-violet-100 hover:bg-violet-500/25`,children:[(0,Y.jsx)(J5,{className:`h-3.5 w-3.5`}),e.isCreatingTickets?t(`specView.actions.creatingTickets`):t(`specView.actions.createTickets`)]})},Z5=({ticket:e})=>(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`break-words text-xs font-medium text-foreground`,children:e.title}),e.key&&(0,Y.jsx)(`div`,{className:`mt-0.5 break-all text-xs text-violet-400`,children:e.key})]}),Vpe=({snapshot:e})=>{let{t}=K(`common`),n=new Map(e.tickets.map(e=>[e.key,e]));return(0,Y.jsx)(`section`,{className:`space-y-2.5`,children:e.bundle_groups.map(e=>{let r=e.ticket_keys.map(e=>n.get(e)).filter(e=>e!==void 0);return(0,Y.jsxs)(`article`,{className:`min-w-0 rounded-md border border-border/50 bg-surface px-3 py-2.5`,children:[(0,Y.jsx)(`h4`,{className:`break-all text-sm font-semibold text-foreground`,children:e.name}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t(`specView.artifactPanel.proposedTicketCount`,{count:r.length})}),r.length>0&&(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:r.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Z5,{ticket:e})},e.key))})]},e.key)})})},Q5={high:0,medium:1,low:2},Hpe=e=>[...e].sort((e,t)=>{let n=Q5[e.severity]??99,r=Q5[t.severity]??99;return n===r?e.ordinal-t.ordinal:n-r}),Upe=e=>{let t={high:0,medium:0,low:0};for(let n of e)t[n.severity]+=1;return t},Wpe=({run:e})=>{let{t}=K(`common`),n=e.agent_status,r=t(`specView.review.status.${n}`,{defaultValue:n});return(0,Y.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})},Gpe=({review:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)(!0),i=e.review?.run??null,a=e.review?.findings??[],o=Hpe(a),s=Upe(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?c5({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,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Y5,{className:`h-3.5 w-3.5`}),t(`specView.review.heading`)]}),open:n,onOpenChange:r,children:(0,Y.jsxs)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-3`,children:[i&&(0,Y.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(Wpe,{run:i}),c&&(0,Y.jsx)(`span`,{className:`inline-flex items-center gap-1 text-violet-300`,"aria-hidden":`true`,children:(0,Y.jsx)(`span`,{className:`h-3 w-3 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})}),h&&(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:h})]}),e.isLoading&&!i&&(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:t(`specView.review.loading`)}),o.length>0?(0,Y.jsx)(`ul`,{className:`space-y-2`,children:o.map(e=>(0,Y.jsxs)(`li`,{className:`rounded-md border border-border/40 bg-surface px-2.5 py-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.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,Y.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e.title})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-foreground`,children:e.what_text}),e.why_text&&(0,Y.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[t(`specView.review.why`),`:`]}),` `,e.why_text]}),e.suggestion_text&&(0,Y.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[t(`specView.review.suggestion`),`:`]}),` `,e.suggestion_text]})]},e.id))}):d?(0,Y.jsx)(`p`,{className:`text-xs ${i?.agent_status===`completed`?`text-emerald-300`:`text-muted-foreground`}`,children:t(d)}):null,l&&(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:e.onStopReview,className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(Lv,{className:`h-3.5 w-3.5`}),t(`specView.review.stop`)]})}),u&&(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:e.onSendToPlanner,disabled:!!e.disabledReason||e.isSendingToPlanner,title:e.disabledReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(SE,{className:`h-3.5 w-3.5`}),e.isSendingToPlanner?t(`specView.review.sendingToPlanner`):t(`specView.review.sendToPlanner`)]})})]})})},Kpe=({review:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)(!1),i=e.isRunning||e.review?.run?.agent_status===`running`,a=e.showModelSelector&&e.selectedDiscoveredModel!==null&&e.selectedDiscoveredModel.variants.length>0,o=t(i?`specView.review.running`:`specView.review.launch`);return(0,Y.jsxs)(Y_,{open:n&&!i,onOpenChange:r,children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,disabled:i||!!e.disabledReason,title:e.disabledReason??void 0,"aria-label":o,className:`gap-1.5 text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(Y5,{className:`h-4 w-4`}),t(`specView.review.heading`)]})}),(0,Y.jsx)(Z_,{align:`end`,className:`w-72 max-w-[calc(100vw-2rem)] p-3`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,children:t(`specView.review.popoverTitle`)}),(0,Y.jsx)(uv,{model:e.runConfigModel,showModelSelector:e.showModelSelector,availableModels:e.availableModels,onModelChange:e.onRunConfigModelChange,selectId:`spec-review-model`,label:t(`specView.review.model`)}),(0,Y.jsx)(dv,{variant:e.runConfigVariant,selectedModel:e.selectedDiscoveredModel,showVariantSelector:a,onVariantChange:e.onRunConfigVariantChange,selectId:`spec-review-variant`,label:t(`specView.review.variant`)}),(0,Y.jsxs)(Q,{type:`button`,size:`sm`,onClick:()=>{r(!1),e.onLaunchReview()},className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(Y5,{className:`h-3.5 w-3.5`}),t(`specView.review.launchAction`)]})]})})]})},qpe=(0,p.memo)((0,p.forwardRef)(({snapshot:e,isLoading:t,desktopWidth:n,onClose:r,actions:i,review:a,className:o},s)=>{let{t:c}=K(`common`),[l,u]=(0,p.useState)(null),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(!0),[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(!0),[b,x]=(0,p.useState)(!0),[S,C]=(0,p.useState)(!0),[w,T]=(0,p.useState)(!0),[E,D]=(0,p.useState)(!0),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(!0),M=(0,p.useCallback)(e=>{u(e)},[]),N=(0,p.useCallback)(()=>{f(!0)},[]),P=`flex h-[26rem] min-h-0 w-full shrink-0 flex-col overflow-hidden border-t border-border/70 bg-surface xl:h-full xl:border-l xl:border-t-0 ${o??``}`;if(t)return(0,Y.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,Y.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,Y.jsx)(Xb,{className:`h-4 w-4`})})]}),(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,Y.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})})]});if(!e)return(0,Y.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,Y.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,Y.jsx)(Xb,{className:`h-4 w-4`})})]}),(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4`,children:(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`specView.artifactPanel.noSnapshot`)})})]});let F=Fpe(e),I=e.tickets.length>0,L=e.bundle_groups.length>0,R=e.dependencies.length>0,ee=e.open_questions.length>0,te=e.assumptions.length>0;return(0,Y.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a&&(0,Y.jsx)(Kpe,{review:a}),(0,Y.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,Y.jsx)(Xb,{className:`h-4 w-4`})})]})]}),(0,Y.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,Y.jsx)(Gpe,{review:a}),(0,Y.jsx)(X5,{heading:c(`specView.artifactPanel.summary`),open:m,onOpenChange:h,children:(0,Y.jsx)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap`,children:e.summary})})}),e.mermaid&&(0,Y.jsx)(X5,{heading:c(`specView.artifactPanel.visualization`),open:g,onOpenChange:_,children:(0,Y.jsx)(`section`,{className:`overflow-auto rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,Y.jsx)(oG,{mermaid:e.mermaid,onClick:()=>{M(e.mermaid)}})})}),e.mockup&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(zpe,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.uiMockup`)]}),open:v,onOpenChange:y,children:(0,Y.jsx)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,Y.jsx)(wG,{html:e.mockup,onClick:N})})}),F&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(jv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.likelyFiles`)]}),open:b,onOpenChange:x,children:(0,Y.jsx)(Rpe,{snapshot:e,onMermaidClick:M})}),I&&!L&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(J5,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.proposedTickets`)]}),open:S,onOpenChange:C,children:(0,Y.jsx)(`section`,{children:(0,Y.jsx)(`ul`,{className:`space-y-1.5`,children:e.tickets.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Z5,{ticket:e})},e.key))})})}),L&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Yv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.bundleGroups`)]}),open:w,onOpenChange:T,children:(0,Y.jsx)(Vpe,{snapshot:e})}),R&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Bw,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.dependencies`)]}),open:E,onOpenChange:D,children:(0,Y.jsx)(`section`,{children:(0,Y.jsx)(`ul`,{className:`space-y-1`,children:e.dependencies.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.blocker_key}),(0,Y.jsx)(`span`,{children:`→`}),(0,Y.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.dependent_key})]},t))})})}),ee&&(0,Y.jsx)(X5,{heading:c(`specView.artifactPanel.openQuestions`),open:O,onOpenChange:k,children:(0,Y.jsx)(`section`,{children:(0,Y.jsx)(`ul`,{className:`space-y-1.5`,children:e.open_questions.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex gap-2 text-sm text-amber-300`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 shrink-0 text-amber-500`,children:`?`}),(0,Y.jsx)(`span`,{children:e})]},t))})})}),te&&(0,Y.jsx)(X5,{heading:c(`specView.artifactPanel.assumptions`),open:A,onOpenChange:j,children:(0,Y.jsx)(`section`,{children:(0,Y.jsx)(`ul`,{className:`space-y-1.5`,children:e.assumptions.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 shrink-0 text-violet-500`,children:`•`}),(0,Y.jsx)(`span`,{children:e})]},t))})})})]}),i&&(0,Y.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,Y.jsx)(Bpe,{actions:i}),(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onImplementInChat,disabled:!!(i.unavailableReason||i.implementInChatUnavailableReason)||i.isCreatingTickets||i.isImplementingInChat||i.isExporting,title:i.unavailableReason??i.implementInChatUnavailableReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(SE,{className:`h-3.5 w-3.5`}),i.isImplementingInChat?c(`specView.actions.startingImplementation`):c(`specView.actions.implementInChat`)]}),(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onExport,disabled:!!i.unavailableReason||i.isCreatingTickets||i.isImplementingInChat||i.isExporting,title:i.unavailableReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(db,{className:`h-3.5 w-3.5`}),i.isExporting?c(`specView.actions.exportingSpec`):c(`specView.actions.exportSpec`)]})]}),l&&(0,Y.jsx)(xG,{mermaid:l,open:!0,onClose:()=>{u(null)}}),e.mockup&&(0,Y.jsx)(TG,{html:e.mockup,open:d,onClose:()=>{f(!1)}})]})})),$5=({className:e})=>(0,Y.jsx)(Hee,{"aria-hidden":`true`,className:e}),e7=(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},t7=(e,t)=>Wb.t(`specView.${e}`,t),n7=e=>t7(`pendingMemorySuggestions`,{count:e}),Jpe=1500,r7=`archon.spec-draft`,i7=`archon.spec-run-config`,a7=`archon.spec-review-run-config`,o7=`archon.spec-session-list-layout`,s7=`archon.spec-artifact-panel-layout`,Ype=`archon.spec-import-notice`,c7=420,l7=320,u7=.5,Xpe=6,d7=`/`,Zpe=`Slash`,Qpe=`NumpadDivide`,$pe=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===d7||e.code===Zpe||e.code===Qpe),f7=({modifierLabel:e,keys:t,ariaHidden:n=!1})=>(0,Y.jsxs)(`span`,{"aria-hidden":n,className:`flex items-center gap-0.5 text-[10px] leading-none`,children:[(0,Y.jsx)(eX,{"aria-hidden":n,children:e}),t.map(e=>(0,Y.jsxs)(`span`,{className:`contents`,children:[(0,Y.jsx)(`span`,{children:`+`}),(0,Y.jsx)(eX,{"aria-hidden":n,children:e})]},e))]}),eme=({label:e,modifierLabel:t,keys:n})=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{children:e}),(0,Y.jsx)(f7,{modifierLabel:t,keys:n,ariaHidden:!0})]}),p7=({projectId:e,tool:t,sessionId:n=null})=>e?n?`${r7}/${e}/sessions/${n}`:`${r7}/${e}/draft/${t}`:null,m7=({projectId:e,sessionId:t})=>e&&t?`${Ype}/${e}/${t}`:null,h7=({projectId:e,tool:t})=>{if(e)try{localStorage.setItem(`${r7}/${e}/tool`,t)}catch{}},g7=e=>{if(!e)return{isOpen:!0};try{let t=localStorage.getItem(`${o7}/${e}`);return{isOpen:(t?JSON.parse(t):null)?.isOpen??!0}}catch{return{isOpen:!0}}},tme=({projectId:e,isOpen:t})=>{if(e)try{localStorage.setItem(`${o7}/${e}`,JSON.stringify({isOpen:t}))}catch{}},nme=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):c7;if(!Number.isFinite(t))return Math.max(l7,n);let r=Math.max(l7,Math.round(t*u7));return Math.max(l7,Math.min(r,n))},_7=e=>{if(!e)return{isOpen:!1,width:c7};try{let t=localStorage.getItem(`${s7}/${e}`);if(!t)return{isOpen:!1,width:c7};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(l7,Math.round(n.width)):c7;return{isOpen:n.isOpen===!0,width:r}}catch{return{isOpen:!1,width:c7}}},rme=({projectId:e,isOpen:t,width:n})=>{if(e)try{localStorage.setItem(`${s7}/${e}`,JSON.stringify({isOpen:t,width:n}))}catch{}},ime=e=>{if(!e)return null;try{return localStorage.getItem(e)}catch{return null}},v7=({storageKey:e,value:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,t)}catch{}},ame=e=>{if(!e)return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},y7=({storageKey:e,notice:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(t))}catch{}},ome=e=>{if(!e)return null;let t=e.skipped.reduce((e,t)=>e+t.count,0),n=e.skipped.map(e=>t7(`importNotice.skipReasons.${e.code}`,{count:e.count})).join(`, `);return e.imported_count>0&&t>0?t7(`importNotice.importedWithSkips`,{importedCount:e.imported_count,skippedCount:t,skippedSummary:n}):e.imported_count>0?t7(`importNotice.importedOnly`,{importedCount:e.imported_count}):t>0?t7(`importNotice.skippedOnly`,{skippedCount:t,skippedSummary:n}):null},b7=({keyPrefix:e,projectId:t,tool:n})=>`${e}:${t}:${n}`,sme=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t):[],x7=({keyPrefix:e,projectId:t,tool:n})=>{if(!t||n!==`opencode`&&n!==`claude`)return null;try{let r=window.localStorage.getItem(b7({keyPrefix:e,projectId:t,tool:n}));if(!r)return null;let i=JSON.parse(r),a=(typeof i.model==`string`?i.model.trim():``)||null;return a?{model:a,variant:a&&typeof i.variant==`string`&&i.variant.trim()||null,skills:sme(i.skills)}:null}catch{return null}},S7=({keyPrefix:e,projectId:t,tool:n,model:r,variant:i,skills:a})=>{if(!(!t||n!==`opencode`&&n!==`claude`||!r))try{let o={model:r,variant:r?i:null,...a?{skills:a}:{}};window.localStorage.setItem(b7({keyPrefix:e,projectId:t,tool:n}),JSON.stringify(o))}catch{}},C7=({projectId:e,tool:t})=>x7({keyPrefix:i7,projectId:e,tool:t}),w7=({projectId:e,tool:t,model:n,variant:r,skills:i})=>S7({keyPrefix:i7,projectId:e,tool:t,model:n,variant:r,skills:i}),cme=({projectId:e,tool:t})=>{let n=C7({projectId:e,tool:t});!n||n.skills.length===0||w7({projectId:e,tool:t,...n,skills:[]})},lme=({projectId:e,tool:t})=>x7({keyPrefix:a7,projectId:e,tool:t}),ume=({projectId:e,tool:t,model:n,variant:r})=>S7({keyPrefix:a7,projectId:e,tool:t,model:n,variant:r}),dme=({projectId:e,tool:t})=>{if(e)try{window.localStorage.removeItem(b7({keyPrefix:a7,projectId:e,tool:t}))}catch{}},fme=`archon.spec-draft-grill`,T7=e=>e?`${fme}/${e}`:null,E7=e=>{let t=T7(e);if(!t)return!1;try{return window.localStorage.getItem(t)===`true`}catch{return!1}},D7=({projectId:e,grillOn:t})=>{let n=T7(e);if(n)try{t?window.localStorage.setItem(n,`true`):window.localStorage.removeItem(n)}catch{}},pme=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c=async()=>!1,onSelectRepoRootTarget:l=async()=>!1,onRestoreSessionTarget:u,activeTool:d,routedSpecSessionId:f,routedSpecSnapshotId:m,initialIssueDraft:h=null,onRoutedSpecNavigationUnavailable:g,onSessionNavigation:_,onInitialIssueDraftConsumed:v,onImplementInChat:y,onNavigateToLifecycleSource:b})=>{let x=bq(),{t:S}=K(`common`),{jiraImportState:C,prepareSpecImportFromJira:w}=Jw(e),{gitHubImportState:T,prepareSpecImportFromGitHub:E}=vw(e),[D,O]=(0,p.useState)([]),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(null),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[ee,te]=(0,p.useState)({}),[z,B]=(0,p.useState)({}),[V,H]=(0,p.useState)(null),[U,ne]=(0,p.useState)({}),[re,ie]=(0,p.useState)({}),[ae,oe]=(0,p.useState)([]),[W,se]=(0,p.useState)(``),[ce,le]=(0,p.useState)(``),[ue,de]=(0,p.useState)([]),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)(!1),[Se,Ce]=(0,p.useState)(null),[we,Te]=(0,p.useState)([]),[Ee,De]=(0,p.useState)(()=>new Set),[Oe,ke]=(0,p.useState)(!1),[Ae,je]=(0,p.useState)(()=>new Set),[Me,Ne]=(0,p.useState)(!1),[Pe,Fe]=(0,p.useState)(()=>g7(e).isOpen),[Ie,Le]=(0,p.useState)(0),[G,Re]=(0,p.useState)(null),[ze,Be]=(0,p.useState)(()=>new Set),[Ve,He]=(0,p.useState)(null),[Ue,We]=(0,p.useState)(null),[Ge,q]=(0,p.useState)(!1),[Je,Ye]=(0,p.useState)(()=>_7(e).isOpen),[Ze,Qe]=(0,p.useState)(()=>_7(e).width),[J,$e]=(0,p.useState)(!1),[et,tt]=(0,p.useState)(!1),[nt,rt]=(0,p.useState)(!1),[it,at]=(0,p.useState)(!1),[ot,st]=(0,p.useState)(!1),[ct,lt]=(0,p.useState)(null),[ut,dt]=(0,p.useState)(!1),[ft,pt]=(0,p.useState)(null),[mt,ht]=(0,p.useState)(()=>E7(e)),[gt,X]=(0,p.useState)(!1),[_t,vt]=(0,p.useState)([]),[yt,bt]=(0,p.useState)(!1),[xt,St]=(0,p.useState)(!1),[Ct,wt]=(0,p.useState)(0),[Tt,Et]=(0,p.useState)(null),[Dt,Ot]=(0,p.useState)(!1),[kt,At]=(0,p.useState)(!1),[jt,Mt]=(0,p.useState)(!1),[Nt,Pt]=(0,p.useState)(!1),[Ft,It]=(0,p.useState)(``),[Lt,Rt]=(0,p.useState)(``),[zt,Bt]=(0,p.useState)(!1),Vt=(0,p.useRef)(null),Ht=(0,p.useRef)(null),Ut=(0,p.useRef)(null),Wt=(0,p.useRef)(null),Gt=(0,p.useRef)(null),Kt=(0,p.useRef)(null),qt=(0,p.useRef)(!1),Jt=(0,p.useRef)(!1),Yt=(0,p.useRef)(0),Xt=(0,p.useRef)(c7),Zt=(0,p.useRef)(c7),Qt=(0,p.useRef)(null),$t=(0,p.useRef)(new Set),en=(0,p.useRef)(0),tn=(0,p.useRef)(0),nn=(0,p.useRef)(f),rn=(0,p.useRef)(!1),an=(0,p.useRef)(!1),on=(0,p.useRef)(!1),sn=(0,p.useRef)({}),cn=(0,p.useRef)({}),ln=(0,p.useRef)({}),un=(0,p.useRef)(new Set),dn=(0,p.useRef)(new Set),fn=(0,p.useRef)(0),pn=(0,p.useRef)({id:null,status:null}),mn=(0,p.useRef)(new Map),hn=(0,p.useRef)(!1),gn=(0,p.useRef)(!1),_n=(0,p.useRef)(()=>{}),vn=m===void 0?Ue:m;nn.current=f;let yn=e?p7({projectId:e,tool:F?d:j?.tool??d,sessionId:j?.id??null}):null,bn=m7({projectId:e,sessionId:j?.id??null}),xn=yn?ee[yn]??``:``,Sn=j?z[bn??``]??null:V,Cn=F?d:j?.tool??d,wn=(0,p.useMemo)(()=>j?U[j.id]??[]:[],[j,U]),Tn=(0,p.useMemo)(()=>j?re[j.id]??0:0,[j,re])>0,{models:En,isLoading:Dn}=pF(Cn),On=(0,p.useCallback)(()=>{de(e=>e.length===0?e:[]),cme({projectId:e,tool:d})},[e,d]);(0,p.useEffect)(()=>{rn.current=F},[F]),(0,p.useEffect)(()=>{sn.current=ee},[ee]),(0,p.useEffect)(()=>{cn.current=z},[z]),(0,p.useEffect)(()=>{ln.current=U},[U]),(0,p.useEffect)(()=>{if(!yn||un.current.has(yn))return;un.current.add(yn);let e=ime(yn);e&&te(t=>Object.prototype.hasOwnProperty.call(t,yn)?t:{...t,[yn]:e})},[yn]),(0,p.useEffect)(()=>{if(!bn||dn.current.has(bn))return;dn.current.add(bn);let e=ame(bn);e&&B(t=>({...t,[bn]:e}))},[bn]),(0,p.useEffect)(()=>{!yn||!Object.prototype.hasOwnProperty.call(ee,yn)||v7({storageKey:yn,value:ee[yn]??``})},[yn,ee]),(0,p.useEffect)(()=>{!bn||!Object.prototype.hasOwnProperty.call(z,bn)||y7({storageKey:bn,notice:z[bn]??null})},[bn,z]),(0,p.useEffect)(()=>{Qt.current=k},[k]),(0,p.useEffect)(()=>{let t=vn??j?.latest_snapshot_id;if(!j?.id||!t||!e){He(null),dt(!1),Ye(!1);return}let n=!1;return q(!0),JM(e,j.id,t).then(e=>{if(!n){if(vn&&e.spec_session_id!==j.id){He(null),dt(!1),g?.();return}He(e),dt((e.created_ticket_ids?.length??0)>0),Ye(!0)}}).catch(e=>{n||(He(null),dt(!1),vn&&e instanceof Ke&&e.status===404?g?.():$.error(e instanceof Error?e.message:t7(`errors.loadSession`)))}).finally(()=>{n||q(!1)}),()=>{n=!0}},[j?.latest_snapshot_id,j?.id,e,vn,g]);let kn=Ve?.id??null,An=j?.id??null;(0,p.useEffect)(()=>{if(!e||!An||!kn){Et(null);return}let t=!1;return Ot(!0),z5(e,An,kn).then(e=>{t||Et(e)}).catch(()=>{t||Et(null)}).finally(()=>{t||Ot(!1)}),()=>{t=!0}},[e,An,kn]);let jn=(0,p.useCallback)(()=>{!e||!An||!kn||z5(e,An,kn).then(Et).catch(()=>{})},[e,An,kn]);(0,p.useEffect)(()=>{rme({projectId:e,isOpen:Je,width:Ze})},[e,Je,Ze]),(0,p.useEffect)(()=>{if(!(f===void 0||!me)){if(!f){rn.current||On(),Ce(null),A(null),M(null),We(null),I(!0);return}if(!(D.some(e=>e.id===f)||j?.id===f)){$.error(t7(`errors.initialSessionMissing`)),an.current=!0,A(null),M(null),I(!1),g?.();return}k!==f&&(Ce(null),A(f),M(null),I(!1),an.current=!0)}},[j?.id,k,me,g,On,f,D]),(0,p.useEffect)(()=>{J||(Zt.current=Ze,Ut.current&&(Ut.current.style.setProperty(`--spec-artifact-panel-width`,`${Ze}px`),Ut.current.setAttribute(`data-desktop-width`,String(Ze))))},[Ze,J]);let Mn=(0,p.useCallback)(async t=>{if(!e){O([]),pe(!1);return}pe(!me);try{let n=await LM(e,t);if(t?.aborted)return;O(r5(n)),he(!0);let r=new Set(n.map(e=>e.id));Be(e=>{let t=new Set([...e].filter(e=>r.has(e)));return t.size===e.size?e:t})}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.loadSessions`))}finally{t?.aborted||pe(!1)}},[e,me]);(0,p.useEffect)(()=>{let e=mn.current,t=new Map,n=[];for(let r of D){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&(a===`done`||a===`error`)&&r.id!==k&&n.push(r),t.set(r.id,a)}mn.current=t,Be(e=>{let t=new Set(e),r=!1,i=new Set(D.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of D){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===k||i!==`done`&&i!==`error`)&&t.delete(e.id)){r=!0;continue}a&&!t.has(e.id)&&(t.add(e.id),r=!0)}return r?t:e})},[e,k,D]);let Nn=(0,p.useCallback)(async(t,n)=>{if(!e)return;_e(!0);let r=en.current+1;en.current=r;let i=tn.current;try{let a=await zM(e,t,n);if(n?.aborted)return;let o=tn.current!==i,s=en.current===r,c=Qt.current===t&&!rn.current;if(!s||o||!c)return;M(a)}catch(e){e instanceof Ke&&e.status===404&&nn.current===t&&Qt.current===t?g?.():Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.loadSession`))}finally{n?.aborted||_e(!1)}},[e,g]),Pn=(0,p.useCallback)(e=>{O(t=>{let n=t.findIndex(t=>t.id===e.id);if(n===-1)return r5([...t,H5(e)]);let r=t.slice();return r[n]=H5(e),r5(r)})},[]),Fn=(0,p.useCallback)((e,t)=>{O(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n[r];if(i.pending_memory_suggestion_count===t)return n;let a=[...n];return a[r]={...i,pending_memory_suggestion_count:t},a}),M(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:{...n,pending_memory_suggestion_count:t})},[]),In=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){vt([]),bt(!1);return}bt(!0);try{let t=await Ar(e,null,r,void 0,n);if(r?.aborted)return;vt(t.suggestions),Fn(n,t.suggestions.length)}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.loadMemorySuggestions`))}finally{r?.aborted||bt(!1)}},[t?.memory_enabled,e,Fn]),Ln=(0,p.useCallback)(e=>{vt(t=>{let n=t.filter(t=>t.id!==e);return k&&Fn(k,n.length),n}),wt(e=>e+1),Mn(),k&&Nn(k)},[k,Nn,Mn,Fn]),Rn=(0,p.useCallback)(e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),[]),zn=(0,p.useCallback)(()=>({tool:d,mode:mt?`grill`:`standard`,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[]}),[d,mt,En.length,W,ce,ae.length,ue]),Bn=(0,p.useCallback)(()=>{rn.current=!0,Qt.current=null,I(!0),On(),A(null),We(null),M(null),He(null),R(null),H(null),Ce(null),Re(null)},[On]),Vn=(0,p.useCallback)(()=>{ve||be||(Bn(),_?.(null))},[ve,be,_,Bn]),Hn=(0,p.useMemo)(()=>iX(),[]),Un=(0,p.useMemo)(()=>(0,Y.jsx)(f7,{modifierLabel:Hn,keys:[d7],ariaHidden:!0}),[Hn]),Wn=(0,p.useMemo)(()=>(0,Y.jsx)(eme,{label:t7(`sidebar.newSessionTooltip`),modifierLabel:Hn,keys:[d7]}),[Hn]);(0,p.useEffect)(()=>{let t=t=>{if($pe(t)){if(!e||ve||be)return;t.preventDefault(),Vn(),Le(e=>e+1);return}};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,ve,be,Vn]);let Gn=(0,p.useCallback)(e=>{be||(Ce(null),A(e.id),We(null),I(!1),R(null),H(null),fn.current+=1,_?.(e.id))},[be,_]),Kn=(0,p.useCallback)(async r=>{if(!e)return!1;lt(r.id);try{let i=await zM(e,r.id);return Pn(i),Qt.current===i.id&&M(i),i.target_available===!1?($.error(i.target_unavailable_reason??t7(`targets.unavailable`)),!1):!t||h5({activeProject:t,activeProjectBranchState:n,session:i})?!0:u?await u(i):!1}catch(e){return Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.restoreTarget`)),!1}finally{lt(e=>e===r.id?null:e)}},[t,n,e,u,Pn]),qn=(0,p.useCallback)(async t=>{if(e){Ce(t);try{await KM(e,t)}catch(e){Ce(e=>e===t?null:e),Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.stopSession`))}}},[e]);(0,p.useEffect)(()=>{if(!Se)return;let e=j?.id===Se?j:D.find(e=>e.id===Se)??null;(!e||e.agent_status!==`running`)&&Ce(null)},[j,Se,D]);let Jn=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ve)){rt(!0);try{if(!await Kn(j))return;let t=await ZM(e,j.id,Ve.id);dt(!0),$.success(t7(`actions.createTicketsSuccess`,{count:t.tickets.length})),Mn()}catch(e){if(Xe(e))return;if(qe(e,`existing_ticket_ids`)){dt(!0);return}$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{rt(!1)}}},[e,j,Ve,Mn,Kn]),Yn=(0,p.useCallback)(()=>{Jn()},[Jn]),Xn=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ve)&&y){at(!0);try{if(!await Kn(j))return;let t=await QM(e,j.id,Ve.id);y(t.draft_text,t.spec_session_id,t.spec_snapshot_id)}catch(e){if(Xe(e))return;e instanceof Ke&&e.status===409&&await Nn(j.id),$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{at(!1)}}},[e,j,Ve,Nn,y,Kn]),Zn=(0,p.useCallback)(async t=>{let n=t?.projectId??e,r=t?.sessionId??j?.id,i=t?.snapshotId??Ve?.id;if(!(!n||!r||!i)){st(!0);try{if(!j||j.id!==r||!await Kn(j))return;await XM(n,r,i,{overwrite:t?.overwrite}),pt(null),$.success(t7(`actions.exportSuccess`))}catch(e){if(Xe(e))return;if(e instanceof YM){pt({path:e.conflictingPath,projectId:n,sessionId:r,snapshotId:i});return}e instanceof Ke&&e.status===409&&j&&await Nn(j.id),$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{st(!1)}}},[e,j,Ve,Nn,Kn]),Qn=(0,p.useCallback)(()=>{Kt.current?.(),Kt.current=null},[]),$n=(0,p.useCallback)(e=>{if(!Vt.current)return;let t=Vt.current.getBoundingClientRect().width,n=nme(e,t);Zt.current=n,Ut.current&&(Ut.current.style.setProperty(`--spec-artifact-panel-width`,`${n}px`),Ut.current.setAttribute(`data-desktop-width`,String(n)))},[]),er=(0,p.useCallback)(e=>{let t=Wt.current,n=Gt.current,r=qt.current;if(t!==null){if(Wt.current=null,Gt.current=null,qt.current=!1,$e(!1),tt(!1),Qn(),e!==null&&typeof Ht.current?.hasPointerCapture==`function`&&Ht.current.hasPointerCapture(e)&&typeof Ht.current.releasePointerCapture==`function`&&Ht.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;Qe(Zt.current),Ye(!0);return}Qe(Zt.current)}},[Qn]),tr=(0,p.useCallback)((e,t)=>{if(Wt.current!==e)return;let n=t-Yt.current,r=Xt.current-n;if(Gt.current===`collapsed`){if(!qt.current&&r<Xpe)return;qt.current||(qt.current=!0,Jt.current=!0,tt(!0),$e(!0))}$n(r)},[$n]),nr=(0,p.useCallback)((e,t)=>{if(Wt.current===e){if(t!==null&&(Gt.current===`inline`||qt.current)){let e=t-Yt.current;$n(Xt.current-e)}er(e)}},[er,$n]),rr=(0,p.useCallback)(e=>{e.preventDefault(),Wt.current=e.pointerId,Gt.current=Je?`inline`:`collapsed`,qt.current=!1,Jt.current=!1,Yt.current=e.clientX,Xt.current=Je?Zt.current:0,$e(Je),Qn(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{tr(e.pointerId,e.clientX)},n=e=>{nr(e.pointerId,e.clientX)},r=e=>{nr(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Kt.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[nr,tr,Je,Qn]),ir=(0,p.useCallback)(e=>{tr(e.pointerId,e.clientX)},[tr]),ar=(0,p.useCallback)(e=>{nr(e.pointerId,e.clientX)},[nr]),or=(0,p.useCallback)(e=>{nr(e.pointerId,e.clientX)},[nr]),sr=(0,p.useCallback)(e=>{Wt.current===e.pointerId&&er(e.pointerId)},[er]),cr=(0,p.useCallback)(()=>{Ye(!1)},[]),lr=(0,p.useCallback)(async()=>{if(!e||we.length===0)return;let t=we;De(e=>{let n=new Set(e);for(let e of t)n.add(e);return n});let n=[],r=[];for(let i of t)try{await qM(e,i),r.push(i)}catch(e){Xe(e)||n.push(e instanceof Error?e.message:t7(`errors.deleteSession`))}if(De(e=>{let n=new Set(e);for(let e of t)n.delete(e);return n}),Te([]),_n.current(r),n.length>0){$.error(n.join(`
275
- `));return}Oe&&(ke(!1),je(new Set),$.success(t7(`toasts.deleteSelectedSuccess`,{count:t.length})))},[e,we,Oe]),ur=(0,p.useCallback)((t,n={})=>{let r=new Set(t);if(r.size===0)return;let i=Qt.current,a=n.preserveDraftRoute===!0,o=!!(a&&i&&r.has(i)&&nn.current===i),s=!!(!a&&i&&r.has(i)),c=s?D.find(e=>!r.has(e.id))??null:null;o&&(On(),_?.(null)),s&&(c||On(),_?.(c?.id??null));for(let t of r)v7({storageKey:p7({projectId:e,tool:d,sessionId:t}),value:``}),y7({storageKey:m7({projectId:e,sessionId:t}),notice:null});ne(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e}),B(t=>{let n={...t},i=!1;for(let t of r){let r=m7({projectId:e,sessionId:t});r&&Object.prototype.hasOwnProperty.call(n,r)&&(delete n[r],i=!0)}return i?n:t}),O(e=>{let t=e.filter(e=>!r.has(e.id));if(i&&r.has(i)){if(nn.current===i)return a?(A(null),M(null),We(null),I(!0),t):(A(null),M(null),We(null),I(c===null),t);let e=t[0]??null;A(e?.id??null),M(null),We(null),I(e===null)}return t}),Be(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),Re(e=>e&&r.has(e.parentId)?null:e),Ce(e=>e&&r.has(e)?null:e),Te(e=>e.filter(e=>!r.has(e))),De(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),je(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,d,_,On,D]),dr=(0,p.useCallback)((e,t)=>{ur([e],t)},[ur]);_n.current=ur;let fr=(0,p.useCallback)((e,t)=>{e&&te(n=>n[e]===t?n:{...n,[e]:t})},[]),pr=(0,p.useCallback)((e,t)=>{ne(n=>{if(t.length===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),mr=(0,p.useCallback)(e=>{ne(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),ie(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),hr=(0,p.useCallback)((e,t)=>{e&&B(n=>(n[e]??null)===t?n:{...n,[e]:t})},[]),gr=(0,p.useCallback)(e=>{e&&(B(t=>!Object.prototype.hasOwnProperty.call(t,e)||t[e]===null?t:{...t,[e]:null}),y7({storageKey:e,notice:null}))},[]),_r=(0,p.useCallback)(t=>{if(e){if(t.spec_session){let n=p7({projectId:e,tool:t.spec_session.tool,sessionId:t.spec_session.id}),r=m7({projectId:e,sessionId:t.spec_session.id});fr(n,t.prompt_text),hr(r,t.import_notice),pr(t.spec_session.id,t.imported_attachments),Pn(t.spec_session),M(t.spec_session),A(t.spec_session.id),I(!1),R(null),H(null),Le(e=>e+1);return}R(t.external_source),H(t.import_notice),On(),I(!0),A(null),M(null),We(null),He(null),fr(p7({projectId:e,tool:d}),t.prompt_text),Le(e=>e+1)}},[e,d,On,fr,hr,pr,Pn]),vr=(0,p.useCallback)(async({provider:e,issueReference:t})=>{let n=$.loading(t7(`toasts.importPreparing`));try{let r=e===`jira`?await w?.({issueReference:t,...zn()}):await E?.({issueReference:t,...zn()});if(!r)throw Error(t7(`toasts.importError`));return(r.import_notice?.skipped.reduce((e,t)=>e+t.count,0)??0)>0?$.warning(t7(`toasts.importPartialSuccess`),{id:n}):$.success(t7(`toasts.importSuccess`),{id:n}),r}catch(e){if(Xe(e))$.dismiss(n);else{let t=e instanceof Error&&e.message?e.message:t7(`toasts.importError`);$.error(t,{id:n})}throw e}},[zn,E,w]),yr=(0,p.useMemo)(()=>[{key:`jira`,label:S(`jiraImportField.label`),placeholder:S(`jiraImportField.placeholder`),state:C,onImport:e=>vr({provider:`jira`,issueReference:e})},{key:`github`,label:S(`githubImportField.label`),placeholder:S(`githubImportField.placeholder`),state:T,onImport:e=>vr({provider:`github`,issueReference:e})}],[S,C,T,vr]),br=yr.some(e=>e.state===`enabled`);(0,p.useEffect)(()=>{h&&(vr({provider:h.external_source.provider,issueReference:h.external_source.external_key}).then(_r).catch(()=>void 0),v?.())},[h,vr,_r,v]);let xr=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ve)){At(!0);try{await Cpe(e,j.id,Ve.id,{tool:j.tool,...zt?{model:Ft||null,variant:Lt||null}:{},skills:j.skills}),zt&&ume({projectId:e,tool:j.tool,model:Ft||null,variant:Lt||null}),jn()}catch(e){if(Xe(e))return;e instanceof Ke&&e.status===409&&await Nn(j.id),$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{At(!1)}}},[e,j,Ve,zt,Ft,Lt,jn,Nn]),Sr=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ve)){Mt(!0);try{await wpe(e,j.id,Ve.id),jn()}catch(e){if(Xe(e))return;$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{Mt(!1)}}},[e,j,Ve,jn]),Cr=(0,p.useCallback)(async()=>{if(!e||!j||!Ve)return;let t=Tt?.run;if(t){Pt(!0);try{fr(yn,(await Tpe(e,j.id,Ve.id,t.id)).draft_text),Le(e=>e+1)}catch(e){if(Xe(e))return;$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{Pt(!1)}}},[e,j,Ve,Tt,fr,yn]),wr=(0,p.useCallback)(e=>{e&&(te(t=>t[e]===``?t:{...t,[e]:``}),v7({storageKey:e,value:``}))},[]),Tr=(0,p.useCallback)((e,t)=>{ie(n=>{let r=Math.max(0,(n[e]??0)+t);if(r===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:r}})},[]),Er=(0,p.useCallback)(async t=>{if(!(!e||gt||gn.current)&&!(j&&j.agent_status===`running`)){if(!k||!j){ht(t),D7({projectId:e,grillOn:t});return}if(j.mode===(t?`grill`:`standard`)){ht(t);return}X(!0);try{let n=await VM(e,j.id,{mode:t?`grill`:`standard`});M(n),Pn(n),ht(t),t||e7(n.messages,n.latest_snapshot_created_at)&&await HM(e,n.id,{instruction:t7(`grill.finalizePrompt`),tool:n.tool,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[]})}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`grill.updateModeError`))}finally{X(!1)}}},[e,j,k,gt,Pn,En,W,ce,ae,ue]),Dr=(0,p.useCallback)(async()=>{if(!e||ve||be||hn.current||gn.current||t&&j&&!h5({activeProject:t,activeProjectBranchState:n,session:j}))return;let r=xn.trim();if(!r&&wn.length===0)return;xe(!0);let i=yn,a=performance.now();fn.current+=1;let o=`spec:${fn.current}`;try{let t=k,n=!t,s=n;if(t&&!j){let r=await zM(e,t);r?s=r.messages?.length===0:(n=!0,s=!0,t=null)}else j&&(s=j.messages?.length===0);if(n){ye(!0);let n=await RM(e,{tool:d,mode:mt?`grill`:`standard`,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[],external_source:L??null});t=n.id,A(t),M(n),I(!1),_?.(t),R(null),ht(!1),D7({projectId:e,grillOn:!1}),h7({projectId:e,tool:d}),ye(!1)}if(!t)throw Error(`Unable to resolve the spec session.`);Ce(e=>e===t?null:e),Re({parentType:`spec`,parentId:t,turnKey:o,startedAt:a});let c=wn.map(e=>e.id),l=await HM(e,t,{instruction:r,tool:d,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[],attachment_ids:c.length>0?c:void 0});M(l),w7({projectId:e,tool:l.tool,model:l.model,variant:l.variant,skills:s?[]:l.skills}),Le(e=>e+1),mr(t),wr(i),gr(m7({projectId:e,sessionId:t})),H(null)}catch(e){Re(e=>e?.turnKey===o?null:e);let t=qe(e,`spec_session`);t?(M(t),Pn(t)):e instanceof Ke&&e.status===409&&Qt.current&&await Nn(Qt.current),Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{xe(!1),ye(!1)}},[t,n,e,ve,be,xn,wn,yn,k,j,d,mt,En,W,ce,ae,ue,L,Nn,Pn,mr,wr,gr,_]),Or=(0,p.useCallback)(async t=>{if(e){$t.current.add(t.id);try{await qM(e,t.id),dr(t.id,{preserveDraftRoute:!0}),Bn()}catch(e){throw $t.current.delete(t.id),e}}},[e,Bn,dr]),kr=(0,p.useCallback)(async t=>{if(!e||Cn!==`opencode`&&Cn!==`claude`)return;let n=k,r=null;if(!n&&t.length>0)try{ye(!0);let t=await RM(e,{tool:d,mode:mt?`grill`:`standard`,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[],external_source:L??null});r=t,n=t.id,A(n),M(t),I(!1),_?.(n),h7({projectId:e,tool:d})}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.upload`));return}finally{ye(!1)}if(n){Tr(n,t.length);try{let r=await WM(e,n,t),i=[...ln.current[n]??[],...r.attachments];pr(n,i)}catch(e){if(r&&!xn.trim())try{await Or(r)}catch{}Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.upload`))}finally{Tr(n,-t.length)}}},[e,k,d,Cn,En,W,ce,ae,ue,mt,L,xn,Or,Tr,_,pr]),jr=(0,p.useCallback)(async t=>{if(!e||!j)return;let n=j,r=n.id,i=(ln.current[r]??[]).filter(e=>e.id!==t);try{await GM(e,r,t),pr(r,i),i.length===0&&!xn.trim()&&(n.messages?.length??0)===0&&await Or(n)}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.removeAttachment`))}},[e,j,Or,xn,pr]);(0,p.useEffect)(()=>{G&&(G.parentId===k&&(be||j?.agent_status===`running`)||Re(null))},[j?.agent_status,k,be,G]),(0,p.useEffect)(()=>{if(!on.current){on.current=!0;return}let t=g7(e),n=_7(e);rn.current=!1,an.current=!1,un.current=new Set,dn.current=new Set,A(null),M(null),We(null),He(null),I(!1),R(null),te({}),B({}),H(null),ne({}),ie({}),$t.current.clear(),Ce(null),Te([]),De(new Set),ke(!1),je(new Set),Re(null),vt([]),bt(!1),St(!1),he(!1),Be(new Set),mn.current=new Map,Zt.current=n.width,Fe(t.isOpen),Qe(n.width),Ye(n.isOpen),ht(E7(e)),X(!1)},[e]);let Mr=(0,p.useCallback)((e,t)=>{je(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,p.useEffect)(()=>{let e=new AbortController;return Mn(e.signal),()=>{e.abort()}},[Mn]),(0,p.useEffect)(()=>{if(f!==void 0||rn.current||F||k||an.current||D.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;let e=t?D.find(e=>h5({activeProject:t,activeProjectBranchState:n,session:e}))??null:D[0]??null;an.current=!0,e&&A(e.id)},[t,n,k,F,f,D]),(0,p.useEffect)(()=>{if(Cn!==`opencode`&&Cn!==`claude`){oe([]),Ne(!1);return}if(Cn!==`opencode`){oe([]);return}let t=new AbortController;return(async()=>{Ne(!0);try{oe(await mF(Cn,t.signal,e))}catch(e){Xe(e)||oe(e=>e)}finally{t.signal.aborted||Ne(!1)}})(),()=>{t.abort()}},[e,Cn]),(0,p.useEffect)(()=>{if(Cn!==`opencode`&&Cn!==`claude`){se(``),le(``),de([]);return}if(F){let t=C7({projectId:e,tool:Cn}),n=new Set(En.map(e=>e.id)),r=t?.model??``,i=r&&(n.size===0||n.has(r)),a=En.find(e=>e.id===r)??null,o=t?.variant??``,s=!a||a.variants.includes(o),c=new Set(ae.map(e=>e.name));se(i?r:``),le(e=>!i||!s?``:o||e),de(Cn===`opencode`?(t?.skills??[]).filter(e=>c.has(e)):[]);return}se(j?.model??``),le(j?.variant??``),de(j?.skills??[])},[e,j?.id,j?.model,j?.skills,j?.variant,En,ae,Cn,F]),(0,p.useEffect)(()=>{if(F||!k){M(null);return}if(j?.id===k)return;M(null);let e=new AbortController;return Nn(k,e.signal),()=>{e.abort()}},[j,k,F,Nn]),(0,p.useEffect)(()=>{St(!1)},[k,F]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||F||!k){vt([]),bt(!1);return}let e=new AbortController;return In(k,e.signal),()=>{e.abort()}},[t?.memory_enabled,k,F,In,Ct]),(0,p.useEffect)(()=>{!xt||yt||_t.length>0||St(!1)},[yt,xt,_t.length]),(0,p.useEffect)(()=>{let e=pn.current,n=j?.id??null,r=j?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&wt(e=>e+1),pn.current={id:n,status:r}},[t?.memory_enabled,j?.agent_status,j?.id]),(0,p.useEffect)(()=>{if(!k||j?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([Mn(e.signal),Nn(k,e.signal)])},Jpe);return()=>{e.abort(),window.clearInterval(t)}},[j?.agent_status,k,Nn,Mn]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(!F&&t.id===Qt.current&&(tn.current+=1,M(t)),Rn(t)&&Pn(t))},n=t=>{if(!t||t.project_id!==e)return;let n=$t.current.delete(t.id);dr(t.id,n?{preserveDraftRoute:!0}:void 0)},r=()=>{Mn();let e=Qt.current;e&&!rn.current&&Nn(e)};return x.on(`connect`,r),x.on(`spec-session:created`,t),x.on(`spec-session:updated`,t),x.on(`spec-session:deleted`,n),()=>{x.off(`connect`,r),x.off(`spec-session:created`,t),x.off(`spec-session:updated`,t),x.off(`spec-session:deleted`,n)}},[e,F,Nn,Mn,Rn,Pn,dr,x]),(0,p.useEffect)(()=>{if(!e||!kn)return;let t=e=>{!e||e.spec_snapshot_id!==kn||jn()};return x.on(`spec-review:updated`,t),()=>{x.off(`spec-review:updated`,t)}},[e,kn,jn,x]);let Nr=(0,p.useMemo)(()=>i5(D),[D]),Pr=(0,p.useCallback)(e=>{e.key!==`Enter`||e.shiftKey||j?.agent_status===`running`||ve||be||Tn||hn.current||gn.current||(e.preventDefault(),Dr())},[Dr,j?.agent_status,ve,be,Tn]),Fr=(0,p.useCallback)(t=>{if(!e||Cn!==`opencode`&&Cn!==`claude`)return;let n=Array.from(t.clipboardData.files).filter(e=>e.type.startsWith(`image/`));n.length!==0&&(t.preventDefault(),kr(n))},[e,Cn,kr]),Ir=(0,p.useMemo)(()=>s5(En),[En]),Lr=(0,p.useMemo)(()=>j?l5({modelLabel:c5({availableModelsById:Ir,model:j.model}),tool:j.tool}):null,[j,Ir]),Rr=(0,p.useMemo)(()=>j?.messages?j.messages.map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],responseTiming:e.response_timing?nq(e.response_timing):null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,created_at:e.created_at,displayTitle:e.role===`assistant`?Lr??o5(j.tool):u5()})):[],[j,Lr]),zr=k!==null||F,Br=F?null:j,Vr=Br?.target_available===!1,Hr=!!(t&&Br&&!Vr&&!h5({activeProject:t,activeProjectBranchState:n,session:Br})),Ur=Hr&&Br?t7(`targets.mismatchReason`,{sessionTarget:_5(Br),currentTarget:v5({activeProject:t,activeProjectBranchState:n})}):null,Wr=Vr?Br?.target_unavailable_reason??t7(`targets.unavailable`):null,Gr=Vr||Hr,Kr=Br?.streaming_response??null,qr=Br?.agent_status===`running`,Jr=!!(be&&G?.parentType===`spec`&&G.parentId===k),Yr=qr||Jr,Xr=Yr?Lr:null,Zr=qr&&Se===k,Qr=!!e&&!ve&&(F||k!==null&&!Gr),$r=!!(t?.memory_enabled&&j&&!F&&(j.pending_memory_suggestion_count>0||yt)),ei=(Cn===`opencode`||Cn===`claude`)&&(F||k!==null)&&Br?.agent_status!==`running`,ti=(0,p.useMemo)(()=>{if(!j?.messages)return null;for(let e=j.messages.length-1;e>=0;--e){let t=j.messages[e];if(t.kind===`grill-question`)return t.id}return null},[j]),ni=(0,p.useMemo)(()=>!j||j.mode!==`grill`?!1:e7(j.messages,j.latest_snapshot_created_at),[j]),ri=(0,p.useMemo)(()=>[...j?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[j]),ii=!!ri,ai=(0,p.useCallback)(async t=>{if(!e||!k||!j)return;xe(!0),fn.current+=1;let n={parentType:`spec`,parentId:k,turnKey:`spec:${fn.current}`,startedAt:performance.now()};Re(n);try{M(await HM(e,k,{instruction:t,tool:j.tool,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[]})),Le(e=>e+1)}catch(e){Re(e=>e?.turnKey===n.turnKey?null:e),Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{xe(!1)}},[e,k,j,En,W,ce,ae,ue]),oi=(0,p.useCallback)(async(t,n)=>{if(!e||!j||N)return;let r=$J({parentType:`spec`,parentId:j.id,setId:n.set_id});P(n.set_id),xe(!0),fn.current+=1;let i={parentType:`spec`,parentId:j.id,turnKey:`spec:${fn.current}`,startedAt:performance.now()};Re(i);try{let r=await UM(e,j.id,t,n);M(r),Pn(r)}catch(e){if(e instanceof Ke&&e.status===409){tY(r);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?(M(t),Pn(t)):await Nn(j.id)}throw Re(e=>e?.turnKey===i.turnKey?null:e),$.error(e instanceof Error?e.message:t7(`errors.resolveQuestions`)),e}finally{P(null),xe(!1)}},[e,j,Nn,N,Pn]),si=(0,p.useCallback)(e=>{if(e.role!==`assistant`)return;let t=e.metadata,n=t?.ask_question;if(n&&j)return(0,Y.jsx)(cY,{messageContent:e.content,questionSet:n,storageKey:$J({parentType:`spec`,parentId:j.id,setId:n.id}),isActive:n.status===`pending`&&ri?.id===e.id,isDisabled:Gr||j.agent_status===`running`||N===n.id,onResolve:t=>oi(e.id,t)});if(e.kind!==`grill-question`)return;let r=t?.grill_question;if(r)return(0,Y.jsx)(B5,{question:r,isActive:Yr?!1:e.id===ti&&j?.agent_status!==`running`&&j?.mode===`grill`,isDisabled:Gr||be||ve||gt,labels:{rationaleLabel:t7(`grill.rationaleLabel`),suggestionsLabel:t7(`grill.suggestionsLabel`),recommendedSuggestionLabel:t7(`grill.recommendedSuggestionLabel`),answerPlaceholder:t7(`grill.answerPlaceholder`),submitLabel:t7(`grill.submitLabel`),submittingLabel:t7(`grill.submittingLabel`)},onSubmitAnswer:e=>{ai(e)}})},[j,Yr,be,ve,Gr,gt,ti,ri?.id,oi,N,ai]),ci=(Cn===`opencode`||Cn===`claude`)&&En.length>0,li=Cn,ui=F?t7(`composer.newSpecTitle`):j?.title??t7(`composer.specTitle`),di=ci?W||null:j?.model??null,fi=c5({availableModelsById:Ir,model:di}),pi=j?.agent_status===`stopped`,mi=t7(`composer.placeholderSpec`),hi=D.some(e=>e.agent_status!==`running`),gi=(0,p.useMemo)(()=>({ariaLabel:t7(`sidebar.ariaLabel`),newSession:t7(`sidebar.newSession`),collapseAriaLabel:t7(`sidebar.collapseAriaLabel`),openAriaLabel:t7(`sidebar.openAriaLabel`),cancelSelection:t7(`sidebar.cancelSelection`),deleteSelected:t7(`sidebar.deleteSelected`),selectedCount:e=>`${e} selected`,select:t7(`sidebar.select`),loadingSessions:t7(`sidebar.loadingSessions`),noSessions:t7(`sidebar.noSessions`),deleteSessionAriaLabel:t7(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>t7(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>t7(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>t7(`sidebar.deleteSessionTitle`,{title:e})}),[]),_i=(0,p.useMemo)(()=>({title:t7(`deleteModal.title`),bulkTitle:t7(`deleteModal.bulkTitle`),description:t7(`deleteModal.description`),bulkDescription:e=>t7(`deleteModal.bulkDescription`,{count:e}),cancel:t7(`deleteModal.cancel`),delete:t7(`deleteModal.delete`),deleting:t7(`deleteModal.deleting`)}),[]),vi=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:!t&&ze.has(e.id)?`finished`:null,[ze]),yi=(0,p.useCallback)(e=>e.agent_status===`running`?t7(`sidebar.cannotDeleteRunning`):null,[]),bi=!!(t?.memory_enabled&&k&&!F),xi=(0,p.useCallback)(e=>{let r=g5({session:e,activeProject:t,activeProjectBranchState:n}),i=bi&&e.pending_memory_suggestion_count>0?n7(e.pending_memory_suggestion_count):null,a=(e.linked_ticket_count??0)+(e.linked_chat_count??0);return a>0?[e.title,r,i,t7(`sidebar.linkedImplementationsAriaLabel`,{itemCount:a})].filter(Boolean).join(` `):e.has_completed_work===1?[e.title,r,i,t7(`sidebar.linkedImplementationsAriaLabelHistorical`)].filter(Boolean).join(` `):[e.title,r,i].filter(Boolean).join(` `)},[t,n,bi]),Si=e=>{let t=e.first_user_message_preview??e.messages?.find(e=>e.role===`user`)?.content;return t&&t.replace(/\s+/g,` `).trim()||null},Ci=(0,p.useCallback)(({session:e,activityState:r})=>{let i=Si(e),a=g5({session:e,activeProject:t,activeProjectBranchState:n}),o=e.linked_ticket_count??0,s=e.linked_chat_count??0,c=o+s,l=e.has_completed_work===1||c>0,u=c>0,d=u?t7(`sidebar.linkedImplementationsTooltip`,{ticketCount:o,chatCount:s}):t7(`sidebar.linkedImplementationsTooltipHistorical`),f=bi&&e.pending_memory_suggestion_count>0;return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,Y.jsx)(`div`,{className:`mb-1 truncate text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground/75`,children:a}):null,(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 truncate text-[13px] font-medium leading-5`,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:e.title}),f?(0,Y.jsx)(oT,{tone:`muted`,className:`shrink-0`,"aria-label":n7(e.pending_memory_suggestion_count),title:n7(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null,l&&(0,Y.jsx)(vv,{content:d,children:(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 text-[11px] text-indigo-500 dark:text-indigo-400`,children:[(0,Y.jsx)(zF,{className:`size-3`}),u&&(0,Y.jsx)(`span`,{children:c})]})})]}),i?(0,Y.jsx)(`div`,{className:`mt-0.5 line-clamp-1 text-xs leading-4 text-muted-foreground`,children:i}):null,e.target_available===!1?(0,Y.jsx)(`div`,{className:`mt-1 line-clamp-1 text-[11px] leading-4 text-amber-200/90`,children:e.target_unavailable_reason??t7(`targets.unavailable`)}):null]}),(0,Y.jsx)(tb,{state:r,className:`mt-1`})]})},[t,n,bi]),wi=qr?(0,Y.jsx)(V8,{isInterrupting:Zr,onStop:()=>{k&&qn(k)},interruptLabel:t7(`composer.interrupt`),interruptingLabel:t7(`composer.interrupting`)}):null,Ti=(0,p.useMemo)(()=>En.find(e=>e.id===W)??null,[En,W]),Ei=({model:t=W,variant:n=ce,skills:r=ue}={})=>{F&&w7({projectId:e,tool:d,model:t||null,variant:t&&n||null,skills:d===`opencode`?r:[]})},Di=Cn===`opencode`||Cn===`claude`?Me||Dn?(0,Y.jsx)(DY,{}):En.length>0?(0,Y.jsx)(OY,{model:W,variant:ce,skills:ue,showModelSelector:!0,showSkillsSelector:ae.length>0,availableModels:En,availableSkills:ae,selectedModel:Ti,onModelChange:e=>{let t=En.find(t=>t.id===e)??null,n=t&&t.variants.includes(ce)?ce:``;se(e),le(n),Ei({model:e,variant:n})},onVariantChange:e=>{le(e),Ei({variant:e})},onSkillsChange:e=>{de(e),Ei({skills:e})},modelSelectId:`spec-model-select`,variantSelectId:`spec-variant-select`,skillsSelectId:`spec-skills-select`}):null:null,Oi=(0,p.useMemo)(()=>we.length===1?D.find(e=>e.id===we[0])?.title??``:``,[we,D]),ki=(0,p.useMemo)(()=>D.filter(e=>we.includes(e.id)),[D,we]),Ai=zr&&j!==null,ji=Ai&&!Je&&!et,Mi=Ai&&(Je||et),Ni=j?.tool??d,Pi=Ni===`opencode`&&En.length>0,Fi=(0,p.useMemo)(()=>En.find(e=>e.id===Ft)??null,[En,Ft]),Ii=Ve&&Ai?{review:Tt,isRunning:kt||jt,isLoading:Dt,availableModels:En,showModelSelector:Pi,runConfigTool:Ni,runConfigModel:Ft,runConfigVariant:Lt,selectedDiscoveredModel:Fi,onRunConfigModelChange:t=>{let n=En.find(e=>e.id===t)??null;It(t),Bt(!!t),t||dme({projectId:e,tool:Ni}),Rt(e=>n&&n.variants.includes(e)?e:``)},onRunConfigVariantChange:e=>{Rt(e),Bt(!!Ft)},onLaunchReview:()=>{xr()},onStopReview:()=>{Sr()},onSendToPlanner:()=>{Cr()},isSendingToPlanner:Nt,disabledReason:Wr??Ur}:void 0;(0,p.useEffect)(()=>{if(Ni!==`opencode`){It(``),Rt(``),Bt(!1);return}let t=lme({projectId:e,tool:Ni}),n=t?.model??``;It(n),Rt(n?t?.variant??``:``),Bt(!!n)},[e,Ni]),(0,p.useEffect)(()=>{Ai||(Wt.current=null,Gt.current=null,qt.current=!1,Jt.current=!1,$e(!1),tt(!1),Qn())},[Ai,Qn]),(0,p.useEffect)(()=>()=>{Qn()},[Qn]);let Li=(0,Y.jsx)(vv,{content:t7(`artifactPanel.open`),disabled:!ji,side:`left`,children:(0,Y.jsx)(`div`,{ref:Ht,className:Z(ji?`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`,J&&!ji&&`bg-background`),role:ji?`button`:`separator`,tabIndex:ji?0:void 0,"aria-label":t7(ji?`artifactPanel.open`:`artifactPanel.resize`),"aria-valuemin":ji?void 0:l7,"aria-valuemax":ji?void 0:Vt.current?Math.round(Vt.current.clientWidth*u7):800,"aria-valuenow":ji?void 0:Ze,onClick:ji?()=>{if(Jt.current){Jt.current=!1;return}Ye(!0)}:void 0,onPointerDown:rr,onPointerMove:ir,onPointerUp:ar,onPointerCancel:or,onLostPointerCapture:sr,children:ji?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`hidden h-full w-full items-center justify-center xl:flex`,children:(0,Y.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,Y.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,Y.jsx)($5,{className:`h-3 w-3 shrink-0`})}),(0,Y.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,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium xl:hidden`,children:[(0,Y.jsx)($5,{className:`h-3.5 w-3.5`}),(0,Y.jsx)(`span`,{children:t7(`artifactPanel.title`)})]})]}):(0,Y.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,J?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})})}),Ri=F&&br?(0,Y.jsx)(BY,{providers:yr,onImported:_r,inputId:`spec-draft-external-import`,className:`max-w-md`,showImportSpinner:!0,showImportErrorToast:!1}):null,zi=j?j.mode===`grill`:mt,Bi=ni;hn.current=Bi,gn.current=ii;let Vi=(0,Y.jsx)(V5,{on:zi,disabled:gt||qr||ve||be||ii||Gr,tooltipContent:t7(`grill.toggleTooltip`),ariaLabelOn:t7(`grill.toggleAriaLabelOn`),ariaLabelOff:t7(`grill.toggleAriaLabelOff`),onToggle:e=>{Er(e)}}),Hi=ome(Sn),Ui=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Hi?(0,Y.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,Y.jsx)(`div`,{className:`font-medium`,children:t7(`importNotice.title`)}),(0,Y.jsx)(`div`,{children:Hi})]}):null,(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[Vi,Ri,wi,F&&t&&(0,Y.jsx)(Jy,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:Wb.t(`common:projectTargetSelector.newSpecAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l})]})]}),Wi=Di,Gi=(0,p.useCallback)(t=>{j?gr(m7({projectId:e,sessionId:j.id})):H(null),fr(yn,t)},[j,e,yn,fr,gr]),Ki=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(Mpe,{projectId:e,specSessionId:F?null:k,messages:Rr,internalLog:Br?.agent_log??null,currentThinkingMessageId:Br?.agent_message_id??null,previousThinkingLog:Br?.previous_agent_log??null,previousThinkingMessageId:Br?.previous_agent_message_id??null,pendingAgentTitle:Xr,streamingResponse:Kr,isRunning:Yr,isLoading:!F&&ge,canShowComposer:Qr,isExternallyResizing:J,layoutKey:j?.id??`spec-draft`,scrollLayoutKey:Ai?Mi?`artifact-visible`:`artifact-hidden`:`artifact-disabled`,header:(0,Y.jsx)($8,{title:ui,tool:F?null:j?.tool??null,modelLabel:fi,interrupted:pi,interruptedLabel:t7(`sidebar.interrupted`),usage:{totalTokens:j?.usage_snapshot_total_tokens??null,contextWindow:j?.usage_snapshot_context_window??null,cost:j?.usage_snapshot_cost??null,tool:li,model:di,availableModels:En},metadataExtra:j?.external_source?(0,Y.jsx)(ZF,{externalSource:j.external_source}):null,actions:j&&e?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[$r&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>St(!0),children:yt?t7(`composer.loadingMemory`):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:t7(`composer.memorySuggestions`)}),(0,Y.jsx)(oT,{children:_t.length})]})}),(0,Y.jsx)(r3,{projectId:e,scope:{type:`spec`,id:j.id},size:`xs`,onNavigateToLifecycleSource:b})]}):null,warnings:Hr&&Ur?(0,Y.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,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`div`,{children:Ur}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,disabled:ct===j?.id,onClick:()=>{j&&Kn(j)},children:ct===j?.id?t7(`targets.switchingBack`):t7(`targets.switchBack`)}),(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:Vn,children:t7(`composer.startNewSession`)})]})]})}):Vr&&Wr?(0,Y.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:Wr}):null}),composerControls:Ui,composerInlineControls:Wi,composerTheme:`default`,composerFocusNonce:Ie,pendingAgentRevealKey:Yr&&G?.parentId===k?G?.turnKey??null:null,pendingAgentRevealDelayMs:Yr&&G?.parentId===k?400:0,liveResponseTiming:G,followUpPrompt:xn,draftAttachments:wn,followUpPlaceholder:mi,emptyStateText:null,isSendingFollowUp:be||ve,isComposerSubmitDisabled:Bi||ii||Gr,isUploadingAttachments:Tn,canAttachImages:ei,followUpDisabledReason:Wr??Ur??(Br?.agent_status===`running`?t7(`composer.waitTurn`):Tn?t7(`composer.waitUpload`):Bi?t7(`composer.waitGrill`):ii?Wb.t(`common:questionSet.waitForResolution`):void 0),renderMessageBody:si,onFollowUpPromptChange:Gi,onFollowUpKeyDown:Pr,onFollowUpPaste:Fr,onUploadAttachments:e=>{kr(e)},onRemoveAttachment:e=>{jr(e)},onFollowUpSubmit:()=>{Dr()}})}),qi=!zr&&me&&!fe?(0,Y.jsx)(z8,{title:t7(`composer.noSessionSelectedTitle`),description:t7(`composer.noSessionSelectedDescription`),startNewSessionLabel:t7(`composer.startNewSession`),onStartNewSession:Vn,canStartNewSession:!!e&&!ve&&!be}):zr&&!F&&!ge&&!j?(0,Y.jsx)(L8,{label:t7(`composer.loadingSession`)}):!me||fe?(0,Y.jsx)(R8,{label:t7(`sidebar.loadingSessions`)}):Ki,Ji=xt&&e&&t?.memory_enabled?(0,Y.jsx)(gC,{onClose:()=>St(!1),overlayClassName:`bg-background/45 p-4 backdrop-blur-sm`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,Y.jsxs)(xC,{size:`sm`,className:`max-h-[calc(100vh-2rem)] w-full gap-0 overflow-hidden border-border/80 bg-card/95 shadow-2xl`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/80 pb-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(CC,{children:t7(`composer.memorySuggestionsTitle`)}),(0,Y.jsx)(wC,{children:t7(`composer.memorySuggestionsDescription`)})]}),(0,Y.jsx)(TC,{children:t})]}),(0,Y.jsx)(EC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,Y.jsx)(e5,{projectId:e,suggestions:_t,emptyState:t7(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:Ln})})]}),closeButtonLabel:t7(`composer.closeMemorySuggestions`)}):null,Yi=ki.length>0?(0,Y.jsx)(I8,{count:ki.length,title:Oi,isDeleting:Ee.size>0,onConfirm:()=>{lr()},onCancel:()=>{Ee.size>0||Te([])},labels:_i}):null,Xi=ft===null?null:(0,Y.jsx)(_C,{title:t7(`actions.exportConflictTitle`),description:t7(`actions.exportConflictDescription`,{path:ft.path}),confirmLabel:t7(`actions.exportConflictConfirm`),cancelLabel:t7(`actions.exportConflictCancel`),confirmVariant:`destructive`,onConfirm:()=>{pt(null),Zn({projectId:ft.projectId,sessionId:ft.sessionId,snapshotId:ft.snapshotId,overwrite:!0})},onCancel:()=>{pt(null)}});return(0,Y.jsxs)(`div`,{"data-testid":`spec-view-shell`,className:`relative flex min-h-0 flex-1 overflow-hidden border-t border-border/70`,children:[(0,Y.jsx)(B8,{sessions:D,sessionGroups:Nr,activeSessionId:k,isDraftOpen:F,isLoadingSessions:fe,isOpen:Pe,onToggleOpen:()=>{Fe(t=>{let n=!t;return tme({projectId:e,isOpen:n}),n})},testId:`spec-sessions-sidebar`,railTestId:`spec-sessions-rail`,onDraftOpen:Vn,isCreatingSession:ve||!e,isSendingPrompt:be,newSessionShortcutHint:Un,newSessionTooltip:Wn,isSelectionMode:Oe,selectedSessionIds:Ae,selectedSessionCount:Ae.size,hasDeletableSessions:hi,deletingSessionIds:Ee,onEnterSelectionMode:()=>{ke(!0),je(new Set)},onExitSelectionMode:()=>{ke(!1),je(new Set)},onToggleSessionSelection:e=>{je(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:Mr,onConfirmDeleteSelectedSessions:()=>{Te(Array.from(Ae))},onSessionSelect:e=>{Gn(e)},onConfirmDeleteSession:e=>{Te([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:yi,getActivityState:vi,getRowAriaLabel:xi,renderRowContent:Ci,labels:gi}),(0,Y.jsxs)(`div`,{ref:Vt,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden xl:flex-row`,children:[(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:qi}),Ai?(0,Y.jsxs)(Y.Fragment,{children:[Li,Mi?(0,Y.jsx)(qpe,{snapshot:Ve,isLoading:Ge,desktopWidth:Ze,onClose:cr,ref:Ut,actions:Ve?{onCreateTickets:Yn,onImplementInChat:()=>{Xn()},onExport:()=>{Zn()},isCreatingTickets:nt,isImplementingInChat:it,isExporting:ot,hasExistingTicketsFromSnapshot:ut,unavailableReason:Wr,implementInChatUnavailableReason:Ve.bundle_groups.length>1?t7(`actions.implementInChatMultiBundleUnavailable`):null}:void 0,review:Ii}):null]}):null]}),Ji,Yi,Xi]})},O7=()=>({hasRunning:!1,hasFinishedUnseen:!1,hasErrorUnseen:!1}),k7=()=>({board:O7(),chat:O7(),spec:O7(),memory:O7()}),A7=(e,t)=>{let n=e[t];return!n.hasFinishedUnseen&&!n.hasErrorUnseen?e:{...e,[t]:{...n,hasFinishedUnseen:!1,hasErrorUnseen:!1}}},mme=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}),j7=e=>e.hasErrorUnseen?`error`:e.hasRunning?`running`:e.hasFinishedUnseen?`finished`:null,hme=(e,t)=>t?null:j7(e),M7=320,gme=.7,_me=28,vme=6,yme=(e,t)=>{let n=Math.max(M7,Math.round(t*gme));return Math.max(M7,Math.min(n,Math.round(e)))},bme=(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},xme=(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},Sme=(e,t)=>{if(t.type===`reset`)return k7();if(t.type===`mark-workspace-visible`)return A7(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}},Cme=({activeProjectId:e,onActivity:t})=>{let{tickets:n}=E8(),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},wme=({activeProjectId:e,onActivity:t})=>{let n=bq(),[r,i]=(0,p.useState)([]),a=(0,p.useRef)(new Map);return(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController;return(async()=>{try{let n=await CM(e,t.signal);if(t.signal.aborted)return;i(n)}catch(e){Xe(e)}})(),()=>{t.abort()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=ax(()=>{document.visibilityState===`visible`&&CM(e,t.signal).then(e=>{t.signal.aborted||i(e)}).catch(e=>{Xe(e)})});return()=>{t.abort(),n()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||i(e=>bme(e,t))},r=t=>{!t||t.project_id!==e||i(e=>e.filter(e=>e.id!==t.id))};return n.on(`chat-session:created`,t),n.on(`chat-session:updated`,t),n.on(`chat-session:deleted`,r),()=>{n.off(`chat-session:created`,t),n.off(`chat-session:updated`,t),n.off(`chat-session:deleted`,r)}},[e,n]),(0,p.useEffect)(()=>{let n=a.current,i=new Map,o=[],s=!1;for(let e of r){let t=n.get(e.id)??null,r=e.agent_status??null;t===`running`&&r===`done`&&o.push(e),t===`running`&&r===`error`&&(s=!0),i.set(e.id,r)}a.current=i;for(let e of o)if(e.title){let t=Tfe({projectId:e.project_id,chatSessionId:e.id,agentMessageId:e.agent_message_id});t&&C8({title:`Chat response ready`,body:e.title,key:t,destination:{kind:`chat-session`,projectId:e.project_id,chatSessionId:e.id}})}o.length>0&&e&&$3(e),t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:o.length>0,didError:s})},[e,t,r]),null},Tme=({activeProjectId:e,onActivity:t})=>{let n=bq(),[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 LM(e,t.signal);if(t.signal.aborted)return;i(n)}catch(e){Xe(e)}})(),()=>{t.abort()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=ax(()=>{document.visibilityState===`visible`&&LM(e,t.signal).then(e=>{t.signal.aborted||i(e)}).catch(e=>{Xe(e)})});return()=>{t.abort(),n()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||i(e=>xme(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)if(e.title){let t=Efe({projectId:e.project_id,specSessionId:e.id,agentMessageId:e.agent_message_id,latestSnapshotId:e.latest_snapshot_id});t&&C8({title:`Spec response ready`,body:e.title,key:t,destination:{kind:`spec-session`,projectId:e.project_id,specSessionId:e.id}})}t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:i.length>0,didError:o})},[e,t,r]),null},Eme=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeRun:u,activeTool:d,onRestoreSessionTarget:f,onChatReviewCapabilityChange:m,routedInspectionReviewCapability:h,onPreviewReviewCapabilityChange:g,previewDisplayMode:_=`hidden`,previewPane:v=null,previewPaneWidth:y=480,isPreviewButtonDisabled:b=!1,previewButtonTitle:x,visibleWorkspace:S,onProjectUsageChange:C,onBundlesChange:w,onBundlesLoadingChange:T,onBoardLoadedProjectIdChange:E,onPreviewToggle:D,onPreviewPaneWidthChange:O,onRunStopped:k,onRunStatusChange:A,onWorkspaceActivityChange:j,onWorkspaceActivityEvent:M,pendingWorkspaceNavigation:N=null,onPendingWorkspaceNavigationConsumed:P,routedTicketId:F=null,onRoutedTicketOpen:I,onRoutedTicketClose:L,onRoutedTicketUnavailable:R,routedBundleId:ee=null,routedChatSessionId:te,routedSpecSessionId:z,routedSpecSnapshotId:B,routedInspection:V=null,onRoutedBundleOpen:H,onRoutedBundleClose:U,onRoutedInspectionOpen:ne,onRoutedInspectionModeChange:re,onRoutedInspectionClose:ie,onChatSessionNavigation:ae,onSpecSessionNavigation:oe,onRoutedEntityUnavailable:W,onSpecImplementationChatReady:se,onViewSourceSpec:ce,onNavigateToLifecycleSource:le,onViewMemorySource:ue,onStartChatFromBundle:de,onOpenProjectExecutionSettings:fe,refreshKey:pe=0,boardFilterState:me,onBoardFilterStateChange:he})=>{let ge=(0,p.useRef)(null),_e=(0,p.useRef)(null),ve=(0,p.useRef)(null),ye=(0,p.useRef)(null),be=(0,p.useRef)(!1),xe=(0,p.useRef)(!1),Se=(0,p.useRef)(0),Ce=(0,p.useRef)(y),we=(0,p.useRef)(y),Te=S===`board`||S===`chat`,Ee=v!==null,[De,Oe]=(0,p.useState)(!1),[ke,Ae]=(0,p.useState)(!1),[je,Me]=(0,p.useState)(y),[Ne,Pe]=(0,p.useReducer)(Sme,void 0,k7),Fe=Te&&Ee&&_===`expanded`,Ie=Te&&Ee&&_===`inline`,Le=Te&&Ee&&_===`hidden`&&!ke,G=(Ie||ke)&&!Fe,Re=Fe||G,ze=Te&&Ee&&!Fe,Be=De?je:y,Ve=S!==`chat`||!G,He=e=>{let t=ve.current,n=ye.current,r=be.current;if(t!==null){if(ve.current=null,ye.current=null,be.current=!1,Oe(!1),Ae(!1),e!==null&&_e.current?.hasPointerCapture(e)&&_e.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;O?.(we.current),D?.();return}O?.(we.current)}},Ue=e=>{if(!ge.current)return;let t=ge.current.getBoundingClientRect().width,n=yme(e,t);we.current=n,Me(n)},K=e=>{O&&(Le&&b||(e.preventDefault(),ve.current=e.pointerId,ye.current=Le?`collapsed`:`inline`,be.current=!1,xe.current=!1,Se.current=e.clientX,Ce.current=Le?0:we.current,Oe(!Le),e.currentTarget.setPointerCapture(e.pointerId)))},We=e=>{if(ve.current!==e.pointerId)return;let t=e.clientX-Se.current,n=Ce.current-t;if(ye.current===`collapsed`){if(!be.current&&n<vme)return;be.current||(be.current=!0,xe.current=!0,Ae(!0),Oe(!0))}Ue(n)},Ge=e=>{if(ve.current===e.pointerId){if(ye.current===`inline`||be.current){let t=e.clientX-Se.current;Ue(Ce.current-t)}He(e.pointerId)}},Ke=e=>{ve.current===e.pointerId&&He(e.pointerId)},qe=(0,p.useCallback)((e,t)=>{M?.(e,t),Pe({type:`update-workspace`,workspace:e,activity:t,visibleWorkspace:S})},[M,S]);(0,p.useEffect)(()=>{Pe({type:`reset`})},[e]),(0,p.useEffect)(()=>{S!==`memory`&&Pe({type:`mark-workspace-visible`,workspace:S})},[S]),(0,p.useEffect)(()=>{j?.(Ne)},[j,Ne]),(0,p.useEffect)(()=>{De||(we.current=y),!Ee&&(ve.current=null,ye.current=null,be.current=!1,xe.current=!1,we.current=y)},[Ee,De,y]);let q=()=>{if(xe.current){xe.current=!1;return}b||D?.()},Je=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),q())},Ye=(r=!1)=>(0,Y.jsx)(Ffe,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,activeRun:u,activeTool:d,inspectionOnly:r,onPreviewReviewCapabilityChange:r?void 0:g,onRunStopped:k,onRunStatusChange:A,onViewSourceSpec:ce,onNavigateToLifecycleSource:le,onStartChatFromBundle:de,onOpenProjectExecutionSettings:fe,refreshKey:pe,boardFilterState:me,onBoardFilterStateChange:he,onInitialTicketNavigationUnavailable:R,routedTicketId:F,onTicketOpen:I,onTicketClose:L,routedBundleId:ee,routedInspection:V,routedInspectionReviewCapability:r&&S===`chat`?h:void 0,onBundleOpen:H,onBundleClose:U,onInspectionOpen:ne,onInspectionModeChange:re,onInspectionClose:ie,onInspectionUnavailable:W,initialImportedDraft:N?.workspace===`board`&&`issueDraft`in N?N.draft:null,onInitialImportedDraftConsumed:P});return(0,Y.jsx)(jfe,{activeProjectId:e,refreshKey:pe,onLoadedProjectIdChange:E,onProjectUsageChange:C,onBundlesChange:w,onBundlesLoadingChange:T,children:(0,Y.jsxs)(`div`,{ref:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(Cme,{activeProjectId:e,onActivity:e=>{qe(`board`,e)}}),(0,Y.jsx)(wme,{activeProjectId:e,onActivity:e=>{qe(`chat`,e)}}),(0,Y.jsx)(Tme,{activeProjectId:e,onActivity:e=>{qe(`spec`,e)}}),S===`spec`?(0,Y.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,Y.jsx)(pme,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,onRestoreSessionTarget:f,activeTool:d,routedSpecSessionId:z,routedSpecSnapshotId:B,initialIssueDraft:N?.workspace===`spec`&&`issueDraft`in N?N.draft:null,onRoutedSpecNavigationUnavailable:W,onSessionNavigation:oe,onInitialIssueDraftConsumed:P,onImplementInChat:se,onNavigateToLifecycleSource:le})}):S===`memory`?(0,Y.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,Y.jsx)(Spe,{activeProject:t,onNavigateToSource:ue})}):(0,Y.jsxs)(`div`,{id:S===`chat`?`project-workspace-panel-chat`:`project-workspace-panel-board`,role:`tabpanel`,"aria-labelledby":S===`chat`?`project-workspace-tab-chat`:`project-workspace-tab-board`,className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:S===`chat`?(0,Y.jsx)(bpe,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeTool:d,routedChatSessionId:te,initialDraftOpen:N?.workspace===`chat`&&`startNewDraft`in N,onInitialDraftOpenConsumed:P,initialSpecDraft:N?.workspace===`chat`&&`draft`in N?{text:N.draftText,specSessionId:N.specSessionId,specSnapshotId:N.specSnapshotId}:null,onInitialSpecDraftConsumed:P,onRoutedChatNavigationUnavailable:W,onSessionNavigation:ae,onViewSourceSpec:ce,onNavigateToLifecycleSource:le,isExternallyResizing:De,onRestoreSessionTarget:f,onReviewCapabilityChange:m,showChangesPanel:Ve}):Ye()}),[ze?(0,Y.jsx)(vv,{content:b?x??`Preview unavailable`:`Open preview`,disabled:!Le,side:`left`,children:(0,Y.jsx)(`div`,{"aria-label":Le?x??`Show preview`:`Resize preview pane`,"aria-orientation":Le?void 0:`vertical`,className:Le?`group flex shrink-0 touch-none select-none items-center justify-center border-l border-border/70 bg-background/90 transition-colors ${b?`cursor-not-allowed text-muted-foreground/60`:`cursor-col-resize text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`:`group flex w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 ${De?`bg-background`:``}`,"data-preview-divider":`true`,"data-testid":Le?`collapsed-preview-rail`:void 0,onLostPointerCapture:Ke,onPointerCancel:Ge,onPointerDown:K,onPointerMove:We,onPointerUp:Ge,onClick:Le?q:void 0,onKeyDown:Le?Je:void 0,ref:_e,role:Le?`button`:`separator`,style:Le?{width:`${_me}px`}:void 0,tabIndex:Le?b?-1:0:void 0,children:Le?(0,Y.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,Y.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,Y.jsx)(xpe,{className:`h-3 w-3 shrink-0`})}),(0,Y.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,Y.jsx)(`div`,{className:`h-14 w-1.5 rounded-full transition-colors ${De?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`}`})})},`preview-divider`):null,Re?(0,Y.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:`${Be}px`},children:(0,Y.jsx)(`div`,{className:`h-full w-full`,children:v})},`preview-container`):null]]}),S!==`board`&&V&&Ye(!0)]})})},Dme=({isExpanded:e,isVisible:t,project:n,onClose:r,onToggleExpanded:i})=>(0,Y.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,Y.jsx)(L4,{createSession:()=>Doe(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})}),Ome=({activeWorkspace:e,activityByWorkspace:t,className:n,memoryEnabled:r=!1,onWorkspaceChange:i})=>{let{t:a}=K(`common`,{keyPrefix:`workspaceTabs`}),o=r?[`board`,`chat`,`spec`,`memory`]:[`board`,`chat`,`spec`],s={board:a(`board`),chat:a(`chat`),spec:a(`spec`),memory:a(`memory`)};return(0,Y.jsx)(`div`,{className:Z(`min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,n),children:(0,Y.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=hme(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,Y.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,Y.jsxs)(`span`,{className:`inline-flex items-center gap-2 whitespace-nowrap`,children:[(0,Y.jsx)(`span`,{children:s[n]}),(0,Y.jsx)(tb,{state:a,className:`mt-0`})]})},n)})})})},N7=32,kme=5.5,Ame=2,jme=24,Mme=8,P7=new Map,Nme={running:{fill:`#fcd34d`,stroke:`#f59e0b`},finished:{fill:`#34d399`,stroke:`#059669`},error:{fill:`#fb7185`,stroke:`#e11d48`}},F7=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),I7=e=>{if(!e)return null;let t=e.trim().match(/^([0-9]+(?:\.[0-9]+)?)/);return t?Number(t[1]):null},L7=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=I7(n.getAttribute(`width`)),a=I7(n.getAttribute(`height`)),o=r??(i&&a?`0 0 ${i} ${a}`:`0 0 ${N7} ${N7}`);return`<svg ${[Array.from(n.attributes).filter(e=>![`width`,`height`,`viewBox`,`x`,`y`,`preserveAspectRatio`].includes(e.name)).map(e=>`${e.name}="${F7(e.value)}"`).join(` `),`x="0"`,`y="0"`,`width="${N7}"`,`height="${N7}"`,`viewBox="${F7(o)}"`,`preserveAspectRatio="xMidYMid meet"`].filter(e=>e.length>0).join(` `)}>${n.innerHTML}</svg>`},Pme=async e=>{if(!e)return null;let t=P7.get(e);if(t)return t;let n=(async()=>{try{if(e.startsWith(`data:image/svg+xml,`))return L7(decodeURIComponent(e.slice(19)));if(e.startsWith(`data:image/svg+xml;base64,`))return L7(atob(e.slice(26)));let t=await fetch(e);return t.ok?L7(await t.text()):null}catch{return null}})();return P7.set(e,n),n},Fme=async(e,t)=>{let{fill:n,stroke:r}=Nme[e],i=await Pme(t);return i?[`<svg xmlns="http://www.w3.org/2000/svg" width="${N7}" height="${N7}" viewBox="0 0 ${N7} ${N7}">`,i,`<circle cx="${jme}" cy="${Mme}" r="${kme}" fill="${n}" stroke="${r}" stroke-width="${Ame}"/>`,`</svg>`].join(``):null},Ime=async(e,t)=>{if(!e)return t;let n=await Fme(e,t);return n?`data:image/svg+xml,${encodeURIComponent(n)}`:t},Lme=()=>{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},R7=({defaultHref:e,state:t})=>{let n=Lme(),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}Ime(t,e).then(e=>{if(n.dataset.browserTabActivityRequestId===String(r)){if(e){n.href=e;return}n.removeAttribute(`href`)}})},Rme=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.archonDesktop===!0&&typeof t.modalHasParentEntry==`boolean`&&(t.modalParentDepth===void 0||Number.isInteger(t.modalParentDepth)&&t.modalParentDepth>0)},z7=e=>!Rme(e)||!e.modalHasParentEntry?0:e.modalParentDepth??1,zme=(e=p8)=>{let[t,n]=(0,p.useState)(()=>e.parse(window.location.pathname)),[r,i]=(0,p.useState)(0),a=(0,p.useRef)(!1);(0,p.useEffect)(()=>{a.current||(a.current=!0,t&&e.isModal(t)&&window.history.replaceState({archonDesktop:!0,modalHasParentEntry:!1},``,e.build(t)))},[e,t]),(0,p.useEffect)(()=>{let t=()=>{n(e.parse(window.location.pathname)),i(e=>e+1)};return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let o=(0,p.useCallback)(t=>{let r=e.isModal(t)?z7(window.history.state):0,a={archonDesktop:!0,modalHasParentEntry:r>0,...r>1?{modalParentDepth:r}:{}};window.history.replaceState(a,``,e.build(t)),n(t),i(e=>e+1)},[e]),s=(0,p.useCallback)(t=>{let r=e.isModal(t);window.history.pushState({archonDesktop:!0,modalHasParentEntry:r},``,e.build(t)),n(t),i(e=>e+1)},[e]),c=(0,p.useCallback)(t=>{let r=z7(window.history.state);if(r===0){o(t);return}let a=r>0?r+1:0,s={archonDesktop:!0,modalHasParentEntry:a>0,...a>1?{modalParentDepth:a}:{}};window.history.pushState(s,``,e.build(t)),n(t),i(e=>e+1)},[e,o]);return{closeModal:(0,p.useCallback)((t,n)=>{let r=z7(window.history.state);if(r===1){window.history.back();return}if(r>1){window.history.go(-r);return}let i=e.parent(t),a=n??i;a&&o(a)},[e,o]),navigationVersion:r,push:s,pushModalSibling:c,replace:o,route:t}},B7=(e,t)=>Wb.t(`common:projectFooter.${e}`,t),Bme=1e3,V7=`archon.active-project-id`,H7=`archon.workspace-by-project`,U7=`archon.preview-mode-by-project`,W7=`archon.dismissed-preview-run-context-by-project`,G7=5e3,K7=`archon.preview-pane-width`,q7=`archon.preview-viewport-preset`,J7=`archon.preview-zoom`,Vme=480,Hme=`responsive`,Ume=1,Y7={hasMounted:!1,isOpen:!1,isExpanded:!1},X7=`hidden`,Wme=(0,p.lazy)(()=>iG(()=>Promise.resolve().then(()=>P6).then(e=>({default:e.WorkspaceReviewModal})),void 0)),Gme=(0,p.lazy)(()=>iG(()=>import(`./VerificationDialog-DXoUeYip.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),Kme=(0,p.lazy)(()=>iG(()=>import(`./GitHubActionsDialog-Bo-6r-yS.js`).then(e=>({default:e.GitHubActionsDialog})),__vite__mapDeps([20,3]))),qme=(0,p.lazy)(()=>iG(()=>import(`./ActivityView-nPkZZ0JB.js`).then(e=>({default:e.ActivityView})),[])),Z7=e=>{if(!e)return null;try{return JSON.parse(e)}catch{return null}},Jme=e=>{let t=e.startsWith(`/`)?e.slice(1).split(`/`):[];if(t[0]!==`app`||t[1]!==`projects`||!t[2])return null;try{return decodeURIComponent(t[2])||null}catch{return null}},Yme=e=>e?.kind===`workspace`?e.workspace:e?.kind===`chat-session`?`chat`:e?.kind===`spec-session`||e?.kind===`spec-snapshot`?`spec`:`board`,Q7=e=>{let t=Z7(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]},$7=e=>{let t=Z7(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}]}):[]},Xme=e=>{let t=Z7(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}]}):[]},Zme=e=>{let t=new Set(kw(e)),n=new Set(Aw(e)),r=new Set(Bne(e)),i=new Set(Vne(e));return{name:e.name,repoPath:e.repo_path,buildExecutionProvider:e.build_execution_provider??`host`,linkedProjectIds:e.linked_project_ids,runSetup:Q7(e.run_setup),runServices:$7(e.run_services),checkDefinitions:Ow(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),autoFix:i.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??``,reviewerModel:e.reviewer_model??``,reviewerVariant:e.reviewer_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:Xme(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}},e9=e=>{let t=e.previewServiceName?.trim()||null,n=e.previewPath?.trim()||``,r=n===``||n===`/`?null:n,i=t||r||e.previewCapabilityMode===`force_web`||e.previewCapabilityMode===`force_disabled`?e.previewCapabilityMode??`auto`:null;return{name:e.name,repo_path:e.repoPath,build_execution_provider:e.buildExecutionProvider??`host`,linked_project_ids:e.linkedProjectIds,run_setup:e.runSetup.length>0?e.runSetup:null,run_services:e.runServices.length>0?e.runServices.map(e=>({...e.name?{name:e.name}:{},cmd:e.cmd,...e.cwd?{cwd:e.cwd}:{}})):null,check_definitions:(e.checkDefinitions??[]).map(e=>e.category===`test`?{id:e.id,name:e.name,category:`test`,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs),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)),auto_fix_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.autoFix).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),run_ide:e.runIde||null,preview_service_name:t,preview_path:r,preview_capability_mode:i,helper_model:e.helperModel||null,helper_variant:e.helperModel&&e.helperVariant||null,...e.reviewerModel===void 0?{}:{reviewer_model:e.reviewerModel||null,reviewer_variant:e.reviewerModel&&e.reviewerVariant||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}},Qme=e=>e?Q7(e.run_setup).length>0||$7(e.run_services).length>0||(e.run_ide?.trim().length??0)>0:!1,t9=(e,t,n)=>`${e} ${e===1?t:n}`,$me=e=>{if(!e.repo_path_locked)return null;let t=[];return e.ticket_count>0&&t.push(t9(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&t.push(t9(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 `)}.`},ehe=(e,t)=>{if(t.length<=1)return`Keep at least one project in Archon.`;let n=[];e.ticket_count>0&&n.push(t9(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&n.push(t9(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(t9(r,`project links to it`,`projects link to it`)),n.length===0?null:`This project can't be deleted while ${n.join(` and `)}.`},the=(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},nhe=(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}),n9=e=>({projectId:e,branch:null,status:`loading`,ahead:0,behind:0,hasUpstream:!1,canPull:!1,diffStats:null}),r9=(e,t)=>t?e[t]??Y7:Y7,i9=(e,t)=>t?e[t]??X7:X7,rhe=()=>{let e=window.localStorage.getItem(K7),t=Number(e);return Number.isFinite(t)&&t>=320?t:Vme},ihe=()=>{let e=window.localStorage.getItem(q7);return e===`phone`||e===`tablet`||e===`laptop`||e===`responsive`?e:Hme},ahe=()=>{let e=Number(window.localStorage.getItem(J7));return Number.isFinite(e)&&e>0?e:Ume},ohe=()=>{let e=Z7(window.localStorage.getItem(H7));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]]:[]))},she=()=>{let e=Z7(window.localStorage.getItem(U7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>e===`hidden`||e===`inline`||e===`expanded`))},che=()=>{let e=Z7(window.localStorage.getItem(W7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`||e===null))},a9=e=>!!e?.preview_service_name?.trim()&&e?.preview_capability_mode!==`force_disabled`,lhe=({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)},uhe=({activeRun:e,project:t,projectId:n})=>!e||!n?null:e.kind===`ticket`?e.project_id===n?e:null:lhe({activeRun:e,project:t})?e:null,o9=`Project root has uncommitted changes. Confirm branch switch to continue.`,dhe=({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,fhe=()=>{let e=zme(),{closeModal:t,navigationVersion:n,push:r,pushModalSibling:i,replace:a,route:o}=e,[s,c]=(0,p.useState)(`opencode`),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)([]),[m,h]=(0,p.useState)(()=>window.localStorage.getItem(V7)),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(null),[S,C]=(0,p.useState)({}),[w,T]=(0,p.useState)({}),[E,D]=(0,p.useState)({}),[O,k]=(0,p.useState)({}),[A,j]=(0,p.useState)({}),[M,N]=(0,p.useState)(she),[P,F]=(0,p.useState)(che),[I,L]=(0,p.useState)(rhe),[R,ee]=(0,p.useState)(ihe),[te,z]=(0,p.useState)(ahe),[B,V]=(0,p.useState)(null),[H,U]=(0,p.useState)([]),[ne,re]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(``),[oe,W]=(0,p.useState)(``),[se,ce]=(0,p.useState)(!1),[le,ue]=(0,p.useState)(null),[de,fe]=(0,p.useState)(`general`),[pe,me]=(0,p.useState)(null),[he,ge]=(0,p.useState)(!1),[_e,ve]=(0,p.useState)({}),[ye,be]=(0,p.useState)(ohe),[xe,Se]=(0,p.useState)(null),[Ce,we]=(0,p.useState)(()=>k7()),[Te,Ee]=(0,p.useState)(()=>O7()),[De,Oe]=(0,p.useState)(0),[ke,Ae]=(0,p.useState)(()=>({query:``,hideStaleTickets:!1,hideBundlesWithPullRequests:!1})),[je,Me]=(0,p.useState)(null),[Ne,Pe]=(0,p.useState)(null),[Fe,Ie]=(0,p.useState)({}),[Le,G]=(0,p.useState)({}),[Re,ze]=(0,p.useState)({}),[Be,Ve]=(0,p.useState)({}),[He,Ue]=(0,p.useState)(!1),[K,We]=(0,p.useState)(!1),[Ge,qe]=(0,p.useState)(!1),[q,Je]=(0,p.useState)(!1),[Ye,Ze]=(0,p.useState)(!1),[Qe,J]=(0,p.useState)(!1),[$e,et]=(0,p.useState)(`idle`),[tt,nt]=(0,p.useState)(0),[rt,it]=(0,p.useState)(!1),{isGitHubConnected:at,defaultBaseBranch:st}=vw(m),[ct,lt]=(0,p.useState)(null),ut=(0,p.useRef)(null),dt=(0,p.useRef)(null),ft=(0,p.useRef)(null),pt=(0,p.useRef)(-1),mt=(0,p.useRef)(!1),ht=(0,p.useRef)(0),gt=(0,p.useRef)(window.localStorage.getItem(V7)),X=d.find(e=>e.id===m)??null,vt=!!X?.memory_enabled,yt=m?ye[m]??`board`:`board`,bt=yt===`memory`?vt?`memory`:`board`:yt,xt=o?.projectId??Jme(window.location.pathname),St=xt?d.find(e=>e.id===xt)??null:null,Ct=o?.kind===`repository-inspection`?o:null,wt=o?.kind===`workspace`&&o.workspace===`memory`&&St?.memory_enabled!==!0,Tt=$e===`error`,Et=!!(o&&St&&m!==o.projectId),Dt=se&&window.location.pathname.startsWith(`/app`)&&(!o||!St||wt||Qe),Ot=d.find(e=>e.id===gt.current)??null,kt=d[0]??null,At=(0,p.useCallback)(t=>{if(!m)return;be(e=>({...e,[m]:t.workspace})),we(e=>A7(e,t.workspace));let n=t.workspace===`board`?{kind:`ticket`,projectId:m,ticketId:t.ticketId}:t.workspace===`chat`?{kind:`chat-session`,projectId:m,chatSessionId:t.chatSessionId}:t.specSnapshotId?{kind:`spec-snapshot`,projectId:m,specSessionId:t.specSessionId,specSnapshotId:t.specSnapshotId}:{kind:`spec-session`,projectId:m,specSessionId:t.specSessionId};e.push(n)},[m,e]),jt=(0,p.useCallback)(t=>{m&&(be(e=>({...e,[m]:t.workspace})),we(e=>A7(e,t.workspace)),Se(t),e.push({kind:`workspace`,projectId:m,workspace:t.workspace}))},[m,e]),Mt=(0,p.useCallback)((e,t,n)=>{m&&jt({workspace:`chat`,draft:!0,draftText:e,specSessionId:t,specSnapshotId:n})},[m,jt]),Nt=(0,p.useCallback)((e,t)=>{At({workspace:`spec`,specSessionId:e,specSnapshotId:t})},[At]),Pt=(0,p.useCallback)(e=>{if(e.source_available){if(e.ticket_id){At({workspace:`board`,ticketId:e.ticket_id});return}if(e.chat_session_id){At({workspace:`chat`,chatSessionId:e.chat_session_id});return}e.spec_session_id&&At({workspace:`spec`,specSessionId:e.spec_session_id})}},[At]),It=(0,p.useCallback)(e=>{if(e.available){if(qe(!1),e.kind===`ticket`){At({workspace:`board`,ticketId:e.id});return}if(e.kind===`chat_session`){At({workspace:`chat`,chatSessionId:e.id});return}e.kind===`spec_session`&&At({workspace:`spec`,specSessionId:e.id})}},[At]),Lt=(0,p.useCallback)(e=>{jt({workspace:`spec`,issueDraft:!0,draft:e})},[jt]),Rt=(0,p.useCallback)(e=>{jt({workspace:`board`,issueDraft:!0,draft:e})},[jt]),Bt=(0,p.useCallback)(()=>{Se(null)},[]),Vt=X!==null,Ht=Qme(X),Ut=!!X?.run_ide?.trim(),Gt=m!==null&&v===m,Kt=m!==null&&(!Ht||b===m),Jt=m?S[m]??n9(m):null,Yt=m?w[m]??null:null,Xt=m?!!E[m]:!1,Zt=m?O[m]??null:null,Qt=(0,p.useMemo)(()=>m?Fe[m]??[]:[],[m,Fe]),$t=m?!!Le[m]:!1,en=m?Re[m]??{current_branch:null,default_branch:null,previous_branch:null}:{current_branch:null,default_branch:null,previous_branch:null},an=m?!!Be[m]:!1,on=m?A[m]??null:null,sn=i9(M,m),cn=sn!==`hidden`,ln=uhe({activeRun:g,project:X,projectId:m}),un=ln?.context_key??null,dn=m?P[m]??null:null,fn=a9(X),pn=un===B,mn=(0,p.useMemo)(()=>mme(Ce),[Ce]),hn=(0,p.useMemo)(()=>j7({hasRunning:mn.hasRunning,hasFinishedUnseen:Te.hasFinishedUnseen,hasErrorUnseen:Te.hasErrorUnseen}),[mn.hasRunning,Te.hasErrorUnseen,Te.hasFinishedUnseen]);(0,p.useEffect)(()=>{Me(null),Pe(null),dt.current=null},[m]),(0,p.useEffect)(()=>{Pe(null)},[bt]),(0,p.useEffect)(()=>{cn||(dt.current=null)},[cn]),(0,p.useEffect)(()=>{let e=je?.target?.kind??null;if(e===`ticket`||e===`bundle`){dt.current=je;return}(bt===`board`||!cn)&&(dt.current=je)},[cn,je,bt]),(0,p.useEffect)(()=>{we(k7())},[m]),(0,p.useEffect)(()=>{Ee(O7())},[m]),(0,p.useEffect)(()=>{if(!m||dx(m))return;let e=new AbortController;return ot(m,e.signal).then(e=>{ux(m,e.connections)}).catch(e=>{Xe(e)}),()=>{e.abort()}},[m]);let gn=(0,p.useCallback)((e,t)=>{document.visibilityState!==`visible`&&(!t.didFinish&&!t.didError||Ee(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`&&Ee(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)(()=>(ut.current===null&&(ut.current=document.querySelector(`link[rel="icon"]`)?.getAttribute(`href`)??`/favicon.svg`),R7({defaultHref:ut.current,state:hn}),()=>{R7({defaultHref:ut.current,state:null})}),[hn]);let _n=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r}=t;try{let t=await $n(e,r,{refreshRemote:n});if(r?.aborted)return;C(n=>({...n,[e]:nhe(e,t)}))}catch(t){if(Xe(t))return;if(t instanceof Ke&&t.status===404){C(t=>({...t,[e]:{...n9(e),status:`unknown`}}));return}C(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}}))}},[]),vn=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r,suppressLoading:i=!1}=t;i||D(t=>({...t,[e]:!0}));try{let t=await ur(e,{refreshRemote:n,signal:r});if(r?.aborted)return;T(n=>({...n,[e]:t}))}catch(t){if(Xe(t))return;t instanceof Ke&&t.status===404&&T(t=>({...t,[e]:null}))}finally{!r?.aborted&&!i&&D(t=>({...t,[e]:!1}))}},[]),yn=(0,p.useCallback)((e,t)=>{k(n=>({...n,[e]:t}))},[]),bn=(0,p.useCallback)(async(e,t)=>{T(n=>({...n,[e.id]:t})),e.active_target_kind!==`bundle`&&await _n(e.id),$3(e.id)},[_n]);(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let{tool:t}=await zr(e.signal);c(t)}catch(e){Xe(e)}finally{e.signal.aborted||u(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!se||d.length>0&&le===null||ne)return;let e=new AbortController;return(async()=>{try{U(await Rr(`opencode`,e.signal))}catch(e){Xe(e)||U(e=>e)}finally{e.signal.aborted||re(!0)}})(),()=>{e.abort()}},[ne,le,d.length,se]),(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let t=await Vn(e.signal);if(e.signal.aborted)return;f(t)}catch(e){Xe(e)||f([])}finally{e.signal.aborted||ce(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!se||pt.current===n)return;if(pt.current=n,J(!1),et(`idle`),Se(e=>e&&o?.kind===`workspace`&&o.workspace===e.workspace?e:null),qe(!1),me(null),window.location.pathname===`/`){let e=d.find(e=>e.id===gt.current)??d[0]??null;if(!e){h(null);return}let t=ye[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;h(e.id),be(t=>({...t,[e.id]:n})),a({kind:`workspace`,projectId:e.id,workspace:n});return}if(!o)return;let e=d.find(e=>e.id===o.projectId);if(!e)return;h(e.id);let t=o.kind===`workspace`?o.workspace:o.kind===`ticket`||o.kind===`bundle`?`board`:o.kind===`repository-inspection`||o.kind===`bundle-inspection`||o.kind===`ticket-inspection`?ye[e.id]??`board`:o.kind===`chat-session`?`chat`:o.kind===`spec-session`||o.kind===`spec-snapshot`?`spec`:ye[e.id]??`board`;be(n=>({...n,[e.id]:t})),mt.current&&o.kind!==`checks`&&(mt.current=!1,qe(!0)),o.kind===`activity-run`&&qe(!0),m8(o)!==window.location.pathname&&a(o)},[o,n,d,se,a,ye]),(0,p.useEffect)(()=>{if(o?.kind!==`checks`||!se)return;let e=d.find(e=>e.id===o.projectId);if(!e)return;let t=new AbortController,n=++ht.current;return et(`loading`),qt(e.id,o.batchRunId,t.signal).then(({batch:r})=>{t.signal.aborted||ht.current!==n||(me({projectId:e.id,targetKind:r.target_kind,targetBundleId:r.target_bundle_id,targetLabel:r.target_label??e.name,definitions:r.selected_definition_snapshots,requiredDefinitionIds:[],preReviewDefinitionIds:[]}),et(`idle`))}).catch(e=>{if(!Xe(e)){if(e instanceof Ke&&e.status===404){J(!0);return}et(`error`)}}),()=>t.abort()},[o,d,se,tt]),(0,p.useEffect)(()=>{if(it(!1),!m||!at||Ye)return;let e=new AbortController,t=async()=>{try{let t=await Wt(m,e.signal);e.signal.aborted||it(t.activeCount>0)}catch(e){Xe(e)}};t();let n=window.setInterval(()=>{t()},G7);return()=>{e.abort(),window.clearInterval(n)}},[m,Ye,at]),(0,p.useEffect)(()=>{if(se){if(m){gt.current=m,window.localStorage.setItem(V7,m);return}window.localStorage.removeItem(V7)}},[m,se]),(0,p.useEffect)(()=>{window.localStorage.setItem(H7,JSON.stringify(ye))},[ye]),(0,p.useEffect)(()=>{window.localStorage.setItem(U7,JSON.stringify(M))},[M]),(0,p.useEffect)(()=>{window.localStorage.setItem(W7,JSON.stringify(P))},[P]),(0,p.useEffect)(()=>{C(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),T(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),D(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[d]),(0,p.useEffect)(()=>{ve(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[d]),(0,p.useEffect)(()=>{let e=new Set(d.map(e=>e.id));Ie(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),G(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),ze(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),Ve(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t))))},[d]),(0,p.useEffect)(()=>{se&&(j(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),N(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),F(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}))},[d,se]),(0,p.useEffect)(()=>{se&&be(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[d,se]),(0,p.useEffect)(()=>{if(!se||!m||!Vt)return;let e=!1,t=null,n=null;C(e=>e[m]?e:{...e,[m]:n9(m)});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([_n(m,{refreshRemote:r,signal:a.signal}),vn(m,{refreshRemote:r,signal:a.signal})])}catch{if(e||a.signal.aborted)return}finally{t===a&&(t=null,n=null)}};r(!1);let i=ax(()=>{document.visibilityState===`visible`&&r(!1)});return()=>{e=!0,t?.abort(),i()}},[m,Vt,se,_n,vn]),(0,p.useEffect)(()=>{if(m)return e6(e=>{e===m&&(_n(e),vn(e))})},[m,_n,vn]),(0,p.useEffect)(()=>{if(!m||!Vt)return;let e=Yt?.operation_state??`idle`;if(!(Zt===`rebase`||e!==`idle`))return;let t=!1,n=null,r=null,i=async()=>{r?.abort(),r=new AbortController;try{await vn(m,{signal:r.signal,suppressLoading:!0})}catch{}finally{t||(n=window.setTimeout(()=>{i()},Bme))}};return i(),()=>{t=!0,r?.abort(),n!==null&&window.clearTimeout(n)}},[Zt,m,Yt?.operation_state,Vt,vn]);let xn=(0,p.useCallback)(async e=>{let t=m;if(!t){_(null),x(null);return}try{let n=await tn(t,e);e?.aborted||(_(n.active_run),x(t))}catch(e){Xe(e)}},[m]),Sn=(0,p.useCallback)(async e=>{let t=m;if(t)try{let n=await zt(t,e);e?.aborted||j(e=>({...e,[t]:n}))}catch(e){Xe(e)}},[m]);(0,p.useEffect)(()=>{if(!se)return;if(!Ht){_(null),x(null);return}if(!Gt)return;let e=new AbortController;x(null),xn(e.signal);let t=window.setInterval(()=>{xn(e.signal)},G7),n=ax(()=>{document.visibilityState===`visible`&&xn(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[Gt,Ht,se,xn]),(0,p.useEffect)(()=>{if(!se||!m||!Gt||!fn)return;let e=new AbortController;Sn(e.signal);let t=window.setInterval(()=>{Sn(e.signal)},G7),n=ax(()=>{document.visibilityState===`visible`&&Sn(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[m,Gt,fn,se,Sn]),(0,p.useEffect)(()=>{window.localStorage.setItem(K7,String(I))},[I]),(0,p.useEffect)(()=>{window.localStorage.setItem(q7,R)},[R]),(0,p.useEffect)(()=>{window.localStorage.setItem(J7,String(te))},[te]),(0,p.useEffect)(()=>{m&&un&&F(e=>{let t=e[m]??null;return!t||t===un?e:{...e,[m]:null}})},[m,un]),(0,p.useEffect)(()=>{!m||!ln||!a9(X)||dn!==ln.context_key&&N(e=>i9(e,m)===`hidden`?{...e,[m]:`inline`}:e)},[X,m,dn,ln]);let Cn=async e=>{try{c((await Br(e)).tool)}catch{}},wn=(0,p.useCallback)(e=>{f(t=>t.map(t=>t.id===e.id?e:t))},[]),Tn=(0,p.useCallback)((e,t)=>{Ie(n=>{let r=[t,...(n[e]??[]).filter(e=>e.id!==t.id)];return{...n,[e]:r}})},[]),En=(0,p.useCallback)(async e=>{Ve(t=>({...t,[e]:!0}));try{let t=await qn(e);ze(n=>({...n,[e]:t}))}catch(e){$.error(e instanceof Ke?e.message:`Unable to load the project target options right now.`,{id:`project-target-selector-load-error`})}finally{Ve(t=>({...t,[e]:!1}))}},[]),Dn=async e=>{try{let t=await Hn(e9(e));return f(e=>[...e,t]),h(t.id),a({kind:`workspace`,projectId:t.id,workspace:`board`}),ue(null),null}catch(e){return e instanceof Ke?e.message:`Unable to create the project right now.`}},On=async e=>{if(!X)return`Select a project before editing settings.`;try{let t=await Un(X.id,e9(e));return f(e=>e.map(e=>e.id===t.id?t:e)),Oe(e=>e+1),ue(null),null}catch(e){return e instanceof Ke?e.message:`Unable to update the project right now.`}},kn=async()=>{if(!X)return`Select a project before deleting it.`;try{await Gn(X.id);let e=d.filter(e=>e.id!==X.id);return f(e),h(e[0]?.id??null),e[0]&&a({kind:`workspace`,projectId:e[0].id,workspace:`board`}),ue(null),null}catch(e){return e instanceof Ke?e.message:`Unable to delete the project right now.`}},jn=(0,p.useCallback)(e=>{f(t=>t.map(t=>the(t,e)))},[]),Mn=(0,p.useCallback)((e,t)=>{e&&Ie(n=>({...n,[e]:t}))},[]),Nn=(0,p.useCallback)((e,t)=>{e&&G(n=>({...n,[e]:t}))},[]),Pn=async(e,t,n)=>await Yn({repo_path:e,helper_model:t||null,helper_variant:t&&n||null}),Fn=async()=>(await Xn()).repo_path,In=(0,p.useCallback)(async e=>{let t=await Zn({repo_path:e});return{valid:t.valid,repoRoot:t.repo_root,error:t.error,willInitialize:t.will_initialize,hasInitialCommit:t.has_initial_commit}},[]),Ln=(0,p.useCallback)(async()=>{if(!(!X||he)){ge(!0);try{let e=await Wn(X.id);f(t=>t.map(t=>t.id===e.id?e:t)),$.success(`Initial commit created.`,{id:`project-initial-commit-success`}),_n(e.id),vn(e.id)}catch(e){$.error(e instanceof Ke?e.message:`Unable to create the initial commit right now.`,{id:`project-initial-commit-error`})}finally{ge(!1)}}},[X,he,_n,vn]),Rn=(0,p.useCallback)((e,t)=>{N(t=>({...t,[e]:`hidden`})),t&&F(n=>({...n,[e]:t}))},[]),zn=(0,p.useCallback)(()=>{m&&Rn(m,un)},[m,Rn,un]),Bn=(0,p.useCallback)(e=>{m&&(N(e=>({...e,[m]:`hidden`})),e&&_(t=>t?.context_key===e?null:t))},[m]),Qn=(0,p.useCallback)(async()=>{if(!ln||B===ln.context_key)return;let{context_key:e}=ln;V(e);try{ln.kind===`ticket`?await An(ln.ticket_id,ln.project_id):_((await rn(ln.project_id)).active_run),Bn(e),await Promise.all([xn(),Sn()])}catch(e){$.error(e instanceof Ke?e.message:`Unable to stop the preview run right now.`,{id:`app-preview-run-stop-error`})}finally{V(t=>t===e?null:t)}},[Bn,ln,Sn,xn,B]),rr=(0,p.useCallback)(e=>{!e||!m||En(m)},[m,En]),ir=(0,p.useCallback)(e=>new Promise(t=>{ft.current=t,lt(e)}),[]),ar=(0,p.useCallback)(e=>{let t=ft.current;ft.current=null,lt(null),t?.(e)},[]),or=(0,p.useCallback)(async e=>{if(!X||!m)throw Error(`Select a project first.`);if(!dhe({activeProject:X,activeProjectBranchState:Jt,nextTarget:e})||!g||g.kind!==`project`||g.project_id!==X.id)return!0;if(!await ir({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=g.context_key,t=await rn(X.id);return Bn(e),_(t.active_run),await Sn(),!0}catch(e){return $.error(e instanceof Ke?e.message:`Unable to stop the project run right now.`,{id:`project-target-switch-stop-run-error`}),!1}},[X,Jt,m,g,Bn,Sn,ir]),sr=(0,p.useCallback)(async e=>{if(!m)throw Error(`Select a project first.`);return await or({kind:`bundle`,bundleId:e})?(wn(await Jn(m,{kind:`bundle`,bundle_id:e})),T(e=>({...e,[m]:null})),await Promise.all([_n(m),vn(m)]),!0):!1},[m,or,_n,vn,wn]),cr=(0,p.useCallback)(async(e,t={})=>{if(!m)throw Error(`Select a project first.`);if(!await or({kind:`repo_root`,branch:e}))return!1;let n=n=>Jn(m,{kind:`repo_root`,...e?{branch:e}:{},...t.createBranch===!1?{create_branch:!1}:{},...n?{confirm_dirty_switch:!0}:{}}),r;try{r=await n(t.confirmDirtySwitch===!0)}catch(e){if(!t.confirmDirtySwitch&&e instanceof Ke&&e.status===409&&e.message===o9){if(!await ir({title:`Switch repo root branch?`,description:`${o9}\n\nSwitch anyway?`,confirmLabel:`Switch anyway`,cancelLabel:`Keep current branch`}))return!1;r=await n(!0)}else throw e}return wn(r),T(e=>({...e,[m]:null})),await Promise.all([_n(m),vn(m),En(m)]),!0},[m,or,En,_n,vn,wn,ir]),lr=(0,p.useCallback)(async e=>!e.target_kind||e.target_available===!1?!0:e.target_kind===`bundle`?e.target_bundle_id?await sr(e.target_bundle_id):!1:await cr(e.target_branch_snapshot??null,{createBranch:!1}),[sr,cr]),dr=(0,p.useCallback)(async e=>{m&&await sr(e)&&jt({workspace:`chat`,startNewDraft:!0})},[m,sr,jt]),fr=(0,p.useCallback)(()=>{Ue(!0)},[]),pr=(0,p.useCallback)(()=>{Ue(!1)},[]),mr=(0,p.useCallback)(e=>{if(e){sr(e);return}cr(null)},[sr,cr]),hr=(0,p.useCallback)(async e=>{if(!m)throw Error(`Select a project first.`);let t=await _t(m,{name:e,prepare:!0});return Tn(m,t),Oe(e=>e+1),t},[m,Tn]),gr=(0,p.useCallback)(async e=>{if(!m)throw Error(`Select a project first.`);await Ft(m,e),Ie(t=>({...t,[m]:(t[m]??[]).filter(t=>t.id!==e)})),Oe(e=>e+1)},[m]),_r=(0,p.useCallback)(async()=>{if(!X)return;let e=X.active_target_kind??`repo_root`,t=X.active_target_bundle_id??null,n=g?.kind===`project`&&g.project_id===X.id&&(g.target_kind??`repo_root`)===e&&((g.target_kind??`repo_root`)!==`bundle`||g.target_bundle_id===t),r=n?g?.context_key??null:null,i=!n&&a9(X)&&sn===`hidden`;i&&(N(e=>({...e,[X.id]:`inline`})),F(e=>({...e,[X.id]:null})));try{let e=n?await rn(X.id):await nn(X.id);n&&Bn(r),_(e.active_run),Sn()}catch(e){i&&N(e=>({...e,[X.id]:`hidden`})),$.error(e instanceof Ke?e.message:`Unable to update the project run right now.`,{id:`app-project-run-error`})}},[sn,X,g,Bn,Sn]),vr=(0,p.useCallback)(async()=>{if(!(!X||!Ut))try{await Kn(X.id)}catch(e){$.error(e instanceof Error?e.message:`Unable to open the IDE right now.`,{id:`app-project-open-ide-error`})}},[X,Ut]),yr=(0,p.useCallback)(async()=>{if(X){yn(X.id,`pull`);try{let e=await er(X.id);await bn(X,e),$.success(e.behind===0?B7(`branchSynced`):B7(`branchUpdated`),{id:`app-project-pull-success`})}catch(e){$.error(e instanceof Ke?e.message:B7(`syncFallbackError`),{id:`app-project-pull-error`})}finally{yn(X.id,null)}}},[X,bn,yn]),br=(0,p.useCallback)(async()=>{if(!X)return;let e=Yt?.base_branch??null;yn(X.id,`rebase`);try{let t=await tr(X.id);await bn(X,t);let n=t.base_branch??e;$.success(n?B7(`branchRebasedOnto`,{branch:n}):B7(`branchRebased`),{id:`app-project-rebase-success`})}catch(e){await Promise.allSettled([_n(X.id),vn(X.id,{suppressLoading:!0})]),$.error(e instanceof Ke?e.message:B7(`rebaseFallbackError`),{id:`app-project-rebase-error`})}finally{yn(X.id,null)}},[X,Yt?.base_branch,bn,_n,vn,yn]),xr=(0,p.useCallback)(async()=>{if(X){yn(X.id,`abort`);try{await bn(X,await nr(X.id)),$.success(B7(`gitOperationAborted`),{id:`app-project-abort-success`})}catch(e){$.error(e instanceof Ke?e.message:B7(`abortFallbackError`),{id:`app-project-abort-error`})}finally{yn(X.id,null)}}},[X,bn,yn]),Sr=(0,p.useCallback)(e=>{X&&r(X.active_target_kind===`bundle`&&X.active_target_bundle_id?{kind:`bundle-inspection`,projectId:X.id,bundleId:X.active_target_bundle_id,mode:e}:{kind:`repository-inspection`,projectId:X.id,mode:e})},[X,r]),Cr=(0,p.useCallback)(()=>{if(o?.kind!==`repository-inspection`)return;let{projectId:e}=o;t(o,{kind:`workspace`,projectId:e,workspace:`board`}),_n(e),vn(e)},[t,o,_n,vn]),wr=(0,p.useCallback)(()=>{if(!X)return;let e=X.active_target_kind??`repo_root`,t=X.active_target_bundle_id??null,n=e===`bundle`?Qt.find(e=>e.id===t):null,r=n?.required_check_policy;me({projectId:X.id,targetKind:e,targetBundleId:t,targetLabel:n?Gy(n):X.name,definitions:Ow(X),requiredDefinitionIds:r?.required_check_definition_ids??kw(X),preReviewDefinitionIds:r?.pre_review_check_definition_ids??Aw(X)})},[X,Qt]),Tr=(0,p.useCallback)(()=>{me(null),o?.kind===`checks`&&t(o)},[t,o]),Er=(0,p.useCallback)(()=>{qe(!1),me(null),o?.kind===`activity-run`&&t(o)},[t,o]),Dr=(0,p.useCallback)(()=>{J(!0)},[]),Or=(0,p.useCallback)((e,t)=>{if(!m)return;if(e.kind===`check_batch`){qe(!1);let t={kind:`checks`,projectId:m,batchRunId:e.id};o?.kind===`activity-run`?a(t):r(t);return}if(e.kind===`check_attempt`&&t){qe(!1);let n={kind:`checks`,projectId:m,batchRunId:t,attemptRunId:e.id};o?.kind===`activity-run`?a(n):r(n);return}let n={kind:`activity-run`,projectId:m,runId:e.id};o?.kind===`activity-run`?a(n):r(n)},[m,o,r,a]),kr=(0,p.useCallback)((e,t)=>{if(!m)return;let n={kind:`checks`,projectId:m,batchRunId:e,attemptRunId:t};if(o?.kind===`checks`){m8(o)!==m8(n)&&a(n);return}r(n)},[m,o,r,a]),Ar=r9(_e,m),jr=X?Mw(X).length>0:!1,Mr=X?Ow(X).length>0:!1,Nr=bt===`chat`?Ne:null,Pr=dt.current,Fr=Pr?.target?.kind??null,Ir=bt===`chat`?Fr===`ticket`||Fr===`bundle`?{target:Pr?.target??null,canSelect:!1,disabledReason:`This preview belongs to a ticket run. Return to Board to send preview comments.`,promptMode:Pr?.promptMode??null,onPromptModeChange:Pr?.onPromptModeChange??null,isUpdatingPromptMode:Pr?.isUpdatingPromptMode??!1,promptPlaceholder:Pr?.promptPlaceholder??null,promptComposerControls:Pr?.promptComposerControls,promptComposerInlineControls:Pr?.promptComposerInlineControls,submitPrompt:null}:Nr?{target:{kind:`chat_session`,id:Nr.chatSessionId??`draft:${m}`},canSelect:Nr.canSubmitReviewPrompt,disabledReason:Nr.canSubmitReviewPrompt?null:Nr.reviewSubmitDisabledReason??`Wait for the current chat turn to finish before sending preview comments.`,promptMode:Nr.mode,onPromptModeChange:Nr.onModeChange,isUpdatingPromptMode:Nr.isUpdatingMode,promptPlaceholder:Nr.promptPlaceholder,promptComposerControls:Nr.promptComposerControls,promptComposerInlineControls:Nr.promptComposerInlineControls,submitPrompt:Nr.canSubmitReviewPrompt?Nr.submitPrompt:null}:{target:null,canSelect:!1,disabledReason:`Select a chat session to send preview comments.`,submitPrompt:null}:je,Lr=Nr?.canSubmitReviewPrompt??!1,Vr=bt===`chat`?Nr?Nr.reviewSubmitDisabledReason:`Select a chat session to send review comments.`:Wb.t(`common:workspaceReviewModal.chatRequired`),Hr=(0,p.useCallback)(()=>{m&&ve(e=>{let t=e[m]??Y7;return{...e,[m]:{hasMounted:!0,isOpen:!t.isOpen,isExpanded:t.isExpanded}}})},[m]),Ur=(0,p.useCallback)(e=>{ve(t=>{let n=t[e]??Y7;return!n.hasMounted||!n.isOpen?t:{...t,[e]:Y7}})},[]),Wr=(0,p.useCallback)(e=>{ve(t=>{let n=t[e]??Y7;return{...t,[e]:{hasMounted:!0,isOpen:n.isOpen,isExpanded:!n.isExpanded}}})},[]),Gr=(0,p.useCallback)(()=>{fe(`general`),ue(`create`)},[]),Kr=(0,p.useCallback)((e=`general`)=>{fe(e),ue(`edit`)},[]),qr=(0,p.useCallback)(e=>{let t=ye[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;h(e.id),r({kind:`workspace`,projectId:e.id,workspace:n})},[r,ye]),Jr=(0,p.useCallback)(e=>{m&&(o?.kind===`ticket`&&o.ticketId===e||r({kind:`ticket`,projectId:m,ticketId:e}))},[m,o,r]),Yr=(0,p.useCallback)(()=>{o?.kind===`ticket`&&t(o)},[t,o]),Xr=(0,p.useCallback)(e=>{m&&(o?.kind===`bundle`&&o.bundleId===e||r({kind:`bundle`,projectId:m,bundleId:e}))},[m,o,r]),Zr=(0,p.useCallback)(()=>{o?.kind===`bundle`&&t(o)},[t,o]),Qr=(0,p.useCallback)((e,t)=>{m&&r(e.kind===`ticket`?{kind:`ticket-inspection`,projectId:m,ticketId:e.ticketId,mode:t}:{kind:`bundle-inspection`,projectId:m,bundleId:e.bundleId,mode:t})},[m,r]),$r=(0,p.useCallback)(e=>{if(o?.kind===`repository-inspection`){if(o.mode===e)return;i({...o,mode:e});return}if(o?.kind===`ticket-inspection`||o?.kind===`bundle-inspection`){if(o.mode===e)return;i({...o,mode:e})}},[o,i]),ei=(0,p.useCallback)(()=>{o?.kind!==`ticket-inspection`&&o?.kind!==`bundle-inspection`||t(o)},[t,o]),ti=(0,p.useCallback)(e=>{if(!m)return;let t=e?{kind:`chat-session`,projectId:m,chatSessionId:e}:{kind:`workspace`,projectId:m,workspace:`chat`};o&&m8(o)===m8(t)||r(t)},[m,o,r]),ni=(0,p.useCallback)(e=>{if(!m)return;let t=e?{kind:`spec-session`,projectId:m,specSessionId:e}:{kind:`workspace`,projectId:m,workspace:`spec`};o&&m8(o)===m8(t)||r(t)},[m,o,r]),ri=(0,p.useCallback)(()=>{if(m){if(cn){zn();return}N(e=>({...e,[m]:`inline`})),F(e=>({...e,[m]:null}))}},[m,zn,cn]),ii=(0,p.useCallback)(()=>{m&&N(e=>{let t=i9(e,m);return{...e,[m]:t===`expanded`?`inline`:`expanded`}})},[m]),ai=X?X.preview_service_name?.trim()?X.preview_capability_mode===`force_disabled`?`Preview is disabled for this project.`:on?.state===`unsupported`?on.message??`Preview is unavailable for this project.`:cn?`Hide preview`:`Show preview`:`Choose a named preview service in project settings first.`:`Select a project first.`,oi=!X||!X.preview_service_name?.trim()||X.preview_capability_mode===`force_disabled`||on?.state===`unsupported`,si=X&&X.preview_service_name?.trim()?(0,Y.jsx)(SM,{project:X,mode:sn===`expanded`?`expanded`:`inline`,status:on,viewportPreset:R,zoom:te,activeRun:ln,reviewCapability:Ir,isStoppingActiveRun:pn,onHide:zn,onStopActiveRun:()=>{Qn()},onToggleExpanded:ii,onViewportPresetChange:ee,onZoomChange:z}):null;return(0,Y.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,Y.jsx)(rx,{}),d.length>0&&(0,Y.jsx)(`header`,{className:`border-b border-border bg-background/95 px-6 py-3 backdrop-blur`,children:(0,Y.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,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 w-full sm:w-[20rem] sm:min-w-[20rem] sm:max-w-[20rem]`,children:(0,Y.jsx)(Ev,{activeProjectId:m,onCreateProject:Gr,projects:d,onEditProject:()=>Kr(),onProjectChange:e=>{let t=d.find(t=>t.id===e);t&&qr(t)}})}),m&&(0,Y.jsx)(lC,{projectId:m,onStartSpecFromDraft:Lt,onCreateTicketFromDraft:Rt})]})}),(0,Y.jsx)(`div`,{className:`min-w-0 justify-self-end min-[1440px]:col-start-3 min-[1440px]:row-start-1`,children:(0,Y.jsx)(Bb,{activeTool:s,onMobileAccessOpen:()=>We(!0),onOpenActivity:()=>qe(!0),onOpenExecutionRuntimes:()=>Je(!0),onToolChange:Cn,...at?{hasActiveGitHubRuns:rt,onOpenGitHubActions:()=>Ze(!0)}:{}})}),m&&(0,Y.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,Y.jsx)(Ome,{activeWorkspace:bt,activityByWorkspace:Ce,className:`w-fit max-w-full`,memoryEnabled:vt,onWorkspaceChange:e=>{m&&(be(t=>({...t,[m]:e})),we(t=>A7(t,e)),r({kind:`workspace`,projectId:m,workspace:e}))}})})]})}),!se||Et?(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Loading projects...`}):Dt||Tt?(0,Y.jsx)(Sv,{isTransientError:Tt,requestedProjectExists:St!==null,retainedProject:Ot?.id===St?.id?null:Ot,defaultProject:kt,onCreateProject:Gr,onRetry:()=>nt(e=>e+1),onOpenProject:e=>{let t=ye[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;h(e.id),a({kind:`workspace`,projectId:e.id,workspace:n})},onOpenWorkspace:()=>{if(!St)return;let e=Yme(o),t=e===`memory`&&!St.memory_enabled?`board`:e;h(St.id),a({kind:`workspace`,projectId:St.id,workspace:t})}}):d.length===0?(0,Y.jsx)(xv,{activeTool:s,availableHelperModels:H,helperModel:ie,helperVariant:oe,isHelperModelsLoaded:ne,isToolLoaded:l,onCreateProject:Gr,onHelperModelChange:e=>{ae(e),W(``)},onHelperVariantChange:W,onToolChange:Cn}):(0,Y.jsxs)(Y.Fragment,{children:[X?.has_initial_commit===!1&&(0,Y.jsx)(vC,{isSubmitting:he,onCreateInitialCommit:()=>{Ln()}}),(0,Y.jsx)(Eme,{activeProjectId:m,activeProject:X,activeProjectBranchState:Jt,targetBundles:Qt,targetBranchSuggestions:en,isTargetBundleLoading:$t,isTargetSelectorLoading:an,onTargetSelectorOpenChange:rr,onSelectBundleTarget:sr,onSelectRepoRootTarget:cr,activeRun:g,activeTool:s,onOpenProjectExecutionSettings:()=>Kr(`execution`),onRestoreSessionTarget:lr,onChatReviewCapabilityChange:Pe,routedInspectionReviewCapability:bt===`chat`?Ne:null,isPreviewButtonDisabled:oi,onPreviewReviewCapabilityChange:Me,onPreviewToggle:ri,onRunStopped:Bn,onWorkspaceActivityChange:we,onWorkspaceActivityEvent:gn,pendingWorkspaceNavigation:xe,onPendingWorkspaceNavigationConsumed:Bt,routedTicketId:o?.kind===`ticket`?o.ticketId:null,onRoutedTicketOpen:Jr,onRoutedTicketClose:Yr,onRoutedTicketUnavailable:Dr,routedBundleId:o?.kind===`bundle`?o.bundleId:null,routedChatSessionId:o?.kind===`chat-session`?o.chatSessionId:void 0,routedSpecSessionId:o?.kind===`spec-session`||o?.kind===`spec-snapshot`?o.specSessionId:void 0,routedSpecSnapshotId:o?.kind===`spec-snapshot`?o.specSnapshotId:void 0,routedInspection:o?.kind===`ticket-inspection`?{target:{kind:`ticket`,ticketId:o.ticketId},mode:o.mode}:o?.kind===`bundle-inspection`?{target:{kind:`bundle`,bundleId:o.bundleId},mode:o.mode}:null,onRoutedBundleOpen:Xr,onRoutedBundleClose:Zr,onRoutedInspectionOpen:Qr,onRoutedInspectionModeChange:$r,onRoutedInspectionClose:ei,onChatSessionNavigation:ti,onSpecSessionNavigation:ni,onRoutedEntityUnavailable:Dr,onSpecImplementationChatReady:Mt,onViewSourceSpec:Nt,onNavigateToLifecycleSource:It,onViewMemorySource:Pt,onStartChatFromBundle:dr,previewDisplayMode:sn,previewPane:si,previewPaneWidth:I,previewButtonTitle:ai,visibleWorkspace:bt,refreshKey:De,boardFilterState:ke,onBoardFilterStateChange:Ae,onBoardLoadedProjectIdChange:y,onBundlesChange:Mn,onBundlesLoadingChange:Nn,onPreviewPaneWidthChange:L,onProjectUsageChange:jn,onRunStatusChange:()=>{xn(),Sn()}},m??`no-project`)]}),d.length>0&&(0,Y.jsx)(Xy,{activeProject:X,activeRun:g,branchState:Jt,targetGitStatus:Yt,isBoardLoadedForActiveProject:Gt,activeProjectBranchAction:Zt,isProjectIdeAvailable:Ut,isProjectRunAvailable:Ht,isRunStatusLoadedForActiveProject:Kt,isTerminalOpen:Ar.isOpen,targetBundles:Qt,targetBranchSuggestions:en,isTargetBundleLoading:$t,isTargetSelectorLoading:an,isTargetGitStatusLoading:Xt,hasConfiguredTests:jr,hasConfiguredChecks:Mr,onProjectIdeOpen:()=>{vr()},onProjectPull:()=>{yr()},onProjectRebase:br,onProjectAbortGitOperation:xr,onProjectRunToggle:()=>{_r()},onProjectFilesOpen:()=>Sr(`files`),onProjectChangesOpen:()=>Sr(`changes`),onProjectVerificationOpen:wr,onTerminalToggle:Hr,onTargetSelectorOpenChange:rr,onSelectBundleTarget:sr,onSelectRepoRootTarget:cr,onManageBundles:fr}),(0,Y.jsx)(Nne,{activeProjectId:m,open:K,onOpenChange:We}),(Ge||o?.kind===`activity-run`)&&m&&!Dt&&(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(qme,{projectId:m,initialRunId:o?.kind===`activity-run`?o.runId:null,initialEventId:o?.kind===`activity-run`?o.eventId:null,onClose:Er,onRunSelectionChange:Or,onUnavailable:o?.kind===`activity-run`?Dr:void 0,onNavigateToLifecycleSource:It})}),Ye&&m&&(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(Kme,{projectId:m,defaultBranch:st,onClose:()=>Ze(!1)})}),He&&X&&(0,Y.jsx)(jC,{bundles:Qt,selectedBundleId:X.active_target_kind===`bundle`?X.active_target_bundle_id??null:null,activeTargetBundleId:X.active_target_kind===`bundle`?X.active_target_bundle_id??null:null,onSelectBundle:mr,onCreateBundle:hr,onDeleteBundle:gr,onClose:pr}),ct&&(0,Y.jsx)(_C,{title:ct.title,description:ct.description,confirmLabel:ct.confirmLabel,cancelLabel:ct.cancelLabel,confirmVariant:ct.confirmVariant,onConfirm:()=>ar(!0),onCancel:()=>ar(!1)}),d.map(e=>{let t=r9(_e,e.id);return t.hasMounted?(0,Y.jsx)(Dme,{project:e,isExpanded:t.isExpanded,isVisible:e.id===m&&t.isOpen,onClose:()=>Ur(e.id),onToggleExpanded:()=>Wr(e.id)},e.id):null}),le&&(0,Y.jsx)(gie,{mode:le,initialSection:de,projectId:le===`edit`&&X?X.id:null,availableHelperModels:H,isLoadingHelperModels:!ne,isAutoConfigReady:l,initialValues:le===`edit`&&X?Zme(X):d.length===0?{name:``,repoPath:``,linkedProjectIds:[],runSetup:[],runServices:[],checkDefinitions:[],runIde:``,previewServiceName:``,previewPath:``,previewCapabilityMode:`auto`,helperModel:ie,helperVariant:oe,commitMessageRules:``,commitAfterEachTicket:!1,autoParkStaleTickets:!1,memoryEnabled:!1,worktreeSync:[],specAwareCodeReviewEnabled:!1,automationDepth:`manual`,automationReviewFixEnabled:!1,automationPauseOnOpenQuestions:!1,automationReviewSeverity:`medium`,automationReviewMaxIterations:3}:void 0,linkedProjectOptions:d.filter(e=>e.id!==X?.id).map(e=>({id:e.id,name:e.name})),repoPathLocked:le===`edit`&&X?X.repo_path_locked:!1,repoPathLockedMessage:le===`edit`&&X?$me(X):null,deleteBlockedMessage:le===`edit`&&X?ehe(X,d):null,onDelete:le===`edit`?kn:void 0,onAutoConfig:Pn,onBrowseRepoPath:Fn,onValidateRepoPath:In,onOpenExecutionRuntimes:()=>Je(!0),onClose:()=>ue(null),onSubmit:le===`edit`?On:Dn}),q&&(0,Y.jsx)(ex,{onClose:()=>Je(!1)}),Ct&&Ct.projectId===m&&X&&Jt?.status!==`loading`&&!Dt&&(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(Wme,{target:{scope:`project_root`},initialMode:Ct.mode,reviewMode:Ct.mode,onReviewModeChange:$r,enabledModes:[`changes`,`files`],projectId:Ct.projectId,targetKind:`repo_root`,reviewCommentsBundleId:null,title:X.name,bundleTargetName:null,hasHelperModel:!!X.helper_model,repoRootDefaultBranch:en.default_branch,onSubmitReviewPrompt:Nr?.submitPrompt,canSubmitReviewPrompt:Lr,reviewSubmitDisabledReason:Vr??void 0,canAddReviewComments:Lr,canModifyChanges:!0,mode:Nr?.mode,onModeChange:Nr?.onModeChange,canToggleMode:!!Nr?.canSubmitReviewPrompt,isUpdatingMode:Nr?.isUpdatingMode??!1,onClose:Cr})}),pe&&!Ge&&!Dt&&pe.projectId===m&&(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(Gme,{targetLabel:pe.targetLabel,definitions:pe.definitions,requiredDefinitionIds:pe.requiredDefinitionIds,preReviewDefinitionIds:pe.preReviewDefinitionIds,checksTarget:{projectId:pe.projectId,targetKind:pe.targetKind,targetBundleId:pe.targetBundleId},requestedInitialTab:o?.kind===`checks`?`checks`:void 0,directBatchRunId:o?.kind===`checks`?o.batchRunId:null,directAttemptRunId:o?.kind===`checks`?o.attemptRunId:null,onCheckSelectionChange:o?.kind===`checks`?kr:void 0,onUnavailable:o?.kind===`checks`?Dr:void 0,testsTarget:{scope:`project`,projectId:pe.projectId,targetKind:pe.targetKind,targetBundleId:pe.targetBundleId},onClose:Tr,onOpenActivity:()=>{if(ht.current+=1,me(null),o?.kind===`checks`){mt.current=!0,a({kind:`workspace`,projectId:o.projectId,workspace:`board`});return}qe(!0)}})})]})},phe=({className:e})=>(0,Y.jsx)($ee,{"aria-hidden":`true`,className:e}),s9=`X-Archon-Mobile-CSRF`,mhe=async(e,t={})=>{let n=await fetch(e,{credentials:`include`,...t});if(!n.ok){let e=null;try{e=await n.clone().json()}catch{}throw new Ke(await Ze(n,`Mobile request failed.`),n.status,e)}return n},c9=async(e,t={})=>await(await mhe(e,t)).json(),l9=e=>c9(`/mobile/projects`,{signal:e}),hhe=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/summary`,{signal:t}),ghe=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/target-options`,{signal:t}),_he=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,{signal:t}),vhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,{signal:n}),yhe=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets`,{signal:t}),bhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,{signal:n}),xhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/agent-runs`,{signal:n}),She=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),Che=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),whe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}`,{signal:n}),The=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/build`,u9(n)),Ehe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/review`,u9(n)),u9=(e,t,n=`POST`)=>({method:n,headers:{"Content-Type":`application/json`,[s9]:e},body:t===void 0?void 0:JSON.stringify(t)}),Dhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,u9(t,n)),Ohe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/messages`,u9(n,r)),khe=(e,t,n,r,i)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Ahe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),jhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/stop`,u9(n)),Mhe=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,{signal:t}),Nhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,{signal:n}),Phe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,u9(t,n)),d9=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/messages`,u9(n,r)),Fhe=(e,t,n,r,i)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Ihe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),Lhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/stop`,u9(n)),f9=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/state`,u9(n,{state:r},`PATCH`)),Rhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/run`,u9(n)),zhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop`,u9(n)),p9=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop-build`,u9(n)),m9=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/resume-build`,u9(n)),Bhe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),Vhe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-follow-up`,u9(n,{instruction:r})),Hhe=(e,t,n,r,i)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Uhe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/follow-up`,u9(n,{instruction:r})),Whe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/follow-up`,u9(n,{instruction:r})),h9=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/target`,u9(t,n)),Ghe=(e,t)=>c9(`/mobile/models?tool=${encodeURIComponent(e)}`,{signal:t}),Khe=(e,t,n)=>{let r=new URLSearchParams({tool:e});return t&&r.set(`project_id`,t),c9(`/mobile/skills?${r.toString()}`,{signal:n})},qhe=({className:e})=>(0,Y.jsx)(Jee,{"aria-hidden":`true`,className:e}),g9=e=>Wb.t(`common:mobileApp.${e}`),Jhe={key:`overview`,label:g9(`navigation.overview`),Icon:qhe},_9={key:`tickets`,label:g9(`navigation.tickets`),Icon:J5,ctaAriaLabel:g9(`overviewActions.ticketsAriaLabel`)},v9={key:`chats`,label:g9(`navigation.chats`),Icon:SE,ctaAriaLabel:g9(`overviewActions.chatsAriaLabel`)},y9={key:`spec`,label:g9(`navigation.spec`),Icon:oC,ctaAriaLabel:g9(`overviewActions.specAriaLabel`)},Yhe=[Jhe,_9,v9,y9],Xhe=({children:e})=>(0,Y.jsx)(`main`,{className:`min-h-screen bg-background text-foreground`,children:(0,Y.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-lg items-center px-4 py-8`,children:(0,Y.jsx)(`div`,{className:`w-full`,children:e})})}),b9=({title:e,description:t,children:n})=>(0,Y.jsx)(Xhe,{children:(0,Y.jsxs)(xC,{className:`w-full border-border/80 bg-card/90 shadow-2xl shadow-black/20`,children:[(0,Y.jsxs)(SC,{children:[(0,Y.jsx)(CC,{children:e}),(0,Y.jsx)(wC,{children:t})]}),n&&(0,Y.jsx)(EC,{className:`space-y-4`,children:n})]})}),Zhe=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`},Qhe=({status:e})=>{let t=Zhe(e);return(0,Y.jsxs)(bC,{variant:t.variant,className:`gap-1.5 px-2.5 py-1 text-[11px] uppercase tracking-[0.14em]`,children:[(0,Y.jsx)(tb,{state:t.indicatorState,className:`mt-0`}),t.label]})},$he=({status:e,onRetry:t})=>e===`connected`?null:e===`unavailable`?(0,Y.jsx)(xC,{className:`border-red-500/25 bg-destructive/10 shadow-none`,children:(0,Y.jsxs)(EC,{className:`flex flex-col gap-3 pt-5`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-medium text-red-100`,children:`Desktop Archon is currently unreachable.`}),(0,Y.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,Y.jsx)(`div`,{children:(0,Y.jsx)(Q,{variant:`warning`,onClick:t,children:`Retry connection`})})]})}):(0,Y.jsx)(xC,{className:`border-amber-500/25 bg-amber-500/10 shadow-none`,children:(0,Y.jsx)(EC,{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.`})}),ege=({selectedProject:e,targetLabel:t,isTargetLoading:n,isTargetDisabled:r,connectionState:i,onOpenProjects:a,onOpenTargetSelector:o})=>(0,Y.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,Y.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,Y.jsxs)(`button`,{type:`button`,"aria-label":`Choose project`,className:`min-w-0 flex-1 text-left`,onClick:a,children:[(0,Y.jsx)(`div`,{className:`truncate text-base font-medium text-foreground`,children:e?.name??`Choose a project`}),(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e?.repo_path??`Select a desktop project to continue`})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(Qhe,{status:i}),(0,Y.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,Y.jsx)(Yv,{className:`h-3.5 w-3.5 shrink-0`}),n?(0,Y.jsx)(Ov,{className:`h-3.5 w-16`}):(0,Y.jsx)(`span`,{className:`truncate text-xs sm:text-sm`,children:t})]}),(0,Y.jsx)(Q,{variant:`outline`,size:`icon-sm`,"aria-label":`Choose project`,onClick:a,children:(0,Y.jsx)(jv,{className:`h-4 w-4`})})]})]})}),tge=({activeSection:e,onChange:t})=>(0,Y.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,Y.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:Yhe.map(n=>{let r=n.key===e,i=n.Icon;return(0,Y.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,Y.jsx)(i,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:n.label})]},n.key)})})}),x9=({title:e,description:t,action:n})=>(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsxs)(SC,{children:[(0,Y.jsx)(CC,{children:e}),(0,Y.jsx)(wC,{children:t})]}),n&&(0,Y.jsx)(EC,{children:n})]}),S9=({text:e})=>(0,Y.jsxs)(`div`,{"aria-live":`polite`,className:`flex items-center gap-2 px-1 py-3 text-sm text-muted-foreground`,role:`status`,children:[(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}),(0,Y.jsx)(`span`,{children:e})]}),nge=e=>e?`Repo root (${e})`:`Repo root`,rge=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?Gy(n):`Selected bundle`}return rge(t?.current_branch??null)},w9=({title:e,description:t,children:n})=>(0,Y.jsxs)(`div`,{className:`flex max-h-[80vh] flex-col overflow-hidden`,children:[(0,Y.jsxs)(j_,{className:`border-b border-border/70 px-4 py-4`,children:[(0,Y.jsx)(N_,{children:e}),t&&(0,Y.jsx)(P_,{children:t})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:n})]}),ige=({projects:e,selectedProjectId:t,error:n,onSelectProject:r,onRetry:i})=>n?(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-red-200`,children:n}),(0,Y.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry projects`})]}):e?e.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No projects are available on the desktop instance yet.`}):(0,Y.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let n=e.id===t;return(0,Y.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,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.repo_path})]}),n&&(0,Y.jsx)(bC,{variant:`info`,children:`Current`})]}),(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:(0,Y.jsxs)(`span`,{children:[e.ticket_count,` tickets`]})})]},e.id)})}):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading projects...`}),age=({open:e,projects:t,selectedProjectId:n,error:r,onOpenChange:i,onSelectProject:a,onRetry:o})=>(0,Y.jsx)(O_,{open:e,onOpenChange:i,children:(0,Y.jsx)(A_,{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,Y.jsx)(w9,{title:`Projects`,children:(0,Y.jsx)(ige,{projects:t,selectedProjectId:n,error:r,onSelectProject:e=>{a(e),i(!1)},onRetry:o})})})}),oge=({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=Ny(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,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-red-200`,children:r}),(0,Y.jsx)(Q,{variant:`warning`,onClick:s,children:`Retry target options`})]}):n?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`Project target`}),(0,Y.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,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:`Target`}),(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:f?`secondary`:`ghost`,className:`w-full justify-start`,disabled:a,onClick:()=>l(null),children:nge(n.current_branch)}),(0,Y.jsxs)(`div`,{className:`relative min-h-10`,"data-testid":`mobile-target-options`,children:[i&&(0,Y.jsx)(`div`,{className:`pointer-events-none absolute right-2 top-2 z-10 text-muted-foreground`,"data-testid":`mobile-target-options-spinner`,children:(0,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin`})}),(0,Y.jsx)(`div`,{className:`max-h-40 overflow-y-auto pr-7`,children:m.length===0&&!i?(0,Y.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No prepared bundles are available yet.`}):m.map(e=>(0,Y.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,Y.jsx)(`span`,{className:`truncate`,children:Gy(e)})},e.id))})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:`Repo root branch`}),(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-3`,children:[(0,Y.jsx)(`div`,{className:`space-y-2`,children:h.length>0?h.map(({key:e,label:t,branch:n})=>(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between gap-3`,disabled:!f||a||!n,onClick:()=>l(n),children:[(0,Y.jsx)(`span`,{children:t}),(0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n})]},e)):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i?`Loading branch suggestions...`:`No suggested branches available.`})}),(0,Y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Y.jsx)(J_,{htmlFor:`mobile-project-target-branch-input`,className:`text-xs text-muted-foreground`,children:`Switch or create branch`}),(0,Y.jsx)(F_,{id:`mobile-project-target-branch-input`,value:u,disabled:!f||a,onChange:e=>d(e.target.value),placeholder:`feature/quick-fix`})]}),(0,Y.jsx)(Q,{type:`button`,disabled:!f||!u.trim()||a,onClick:()=>l(u.trim()),children:`Switch`})]}),!f&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Switch to repo root to choose a branch.`})]})]})]}):(0,Y.jsx)(S9,{text:`Loading target options...`}):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a project before choosing a target.`});return(0,Y.jsx)(O_,{open:e,onOpenChange:o,children:(0,Y.jsx)(A_,{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,Y.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,Y.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,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.title})}),(0,Y.jsx)(bC,{variant:D9(T9(e)),children:E9(e)})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:[e.agent_status&&(0,Y.jsx)(`span`,{children:e.agent_status}),e.branch&&(0,Y.jsx)(`span`,{children:e.branch}),e.bundle?.name&&(0,Y.jsx)(`span`,{children:e.bundle.name})]})]}),sge=({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=Gy(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,Y.jsxs)(iw,{open:s,onOpenChange:c,children:[(0,Y.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,Y.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,"aria-label":`Open bundle ${l}`,onClick:()=>r(e.bundle.id),children:(0,Y.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(bC,{variant:`outline`,children:`Bundle`}),(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:l})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[e.tickets.length,` ticket`,e.tickets.length===1?``:`s`]}),u>0&&(0,Y.jsxs)(`span`,{children:[u,` running`]}),e.bundle.branch&&(0,Y.jsx)(`span`,{children:e.bundle.branch})]})]})})}),(0,Y.jsx)(aw,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`mt-0.5 shrink-0`,"aria-label":`Toggle bundle tickets for ${l}`,children:(0,Y.jsx)(Cv,{className:Z(`h-4 w-4 transition-transform`,s&&`rotate-180`)})})})]}),(0,Y.jsx)(ow,{className:`pt-2`,children:(0,Y.jsx)(`div`,{className:`space-y-2 pl-3`,children:e.tickets.map(t=>(0,Y.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),cge=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,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before browsing tickets from this phone.`});if(i)return(0,Y.jsx)(x9,{title:`Tickets unavailable`,description:i,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:a,children:`Retry tickets`})});if(!t)return(0,Y.jsx)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,Y.jsx)(EC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading tickets...`})});if(t.length===0)return(0,Y.jsx)(x9,{title:`No tickets`,description:`This project does not have any tickets yet.`});let c=cge(t);return(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/70 pb-4`,children:[(0,Y.jsx)(CC,{children:`Tickets`}),(0,Y.jsxs)(wC,{children:[t.length,` total`]})]}),(0,Y.jsx)(EC,{className:`space-y-4 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:c.map(e=>(0,Y.jsxs)(`section`,{className:`space-y-2`,"aria-label":`${e.label} tickets`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsx)(`span`,{children:e.tickets.length})]}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:e.items.map(e=>e.kind===`bundle`?(0,Y.jsx)(sge,{group:e.group,selectedBundleId:n,selectedTicketId:r,onSelectBundle:o,onSelectTicket:s},e.group.id):(0,Y.jsx)(O9,{ticket:e.ticket,isSelected:e.ticket.id===r,onSelectTicket:e=>s(e,null)},e.ticket.id))})]},e.key))})]})},lge=e=>c9(`/mobile-auth/status`,{signal:e}),uge=(e,t)=>c9(`/mobile-auth/pair/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t}),dge=e=>c9(`/mobile-auth/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),fge=e=>c9(`/mobile-auth/logout`,{method:`POST`,headers:{[s9]:e}}),pge=()=>nC(window.location.origin,{withCredentials:!0}),j9=e=>Wb.t(`common:mobileApp.${e}`),M9=`Project root has uncommitted changes. Confirm branch switch to continue.`,mge=()=>{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,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-card/70 p-3`,children:[(0,Y.jsx)(`div`,{className:Z(`text-xl font-semibold text-foreground`,n),children:t}),(0,Y.jsx)(`div`,{className:`mt-1 text-xs uppercase tracking-[0.14em] text-muted-foreground`,children:e})]}),hge=()=>(0,Y.jsxs)(`div`,{className:`space-y-3`,"data-testid":`mobile-overview-skeleton`,children:[(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsx)(SC,{className:`border-b border-border/70 pb-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(Ov,{className:`h-6 w-28`}),(0,Y.jsx)(Ov,{className:`h-6 w-28 rounded-full`})]})}),(0,Y.jsxs)(EC,{className:`space-y-4 pt-5`,children:[(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-card/70 p-3`,children:[(0,Y.jsx)(Ov,{className:`h-6 w-10`}),(0,Y.jsx)(Ov,{className:`mt-2 h-3 w-16`})]},t))}),(0,Y.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,Y.jsx)(Ov,{className:`h-10 w-full rounded-xl`}),(0,Y.jsx)(Ov,{className:`h-10 w-full rounded-xl`})]})]})]}),(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsx)(SC,{children:(0,Y.jsx)(Ov,{className:`h-6 w-20`})}),(0,Y.jsx)(EC,{children:(0,Y.jsx)(Ov,{className:`h-10 w-40 rounded-xl`})})]})]}),gge=({isLoggingOut:e,onLogout:t})=>(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsx)(SC,{children:(0,Y.jsx)(CC,{children:`Session`})}),(0,Y.jsx)(EC,{children:(0,Y.jsxs)(Q,{variant:`destructive`,className:`gap-2`,disabled:e,onClick:t,children:[(0,Y.jsx)(phe,{className:`h-4 w-4`}),e?`Logging out...`:`Log out this phone`]})})]}),_ge=({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=jF(a.filter(e=>e.state===`review`));return o===`building`?{label:Wb.t(`common:statusBadge.building`),variant:`success`}:o===`reviewing`?{label:Wb.t(`common:statusBadge.reviewing`),variant:`warning`}:a.some(e=>e.state===`build`)?{label:Wb.t(`common:statusBadge.building`),variant:`success`}:a.some(e=>e.state===`plan`)?{label:`Planning`,variant:`info`}:{label:`Idle`,variant:`outline`}},vge=({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r})=>{let i=_ge({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r});return(0,Y.jsx)(bC,{variant:i.variant,children:i.label})},yge=({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,Y.jsx)(x9,{title:`Project summary unavailable`,description:r,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:o,children:`Retry summary`})}):e?!t||t.project.id!==e?(0,Y.jsx)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,Y.jsx)(EC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading project summary...`})}):(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/70 pb-4`,children:[(0,Y.jsx)(CC,{children:`Overview`}),(0,Y.jsx)(TC,{children:(0,Y.jsx)(vge,{activeRun:t.active_run,tickets:n,chatSessions:i,chatSessionDetail:a})})]}),(0,Y.jsxs)(EC,{className:`space-y-4 pt-5`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:[(0,Y.jsx)(N9,{label:`Tickets`,value:t.tickets.total}),(0,Y.jsx)(N9,{label:`Plan`,value:t.tickets.plan,accentClassName:`text-sky-200`}),(0,Y.jsx)(N9,{label:`Build`,value:t.tickets.build,accentClassName:`text-emerald-200`}),(0,Y.jsx)(N9,{label:`Review`,value:t.tickets.review,accentClassName:`text-amber-200`}),(0,Y.jsx)(N9,{label:`Done`,value:t.tickets.parked}),(0,Y.jsx)(N9,{label:`Bundles`,value:t.project.bundle_count??0})]}),(0,Y.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,Y.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":_9.ctaAriaLabel,onClick:s,children:[(0,Y.jsx)(u,{className:`h-4 w-4`}),_9.label]}),(0,Y.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":v9.ctaAriaLabel,onClick:c,children:[(0,Y.jsx)(d,{className:`h-4 w-4`}),v9.label]}),(0,Y.jsxs)(Q,{variant:`outline`,className:`gap-2 sm:col-span-2`,"aria-label":y9.ctaAriaLabel,onClick:l,children:[(0,Y.jsx)(f,{className:`h-4 w-4`}),y9.label]})]})]})]}):(0,Y.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,Y.jsx)(x9,{title:`Chats unavailable`,description:r,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry chats`})}):(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/70 pb-4`,children:[(0,Y.jsx)(CC,{children:`Chats`}),(0,Y.jsx)(wC,{children:t?`${t.length} recent`:`Loading chats...`}),(0,Y.jsx)(TC,{children:(0,Y.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:`New chat`})})]}),(0,Y.jsx)(EC,{className:`space-y-2 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:t?t.length===0?(0,Y.jsx)(x9,{title:`No chats`,description:`Start a new chat to plan or build from this project.`,action:(0,Y.jsx)(Q,{onClick:a,children:`Start a chat`})}):t.map(e=>(0,Y.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,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.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,Y.jsx)(bC,{variant:e.agent_status===`running`?`warning`:e.mode===`plan`?`info`:`success`,children:e.agent_status??e.mode})]})},e.id)):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading chats...`})})]}):(0,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before browsing chats from this phone.`}),I9=({label:e,disabled:t,onClick:n})=>(0,Y.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=>hy(e)&&e.agent_status===`running`&&!!e.session_id)??null,s=t.find(e=>hy(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}},bge=({ticket:e,actionState:t,actionError:n,onAction:r})=>{let i=a3(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,Y.jsx)(R4,{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,Y.jsx)(I9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},xge=({bundleDetail:e,actionState:t,actionError:n,onAction:r})=>{let{actions:i}=L9(e);return i.length===0?null:(0,Y.jsx)(R4,{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,Y.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?nq(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,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[i?(0,Y.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 px-2.5 lg:hidden`,"aria-label":r,onClick:i,children:[(0,Y.jsx)(CF,{className:`h-4 w-4`}),`Back`]}):null,(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e}),t?(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t}):null]})]}),a?(0,Y.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),n?(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n}):null]}),Sge=({title:e,backLabel:t,onBack:n,action:r})=>(0,Y.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,Y.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 px-2.5`,"aria-label":t,onClick:n,children:[(0,Y.jsx)(CF,{className:`h-4 w-4`}),`Back`]}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground`,children:e}),(0,Y.jsx)(`div`,{className:`shrink-0`,children:r})]}),V9=({title:e,backLabel:t,onBack:n,action:r,subheader:i,children:a})=>(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(Sge,{title:e,backLabel:t,onBack:n,action:r}),i?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-border/70 py-2 lg:hidden`,children:i}):null,(0,Y.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,Y.jsxs)(`div`,{className:`flex gap-2 px-3 sm:px-0`,children:[(0,Y.jsx)(Q,{type:`button`,variant:e===`transcript`?`secondary`:`ghost`,className:`h-9 flex-1`,"aria-pressed":e===`transcript`,onClick:t,children:`Transcript`}),(0,Y.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,Y.jsxs)(iw,{open:t,onOpenChange:n,children:[(0,Y.jsx)(`div`,{className:`px-1 pb-1`,children:(0,Y.jsx)(aw,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2 text-xs text-muted-foreground`,children:[`Options`,(0,Y.jsx)(Cv,{className:Z(`h-3.5 w-3.5 transition-transform`,t&&`rotate-180`)})]})})}),(0,Y.jsx)(ow,{className:`px-1 pb-1`,children:(0,Y.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-background/35 p-2`,children:e})})]})},Cge=({ticket:e})=>{let t=[{label:`State`,value:E9(e)},{label:`Tool`,value:PF(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,Y.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-xl border border-border/70 bg-background/40 px-3 py-3`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Details`}),(0,Y.jsx)(`dl`,{className:`grid gap-2 text-sm sm:grid-cols-2`,children:t.map(e=>(0,Y.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border/60 bg-background/50 px-3 py-2`,children:[(0,Y.jsx)(`dt`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:e.label}),(0,Y.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,Y.jsxs)(xC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,a),children:[(0,Y.jsx)(SC,{className:`min-w-0 pb-3`,children:(0,Y.jsx)(B9,{title:e.title,badges:t})}),(0,Y.jsxs)(EC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,Y.jsx)(bge,{ticket:e,actionState:n,actionError:r,onAction:i}),e.description?(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-xl border border-border/70 bg-background/40 px-3 py-3`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Description`}),(0,Y.jsx)(tq,{content:e.description,className:`min-w-0 text-foreground`})]}):null,(0,Y.jsx)(Cge,{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,Y.jsxs)(xC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,f),children:[(0,Y.jsx)(SC,{className:`min-w-0 pb-3`,children:(0,Y.jsx)(B9,{title:t,subtitle:n,badges:r})}),(0,Y.jsxs)(EC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,Y.jsx)(xge,{bundleDetail:e,actionState:i,actionError:a,onAction:o}),(0,Y.jsxs)(iw,{open:l,onOpenChange:u,children:[(0,Y.jsx)(aw,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs text-muted-foreground`,children:[`Tickets`,(0,Y.jsx)(Cv,{className:Z(`h-3.5 w-3.5 transition-transform`,l&&`rotate-180`)})]})}),(0,Y.jsx)(ow,{className:`pt-2`,children:(0,Y.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-background/35 p-3`,children:(0,Y.jsx)(p3,{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,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before opening bundle details from this phone.`});if(!t)return(0,Y.jsx)(x9,{title:`Choose a bundle`,description:`Open a bundle to review its transcript and grouped ticket progress.`});if(a)return(0,Y.jsx)(V9,{title:`Bundle unavailable`,backLabel:`Back to tickets`,onBack:f,children:(0,Y.jsx)(x9,{title:`Bundle unavailable`,description:a,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:m,children:`Retry bundle`})})});if(!n||n.bundle.id!==t)return(0,Y.jsx)(V9,{title:`Loading bundle`,backLabel:`Back to tickets`,onBack:f,children:(0,Y.jsx)(S9,{text:`Loading bundle details...`})});let w=Gy(n.bundle)||n.bundle.branch||n.bundle.name||`Bundle`,T=new Map(d.map(e=>[e.id,e.label])),E=_3(n.tickets,T),D=b3(n),O=v3(n.tickets,n.execution_order_ticket_ids),k=y3(n.tickets,T,E,n.execution_order_ticket_ids),A=NF(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`&&Iy(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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(TF,{status:A}),(0,Y.jsx)(bC,{variant:`outline`,children:L}),M?(0,Y.jsxs)(bC,{variant:`outline`,children:[`Target: `,M.title]}):null]});return(0,Y.jsx)(V9,{title:w,backLabel:`Back to tickets`,onBack:f,subheader:x?void 0:(0,Y.jsx)(H9,{value:i,onTranscript:()=>g(`transcript`),onDetails:()=>g(`details`)}),children:x?(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden pt-3`,children:[(0,Y.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,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,Y.jsx)(f3,{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:dy(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,Y.jsx)(`p`,{className:`shrink-0 text-sm text-red-200`,children:u}):null]}):i===`details`?(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,Y.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,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(f3,{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:dy(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,Y.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,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before opening the chat workspace.`});if(n&&i)return(0,Y.jsx)(x9,{title:`Chat unavailable`,description:i,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:b,children:`Retry chat`})});if(n&&(!t||t.id!==n))return(0,Y.jsx)(V9,{title:`Loading chat`,backLabel:`Back to chats`,onBack:y,children:(0,Y.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,ee=OF(t?.post_build_check),te=ee?Wb.t(`common:postBuildChecks.blockedReason`):R?Wb.t(`common:questionSet.waitForResolution`):v,z=t?.agent_status===`running`?(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:a,onClick:x,children:[a?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:a?`Interrupting...`:`Interrupt`})]}):null,B=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(bC,{variant:N===`plan`?`info`:`success`,children:N}),(0,Y.jsx)(bC,{variant:`outline`,children:t?.tool??s}),t?.agent_status?(0,Y.jsx)(bC,{variant:`outline`,children:t.agent_status}):null]}),V=P?(0,Y.jsx)(OY,{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:!!te||h}):s===`opencode`&&m?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,H=!M&&V?(0,Y.jsx)(U9,{controls:V}):V,U=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)($Y,{value:N,disabled:!!te||h||g,onChange:S}),_&&(0,Y.jsx)(Q8,{disabled:h||g,onClick:C})]}),ne=M?void 0:({showThinkingControl:e})=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[U,(0,Y.jsx)(`div`,{className:`ml-auto`,children:e})]}),re=`mobile-chat:${n??`new`}:${r}`;return(0,Y.jsx)(V9,{title:t?.title??`New chat`,backLabel:`Back to chats`,onBack:y,action:z,children:(0,Y.jsx)(Z8,{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,Y.jsx)(B9,{title:t?.title??`New chat`,subtitle:t?.target_label_snapshot??`Project root`,badges:B}):ne,composerControls:M?U:void 0,composerInlineControls:H,composerTheme:N,forceScrollToBottomKey:re,layoutKey:re,scrollLayoutKey:re,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,Y.jsx)(cY,{messageContent:e.content,questionSet:n,storageKey:$J({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||ee,postBuildCheck:t?.post_build_check,followUpDisabledReason:te??void 0,hidePendingAgentTitle:!M,onFollowUpPromptChange:w,onFollowUpKeyDown:O,onFollowUpSubmit:k},re)})},wge=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?nq(e.response_timing):null,transcript_runs:e.transcript_runs??null})),Tge=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,Y.jsx)(x9,{title:j9(`specList.listError`),description:r,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:i,children:j9(`specList.retry`)})}):(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/70 pb-4`,children:[(0,Y.jsx)(CC,{children:j9(`specList.title`)}),(0,Y.jsx)(wC,{children:t?`${t.length} recent`:j9(`specList.loading`)}),(0,Y.jsx)(TC,{children:(0,Y.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:j9(`specList.newSpec`)})})]}),(0,Y.jsx)(EC,{className:`space-y-2 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:t?t.length===0?(0,Y.jsx)(x9,{title:j9(`specList.emptyTitle`),description:j9(`specList.emptyDescription`),action:(0,Y.jsx)(Q,{onClick:a,children:j9(`specList.startSpec`)})}):t.map(e=>(0,Y.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,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.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,Y.jsx)(bC,{variant:e.agent_status===`running`?`warning`:e.mode===`grill`?`info`:`success`,children:e.agent_status??e.mode})]})},e.id)):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:j9(`specList.loading`)})})]}):(0,Y.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:_,targetWarning:v,targetActionLabel:y,targetActionError:b,isRestoringTarget:x,onBack:S,onRetry:C,onStop:w,onModeChange:T,onPromptChange:E,onModelChange:D,onVariantChange:O,onSkillsChange:k,onPromptKeyDown:A,onSubmit:j,onSubmitAnswer:M,onResolveQuestionSet:N,onRestoreTarget:P,liveResponseTiming:F,isLargeScreen:I})=>{if(!e)return(0,Y.jsx)(x9,{title:j9(`specList.emptyTitle`),description:`Select a project before opening the spec workspace.`});if(n&&i)return(0,Y.jsx)(x9,{title:j9(`specDetail.unavailableTitle`),description:i,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:C,children:j9(`specDetail.retry`)})});if(n&&(!t||t.id!==n))return(0,Y.jsx)(V9,{title:j9(`specDetail.loadingTitle`),backLabel:j9(`specDetail.back`),onBack:S,children:(0,Y.jsx)(S9,{text:j9(`specDetail.loading`)})});let L=t?.mode??o,R=s===`opencode`&&f.length>0,ee=f.find(e=>e.id===l)??null,te=wge(t?.messages),z=Tge(t?.messages),B=z9(t?.messages),V=B?Wb.t(`common:questionSet.waitForResolution`):_,H=t?.agent_status===`running`,U=H?(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:a,onClick:w,children:[a?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:j9(a?`specDetail.interrupting`:`specDetail.interrupt`)})]}):null,ne=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(bC,{variant:L===`grill`?`info`:`success`,children:L}),(0,Y.jsx)(bC,{variant:`outline`,children:t?.tool??s}),t?.agent_status?(0,Y.jsx)(bC,{variant:`outline`,children:t.agent_status}):null]}),re=R?(0,Y.jsx)(OY,{model:l,variant:u,skills:d,showModelSelector:!0,showSkillsSelector:!0,availableModels:f,availableSkills:p,selectedModel:ee,onModelChange:D,onVariantChange:O,onSkillsChange:k,modelSelectId:`mobile-spec-model-selector`,variantSelectId:`mobile-spec-variant-selector`,skillsSelectId:`mobile-spec-skills-selector`,disabled:!!V||h}):s===`opencode`&&m?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,ie=!I&&re?(0,Y.jsx)(U9,{controls:re}):re,ae={rationaleLabel:Wb.t(`common:specView.grill.rationaleLabel`),suggestionsLabel:Wb.t(`common:specView.grill.suggestionsLabel`),recommendedSuggestionLabel:Wb.t(`common:specView.grill.recommendedSuggestionLabel`),answerPlaceholder:Wb.t(`common:specView.grill.answerPlaceholder`),submitLabel:Wb.t(`common:specView.grill.submitLabel`),submittingLabel:Wb.t(`common:specView.grill.submittingLabel`)},oe=e=>{if(e.role!==`assistant`)return;let n=e.metadata,r=n?.ask_question;if(r&&t)return(0,Y.jsx)(cY,{messageContent:e.content,questionSet:r,storageKey:$J({parentType:`spec`,parentId:t.id,setId:r.id}),isActive:r.status===`pending`&&B?.id===e.id,isDisabled:!!v||H||h||g,onResolve:t=>N(e.id,t)});if(e.kind!==`grill-question`)return;let i=n?.grill_question;if(i)return(0,Y.jsx)(B5,{question:i,isActive:H?!1:e.id===z&&t?.agent_status!==`running`&&t?.mode===`grill`,isDisabled:!!v||h||g,labels:ae,onSubmitAnswer:M})},W=(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,Y.jsx)(V5,{on:L===`grill`,disabled:!!V||h||g,onToggle:e=>T(e?`grill`:`standard`),tooltipContent:Wb.t(`common:specView.grill.toggleTooltip`),ariaLabelOn:Wb.t(`common:specView.grill.toggleAriaLabelOn`),ariaLabelOff:Wb.t(`common:specView.grill.toggleAriaLabelOff`)})}),se=I?void 0:({showThinkingControl:e})=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[W,(0,Y.jsx)(`div`,{className:`ml-auto`,children:e})]}),ce=`mobile-spec:${n??`new`}:${r}`;return(0,Y.jsxs)(V9,{title:t?.title??j9(`specDetail.newSpecTitle`),backLabel:j9(`specDetail.back`),onBack:S,action:U,children:[v&&(0,Y.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-100`,children:[(0,Y.jsx)(`p`,{children:v}),y&&(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`mt-2`,disabled:x,onClick:P,children:x?j9(`specDetail.switchingBack`):y}),b&&(0,Y.jsx)(`p`,{className:`mt-2 text-red-200`,children:b})]}),(0,Y.jsx)(Z8,{projectId:e,agentRunParentType:n?`spec`:null,agentRunParentId:n,messages:te,internalLog:t?.agent_log??null,currentThinkingMessageId:t?.agent_message_id??null,previousThinkingLog:t?.previous_agent_log??null,previousThinkingMessageId:t?.previous_agent_message_id??null,pendingAgentTitle:t?.title??j9(`specDetail.newSpecTitle`),streamingResponse:t?.streaming_response??null,isRunning:H,pendingAgentRevealKey:F?.turnKey??null,liveResponseTiming:F,canShowComposer:!0,header:I?(0,Y.jsx)(B9,{title:t?.title??j9(`specDetail.newSpecTitle`),subtitle:t?.first_user_message_preview??null,badges:ne}):se,composerControls:I?W:void 0,composerInlineControls:ie,composerTheme:`default`,forceScrollToBottomKey:ce,layoutKey:ce,scrollLayoutKey:ce,composerFocusNonce:r,blurComposerOnSendStart:!I,followUpPrompt:c,followUpPlaceholder:j9(n?`specDetail.composerPlaceholder`:`specDetail.composerPlaceholderDraft`),emptyStateText:j9(n?`specDetail.emptyMessages`:`specDetail.emptyDraft`),renderMessageBody:oe,isSendingFollowUp:h,isComposerSubmitDisabled:!!V,followUpDisabledReason:V??void 0,hidePendingAgentTitle:!I,onFollowUpPromptChange:E,onFollowUpKeyDown:A,onFollowUpSubmit:j},ce)]})},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,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before opening ticket details from this phone.`});if(!t)return(0,Y.jsx)(x9,{title:`Choose a ticket`,description:`Open a ticket to review its transcript and continue the workflow.`});if(i)return(0,Y.jsx)(x9,{title:`Ticket unavailable`,description:i,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:v,children:`Retry ticket`})});if(!n||n.id!==t)return(0,Y.jsx)(V9,{title:`Loading ticket`,backLabel:`Back to tickets`,onBack:_,children:(0,Y.jsx)(S9,{text:`Loading ticket details...`})});let j=o3(n,{requireWorktree:!0}),M=R9(n.messages,n.id),N=z9(n.messages),P=!!N,F=OF(n.post_build_check),I=F?Wb.t(`common:postBuildChecks.blockedReason`):P?Wb.t(`common:questionSet.waitForResolution`):j.disabledReason,L=d.find(e=>e.id===c)??null,R=PF(n,`opencode`)===`opencode`&&d.length>0?(0,Y.jsx)(OY,{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}):PF(n,`opencode`)===`opencode`&&m?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,ee=!O&&R?(0,Y.jsx)(U9,{controls:R}):R,te=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(bC,{variant:D9(T9(n)),children:E9(n)}),n.tool?(0,Y.jsx)(bC,{variant:`outline`,children:n.tool}):null,n.agent_status?(0,Y.jsx)(bC,{variant:`outline`,children:n.agent_status}):null,n.branch?(0,Y.jsx)(bC,{variant:`outline`,children:n.branch}):null,n.bundle?.name?(0,Y.jsx)(bC,{variant:`outline`,children:n.bundle.name}):null]}),z=`mobile-ticket:${n.id}:${r}`,B=e=>{let t=e.metadata?.ask_question;if(!(e.role!==`assistant`||!t))return(0,Y.jsx)(cY,{messageContent:e.content,questionSet:t,storageKey:$J({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)})},V=(0,Y.jsx)(H9,{value:k,onTranscript:()=>A(`transcript`),onDetails:()=>A(`details`)});return(0,Y.jsx)(V9,{title:n.title,backLabel:`Back to tickets`,onBack:_,subheader:O?void 0:V,children:O?(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden pt-3`,children:[(0,Y.jsx)(W9,{ticket:n,badges:te,actionState:a,actionError:o,onAction:y,className:`shrink-0`}),(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,Y.jsx)(gY,{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:dy(n.state),forceScrollToBottomKey:z,layoutKey:z,scrollLayoutKey:z,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:B,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},z)}),g?(0,Y.jsx)(`p`,{className:`shrink-0 text-sm text-red-200`,children:g}):null]}):k===`details`?(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,Y.jsx)(W9,{ticket:n,badges:te,actionState:a,actionError:o,onAction:y,className:`h-full`})}):(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(gY,{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:ee,composerTheme:dy(n.state),surfaceVariant:`chat`,composerSize:`compact-on-laptop`,forceScrollToBottomKey:z,layoutKey:z,scrollLayoutKey:z,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:B,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},z),g?(0,Y.jsx)(`p`,{className:`shrink-0 px-1 pt-2 text-sm text-red-200`,children:g}):null]})})},Ege=()=>{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}},Dge=()=>{window.history.replaceState({},``,`/mobile`)},Oge=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Z9=(e,t)=>e instanceof Ke&&e.message?e.message:t,Q9=e=>({status:`authenticated`,csrfToken:e,projects:null,selectedProjectId:null,projectError:null,projectSummary:null,projectSummaryError:null,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),$9=(e=`pairing_required`)=>({status:`unauthenticated`,reason:e}),kge=e=>e instanceof Ke&&(e.status===401||e.status===403),Age=()=>{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),[ee,te]=(0,p.useState)(!1),[z,B]=(0,p.useState)(null),[V,H]=(0,p.useState)(null),[U,ne]=(0,p.useState)(null),[re,ie]=(0,p.useState)(!1),[ae,oe]=(0,p.useState)(``),[W,se]=(0,p.useState)(`standard`),[ce,le]=(0,p.useState)(``),[ue,de]=(0,p.useState)(``),[fe,pe]=(0,p.useState)([]),[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,Te]=(0,p.useState)(0),[Ee,De]=(0,p.useState)(null),[Oe,ke]=(0,p.useState)(null),[Ae,je]=(0,p.useState)(null),[Me,Ne]=(0,p.useState)(null),[Pe,Fe]=(0,p.useState)(``),[Ie,Le]=(0,p.useState)(``),[G,Re]=(0,p.useState)(``),[ze,Be]=(0,p.useState)([]),[Ve,He]=(0,p.useState)(!1),[Ue,K]=(0,p.useState)(null),[We,Ge]=(0,p.useState)(null),[q,Je]=(0,p.useState)(``),[Ye,Ze]=(0,p.useState)(!1),[Qe,J]=(0,p.useState)(null),[$e,et]=(0,p.useState)(0),[tt,nt]=(0,p.useState)(0),[rt,it]=(0,p.useState)(0),[at,ot]=(0,p.useState)(`transcript`),[st,ct]=(0,p.useState)(null),[lt,ut]=(0,p.useState)(null),[dt,ft]=(0,p.useState)(!1),[pt,mt]=(0,p.useState)(!1),[ht,gt]=(0,p.useState)(!1),[X,_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=>kge(e)?(t($9(`session_revoked`)),r(`unavailable`),l(!1),d(!1),m(!1),g(!1),ie(!1),!0):!1,[]),Ot=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await bhe(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(!Xe(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 whe(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(!Xe(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 yhe(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(!Xe(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 vhe(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(!Xe(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 _he(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(!Xe(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 Nhe(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(!Xe(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 Mhe(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(!Xe(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 hhe(n,r);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,projectSummary:i,projectSummaryError:null})}catch(r){if(!Xe(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,n,r=!1)=>{mt(!0),ut(null);try{let[i,a]=await Promise.all([ghe(e,n),r?l9(n):Promise.resolve(null)]),o=bt.current;if(o&&o!==e)return;if(ct(i),ut(null),_t(null),a){let n=a.find(t=>t.id===e);n&&t(t=>t.status!==`authenticated`||t.selectedProjectId!==e?t:{...t,projects:t.projects?.map(t=>t.id===e?{...t,active_target_kind:n.active_target_kind,active_target_bundle_id:n.active_target_bundle_id}:t)??t.projects})}return!0}catch(t){if(!Xe(t)){if(Dt(t))return;let n=bt.current;if(n&&n!==e)return;ct(null),ut(Z9(t,`Unable to load project target options.`))}return!1}finally{n?.aborted||mt(!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 l9(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(!Xe(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 lge(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){Xe(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=Ege();return Dge(),n?(t({status:`pairing`}),uge(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=!pt&&st&&`current_branch`in st?{status:`ready`,branch:st.current_branch}:null,$t=Zt?.target_available===!1?Zt.target_unavailable_reason??j9(`specDetail.targetUnavailable`):null,en=!!(Zt?.target_kind===`repo_root`&&Zt.target_branch_snapshot&&qt?.active_target_kind!==`bundle`),tn=Zt?.target_kind===`bundle`&&lt?Wb.t(`common:mobileApp.specDetail.targetRefreshError`,{error:lt}):en&&lt?Wb.t(`common:mobileApp.specDetail.targetLoadError`,{error:lt}):null,nn=Zt&&pt||en&&!Qt&&!tn?j9(`specDetail.targetLoading`):tn,rn=!!(Zt&&!$t&&!nn&&!h5({activeProject:qt,activeProjectBranchState:Qt,session:Zt})),an=rn&&Zt?Wb.t(`common:mobileApp.specDetail.targetMismatch`,{sessionTarget:_5(Zt),currentTarget:v5({activeProject:qt,activeProjectBranchState:Qt})}):null,on=C9(qt,st),sn=pt&&(!qt||qt.active_target_kind===`bundle`),cn=mge(),ln=Jt?.tool??`opencode`,un=Zt?.tool??`opencode`,dn=!!z9(Jt?.messages),fn=!!z9(Zt?.messages),pn=!!z9(Xt?.messages),mn=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:ee?`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.`:dn?Wb.t(`common:questionSet.waitForResolution`):null,hn=!!(Jt&&rX(Jt,dn)),gn=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:$t||nn||an||(ge?`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.`:fn?Wb.t(`common:questionSet.waitForResolution`):null),_n=!cn&&(o===`tickets`&&(f&&!!Gt||u&&!!Wt)||o===`chats`&&h||o===`spec`&&re);(0,p.useEffect)(()=>{bt.current=Ht},[Ht]),(0,p.useEffect)(()=>{Ht||(ct(null),ut(null),_t(null),ft(!1),mt(!1),gt(!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(!(ln===`opencode`||Xt?.tool===`opencode`||un===`opencode`)){M([]),P([]),I(!1);return}let e=new AbortController;return I(!0),Promise.all([Ghe(`opencode`,e.signal),Khe(`opencode`,Ht,e.signal)]).then(([e,t])=>{M(e),P(t)}).catch(e=>{Dt(e)||Xe(e)||(M([]),P([]))}).finally(()=>{e.signal.aborted||I(!1)}),()=>e.abort()},[Vt,ln,Dt,Ht,Xt?.tool,un]),(0,p.useEffect)(()=>{if(ln!==`opencode`){E(``),O(``),A([]);return}E(Jt?.model??qt?.helper_model??``),O(Jt?.variant??qt?.helper_variant??``),A(Jt?.skills??[])},[ln,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)(()=>{Fe(``),K(null),Le(Xt?.model??``),Re(Xt?.variant??``),Be(Xt?.skills??[])},[Xt?.id,Xt?.model,Xt?.skills,Xt?.variant]),(0,p.useEffect)(()=>{Je(``),J(null)},[Yt?.bundle.id]),(0,p.useEffect)(()=>{if(un!==`opencode`){le(``),de(``),pe([]);return}le(Zt?.model??qt?.helper_model??``),de(Zt?.variant??qt?.helper_variant??``),pe(Zt?.skills??[])},[un,qt?.helper_model,qt?.helper_variant,Zt?.id,Zt?.model,Zt?.skills,Zt?.variant]),(0,p.useEffect)(()=>{Zt?.mode&&se(Zt.mode)},[Zt?.id,Zt?.mode]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===ce)??null;de(t=>e?e.variants.includes(t)?t:``:t)},[j,ce]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===Ie)??null;Re(t=>e?e.variants.includes(t)?t:``:t)},[j,Ie]),(0,p.useEffect)(()=>{if(!Vt)return;let e=pge();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 vn=()=>{zt()},yn=e=>{s(e),d(!1),m(!1),g(!1),ie(!1),yt(null)},bn=()=>{l(!0)},xn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(_t(null),ft(!0),!st&&!pt&&It(e.selectedProjectId))},Sn=()=>{e.status===`authenticated`&&(v(!0),fge(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)))},Cn=()=>{if(e.status!==`pairing_confirmation`||y)return;let n=e.payload;b(!0),t({...e,error:null}),dge(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))},wn=()=>{window.history.replaceState({},``,`/mobile`),t($9())},Tn=()=>{e.status===`authenticated`&&(t({...e,projects:null,projectError:null}),Rt(e.csrfToken))},En=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,projectSummary:null,projectSummaryError:null}),Ft(e.csrfToken,e.selectedProjectId))},Dn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(ct(null),ut(null),_t(null),It(e.selectedProjectId))},On=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),Mt(e.csrfToken,e.selectedProjectId))},kn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||(t({...e,chatSessionDetail:null,chatSessionDetailError:null}),jt(e.csrfToken,e.selectedProjectId,e.selectedChatSessionId))},An=()=>{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))},jn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||(t({...e,ticketDetail:null,ticketDetailError:null}),Ot(e.csrfToken,e.selectedProjectId,e.selectedTicketId))},Mn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||(t({...e,bundleDetail:null,bundleDetailError:null}),kt(e.csrfToken,e.selectedProjectId,e.selectedBundleId))},Nn=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}),De(null),ke(null),je(null),Ne(null),H(null),Ne(null),xe(null),J(null),ct(null),ut(null),_t(null),l(!1),ft(!1),d(!1),m(!1),g(!1),ie(!1),ot(`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)},Pn=async t=>{if(!(e.status!==`authenticated`||!e.selectedProjectId)){gt(!0),_t(null);try{Lt(await h9(e.selectedProjectId,e.csrfToken,{kind:`bundle`,bundle_id:t})),ft(!1),Ft(e.csrfToken,e.selectedProjectId),await It(e.selectedProjectId)}catch(e){if(Dt(e))return;_t(Z9(e,j9(`specDetail.updateTargetError`)))}finally{gt(!1)}}},Fn=async(t,n={})=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;gt(!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 Ke&&e.status===409&&e.message===M9){if(!window.confirm(`${M9}\n\nSwitch anyway?`))return;t=await r(!0)}else throw e}Lt(t),ft(!1),Ft(e.csrfToken,e.selectedProjectId),await It(e.selectedProjectId)}catch(e){if(Dt(e))return;_t(Z9(e,j9(`specDetail.updateTargetError`)))}finally{gt(!1)}},In=tn?Dn:()=>{if(!(!Zt||Zt.target_available===!1)){if(Zt.target_kind===`bundle`){Zt.target_bundle_id&&Pn(Zt.target_bundle_id);return}Fn(Zt.target_branch_snapshot??null,{createBranch:!1})}},Ln=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:n,chatSessionDetail:null,chatSessionDetailError:null}),H(null),et(e=>e+1),g(!0),s(`chats`),jt(e.csrfToken,e.selectedProjectId,n))},Rn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),H(null),S(``),et(e=>e+1),g(!0),s(`chats`))},zn=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedBundleId:n,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),De(null),ke(null),Ne(null),J(null),yt(null),ot(`transcript`),nt(e=>e+1),d(!0),m(!1),s(`tickets`),kt(e.csrfToken,e.selectedProjectId,n))},Bn=(n,r)=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedTicketId:n,ticketDetail:null,ticketDetailError:null}),yt(r),it(e=>e+1),d(r!==null),m(!0),s(`tickets`),Ot(e.csrfToken,e.selectedProjectId,n))},Vn=()=>{g(!1)},Hn=async n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return null;if(!e.chatSessionDetail||!e.selectedChatSessionId)return w(n),null;if(e.chatSessionDetail.mode===n||ee||dn)return null;let r=e.selectedProjectId,i=e.selectedChatSessionId,a=e.csrfToken;te(!0),H(null);try{let e=await Ahe(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)||H(Z9(e,`Unable to update the chat mode right now.`)),null}finally{te(!1)}},Un=()=>{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)},Wn=()=>{d(!1)},Gn=e=>{let t=j.find(t=>t.id===e)??null;E(e),O(e=>t&&t.variants.includes(e)?e:``)},Kn=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Yn())},qn=(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})},Jn=(n,r,i=e.status===`authenticated`?e.chatSessionDetail:null)=>{if(e.status!==`authenticated`||!e.selectedProjectId||L||mn)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=ln===`opencode`&&T?T:null,u=ln===`opencode`&&T&&D?D:null,d=ln===`opencode`?k:[],f=performance.now();Tt.current+=1;let p=`mobile-chat:${Tt.current}`;i&&ne({parentType:`chat`,parentId:i.id,turnKey:p,startedAt:f}),H(null),R(!0);let m=e=>Ohe(o,e.id,c,{instruction:a,tool:e.tool,model:l,variant:u,skills:d});return(i?m(i):Dhe(o,c,{mode:C,tool:ln,model:l,variant:u,skills:d}).then(m)).then(e=>(ne({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=>{ne(e=>e?.turnKey===p?null:e);let t=qe(e,`chat_session`);return t&&s?qn(o,s,t):e instanceof Ke&&e.status===409&&s&&await jt(c,o,s),Dt(e)||H(Z9(e,`Unable to send the chat prompt.`)),!1}).finally(()=>{R(!1)})},Yn=()=>{x.trim()&&Jn(x,!0)},Xn=async()=>{let t=e.status===`authenticated`?e.chatSessionDetail:null;if(!(!t||!rX(t,dn)||Et.current||L||mn)){Et.current=!0;try{let e=await Hn(`build`);if(!e)return;await Jn(nX,!1,e)}finally{Et.current=!1}}},Zn=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=$J({parentType:`chat`,parentId:a,setId:r.set_id});H(null);try{let e=await khe(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedChatSessionId!==a?t:{...t,chatSessions:t.chatSessions?.map(t=>t.id===e.id?e:t)??t.chatSessions,chatSessionDetail:e,chatSessionDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){tY(s);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?qn(i,a,t):await jt(o,i,a)}throw Dt(e)||H(Z9(e,`Unable to resolve the chat questions.`)),e}},Qn=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||z)return;let t=e.selectedProjectId,n=e.selectedChatSessionId;H(null),B(n),ne(e=>e?.parentId===n?null:e),jhe(t,n,e.csrfToken).then(()=>jt(e.csrfToken,t,n)).catch(e=>{Dt(e)||H(Z9(e,`Unable to stop the chat response.`))}).finally(()=>B(null))},$n=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),Pt(e.csrfToken,e.selectedProjectId))},er=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||(t({...e,specSessionDetail:null,specSessionDetailError:null}),Nt(e.csrfToken,e.selectedProjectId,e.selectedSpecSessionId))},tr=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:n,specSessionDetail:null,specSessionDetailError:null}),xe(null),_t(null),Te(e=>e+1),ie(!0),s(`spec`),Nt(e.csrfToken,e.selectedProjectId,n),It(e.selectedProjectId,void 0,!0))},nr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),xe(null),oe(``),Te(e=>e+1),ie(!0),s(`spec`))},rr=()=>{ie(!1)},ir=n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;if(!e.specSessionDetail||!e.selectedSpecSessionId){se(n);return}if(e.specSessionDetail.mode===n||ge||fn)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken;_e(!0),xe(null),Ihe(r,i,a,{mode:n}).then(e=>{se(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)||xe(Z9(e,j9(`specDetail.modeError`)))}).finally(()=>_e(!1))},ar=e=>{let t=j.find(t=>t.id===e)??null;le(e),de(e=>t&&t.variants.includes(e)?e:``)},or=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),cr())},sr=(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})},cr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||me||gn)return;let n=ae.trim();if(!n)return;let r=e.selectedProjectId,i=e.specSessionDetail?.id??null,a=e.csrfToken,o=un===`opencode`&&ce?ce:null,s=un===`opencode`&&ce&&ue?ue:null,c=un===`opencode`?fe:[],l=performance.now();Tt.current+=1;let u=`mobile-spec:${Tt.current}`;e.specSessionDetail&&Ce({parentType:`spec`,parentId:e.specSessionDetail.id,turnKey:u,startedAt:l}),xe(null),he(!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):Phe(r,a,{mode:W,tool:un,model:o,variant:s,skills:c}).then(d)).then(e=>{Ce({parentType:`spec`,parentId:e.id,turnKey:u,startedAt:l}),oe(``),ie(!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=>{Ce(e=>e?.turnKey===u?null:e);let t=e instanceof Ke&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&i&&sr(r,i,t),!Dt(e)&&xe(Z9(e,j9(`specDetail.sendError`)))}).finally(()=>he(!1))},lr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||me)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken,o=e.specSessionDetail?.tool??un,s=un===`opencode`&&ce?ce:null,c=un===`opencode`&&ce&&ue?ue:null,l=un===`opencode`?fe:[],u=performance.now();Tt.current+=1;let d=`mobile-spec:${Tt.current}`;Ce({parentType:`spec`,parentId:i,turnKey:d,startedAt:u}),xe(null),he(!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=>{Ce(e=>e?.turnKey===d?null:e);let t=e instanceof Ke&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&sr(r,i,t),!Dt(e)&&xe(Z9(e,j9(`specDetail.sendError`)))}).finally(()=>he(!1))},ur=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=$J({parentType:`spec`,parentId:a,setId:r.set_id});xe(null);try{let e=await Fhe(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedSpecSessionId!==a?t:{...t,specSessions:t.specSessions?.map(t=>t.id===e.id?e:t)??t.specSessions,specSessionDetail:e,specSessionDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){tY(s);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?sr(i,a,t):await Nt(o,i,a)}throw Dt(e)||xe(Z9(e,`Unable to resolve the spec questions.`)),e}},dr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||ve)return;let t=e.selectedProjectId,n=e.selectedSpecSessionId;xe(null),ye(n),Ce(e=>e?.parentId===n?null:e),Lhe(t,n,e.csrfToken).then(()=>Nt(e.csrfToken,t,n)).catch(e=>{Dt(e)||xe(Z9(e,j9(`specDetail.stopError`)))}).finally(()=>ye(null))},fr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||Ae||(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`?Rhe(r,i,a):n===`stop-run`?zhe(r,i,a):n===`pause-build`?p9(r,i,a):m9(r,i,a);je(n),Ne(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)||Ne(Z9(e,`Unable to update this ticket from mobile.`))}).finally(()=>je(null))},pr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||Ee)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`?The(r,i,a):n===`review`?Ehe(r,i,a):n===`pause-build`?s?p9(r,s,a):null:c?m9(r,c,a):null;d&&(De(n),ke(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)||ke(Z9(e,`Unable to update this bundle from mobile.`))}).finally(()=>De(null)))},mr=e=>{let t=j.find(t=>t.id===e)??null;Le(e),Re(e=>t&&t.variants.includes(e)?e:``)},hr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),gr())},gr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||!e.ticketDetail||Ve||pn)return;let n=Pe.trim();if(!n)return;let r=e.selectedProjectId,i=e.ticketDetail,a=e.csrfToken,o=s3(i,{model:Ie||null,variant:G||null,skills:ze});Tt.current+=1;let s={parentType:`ticket`,parentId:i.id,turnKey:`mobile-ticket:${Tt.current}`,startedAt:performance.now()};Ge(s);let c=()=>i.state===`plan`?Vhe(r,i.id,a,n):Uhe(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}})};He(!0),K(null),(async()=>{o.shouldPersist&&l(await Bhe(r,i.id,a,{model:o.model,variant:o.variant,skills:o.skills})),l(await c()),Fe(``),At(a,r),Ot(a,r,i.id)})().catch(async e=>{Ge(e=>e?.turnKey===s.turnKey?null:e);let t=qe(e,`ticket`);t?l(t):e instanceof Ke&&e.status===409&&await Ot(a,r,i.id),!Dt(e)&&K(Z9(e,`Unable to send the ticket follow-up.`))}).finally(()=>He(!1))},_r=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=$J({parentType:`ticket`,parentId:a,setId:r.set_id});K(null);try{let e=await Hhe(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedTicketId!==a?t:{...t,tickets:t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets,ticketDetail:e,ticketDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){tY(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)||K(Z9(e,`Unable to resolve the ticket questions.`)),e}},vr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),yr())},yr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||Ye)return;let n=q.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})};Ze(!0),J(null),Whe(r,i,a,n).then(e=>{o(e),Je(``),At(a,r),kt(a,r,i)}).catch(e=>{Dt(e)||J(Z9(e,`Unable to send the bundle follow-up.`))}).finally(()=>Ze(!1))},br=(0,p.useCallback)(async(e,t,n)=>{try{return await xhe(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]),xr=(0,p.useCallback)(async(e,t,n)=>{try{return await She(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]),Sr=(0,p.useCallback)(async(e,t,n)=>{try{return await Che(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]);return e.status===`checking`?(0,Y.jsx)(b9,{title:`Checking mobile session`,description:`Archon is validating this browser before showing project controls.`}):e.status===`pairing`?(0,Y.jsx)(b9,{title:`Checking pairing link`,description:`Keep this page open while Archon verifies the one-time pairing link.`}):e.status===`pairing_confirmation`?(0,Y.jsxs)(b9,{title:`Compare pairing code`,description:`Confirm this code matches the desktop dialog before pairing this phone.`,children:[(0,Y.jsx)(xC,{className:`border-primary/25 bg-primary/10 shadow-none`,children:(0,Y.jsxs)(EC,{className:`space-y-2 pt-5 text-center`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-foreground`,children:`Verification code`}),(0,Y.jsx)(`div`,{className:`font-mono text-3xl font-semibold tracking-[0.18em] text-foreground`,children:e.displayCode}),(0,Y.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expires at `,Oge(e.expiresAt)]})]})}),(0,Y.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,Y.jsx)(`p`,{className:`text-sm text-red-200`,children:e.error}):null,(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,Y.jsx)(Q,{size:`lg`,disabled:y,onClick:Cn,children:y?`Pairing...`:`Pair this phone`}),(0,Y.jsx)(Q,{variant:`outline`,size:`lg`,disabled:y,onClick:wn,children:`Cancel`})]})]}):e.status===`unauthenticated`?(0,Y.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,Y.jsx)(Q,{onClick:vn,children:`Retry`})}):e.status===`error`?(0,Y.jsx)(b9,{title:`Mobile access unavailable`,description:e.message,children:(0,Y.jsx)(Q,{onClick:vn,children:`Retry`})}):(0,Y.jsx)(Eq,{socket:i??void 0,fetchTicketRuns:br,fetchChatRuns:xr,fetchSpecRuns:Sr,children:(0,Y.jsxs)(`main`,{className:Z(`bg-background text-foreground`,_n?`flex h-[100dvh] flex-col overflow-hidden`:`min-h-screen`),children:[(0,Y.jsx)(age,{open:c,projects:e.projects,selectedProjectId:e.selectedProjectId,error:e.projectError,onOpenChange:l,onSelectProject:Nn,onRetry:Tn}),(0,Y.jsx)(oge,{open:dt,project:qt,targetOptions:st,error:X??lt,isLoading:pt,isSubmitting:ht,onOpenChange:ft,onRetry:Dn,onSelectBundle:e=>{Pn(e)},onSelectRepoRoot:(e,t)=>{Fn(e,t)}}),(0,Y.jsx)(ege,{selectedProject:qt,targetLabel:on,isTargetLoading:sn,isTargetDisabled:!Ht,connectionState:n,onOpenProjects:bn,onOpenTargetSelector:xn}),_n?(0,Y.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,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:f&&e.selectedTicketId?(0,Y.jsx)(X9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:rt,error:e.ticketDetailError,actionState:Ae,actionError:Me,followUpPrompt:Pe,followUpSelectedModel:Ie,followUpSelectedVariant:G,followUpSelectedSkills:ze,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSendingFollowUp:Ve,liveResponseTiming:Xt?.agent_status===`running`&&We?.parentId===Xt.id?We:null,followUpError:Ue,onBack:Un,onRetry:jn,onAction:fr,onFollowUpPromptChange:Fe,onFollowUpModelChange:mr,onFollowUpVariantChange:Re,onFollowUpSkillsChange:Be,onFollowUpKeyDown:hr,onFollowUpSubmit:gr,onResolveQuestionSet:_r,isLargeScreen:!1}):(0,Y.jsx)(K9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:tt,mobileDetailView:at,error:e.bundleDetailError,actionState:Ee,actionError:Oe,followUpPrompt:q,isSendingFollowUp:Ye,followUpError:Qe,availableModels:j,onBack:Wn,onRetry:Mn,onAction:pr,onDetailViewChange:ot,onSelectTicket:Bn,onFollowUpPromptChange:Je,onFollowUpKeyDown:vr,onFollowUpSubmit:yr,isLargeScreen:!1})}):null,o===`chats`?(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(q9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:$e,error:e.chatSessionDetailError,isStopping:z===e.selectedChatSessionId,composerMode:e.chatSessionDetail?.mode??C,composerTool:ln,prompt:x,selectedModel:T,selectedVariant:D,selectedSkills:k,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:L,liveResponseTiming:Jt?.agent_status===`running`&&U?.parentId===Jt.id?U:null,isUpdatingMode:ee,showStartBuilding:hn,composerDisabledReason:mn,onBack:Vn,onRetry:kn,onStop:Qn,onModeChange:Hn,onStartBuilding:Xn,onPromptChange:S,onModelChange:Gn,onVariantChange:O,onSkillsChange:A,onPromptKeyDown:Kn,onSubmit:Yn,onResolveQuestionSet:Zn,isLargeScreen:!1}),V?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:V}):null]}):null,o===`spec`?(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(Y9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:we,error:e.specSessionDetailError,isStopping:ve===e.selectedSpecSessionId,composerMode:e.specSessionDetail?.mode??W,composerTool:un,prompt:ae,selectedModel:ce,selectedVariant:ue,selectedSkills:fe,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:me,liveResponseTiming:Zt?.agent_status===`running`&&Se?.parentId===Zt.id?Se:null,isUpdatingMode:ge,composerDisabledReason:gn,targetWarning:$t??nn??an,targetActionLabel:tn?j9(`specDetail.retryTarget`):rn&&Zt?Wb.t(`common:mobileApp.specDetail.switchBack`,{target:_5(Zt)}):null,targetActionError:X,isRestoringTarget:ht,onBack:rr,onRetry:er,onStop:dr,onModeChange:ir,onPromptChange:oe,onModelChange:ar,onVariantChange:de,onSkillsChange:pe,onPromptKeyDown:or,onSubmit:cr,onSubmitAnswer:lr,onResolveQuestionSet:ur,onRestoreTarget:In,isLargeScreen:!1}),be?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:be}):null]}):null]}):(0,Y.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,Y.jsxs)(`div`,{className:`space-y-3 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col`,children:[(0,Y.jsx)($he,{status:n,onRetry:vn}),o===`overview`?(0,Y.jsx)(`div`,{className:`space-y-3 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col`,children:e.projectError?(0,Y.jsx)(x9,{title:`Projects unavailable`,description:e.projectError,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:Tn,children:`Retry projects`})}):e.selectedProjectId&&!e.projectSummary&&!e.projectSummaryError?(0,Y.jsx)(hge,{}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(yge,{selectedProjectId:e.selectedProjectId,summary:e.projectSummary,tickets:e.tickets,error:e.projectSummaryError,chatSessions:e.chatSessions,chatSessionDetail:e.chatSessionDetail,onRetry:En,onOpenTickets:()=>yn(`tickets`),onOpenChats:()=>yn(`chats`),onOpenSpec:()=>yn(`spec`)}),(0,Y.jsx)(gge,{isLoggingOut:_,onLogout:Sn})]})}):null,o===`tickets`?cn?(0,Y.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(`div`,{className:`min-h-0`,children:(0,Y.jsx)(A9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:An,onSelectBundle:zn,onSelectTicket:Bn})}),(0,Y.jsx)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:f&&e.selectedTicketId?(0,Y.jsx)(X9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:rt,error:e.ticketDetailError,actionState:Ae,actionError:Me,followUpPrompt:Pe,followUpSelectedModel:Ie,followUpSelectedVariant:G,followUpSelectedSkills:ze,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSendingFollowUp:Ve,liveResponseTiming:Xt?.agent_status===`running`&&We?.parentId===Xt.id?We:null,followUpError:Ue,onBack:Un,onRetry:jn,onAction:fr,onFollowUpPromptChange:Fe,onFollowUpModelChange:mr,onFollowUpVariantChange:Re,onFollowUpSkillsChange:Be,onFollowUpKeyDown:hr,onFollowUpSubmit:gr,onResolveQuestionSet:_r,isLargeScreen:!0}):(0,Y.jsx)(K9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:tt,mobileDetailView:at,error:e.bundleDetailError,actionState:Ee,actionError:Oe,followUpPrompt:q,isSendingFollowUp:Ye,followUpError:Qe,availableModels:j,onBack:Wn,onRetry:Mn,onAction:pr,onDetailViewChange:ot,onSelectTicket:Bn,onFollowUpPromptChange:Je,onFollowUpKeyDown:vr,onFollowUpSubmit:yr,isLargeScreen:!0})})]}):(0,Y.jsx)(A9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:An,onSelectBundle:zn,onSelectTicket:Bn}):null,o===`chats`?cn?(0,Y.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(`div`,{className:`min-h-0`,children:(0,Y.jsx)(F9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:On,onOpenNewChat:Rn,onSelectChat:Ln})}),(0,Y.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,Y.jsx)(q9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:$e,error:e.chatSessionDetailError,isStopping:z===e.selectedChatSessionId,composerMode:e.chatSessionDetail?.mode??C,composerTool:ln,prompt:x,selectedModel:T,selectedVariant:D,selectedSkills:k,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:L,liveResponseTiming:Jt?.agent_status===`running`&&U?.parentId===Jt.id?U:null,isUpdatingMode:ee,showStartBuilding:hn,composerDisabledReason:mn,onBack:Vn,onRetry:kn,onStop:Qn,onModeChange:Hn,onStartBuilding:Xn,onPromptChange:S,onModelChange:Gn,onVariantChange:O,onSkillsChange:A,onPromptKeyDown:Kn,onSubmit:Yn,onResolveQuestionSet:Zn,isLargeScreen:!0}),V?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:V}):null]})]}):(0,Y.jsx)(F9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:On,onOpenNewChat:Rn,onSelectChat:Ln}):null,o===`spec`?cn?(0,Y.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(`div`,{className:`min-h-0`,children:(0,Y.jsx)(J9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:$n,onOpenNewSpec:nr,onSelectSpec:tr})}),(0,Y.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,Y.jsx)(Y9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:we,error:e.specSessionDetailError,isStopping:ve===e.selectedSpecSessionId,composerMode:e.specSessionDetail?.mode??W,composerTool:un,prompt:ae,selectedModel:ce,selectedVariant:ue,selectedSkills:fe,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:me,liveResponseTiming:Zt?.agent_status===`running`&&Se?.parentId===Zt.id?Se:null,isUpdatingMode:ge,composerDisabledReason:gn,targetWarning:$t??nn??an,targetActionLabel:tn?j9(`specDetail.retryTarget`):rn&&Zt?Wb.t(`common:mobileApp.specDetail.switchBack`,{target:_5(Zt)}):null,targetActionError:X,isRestoringTarget:ht,onBack:rr,onRetry:er,onStop:dr,onModeChange:ir,onPromptChange:oe,onModelChange:ar,onVariantChange:de,onSkillsChange:pe,onPromptKeyDown:or,onSubmit:cr,onSubmitAnswer:lr,onResolveQuestionSet:ur,onRestoreTarget:In,isLargeScreen:!0}),be?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:be}):null]})]}):(0,Y.jsx)(J9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:$n,onOpenNewSpec:nr,onSelectSpec:tr}):null]})}),_n?null:(0,Y.jsx)(tge,{activeSection:o,onChange:yn})]})})},jge=({socket:e=rC,children:t})=>(0,Y.jsx)(yq.Provider,{value:e,children:t}),Mge=()=>typeof window<`u`&&window.location.pathname.startsWith(`/mobile`),Nge=()=>{let e=Mge();return Db(e?null:rC),(0,Y.jsx)(We,{i18n:Wb,children:(0,Y.jsx)(at,{children:(0,Y.jsxs)(jge,{children:[e&&(0,Y.jsx)(Age,{}),!e&&(0,Y.jsx)(Eq,{children:(0,Y.jsx)(sfe,{children:(0,Y.jsx)(fhe,{})})})]})})})};document.documentElement.classList.add(`dark`),document.documentElement.style.colorScheme=`dark`,x8(),(0,f.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(Nge,{}));export{Jt as $,eb as A,F_ as B,ax as C,tb as D,ub as E,Pv as F,M_ as G,k_ as H,jv as I,Q as J,j_ as K,Av as L,$ as M,Lv as N,Zy as O,Fv as P,Yt as Q,Cv as R,rC as S,Wb as T,A_ as U,O_ as V,P_ as W,Vn as X,Z as Y,qt as Z,iw as _,K as _t,H4 as a,$t as at,bC as b,bq as c,Vt as ct,Mw as d,it as dt,Zt as et,jw as f,Ke as ft,xw as g,J as gt,bw as h,Qe as ht,W4 as i,Xt as it,Qy as j,$y as k,iG as l,Ut as lt,Sw as m,Xe as mt,Q6 as n,en as nt,U4 as o,Qt as ot,yw as p,q as pt,N_ as q,n3 as r,Gt as rt,Fce as s,Ht as st,$5 as t,Kt as tt,Iw as u,Bt as ut,ow as v,c as vt,Xb as w,aC as x,aw as y,J_ as z};
274
+ `);ne.current+=1,W([...te.current,{kind:`source`,id:`${O.content.path}:${e}:${Date.now()}:${ne.current}`,target:t,filePath:O.content.path,lineNumber:e,lineContent:r[e-1]??``,sourceContext:yde(O.content.content,e),contentSignature:O.content.content_signature,comment:n,stale:!1}])},[W,O,t]);(0,p.useEffect)(()=>{me&&D(`source`)},[me]);let xe=(0,p.useCallback)(()=>{O.kind===`content`&&(D(`source`),j(!0))},[O.kind]),Se=(0,p.useCallback)(e=>{ge.length!==0&&F(t=>((t<0?0:Math.min(t,ge.length-1))+e+ge.length)%ge.length)},[ge.length]);return(0,p.useEffect)(()=>{A&&ie.current?.focus({preventScroll:!0})},[A]),(0,p.useEffect)(()=>{let e=e=>{if(!(!n||O.kind!==`content`||e.defaultPrevented)){if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLocaleLowerCase()===`f`){e.preventDefault(),xe(),requestAnimationFrame(()=>ie.current?.focus({preventScroll:!0}));return}A&&e.key===`Escape`&&(e.preventDefault(),se())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O.kind,n,A,xe,se]),(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 overflow-hidden rounded-xl border border-border`,"aria-label":`Files mode`,children:[(0,Y.jsxs)(`aside`,{className:`flex w-80 shrink-0 flex-col border-r border-border bg-muted/10`,"aria-label":j6(`fileBrowser`),children:[(0,Y.jsxs)(`div`,{className:`space-y-3 border-b border-border p-3`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs text-muted-foreground`,children:[j6(`searchFiles`),(0,Y.jsx)(F_,{ref:re,type:`search`,className:`mt-1 h-8`,value:_,onChange:e=>v(e.target.value),placeholder:j6(`searchPlaceholder`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-foreground`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked)}),j6(`changedOnly`)]}),(0,Y.jsx)(vv,{content:j6(`refreshFiles`),children:(0,Y.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":j6(`refreshFiles`),disabled:h,onClick:()=>{de(!0)},children:h?(0,Y.jsx)(Pv,{className:`size-3.5 animate-spin`}):(0,Y.jsx)(Yb,{className:`size-3.5`})})})]})]}),h&&!u&&(0,Y.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:j6(`loadingManifest`)}),f&&(0,Y.jsxs)(`div`,{className:`space-y-3 p-4 text-sm text-destructive`,children:[(0,Y.jsx)(`p`,{children:f}),(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void de(),children:j6(`retry`)})]}),u&&(0,Y.jsxs)(Y.Fragment,{children:[u.truncated&&(0,Y.jsx)(`div`,{className:`border-b border-border px-3 py-2 text-xs text-amber-300`,children:j6(`truncated`)}),(0,Y.jsx)(mde,{entries:u.entries,search:y,changedOnly:b,expandedPaths:S,selectedPath:w,commentCounts:ye,onExpandedPathsChange:C,onSelectPath:ue})]})]}),(0,Y.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate font-mono text-xs text-foreground`,children:w??j6(`selectFile`)}),fe&&(0,Y.jsx)(`div`,{className:`mt-0.5 text-[11px] capitalize text-muted-foreground`,children:bde(fe)})]}),(O.kind===`content`||pe||l||w&&fe?.status&&c)&&(0,Y.jsxs)(`div`,{"data-testid":`workspace-file-header-actions`,className:`flex shrink-0 flex-wrap items-center justify-end gap-2 pr-10`,children:[pe&&(0,Y.jsxs)(`div`,{className:`flex items-center rounded-lg border border-border bg-muted/20 p-0.5`,role:`group`,"aria-label":j6(`viewMode.ariaLabel`),children:[(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:he===`preview`?`secondary`:`ghost`,"aria-pressed":he===`preview`,disabled:me,onClick:()=>{D(`preview`)},children:j6(`viewMode.preview`)}),(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:he===`source`?`secondary`:`ghost`,"aria-pressed":he===`source`,onClick:()=>{D(`source`)},children:j6(`viewMode.source`)})]}),me&&(0,Y.jsx)(`p`,{className:`text-xs text-amber-200`,role:`status`,children:j6(`viewMode.sourceRequiredLargeFile`)}),O.kind===`content`&&!A&&(0,Y.jsx)(vv,{content:j6(`source.search.open`),children:(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":j6(`source.search.open`),onClick:xe,children:(0,Y.jsx)(Wue,{className:`size-4`})})}),O.kind===`content`&&A&&(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-lg border border-border bg-muted/20 p-1`,role:`search`,children:[(0,Y.jsx)(F_,{ref:ie,type:`search`,className:`h-7 w-40 rounded-md px-2 text-xs sm:w-56`,"aria-label":j6(`source.search.inputLabel`),placeholder:j6(`source.search.placeholder`),value:M,onChange:e=>{N(e.target.value),F(0)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Se(e.shiftKey?-1:1))}}),(0,Y.jsx)(`output`,{className:`min-w-12 whitespace-nowrap px-1 text-center text-[11px] text-muted-foreground`,"aria-live":`polite`,children:ge.length>0?j6(`source.search.matchCount`,{current:_e+1,total:ge.length}):j6(`source.search.noMatches`)}),(0,Y.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":j6(`source.search.previous`),disabled:ge.length===0,onClick:()=>Se(-1),children:(0,Y.jsx)(Cv,{className:`size-3.5 rotate-180`})}),(0,Y.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":j6(`source.search.next`),disabled:ge.length===0,onClick:()=>Se(1),children:(0,Y.jsx)(Cv,{className:`size-3.5`})}),(0,Y.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":j6(`source.search.close`),onClick:se,children:(0,Y.jsx)(Xb,{className:`size-3.5`})})]}),w&&fe?.status&&c&&(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>c(w),children:j6(`viewChanges`)}),l]})]}),O.kind===`empty`&&(0,Y.jsx)(`div`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:j6(`empty`)}),O.kind===`loading`&&(0,Y.jsx)(`div`,{className:`m-auto text-sm text-muted-foreground`,children:j6(`loadingFile`,{path:O.path})}),O.kind===`unsupported`&&(0,Y.jsxs)(`div`,{className:`m-auto max-w-md space-y-2 text-center`,children:[(0,Y.jsx)(bC,{variant:`outline`,className:`capitalize`,children:O.reason.replace(/_/g,` `)}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O.message})]}),O.kind===`error`&&(0,Y.jsxs)(`div`,{className:`m-auto max-w-md space-y-3 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:O.message}),(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void le(O.path,!0),children:j6(`retry`)})]}),O.kind===`content`&&(0,Y.jsx)(xde,{file:O.content,viewMode:he,comments:ve,canComment:r,searchMatches:ge,activeSearchMatchIndex:_e,onAddComment:be})]})]})},P6=r({WorkspaceReviewModal:()=>I6}),F6=e=>Wb.t(`common:workspaceReviewModal.${e}`),Cde=({activeMode:e,availableModes:t,onModeChange:n})=>(0,Y.jsx)(`div`,{role:`tablist`,"aria-label":F6(`modeAriaLabel`),className:`flex items-center gap-1 rounded-lg border border-border/80 bg-muted/30 p-1`,children:t.map(t=>(0,Y.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,Y.jsx)(jv,{className:`h-4 w-4`}):(0,Y.jsx)(Mv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:F6(t)})]},t))}),I6=({target:e,initialMode:t=`changes`,reviewMode:n,onReviewModeChange:r,enabledModes:i=[`changes`],filesView:a,fileTarget:o,bundleTargetName:s=null,onClose:c,title:l,mode:u,onModeChange:d,canToggleMode:f=!1,...m})=>{let[h,g]=(0,p.useState)(t),_=n??h,v=i.includes(_)?i:[_,...i],[y]=(0,p.useState)(e),[b,x]=(0,p.useState)(null),[S,C]=(0,p.useState)(null),[w,T]=(0,p.useState)([]),[E,D]=(0,p.useState)([]),O=(0,p.useRef)(E),[k,A]=(0,p.useState)(null);O.current=E;let j=(0,p.useCallback)(e=>{O.current=e,D(e)},[]),M=(0,p.useCallback)(()=>{O.current=[],D([])},[]),N=v.length>1,P=N&&a===void 0,[F]=(0,p.useState)(s),[I]=(0,p.useState)(()=>o??(y.scope===`project_root`?m.targetKind===`bundle`&&m.reviewCommentsBundleId?{kind:`bundle`,bundle_id:m.reviewCommentsBundleId,ticket_id:null}:{kind:`repo_root`,bundle_id:null,ticket_id:null}:m.reviewCommentsBundleId?{kind:`bundle`,bundle_id:m.reviewCommentsBundleId,ticket_id:null}:{kind:`ticket`,bundle_id:null,ticket_id:y.ticketId})),L=I.kind===`repo_root`?Wb.t(`common:workspaceFiles.repositoryRoot`):I.kind===`bundle`?Wb.t(`common:workspaceFiles.bundleTarget`,{name:F||I.bundle_id}):Wb.t(`common:workspaceFiles.ticketTarget`,{id:I.ticket_id}),R=I.kind===`ticket`?l:L,ee=(0,p.useCallback)(async()=>{if(!m.projectId||E.length===0)return E;let e=await A6(m.projectId,E),t=new Map(e.map(e=>[e.id,e.stale])),n=O.current.map(e=>{let n=t.get(e.id);return n===void 0?e:{...e,stale:n}});return j(n),n},[m.projectId,E,j]),te=(0,p.useCallback)(()=>{m.projectId&&localStorage.removeItem(k6(m.projectId,I)),M()},[m.projectId,M,I]),z=(0,p.useCallback)(e=>{r?.(e),n===void 0&&g(e)},[r,n]),B=(0,p.useCallback)(e=>{x(e),z(`changes`)},[z]),V=(0,p.useCallback)(e=>{C(e),z(`files`)},[z]),H=(0,p.useCallback)(e=>{x(t=>t===e?null:t)},[]),U=(0,p.useCallback)(e=>{C(t=>t===e?null:t)},[]),ne=(0,p.useCallback)(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u!==void 0&&d&&(0,Y.jsx)($Y,{value:u,disabled:!f||m.isUpdatingMode,onChange:d,planInactiveTooltip:(0,Y.jsx)(lX,{label:Wb.t(`common:ticketChangesModal.switchToPlan`)}),buildInactiveTooltip:(0,Y.jsx)(lX,{label:Wb.t(`common:ticketChangesModal.switchToBuild`)})}),(0,Y.jsx)(T3,{reviewComments:w,reviewFindings:e.reviewFindings,githubComments:e.githubComments,pendingFixCount:e.pendingFixCount,canSendReview:e.canSendReview,isSubmittingReview:e.isSubmittingReview,reviewSubmitDisabledReason:e.reviewSubmitDisabledReason,onClearPendingFixes:e.onClearPendingFixes,onSubmitReview:e.onSubmitReview,onUpdateReviewComment:e.onUpdateReviewComment,onRemoveReviewComment:e.onRemoveReviewComment})]}),[f,m.isUpdatingMode,u,d,w]),re=(0,p.useCallback)(()=>k?ne(k):null,[ne,k]);return(0,p.useEffect)(()=>{if(!d||u===void 0)return;let e=e=>{!oX(e)||!f||(e.preventDefault(),d(aX(u)))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[f,u,d]),(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(gC,{onClose:c,overlayClassName:`z-[70] bg-black/30 p-[5vh]`,panelClassName:`flex h-[92vh] w-full max-w-none flex-col overflow-hidden rounded-2xl border border-border bg-card p-6 shadow-2xl`,closeButtonLabel:F6(`closeAriaLabel`),renderContent:({closeButton:e})=>{let t=N?(0,Y.jsx)(Cde,{activeMode:_,availableModes:v,onModeChange:z}):null,n=N?(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:t}):null,r=y.scope===`ticket`?(0,Y.jsx)(v6,{...m,...y,projectId:m.projectId,title:l,onClose:c,mode:u,onModeChange:d,canToggleMode:f,headerControls:n,isActive:_===`changes`,onPendingReviewCommentsChange:T,onReviewControlsStateChange:A,renderReviewControls:ne,showReviewControls:!N||_===`changes`,sourceReviewComments:E,onSourceReviewCommentsChange:j,onClearSourceReviewComments:M,onSourceReviewCommentsSubmitted:te,onValidateSourceReviewComments:ee,requestedDiffPath:b,onRequestedDiffPathHandled:H,onViewCurrentFile:P?V:void 0}):(0,Y.jsx)(v6,{...m,scope:`project_root`,projectId:m.projectId,title:l,onClose:c,mode:u,onModeChange:d,canToggleMode:f,headerControls:n,isActive:_===`changes`,onPendingReviewCommentsChange:T,onReviewControlsStateChange:A,renderReviewControls:ne,showReviewControls:!N||_===`changes`,sourceReviewComments:E,onSourceReviewCommentsChange:j,onClearSourceReviewComments:M,onSourceReviewCommentsSubmitted:te,onValidateSourceReviewComments:ee,requestedDiffPath:b,onRequestedDiffPathHandled:H,onViewCurrentFile:P?V:void 0}),i=N?(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[_===`files`&&(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-4`,children:[(0,Y.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-lg font-semibold text-foreground`,children:R}),(0,Y.jsx)(`div`,{"data-testid":`workspace-review-files-header-actions`,className:`flex min-w-0 max-w-full items-center gap-2 pr-10`,children:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:t})})]}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(`div`,{id:`workspace-review-changes-panel`,role:`tabpanel`,hidden:_!==`changes`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":_===`changes`,children:r}),(0,Y.jsx)(`div`,{id:`workspace-review-files-panel`,role:`tabpanel`,hidden:_!==`files`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":_===`files`,children:a??(0,Y.jsx)(Sde,{projectId:m.projectId,target:I,isActive:_===`files`,canAddComments:m.canAddReviewComments??!1,comments:E,onCommentsChange:j,requestedPath:S,onRequestedPathHandled:U,onViewChanges:B,headerControls:_===`files`&&k?re():void 0})})]})]}):r;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`absolute right-4 top-4 z-10 mt-2`,children:e}),i]})}})})},wde=e=>!(e instanceof Ke)||e.status!==409||typeof e.data!=`object`||e.data===null?!1:`code`in e.data&&e.data.code===`build_open_questions_changed`,Tde=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))},Ede=e=>e.flatMap(e=>e.questions.map(e=>`${e.id}:${e.updated_at}`)).join(`|`),Dde=({details:e,onClose:t,onRefresh:n,onSubmit:r})=>{let{t:i}=K(`common`),a=(0,p.useMemo)(()=>Tde(e),[e]),o=(0,p.useMemo)(()=>a.flatMap(e=>e.questions),[a]),s=(0,p.useMemo)(()=>Ede(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,Y.jsx)(O_,{open:!0,onOpenChange:e=>{e||t()},children:(0,Y.jsx)(A_,{showCloseButton:!1,className:`max-h-[calc(100vh-2rem)] gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:(0,Y.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(wde(e)){try{await n()}catch{_(i(`buildOpenQuestionsDialog.refreshFailedError`))}h(!0),_(e=>e??i(`buildOpenQuestionsDialog.conflictError`))}else _(e instanceof Ke?e.message:i(`buildOpenQuestionsDialog.submitError`))}finally{f(!1)}}},className:`flex min-h-0 flex-col`,children:[(0,Y.jsxs)(j_,{className:`border-b border-border/70 px-5 py-4 sm:px-6`,children:[(0,Y.jsx)(N_,{children:i(`buildOpenQuestionsDialog.title`)}),(0,Y.jsx)(P_,{children:i(`buildOpenQuestionsDialog.description`)})]}),(0,Y.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,Y.jsxs)(`section`,{"aria-labelledby":`build-question-ticket-${e.ticket.id}`,children:[(0,Y.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,Y.jsx)(`div`,{className:`mt-2 space-y-3`,children:e.questions.map(e=>{let t=l[e.id]??{mode:null,answer:``};return(0,Y.jsxs)(`article`,{className:`min-w-0 rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,Y.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-foreground`,children:e.question_text}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Y.jsxs)(J_,{className:`flex cursor-pointer items-center gap-2 text-sm`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`decision-${e.id}`,checked:t.mode===`answer`,onChange:()=>x(e.id,{mode:`answer`})}),i(`buildOpenQuestionsDialog.answerOption`)]}),(0,Y.jsxs)(J_,{className:`flex cursor-pointer items-center gap-2 text-sm`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`mt-3`,children:[(0,Y.jsx)(J_,{htmlFor:`answer-${e.id}`,className:`sr-only`,children:i(`buildOpenQuestionsDialog.answerLabel`,{question:e.question_text})}),(0,Y.jsx)(I_,{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,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`buildOpenQuestionsDialog.empty`)})]}),(0,Y.jsxs)(M_,{className:`items-start border-t border-border/70 px-5 py-4 sm:items-center sm:px-6`,children:[(0,Y.jsxs)(`div`,{className:`mr-auto min-w-0 text-xs leading-5 text-muted-foreground`,"aria-live":`polite`,children:[g&&(0,Y.jsx)(`p`,{className:`text-destructive`,children:g}),!g&&b&&(0,Y.jsx)(`p`,{children:i(`buildOpenQuestionsDialog.dismissSummary`)}),!g&&!y&&!b&&(0,Y.jsx)(`p`,{children:i(`buildOpenQuestionsDialog.incompleteSummary`)})]}),m&&(0,Y.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>{h(!1),_(null)},children:i(`buildOpenQuestionsDialog.reviewRefreshed`)}),(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:t,children:i(`buildOpenQuestionsDialog.cancel`)}),(0,Y.jsx)(Q,{type:`submit`,disabled:!v||m||d,children:i(d?`buildOpenQuestionsDialog.submitting`:`buildOpenQuestionsDialog.submit`)})]})]})})})},L6={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`}},Ode=e=>ry(e)?`ready`:`blocked`,R6=180,kde=560,z6=88,B6=12,V6=18,H6=`dependency-overlay-clip`,U6=(e,t,n)=>Math.min(Math.max(e,t),n),Ade=(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(` `)}`},jde=(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}),Mde=(e,t)=>{let n=U6(Math.round(e.length*7.2)+24,R6,kde),r=Math.max(R6,t-B6*2);return Math.min(n,r)},Nde=(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}=cy(t,o??{left:e.pointer.x,top:e.pointer.y,width:0,height:0}),d=jde(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=Mde(c,d.width);return{text:c,x:o&&s?U6(f.x-p/2,B6,Math.max(B6,d.width-p-B6)):(()=>{let e=f.x+V6,t=f.x-V6-p;return e+p<=d.width-B6?e:t>=B6?t:U6(e,B6,Math.max(B6,d.width-p-B6))})(),y:U6(f.y,B6,Math.max(B6,d.height-z6-B6)),width:p}},W6=({blockerRect:e,dependentRect:t,className:n,testId:r,markerEnd:i})=>{let{start:a,end:o}=cy(e,t),{path:s}=tne(a,o);return(0,Y.jsx)(`g`,{"data-testid":r,children:(0,Y.jsx)(`path`,{d:s,className:n,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,markerEnd:i})})},Pde=({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=Nde(e,i,n,t,r);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W6,{blockerRect:i,dependentRect:a,className:L6.preview.className,testId:`dependency-preview`,markerEnd:`url(#${L6.preview.markerId})`}),(e=>o?(0,Y.jsx)(`foreignObject`,{x:o.x,y:o.y,width:o.width,height:z6,"data-testid":`dependency-preview-label`,children:e}):null)((0,Y.jsx)(`div`,{className:`pointer-events-none flex h-full w-full items-start`,children:(0,Y.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})}))]})},Fde=({dependencies:e,cardRects:t,clipRects:n=[],preview:r,ticketsById:i,overlaySize:a})=>{let o=Ade(a,n);return(0,Y.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 z-10 h-full w-full overflow-visible`,children:[(0,Y.jsxs)(`defs`,{children:[Object.values(L6).map(e=>(0,Y.jsx)(`marker`,{id:e.markerId,markerWidth:`8`,markerHeight:`8`,refX:`7`,refY:`4`,orient:`auto`,markerUnits:`userSpaceOnUse`,children:(0,Y.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,Y.jsx)(`clipPath`,{id:H6,children:(0,Y.jsx)(`path`,{d:o,clipRule:`evenodd`})})]}),(0,Y.jsxs)(`g`,{"data-testid":`dependency-overlay-content`,clipPath:o?`url(#${H6})`: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=L6[Ode(n)];return!a||!o?null:(0,Y.jsx)(W6,{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,Y.jsx)(Pde,{preview:r,cardRects:t,ticketsById:i,overlaySize:a})]})]})},Ide=({onOpenProjectExecutionSettings:e})=>{let{t}=K(`common`);return(0,Y.jsxs)(`p`,{className:`mt-2 w-full max-w-none text-xs leading-relaxed text-amber-200/90`,role:`status`,children:[t(`modelSelector.dockerSandboxNotice`),e&&(0,Y.jsx)(Q,{type:`button`,variant:`link`,size:`xs`,className:`ml-1 h-auto align-baseline px-0 text-xs font-medium text-amber-100`,onClick:e,children:t(`modelSelector.openExecutionSettings`)})]})},Lde=({onSubmit:e,bundles:t,projectId:n=null,projectBranchState:r=null,tool:i,showModelSelector:a=!1,showSkillsSelector:o=!1,availableModels:s=[],availableSkills:c=[],initialModel:l=``,initialVariant:u=``,initialSkills:d=[],initialWorktreeBundleId:f=null,initialImportedDraft:p=null,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,showDockerSandboxModelNotice:_=!1,onOpenProjectExecutionSettings:v,onClose:y})=>{let{t:b}=K(`common`),{jiraImportState:x,importFromJira:S}=Jw(n),{gitHubImportState:C,importFromGitHub:w}=vw(n),T=[{key:`jira`,label:b(`jiraImportField.label`),placeholder:b(`jiraImportField.placeholder`),state:x,onImport:S},{key:`github`,label:b(`githubImportField.label`),placeholder:b(`githubImportField.placeholder`),state:C,onImport:w}];return(0,Y.jsx)(gC,{onClose:y,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:x})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`absolute right-4 top-4 z-10 sm:right-5 sm:top-5 lg:right-6 lg:top-6`,children:x}),(0,Y.jsx)(KY,{heading:b(`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:T,onCancel:y,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,modelSelectorNotice:_?(0,Y.jsx)(Ide,{onOpenProjectExecutionSettings:v}):void 0,titleInputId:`title`,descriptionInputId:`description`,bundleSelectId:`new-ticket-bundle`,modelSelectId:`new-model`,variantSelectId:`new-variant`,skillsSelectId:`new-skills`,showEmptyBundleOption:!0,planAction:i?{label:b(`newTicketModal.actions.plan`),onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`plan`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}}:void 0,primaryAction:{label:b(`newTicketModal.actions.createTicket`),variant:`subtle`,onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`create`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}},secondaryAction:{label:b(`newTicketModal.actions.createAndBuild`),variant:`brand`,showAdvanceIcon:!0,onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`build`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}}})]})})},Rde=({className:e=``})=>{let{setNodeRef:t,isOver:n}=sF({id:`trash`});return(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(bC,{variant:`destructive`,className:`text-[11px] uppercase tracking-[0.28em]`,children:`Delete`}),(0,Y.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:n?`Release to delete`:`Drop here to delete`})]}),(0,Y.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,Y.jsx)(kC,{className:`h-5 w-5 transition-colors ${n?`text-red-100`:`text-red-300/70`}`})})]})},zde=(e,t)=>J(Ye(`/ticket-dependencies`,e),{signal:t}),Bde=(e,t)=>J(Ye(`/ticket-dependencies`,e),{method:`POST`,body:t,fallbackErrorMessage:`Unable to create the dependency right now.`}),Vde=(e,t,n)=>Qe(Ye(`/ticket-dependencies/${t}/${n}`,e),{method:`DELETE`,fallbackErrorMessage:`Unable to remove the dependency right now.`}),Hde=(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},Ude=(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,Wde=(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,Gde=({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=>Ude(e,r)?e:r),C.current=n,c(e=>Hde(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=>{Wde(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}},[]),ee=(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},[]),te=(0,p.useCallback)(async t=>{if(e)try{await Vde(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 Ke?e.message:`Unable to remove the dependency right now.`,{id:`board-dependency-error`})}},[e,r]),z=(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:ee(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=ee(a.x,a.y,t),s=o?ny(n,t,o):null;if(D.current?.(),D.current=null,F(null),!(!o||!s)){if(!s.valid){$.error(Zte(s.reason),{id:`board-dependency-error`});return}try{let n=await Bde(e,{blocker_ticket_id:t,dependent_ticket_id:o});r(e=>ey(e,n))}catch(e){$.error(e instanceof Ke?e.message:`Unable to create the dependency right now.`,{id:`board-dependency-error`})}}};D.current=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),I()},window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0})},[e,I,n,ee,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 B=(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=ny(n,r,e.id);i.set(e.id,t.valid?`valid`:`idle`)}return i},[e,n,g,j,t]),V=(0,p.useCallback)(e=>{if(!B||!g)return`idle`;let t=B.get(e)??`idle`;return e===g.hoveredTicketId&&t===`idle`?`invalid`:t},[B,g]),H=(0,p.useMemo)(()=>!g||g.projectId!==e||!j.has(g.blockerTicketId)?null:{blockerTicketId:g.blockerTicketId,hoveredTicketId:g.hoveredTicketId,pointer:g.pointer},[e,g,j]);return{boardViewportRef:v,boardContentRef:y,registerTicketNode:N,registerDependencyClipNodes:P,measuredCardRects:(0,p.useMemo)(()=>{if(!i)return s;let e=s[i.id];return e?m?.ticketId===i.id?{...s,[i.id]:m.rect}:{...s,[i.id]:{...e,left:e.left+o.x,top:e.top+o.y}}:s},[m,i,s,o.x,o.y]),dependencyClipRects:l,overlayPreview:H,overlaySize:d,getDependencyTargetState:V,handleDependencyStart:z,handleDeleteDependency:te}},Kde=`[data-terminal-pane="true"]`,qde=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},Jde=e=>e instanceof HTMLElement?e.closest(Kde)!==null:!1,Yde=e=>qde(e)||Jde(e),Xde=(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])},G6=new Set([`queued`,`running`]),Zde={check_batch:`checks`,check_repair:`auto_fix`,automation_review_fix:`auto_fix`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pr`},K6=e=>{if(!e.id)return null;let t=Date.parse(e.updated_at);return Number.isFinite(t)?t:null},Qde=e=>{let t=e.source_reference;if(e.kind!==`automation_progression`||e.status!==`waiting`&&!G6.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=K6(e);return!n||r===null?null:{bundleId:n,id:e.id,isActive:G6.has(e.status),updatedAt:r}},$de=e=>{let t=Zde[e.kind],n=K6(e);return!t||!G6.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}},q6=(e,t)=>e.updatedAt===t.updatedAt?e.id.localeCompare(t.id)>0:e.updatedAt>t.updatedAt,efe=e=>{let t=new Map,n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=Qde(r);if(e){let n=t.get(e.bundleId);(!n||q6(e,n))&&t.set(e.bundleId,e);continue}let i=$de(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||q6(e,n))&&a.set(t,e)}for(let[e,t]of a)i.set(e,t.status);return i},J6={runs:[],events:[],isLoading:!1,isLoadingMore:!1,hasMoreRuns:!1,hasMoreEvents:!1,error:null},Y6=(0,p.createContext)({state:new Map,loadMoreProject:()=>void 0,refreshProject:()=>void 0,subscribeProject:()=>()=>void 0}),tfe=[`queued`,`waiting`,`running`],nfe=(e,t,n,r)=>Mce(e,{cursor:t,limit:200,signal:n,statuses:r}),rfe=(e,t,n)=>Nce(e,{cursor:t,limit:200,signal:n}),ife=(e,t)=>{let n=t.created_at.localeCompare(e.created_at);return n===0?t.id.localeCompare(e.id):n},afe=(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},X6=(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(ife)},Z6=(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(afe)},ofe=async(e,t,n)=>{let r=null,i=[];do{let a=await e(t,r,n,tfe);i=X6(i,a.runs),r=a.next_cursor}while(r);return i},sfe=({socket:e,fetchRunsPage:t,fetchEventsPage:n,children:r})=>{let i=bq(),a=e??i,o=t??nfe,s=n??rfe,[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)??J6;return n.set(e,{...r,isLoading:!0,isLoadingMore:!1,error:null}),n}),Promise.all([o(e,null,t.signal),ofe(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:X6(X6(n.runs,r),a.runs),events:Z6(i.events,a.events),isLoading:!1,isLoadingMore:!1,hasMoreRuns:!!n.next_cursor,hasMoreEvents:!!i.next_cursor,error:null}),o})}).catch(t=>{Xe(t)||l(n=>{let r=new Map(n),i=r.get(e)??J6;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)??J6;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)??J6;return i.set(e,{...a,runs:X6(a.runs,t.runs),events:Z6(a.events,r.events),isLoadingMore:!1,hasMoreRuns:!!t.next_cursor,hasMoreEvents:!!r.next_cursor,error:null}),i}))}).catch(t=>{Xe(t)||l(n=>{let r=new Map(n),i=r.get(e)??J6;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=X6(t.runs,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??J6;return n.set(e.project_id,{...r,runs:X6(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=Z6(t.events,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??J6;return n.set(e.project_id,{...r,events:Z6(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,Y.jsx)(Y6.Provider,{value:x,children:r})},Q6=e=>{let{loadMoreProject:t,refreshProject:n,state:r,subscribeProject:i}=(0,p.useContext)(Y6);(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)??J6:J6,loadMore:o,refresh:a}},$6=e=>({...e,messages:void 0,agent_log:void 0,streaming_response:void 0}),e8=(e,t)=>e?e.state!==t.state||e.parked_at!==t.parked_at||e.worktree_bundle_id!==t.worktree_bundle_id:!0,t8=(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}},n8=(e,t)=>{let n=e=>_y(t)?_y(e):e.state===t.state&&!_y(e),r=e.findIndex(e=>n(e));if(r===-1)return[...e,t];let i=[...e];return i.splice(r,0,t),i},r8=(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)]},i8=(e,t)=>{let n=e.find(e=>e.id===t.id);if(!n)return[...e,t];let r=t8(n,t);return e.map(e=>e.id===t.id?r:e)},a8=(e,t)=>{let n=t8(e.find(e=>e.id===t.id),t);return n8(o8(e,t.id),n)},cfe=(e,t)=>{if(e.length===0)return[...t];let n=[...e];for(let e of t)n=e8(n.find(t=>t.id===e.id),e)?a8(n,e):i8(n,e);let r=new Set(t.map(e=>e.id));return n.filter(e=>r.has(e.id))},o8=(e,t)=>e.filter(e=>e.id!==t),s8=(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=o8(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 n8(s,o)},lfe=new Set([`findings`,`pull-requests`,`deployments`,`incidents`]),c8=e=>encodeURIComponent(e),ufe=e=>{try{let t=decodeURIComponent(e);return t.length>0?t:null}catch{return null}},l8=(e,t)=>t.every((t,n)=>e[n]===t),u8=(e,t)=>e.length<=t.length&&l8(t,e),d8=e=>e===`files`||e===`changes`,dfe=(e,t=lfe)=>{let n=[...e.map(e=>e.namespace),...Array.from(t,e=>[e])];for(let e of n)if(e.length===0||e.some(e=>e.length===0))throw Error(`Desktop route namespaces must contain non-empty segments`);for(let e=0;e<n.length;e+=1)for(let t=e+1;t<n.length;t+=1){let r=n[e],i=n[t];if(u8(r,i)||u8(i,r))throw Error(`Duplicate or prefix-ambiguous desktop route namespace: ${r.join(`/`)} and ${i.join(`/`)}`)}return{build:t=>{if(t.projectId.length===0)throw Error(`Desktop routes require a project ID`);let n=e.flatMap(e=>{let n=e.build(t);return n?[[...e.namespace,...n]]:[]});if(n.length!==1)throw Error(`Desktop route kind must be owned by exactly one descriptor: ${t.kind}`);if(n[0].some(e=>e.length===0))throw Error(`Desktop route segments must be non-empty: ${t.kind}`);return`/app/projects/${c8(t.projectId)}/${n[0].map(c8).join(`/`)}`},isModal:t=>{let n=e.filter(e=>e.build(t)!==null);if(n.length!==1)throw Error(`Desktop route must have exactly one descriptor: ${t.kind}`);return n[0].isModal(t)},parse:t=>{let n=t.startsWith(`/`)?t.slice(1).split(`/`):[];if(n.length<4||n[0]!==`app`||n[1]!==`projects`)return null;let r=n.slice(2).map(ufe);if(r.some(e=>e===null))return null;let[i,...a]=r,o=e.find(e=>l8(a,e.namespace));if(!o)return null;let s=null;try{s=o.parse(i,a.slice(o.namespace.length))}catch{return null}return s||null},parent:t=>{let n=e.filter(e=>e.build(t)!==null);if(n.length!==1)throw Error(`Desktop route must have exactly one descriptor: ${t.kind}`);return n[0].parent(t)}}},f8=e=>({namespace:[e],parse:(t,n)=>n.length===0?{kind:`workspace`,projectId:t,workspace:e}:e===`board`&&n.length===2&&n[0]===`tickets`?{kind:`ticket`,projectId:t,ticketId:n[1]}:e===`board`&&n.length===2&&n[0]===`bundles`?{kind:`bundle`,projectId:t,bundleId:n[1]}:e===`chat`&&n.length===2&&n[0]===`sessions`?{kind:`chat-session`,projectId:t,chatSessionId:n[1]}:e===`spec`&&n.length===2&&n[0]===`sessions`?{kind:`spec-session`,projectId:t,specSessionId:n[1]}:e===`spec`&&n.length===4&&n[0]===`sessions`&&n[2]===`snapshots`?{kind:`spec-snapshot`,projectId:t,specSessionId:n[1],specSnapshotId:n[3]}:null,build:t=>t.kind===`workspace`?t.workspace===e?[]:null:e===`board`&&t.kind===`ticket`?[`tickets`,t.ticketId]:e===`board`&&t.kind===`bundle`?[`bundles`,t.bundleId]:e===`chat`&&t.kind===`chat-session`?[`sessions`,t.chatSessionId]:e===`spec`&&t.kind===`spec-session`?[`sessions`,t.specSessionId]:e===`spec`&&t.kind===`spec-snapshot`?[`sessions`,t.specSessionId,`snapshots`,t.specSnapshotId]:null,isModal:e=>e.kind===`ticket`||e.kind===`bundle`,parent:e=>e.kind===`ticket`||e.kind===`bundle`?{kind:`workspace`,projectId:e.projectId,workspace:`board`}:e.kind===`chat-session`?{kind:`workspace`,projectId:e.projectId,workspace:`chat`}:e.kind===`spec-session`||e.kind===`spec-snapshot`?{kind:`workspace`,projectId:e.projectId,workspace:`spec`}:null}),p8=dfe([f8(`board`),f8(`chat`),f8(`spec`),f8(`memory`),{namespace:[`repository`],parse:(e,t)=>t.length===1&&d8(t[0])?{kind:`repository-inspection`,projectId:e,mode:t[0]}:null,build:e=>e.kind===`repository-inspection`?[e.mode]:null,isModal:e=>e.kind===`repository-inspection`,parent:e=>e.kind===`repository-inspection`?{kind:`workspace`,projectId:e.projectId,workspace:`board`}:null},{namespace:[`bundles`],parse:(e,t)=>t.length===2&&d8(t[1])?{kind:`bundle-inspection`,projectId:e,bundleId:t[0],mode:t[1]}:null,build:e=>e.kind===`bundle-inspection`?[e.bundleId,e.mode]:null,isModal:e=>e.kind===`bundle-inspection`,parent:e=>e.kind===`bundle-inspection`?{kind:`bundle`,projectId:e.projectId,bundleId:e.bundleId}:null},{namespace:[`tickets`],parse:(e,t)=>t.length===2&&d8(t[1])?{kind:`ticket-inspection`,projectId:e,ticketId:t[0],mode:t[1]}:null,build:e=>e.kind===`ticket-inspection`?[e.ticketId,e.mode]:null,isModal:e=>e.kind===`ticket-inspection`,parent:e=>e.kind===`ticket-inspection`?{kind:`ticket`,projectId:e.projectId,ticketId:e.ticketId}:null},{namespace:[`activity`],parse:(e,t)=>t.length===2&&t[0]===`runs`?{kind:`activity-run`,projectId:e,runId:t[1]}:t.length===4&&t[0]===`runs`&&t[2]===`events`?{kind:`activity-run`,projectId:e,runId:t[1],eventId:t[3]}:null,build:e=>e.kind===`activity-run`?e.eventId?[`runs`,e.runId,`events`,e.eventId]:[`runs`,e.runId]:null,isModal:e=>e.kind===`activity-run`,parent:e=>e.kind===`activity-run`?{kind:`workspace`,projectId:e.projectId,workspace:`board`}:null},{namespace:[`checks`],parse:(e,t)=>t.length===1?{kind:`checks`,projectId:e,batchRunId:t[0]}:t.length===3&&t[1]===`attempts`?{kind:`checks`,projectId:e,batchRunId:t[0],attemptRunId:t[2]}:null,build:e=>e.kind===`checks`?e.attemptRunId?[e.batchRunId,`attempts`,e.attemptRunId]:[e.batchRunId]:null,isModal:e=>e.kind===`checks`,parent:e=>e.kind===`checks`?{kind:`workspace`,projectId:e.projectId,workspace:`board`}:null}]),m8=p8.build;p8.parse,p8.parent;var h8=`archon:completion-notifications:v1`,g8=`${h8}:emitted:`,_8=`archon:completion-notification-events:v1`,ffe=`archon:completion-notifications:v1`,pfe=50,mfe=500,hfe=10080*60*1e3,gfe=256,_fe=256,v8=()=>({emitted:{},leases:{}}),y8=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,b8=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`candidate`&&typeof t.key==`string`&&typeof t.tabId==`string`&&typeof t.expiresAt==`number`||t.type===`emitted`&&typeof t.key==`string`&&typeof t.emittedAt==`number`},vfe=()=>{if(typeof window>`u`)return null;try{let e=window.localStorage;return{publish:t=>{e.setItem(_8,JSON.stringify({event:t,nonce:y8()}))},subscribe:e=>{let t=t=>{if(!(t.key!==_8||!t.newValue))try{let n=JSON.parse(t.newValue);b8(n.event)&&e(n.event)}catch{}};return window.addEventListener(`storage`,t),()=>window.removeEventListener(`storage`,t)}}}catch{return null}},yfe=()=>{if(typeof window>`u`)return null;let e=vfe();if(typeof window.BroadcastChannel!=`function`)return e;try{let t=new window.BroadcastChannel(ffe);return{publish:n=>{if(t){t.postMessage(n);return}e?.publish(n)},subscribe:n=>{let r=e=>{b8(e.data)&&n(e.data)};try{t?.addEventListener(`message`,r)}catch{return t?.close(),t=null,e?.subscribe(n)??(()=>{})}return()=>{t?.removeEventListener(`message`,r),t?.close(),t=null}}}}catch{return e}},bfe=((e={})=>{let t=e.tabId??y8(),n=e.storage===void 0?(()=>{try{return typeof window>`u`?null:window.localStorage}catch{return null}})():e.storage,r=e.transport===void 0?yfe():e.transport,i=e.now??Date.now,a=e.wait??(e=>new Promise(t=>window.setTimeout(t,e))),o=e.electionMs??pfe,s=e.leaseMs??mfe,c=e.retentionMs??hfe,l=e.maxEmittedKeys??gfe,u=e.maxCandidateKeys??_fe,d=new Map,f=new Map,p=new Map,m=e=>{let t=Array.from(f).filter(([,t])=>e-t<=c).sort((e,t)=>t[1]-e[1]).slice(0,l);f.clear();for(let[e,n]of t)f.set(e,n);let n=Array.from(d).map(([t,n])=>[t,new Map(Array.from(n).filter(([,t])=>t>e).sort((e,t)=>t[1]-e[1]).slice(0,u))]).filter(([,e])=>e.size>0).sort((e,t)=>Math.max(...t[1].values())-Math.max(...e[1].values())).slice(0,u);d.clear();for(let[e,t]of n)d.set(e,t)},h=()=>{if(!n)return v8();try{let e=n.getItem(h8);if(!e)return v8();let t=JSON.parse(e);return{emitted:t.emitted&&typeof t.emitted==`object`?t.emitted:{},leases:t.leases&&typeof t.leases==`object`?t.leases:{}}}catch{return v8()}},g=(e,t)=>{let n=Object.entries(e.emitted).filter(([,e])=>typeof e==`number`&&t-e<=c).sort((e,t)=>t[1]-e[1]).slice(0,l),r=Object.fromEntries(Object.entries(e.leases).filter(([,e])=>e&&typeof e.owner==`string`&&typeof e.expiresAt==`number`&&e.expiresAt>t));return{emitted:Object.fromEntries(n),leases:r}},_=e=>{if(!n)return!1;try{return n.setItem(h8,JSON.stringify(e)),!0}catch{return!1}},v=e=>{let t=d.get(e.key)??new Map;t.set(e.tabId,e.expiresAt),d.set(e.key,t)},y=e=>{if(m(i()),e.type===`candidate`){v(e),m(i());return}f.set(e.key,e.emittedAt),m(i())},b=()=>{};try{b=r?.subscribe(y)??b}catch{}let x=(e,t)=>{m(t);let r=f.get(e);if(r!==void 0&&t-r<=c)return!0;let i;if(n)try{let t=n.getItem(`${g8}${e}`),r=t===null?NaN:Number(t);Number.isFinite(r)&&(i=r)}catch{}return i??=h().emitted[e],i!==void 0&&t-i<=c},S=(e,n)=>{let i={type:`candidate`,key:e,tabId:t,expiresAt:n+o+s};v(i),m(n);try{r?.publish(i)}catch{}},C=(e,n)=>{m(n);let r=d.get(e);return r?Array.from(r).filter(([,e])=>e>n).map(([e])=>e).sort()[0]??t:t},w=(e,r)=>{if(!n)return!0;let i=g(h(),r);if(i.emitted[e]!==void 0)return!1;let a=i.leases[e];return a&&a.owner!==t?!1:(i.leases[e]={owner:t,expiresAt:r+s},_(i)?h().leases[e]?.owner===t:!0)},T=(e,r)=>{if(!n)return!0;let i=g(h(),r);return i.emitted[e]!==void 0||i.leases[e]?.owner!==t?!1:(i.leases[e]={owner:t,expiresAt:r+s},_(i)&&h().leases[e]?.owner===t)},E=(e,t)=>{f.set(e,t);try{n?.setItem(`${g8}${e}`,String(t))}catch{}try{r?.publish({type:`emitted`,key:e,emittedAt:t})}catch{}},D=async(e,n)=>{if(x(e,i()))return!1;for(let r=0;r<2;r+=1){S(e,i()),await a(o);let r=i();if(x(e,r))return!1;if(C(e,r)!==t||!w(e,r)){if(await a(s),x(e,i()))return!1;continue}let c=window.setInterval(()=>{T(e,i())},Math.max(1,Math.floor(s/2)));try{await n()}catch{return!1}finally{window.clearInterval(c)}return E(e,i()),!0}return!1};return{coordinate:async(e,t)=>{let n=p.get(e);if(n)return await n,!1;let r=D(e,t);p.set(e,r);try{return await r}finally{p.get(e)===r&&p.delete(e)}},close:b,tabId:t}})(),xfe=`/notification-service-worker.js`,Sfe=`archon:get-notification-client-id`,Cfe=async e=>{let t=new MessageChannel;return new Promise(n=>{let r=window.setTimeout(()=>n(null),1e3);t.port1.onmessage=e=>{window.clearTimeout(r);let t=e.data;n(typeof t?.clientId==`string`?t.clientId:null)},e.postMessage({type:Sfe},[t.port2])})},x8=async()=>{if(!(`serviceWorker`in navigator))return null;try{return await navigator.serviceWorker.register(xfe,{scope:`/`})}catch{return null}},S8=e=>typeof e==`string`&&e.length>0,wfe=({projectId:e,ticketId:t,agentMessageId:n})=>S8(n)?`v1:ticket:${e}:${t}:message:${n}`:null,Tfe=({projectId:e,chatSessionId:t,agentMessageId:n})=>S8(n)?`v1:chat:${e}:${t}:message:${n}`:null,Efe=({projectId:e,specSessionId:t,agentMessageId:n,latestSnapshotId:r})=>S8(n)?`v1:spec:${e}:${t}:message:${n}`:S8(r)?`v1:spec:${e}:${t}:snapshot:${r}`:null,C8=async({title:e,body:t,key:n,destination:r})=>{if(!(`Notification`in window)||Notification.permission===`denied`)return!1;if(Notification.permission===`default`)try{await Notification.requestPermission()}catch{return!1}return Notification.permission!==`granted`||!(`serviceWorker`in navigator)?!1:bfe.coordinate(n,async()=>{if(!await x8())throw Error(`Notification service worker unavailable`);let i=await navigator.serviceWorker.ready;if(!i.active)throw Error(`Notification service worker inactive`);let a=await Cfe(i.active);await i.showNotification(e,{body:t,tag:n,requireInteraction:!1,data:{url:m8(r),clientId:a}})})},w8=(0,p.createContext)(null),Dfe=15*1e3,Ofe=1e3,kfe=async(e,t)=>{let n=wfe({projectId:t,ticketId:e.id,agentMessageId:e.agent_message_id});if(!n)return;let r=e.worktree_bundle_id!==null&&e.state!==`plan`?{kind:`bundle`,projectId:t,bundleId:e.worktree_bundle_id}:{kind:`ticket`,projectId:t,ticketId:e.id};await C8({title:`Ticket done`,body:e.title,key:n,destination:r})},T8=e=>$6(e),Afe=(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,jfe=({activeProjectId:e,refreshKey:t=0,onLoadedProjectIdChange:n,onProjectUsageChange:r,onBundlesChange:i,onBundlesLoadingChange:a,children:o})=>{let s=bq(),[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,E]=(0,p.useState)(null),D=(0,p.useRef)(0),O=(0,p.useRef)(0),k=(0,p.useRef)(new Map),A=(0,p.useRef)(new Map),j=(0,p.useRef)([]),M=(0,p.useRef)(e),N=(0,p.useRef)(new Map),P=(0,p.useRef)(new Map),F=(0,p.useRef)(new Map),I=(0,p.useCallback)((e,t)=>{let n=P.current.get(t.id);return!n||!e||t.state===n?t:e},[]),L=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(P.current);for(let r of e)n.set(r,t);P.current=n},[]),R=(0,p.useCallback)(e=>{if(e.length===0||P.current.size===0)return;let t=new Map(P.current);for(let n of e)t.delete(n);P.current=t},[]),ee=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(F.current);for(let r of e)n.set(r,t);F.current=n},[]),te=(0,p.useCallback)(e=>{if(e.length===0||F.current.size===0)return;let t=new Map(F.current);for(let n of e)t.delete(n);F.current=t},[]),z=(0,p.useCallback)((e,t)=>{if(N.current.has(t.id))return null;let n=I(e,t);return F.current.has(t.id)?{...n,parked_at:F.current.get(t.id)??null}:n},[I]),B=(0,p.useCallback)((e,t)=>{if(N.current.size===0&&P.current.size===0&&F.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 an(e,t,{detail:`board`});return Array.isArray(n)?(!t?.aborted&&M.current===e&&l(e=>cfe(e,B(e,n).map(T8))),n):null},[B]),H=(0,p.useCallback)(async(e,t)=>{await V(e,t)},[V]),U=(0,p.useCallback)(async(e,t)=>{let n=++O.current,r=await on(e,t);if(!Array.isArray(r)||t?.aborted||M.current!==e||O.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}))},[]),ne=(0,p.useCallback)(e=>e.some(e=>e.is_stale===void 0),[]),re=(0,p.useCallback)(async e=>{let t=M.current;if(!t)return null;try{let n=await sn(e,t);if(M.current!==t)return null;let r=A.current.get(n.id),i=z(r,n);if(!i)return null;let a=T8(i),o=e8(r,a);return l(e=>o?a8(e,a):i8(e,a)),n}catch{return null}},[z]),ie=(0,p.useCallback)(async t=>{if(!e){m([]);return}m(await X(e,t))},[e]),ae=(0,p.useMemo)(()=>new Map(c.map(e=>[e.id,e])),[c]),oe=(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:T}},[T,c]);(0,p.useEffect)(()=>{if(A.current=ae,j.current.length===0)return;let e=[],t=[];for(let n of j.current){let r=ae.get(n.blocker_ticket_id),i=ae.get(n.dependent_ticket_id);r&&i&&r.project_id===M.current&&i.project_id===M.current?e.push(n):t.push(n)}j.current=t,e.length>0&&d(t=>e.reduce((e,t)=>ey(e,t),t))},[ae]),(0,p.useEffect)(()=>{M.current=e,N.current.clear(),j.current=[],P.current.clear(),F.current.clear(),E(null),g(null),k.current.clear()},[e]),(0,p.useEffect)(()=>{n?.(x?null:_)},[_,x,n]),(0,p.useEffect)(()=>{if(i){if(!e){i(null,[]);return}if(y!==e){i(e,[]);return}i(e,f)}},[e,f,y,i]),(0,p.useEffect)(()=>{if(a){if(!e){a(null,!1);return}a(e,C===e)}},[e,C,a]),(0,p.useEffect)(()=>{let t=new AbortController,n=++D.current,r=null,i=async()=>{try{if(!e){l([]),d([]),m([]),v(null),b(null),S(null);return}l([]),d([]),m([]),v(null),b(null),S(e),w(e);let i=V(e,t.signal).finally(()=>{!t.signal.aborted&&D.current===n&&(v(e),S(null))}),a=zde(e,t.signal).then(e=>(!t.signal.aborted&&D.current===n&&d(e),e)),o=X(e,t.signal).then(e=>(!t.signal.aborted&&D.current===n&&m(e),e)).finally(()=>{!t.signal.aborted&&D.current===n&&(b(e),w(null))}),[s,c,u]=await Promise.allSettled([i,a,o]);if(t.signal.aborted)return;s.status!==`fulfilled`&&!Xe(s.reason)&&l([]),c.status===`fulfilled`?d(c.value):Xe(c.reason)||d([]),u.status===`fulfilled`?m(u.value):Xe(u.reason)||m([]),s.status===`fulfilled`&&s.value!==null&&ne(s.value)&&(r=window.setTimeout(()=>{t.signal.aborted||U(e,t.signal)},Ofe))}finally{!t.signal.aborted&&D.current===n&&(S(null),w(null))}},a=t=>{t.project_id===e&&(g(t),!N.current.has(t.id)&&(t.bundle&&m(e=>r8(e,t.bundle)),l(e=>a8(e,T8(t)))))},o=t=>{if(t.project_id===e&&g(t),l(n=>{if(t.project_id!==e)return o8(n,t.id);let r=n.find(e=>e.id===t.id),i=z(r,t);if(!i)return n;let a=T8(i);return e8(r,a)?a8(n,a):i8(n,a)}),t.project_id!==e){d(e=>$v(e,t.id));return}t.bundle&&m(e=>r8(e,t.bundle))},c=({id:e})=>{N.current.delete(e),F.current.delete(e),P.current.delete(e),l(t=>o8(t,e)),d(t=>$v(t,e))},u=({project_id:e,bundle_id:t,pull_request:n})=>{e===M.current&&(m(e=>e.map(e=>e.id===t?{...e,pull_request:n}:e)),l(e=>e.map(e=>e.worktree_bundle_id!==t||!e.bundle?e:{...e,bundle:{...e.bundle,pull_request:n}})),g(e=>e?.worktree_bundle_id!==t||!e.bundle?e:{...e,bundle:{...e.bundle,pull_request:n}}))},f=e=>{if(!e)return;let t=A.current.get(e.blocker_ticket_id),n=A.current.get(e.dependent_ticket_id);if(!t||!n){j.current.push(e);return}t.project_id!==M.current||n.project_id!==M.current||d(t=>ey(t,e))},p=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(`bundle-pull-request:updated`,u),s.on(`ticket-dependency:created`,f),s.on(`ticket-dependency:deleted`,p),()=>{t.abort(),r!==null&&window.clearTimeout(r),s.off(`ticket:created`,a),s.off(`ticket:updated`,o),s.off(`ticket:deleted`,c),s.off(`bundle-pull-request:updated`,u),s.off(`ticket-dependency:created`,f),s.off(`ticket-dependency:deleted`,p)}},[e,U,t,ne,V,z,s]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=()=>{document.visibilityState===`visible`&&Promise.allSettled([V(e,t.signal),ie(t.signal)]).then(n=>{n[0]?.status===`fulfilled`&&n[0].value!==null&&ne(n[0].value)&&U(e,t.signal)}).catch(()=>{})},r=window.setInterval(n,Dfe),i=ax(n);return()=>{t.abort(),window.clearInterval(r),i()}},[e,ie,U,ne,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)(()=>{if(e)for(let t of c){let n=k.current.get(t.id),r=Afe(t,n);r&&E(r),n!==void 0&&n===`running`&&t.agent_status===`done`&&(t.state===`plan`||t.state===`build`||t.state===`review`)&&kfe(t,e),k.current.set(t.id,t.agent_status)}},[e,c]);let W=(0,p.useCallback)(()=>{g(null)},[]),se=(0,p.useMemo)(()=>({tickets:c,setTickets:l,dependencies:u,setDependencies:d,bundles:f,setBundles:m,latestDetailedTicketUpdate:h,clearLatestDetailedTicketUpdate:W,loadedProjectId:_,bundlesLoadedProjectId:y,loadingProjectId:x,activeProjectIdRef:M,pendingDeletedTicketsRef:N,pendingOptimisticMovesRef:P,pendingParkedTicketsRef:F,refreshTickets:H,requestSingleTicketRefresh:re,refreshBundles:ie,resolvePendingTicket:z,resolvePendingTickets:B,markPendingOptimisticMoves:L,clearPendingOptimisticMoves:R,markPendingParkedTickets:ee,clearPendingParkedTickets:te,liveActivity:oe}),[f,y,W,R,te,u,oe,_,h,x,L,ee,ie,H,re,z,B,c]);return(0,Y.jsx)(w8.Provider,{value:se,children:o})},E8=()=>{let e=(0,p.useContext)(w8);if(!e)throw Error(`useProjectWorkspace must be used inside ProjectWorkspaceProvider`);return e},D8=(0,p.lazy)(()=>iG(()=>import(`./VerificationDialog-ayyiyvGt.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),O8=`archon.last-model-selection`,k8=`archon.last-variant-selection`,A8=`archon.last-skills-selection`,Mfe=()=>{try{let e=window.localStorage.getItem(A8),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}},j8=[`plan`,`build`,`review`],M8=`done`,N8=()=>({build:!1,stopBuild:!1,resumeBuild:!1,review:!1,undoReview:!1,run:!1,stop:!1,followUp:!1,bundleRefresh:!1}),Nfe=(e,t,n)=>{e?window.localStorage.setItem(O8,e):window.localStorage.removeItem(O8),t?window.localStorage.setItem(k8,t):window.localStorage.removeItem(k8),n.length>0?window.localStorage.setItem(A8,JSON.stringify(n)):window.localStorage.removeItem(A8)},P8=(e,t={})=>Ry(e,t),Pfe=()=>({model:window.localStorage.getItem(O8)??``,variant:window.localStorage.getItem(k8)??``,skills:Mfe()}),F8=(e,t)=>{let n=o8(e,t.ticket.id),r=Math.max(0,Math.min(t.index,n.length));return n.splice(r,0,t.ticket),n},Ffe=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,activeRun:r,activeTool:i,onPreviewReviewCapabilityChange:a,onRunStopped:o,onRunStatusChange:s,onViewSourceSpec:c,onNavigateToLifecycleSource:l,onStartChatFromBundle:u,refreshKey:d=0,boardFilterState:f,onBoardFilterStateChange:m,initialTicketId:h=null,onInitialTicketNavigationConsumed:g,onInitialTicketNavigationUnavailable:_,routedTicketId:v,onTicketOpen:y,onTicketClose:b,routedBundleId:x,routedInspection:S=null,routedInspectionReviewCapability:C,inspectionOnly:w=!1,onBundleOpen:T,onBundleClose:E,onInspectionOpen:D,onInspectionModeChange:O,onInspectionClose:k,onInspectionUnavailable:A,initialImportedDraft:j=null,onInitialImportedDraftConsumed:M,onOpenProjectExecutionSettings:N})=>{let{t:P}=K(`common`),F=zN(RN(FP,{activationConstraint:{distance:5}})),{tickets:I,setTickets:L,dependencies:R,setDependencies:ee,bundles:te,setBundles:z,latestDetailedTicketUpdate:B,clearLatestDetailedTicketUpdate:V,loadedProjectId:H,bundlesLoadedProjectId:U,loadingProjectId:ne,activeProjectIdRef:re,pendingDeletedTicketsRef:ie,requestSingleTicketRefresh:ae,refreshBundles:oe,resolvePendingTicket:W,markPendingOptimisticMoves:se,clearPendingOptimisticMoves:ce,markPendingParkedTickets:le,clearPendingParkedTickets:ue}=E8(),{runs:de}=Q6(e),fe=(0,p.useMemo)(()=>{let e=efe(de);for(let t of I)t.worktree_bundle_id&&t.automation_paused_reason&&e.delete(t.worktree_bundle_id);return e},[de,I]),[pe,me]=(0,p.useState)(null),[he,ge]=(0,p.useState)(null),[_e,ve]=(0,p.useState)(null),ye=(0,p.useCallback)(e=>ve(e),[]),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)({x:0,y:0}),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)([]),[Oe,ke]=(0,p.useState)(null),Ae=pF(`opencode`),je=pF(`claude`),Me=(0,p.useMemo)(()=>({opencode:Ae.models,claude:je.models}),[Ae.models,je.models]),Ne=(0,p.useCallback)(e=>{let n=Me[e]??[];return t?.build_execution_provider===`docker_sandbox`?Kre(n,Oe?Oe.approved_providers?.[e]??[]:[]):n},[t?.build_execution_provider,Oe,Me]),Pe=(0,p.useMemo)(()=>({opencode:Ne(`opencode`),claude:Ne(`claude`)}),[Ne]);(0,p.useEffect)(()=>{if(!e||t?.build_execution_provider!==`docker_sandbox`){ke(null);return}let n=new AbortController;return ke(null),Kb(e,n.signal).then(e=>{n.signal.aborted||ke(e)}).catch(e=>{!Xe(e)&&!n.signal.aborted&&ke(null)}),()=>n.abort()},[t?.build_execution_provider,e]);let Fe=(0,p.useMemo)(()=>{if(t?.build_execution_provider!==`docker_sandbox`)return Ee;let e=Oe?.available_skills?.opencode;if(!e)return[];let n=new Map(Ee.map(e=>[e.name,e]));return e.map(e=>n.get(e)??{name:e,description:``})},[t?.build_execution_provider,Ee,Oe?.available_skills?.opencode]),[Ie,Le]=(0,p.useState)(!1),[G,Re]=(0,p.useState)(!1),[ze,Be]=(0,p.useState)(!1),[Ve,He]=(0,p.useState)(null),[Ue,We]=(0,p.useState)(null),[Ge,qe]=(0,p.useState)(null),q=(0,p.useRef)(null),Je=v===void 0?h:v,Ye=(0,p.useRef)(null),Ze=(0,p.useRef)(null),[Qe,J]=(0,p.useState)(null),$e=(0,p.useRef)(null),[et,tt]=(0,p.useState)(null),[nt,rt]=(0,p.useState)(null),[it,at]=(0,p.useState)(null),[ot,st]=(0,p.useState)(null),ct=(0,p.useRef)(0),[lt,ut]=(0,p.useState)(null),[dt,ft]=(0,p.useState)(null),[pt,mt]=(0,p.useState)(null),[ht,gt]=(0,p.useState)(!1),[X,vt]=(0,p.useState)(N8()),[yt,St]=(0,p.useState)(0),[Ct,wt]=(0,p.useState)(()=>({query:``,hideStaleTickets:!1,hideBundlesWithPullRequests:!1})),At=f??Ct,jt=e=>{let t={...At,...e};if(m){m(t);return}wt(t)},Mt=FF(i)||FF(Ge?.tool)||!!nt?.tickets.some(e=>FF(PF(e,i))),zt=FF(i)&&(Ne(i).length>0||t?.build_execution_provider===`docker_sandbox`&&Me[i].length>0),Bt=FF(PF(Ge,i))&&Ne(PF(Ge,i)).length>0,Vt=!!nt?.tickets.some(e=>FF(PF(e,i)))&&(Pe.opencode.length>0||Pe.claude.length>0),Ht=(0,p.useRef)(null),[Ut,Wt]=(0,p.useState)(null),Gt=I.find(e=>e.is_running)??null,Kt=Gt?fy(Gt):null,qt=r?.context_key??null,Jt=r?.kind===`ticket`?rne(r,I)??Kt:Kt,Yt=r?.kind===`project`,Xt=Jt??Ut,Zt=(0,p.useCallback)(e=>ine({bundleId:e,activeRunContextKey:Xt,isProjectRootRunActive:Yt}),[Xt,Yt]),Qt=pe!==null&&Dy(pe,`trash`)||he!==null&&Sy(he),$t=ne===e,en=(0,p.useMemo)(()=>t?Ow(t):[],[t]),tn=(0,p.useMemo)(()=>jw(en),[en]),nn=(0,p.useMemo)(()=>t?kw(t):[],[t]),rn=(0,p.useMemo)(()=>t?Aw(t):[],[t]),an=tn.length>0,on=(0,p.useMemo)(()=>new Map(I.map(e=>[e.id,e])),[I]);(0,p.useEffect)(()=>{Wt(null)},[e]),(0,p.useEffect)(()=>{Ut!==null&&(Yt||Jt!==null)&&Wt(null)},[Jt,Yt,Ut]),(0,p.useEffect)(()=>{if(!Ue){qe(null);return}let e=on.get(Ue)??null;e&&qe(t=>!t||t.id!==Ue?e:my(t,e))},[Ue,on]),(0,p.useEffect)(()=>{B&&(qe(e=>!e||e.id!==B.id?e:my(e,B)),rt(e=>{if(!e)return e;let t=B.worktree_bundle_id;if(!t||e.bundle.id!==t)return e;let n=e.tickets.some(e=>e.id===B.id)?e.tickets.map(e=>e.id===B.id?my(e,B):e):[...e.tickets,B];return{...e,tickets:n}}))},[B]),(0,p.useEffect)(()=>{B===null||Ue!==null||Qe!==null||V()},[V,B,Qe,Ue]);let sn=(0,p.useCallback)(async e=>{let t=await ae(e);if(!t)return null;let n=on.get(e),r=n?my(t,n):t;return qe(t=>t&&t.id!==e||Ue&&Ue!==e?t:r),r},[ae,Ue,on]),ln=(0,p.useCallback)(e=>{qe(e),We(e.id),sn(e.id),y?.(e.id)},[y,sn]),dn=(0,p.useCallback)(()=>{$e.current=null,J(null),tt(null),rt(null),gt(!1),vt(N8())},[]),fn=(0,p.useMemo)(()=>new Map(te.map(e=>[e.id,e])),[te]),pn=(0,p.useMemo)(()=>{if(!nt)return null;let e=nt.bundle.id,t=B?.worktree_bundle_id===e?B:null,n=I.filter(t=>t.worktree_bundle_id===e),r=new Map(n.map(e=>[e.id,e])),i=nt.tickets.filter(e=>!ie.current.has(e.id)).map(e=>t&&e.id===t.id?my(e,t):e);t&&!i.some(e=>e.id===t.id)&&!ie.current.has(t.id)&&i.push(t);let a=i.map(e=>my(e,r.get(e.id)));for(let e of n)a.some(t=>t.id===e.id)||a.push(e);a=v3(a);let o=nt.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=Py(a),p=a.find(e=>e.id===nt.review_owner_ticket_id&&e.state===`review`)??a.find(e=>e.state===`review`)??null,m=Ry(a,{targetTicketId:nt.target_ticket_id,reviewOwnerTicketId:p?.id??nt.review_owner_ticket_id,latestSessionTicketId:f?.id??nt.latest_session_ticket_id});return{...nt,bundle:fn.get(e)??nt.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:nt.has_completed_review,has_follow_up_since_last_review:l?d.has_follow_up_since_last_review:nt.has_follow_up_since_last_review,can_re_review:l?d.can_re_review:nt.can_re_review}},[fn,B,ie,nt,I]),mn=(0,p.useMemo)(()=>I.filter(e=>{if(At.hideStaleTickets&&yy(e))return!1;if(At.hideBundlesWithPullRequests&&e.worktree_bundle_id){let t=fn.get(e.worktree_bundle_id);if(t&&t.pull_request!==void 0?t.pull_request:e.bundle?.pull_request)return!1}return one(At.query,e)}),[At,fn,I]),hn=(0,p.useMemo)(()=>Vy(mn),[mn]),gn=(0,p.useMemo)(()=>mn.filter(e=>_y(e)),[mn]),_n=(0,p.useMemo)(()=>zy(gn,te,M8),[te,gn]),{boardViewportRef:vn,boardContentRef:yn,registerTicketNode:Fn,registerDependencyClipNodes:Ln,measuredCardRects:Bn,dependencyClipRects:Vn,overlayPreview:Hn,overlaySize:Un,getDependencyTargetState:Wn,handleDependencyStart:Gn,handleDeleteDependency:Kn}=Gde({activeProjectId:e,tickets:I,dependencies:R,setDependencies:ee,activeTicket:pe,activeOverlayNode:be,dragOffset:Se}),qn=Pfe(),Jn=!!t?.run_ide?.trim(),Yn=(0,p.useCallback)((e,t,n=I)=>{let r=zy(n,te,t).find(t=>t.kind===`bundle`&&t.group.bundle.id===e);return r?.kind===`bundle`?r.group:null},[te,I]),Xn=(0,p.useCallback)(e=>{let n=PF(e,i);return(0,Y.jsx)(u3,{ticket:e,allTickets:I,dependencies:R,bundles:te,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:e.worktree_bundle_id?fe.get(e.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:FF(n)&&Ne(n).length>0,availableModels:Ne(n),runDisabled:!0,hideBundleScopedControls:!0})},[t?.memory_enabled,i,fe,te,R,Ne,I]),Zn=(0,p.useCallback)(t=>Iy(t)?t.project_id===e?Jn:!!t.has_run_ide:!1,[Jn,e]),Qn=(0,p.useCallback)(e=>!!e.project_id&&!!(e.bundle?.branch??e.branch)&&Iy(e),[]),$n=(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?Zn(t):!1},[Zn]),er=(0,p.useCallback)(e=>{let t=v3(I.filter(t=>t.worktree_bundle_id===e));return nt?.bundle.id===e?P8(v3(nt.tickets.map(e=>t.find(t=>t.id===e.id)??e)),{targetTicketId:nt.target_ticket_id,reviewOwnerTicketId:nt.review_owner_ticket_id,latestSessionTicketId:nt.latest_session_ticket_id}):P8(t)},[nt,I]),tr=(0,p.useCallback)(e=>{let t=er(e),n=te.some(t=>t.id===e&&t.has_prepared_worktree===!0)||I.some(t=>t.worktree_bundle_id===e&&Iy(t))||!!(nt?.bundle.id===e&&nt.tickets.some(Iy));return!!(t?.project_id&&(t.bundle?.branch??t.branch)&&n)},[te,er,nt,I]),nr=(0,p.useCallback)(e=>{let t=fn.get(e),n=er(e),r=nt?.bundle.id===e?[...I,...nt.tickets]:I;return!!(t&&n?.project_id&&Ly(t,r))},[fn,er,nt,I]);(0,p.useEffect)(()=>{Re(!1),Be(!1),ut(null),mt(null)},[e,d]),(0,p.useEffect)(()=>{if(!Mt){De([]);return}let t=new AbortController;return(async()=>{try{De(await mF(`opencode`,t.signal,e))}catch(e){Xe(e)||De([])}})(),()=>{t.abort()}},[e,Mt]);let rr=({active:e})=>{Le(!1),xe(null),Ce({x:0,y:0}),ve(null);let t=Hy(String(e.id));if(t){ge(Yn(t.bundleId,t.column)),me(null);return}ge(null),me(I.find(t=>t.id===e.id)??null)},ir=()=>{Le(!1),xe(null),Ce({x:0,y:0}),me(null),ge(null),ve(null)},ar=(0,p.useCallback)(e=>{L(t=>e.reduce((e,t)=>a8(e,t),t))},[L]),or=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=e[0]?.state;n&&L(r=>e.reduce((e,r)=>s8(e,r.id,t,Ey(r,n,t)),r))},[L]),sr=(0,p.useCallback)((e,t=I)=>!e.worktree_bundle_id||!e.project_id||e.state!==`build`?[]:v3(t.filter(t=>t.project_id===e.project_id&&t.worktree_bundle_id===e.worktree_bundle_id&&t.state===`build`&&t.parked_at===null)),[I]),cr=async({active:e,over:t})=>{let n=Hy(String(e.id)),r=I.find(t=>t.id===e.id),i=n?Yn(n.bundleId,n.column):null,a=t?.id===`trash`&&(r!==void 0&&Dy(r,`trash`)||i!==null&&Sy(i)),o=t?.id&&j8.includes(t.id)?t.id:null;if(Le(a),xe(null),Ce({x:0,y:0}),me(null),ge(null),t){if(n){if(t.id===`trash`){if(!i||!Sy(i))return;await br(i);return}if(t.id===M8){if(!i||!lne(i))return;await _r(i);return}if(o){if(n.column===M8){if(!i||!Cy(i))return;await vr(i);return}await ci(n.bundleId,n.column,o)}return}if(t.id===`trash`){if(!r||!Dy(r,`trash`))return;Sr(e.id);return}if(t.id===M8){if(!r||!Dy(r,M8))return;await hr(e.id);return}if(o){if(r&&cne(r,o)){await gr(e.id);return}if(!(!r||!Dy(r,o)))try{await pr(r,o,{optimistic:!0})}catch(e){$.error(e instanceof Ke?e.message:P(`board.errors.moveTicket`),{id:`board-move-error`})}}}},lr=async(t,n,r,i,a,o,s)=>{let c=await cn({title:t,description:n,model:i,variant:a,skills:o,project_id:e,...s});if(Nfe(i,a,o),L(e=>a8(e,$6(c))),c.bundle&&z(e=>r8(e,c.bundle)),r===`build`)try{await pr(c,`build`)}catch(e){$.error(e instanceof Ke?e.message:P(`board.errors.moveTicket`),{id:`board-move-error`})}r===`plan`&&zn(c.id,c.project_id)},ur=async t=>{if(!e)throw Error(P(`board.errors.createBundleWithoutProject`));let n=await _t(e,{name:t,prepare:!0});return z(e=>r8(e,n)),n},dr=(0,p.useCallback)((e,t={})=>{let n=$6(e);L(e=>t.reorderInState?a8(e,n):i8(e,n)),qe(t=>!t||t.id!==e.id?t:my(e,n)),e.bundle&&z(t=>r8(t,e.bundle))},[z,L]),fr=(0,p.useCallback)(e=>{z(t=>r8(t,e)),L(t=>t.map(t=>t.worktree_bundle_id===e.id?{...t,bundle:e}:t)),rt(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)})},[z,rt,L]),pr=async(e,t,n={})=>{let r=I.findIndex(t=>t.id===e.id),i=t===`review`?sr(e):[],a=t===`review`&&i.length>1,o=n.optimistic?a?i.map(e=>e.id):[e.id]:[];n.optimistic&&(se(o,t),a?or(i,t):L(n=>s8(n,e.id,t,wy(e,t))));try{if(a&&e.project_id&&e.worktree_bundle_id){let t=await Et(e.project_id,e.worktree_bundle_id);Hr(t);let n=t.tickets.find(t=>t.id===e.id);if(!n)throw Error(P(`board.errors.missingBundleReviewTicket`));return ce(o),n}let n=await un(e.id,e.project_id,t);return L(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:e8(i,n)?a8(r,n):i8(r,n)}),n.bundle&&z(e=>r8(e,n.bundle)),ce(o),n}catch(t){throw n.optimistic&&(a?ar(i):L(t=>s8(t,e.id,e.state,{agent_status:e.agent_status,agent_log:e.agent_log,build_completed_at:e.build_completed_at},{preferredIndex:r})),ce(o)),t}},mr=(e,t)=>{L(n=>n.map(n=>n.id===e?{...n,...t}:n))},hr=async t=>{let n=I.find(e=>e.id===t);if(n)try{let r=new Date().toISOString();le([t],r),mr(t,{parked_at:r}),dr(await wn(t,n.project_id??e),{reorderInState:!0}),ue([t])}catch(e){ue([t]),mr(t,{parked_at:n.parked_at}),$.error(e instanceof Ke?e.message:P(`board.errors.parkTicket`),{id:`board-park-error`})}},gr=async t=>{let n=I.find(e=>e.id===t);if(n)try{le([t],null),mr(t,{parked_at:null}),dr(await Tn(t,n.project_id??e),{reorderInState:!0}),ue([t])}catch(e){ue([t]),mr(t,{parked_at:n.parked_at}),$.error(e instanceof Ke?e.message:P(`board.errors.returnTicket`),{id:`board-unpark-error`})}},_r=(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();le(e.tickets.map(e=>e.id),r),L(e=>e.map(e=>t.has(e.id)?{...e,parked_at:r}:e));let i=await Promise.allSettled(e.tickets.map(e=>wn(e.id,e.project_id??re.current))),a=new Set;if(i.forEach((t,n)=>{if(t.status===`fulfilled`){ue([t.value.id]),dr(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&a.add(r.id)}),a.size===0)return;ue([...a]),L(e=>e.map(e=>{if(!a.has(e.id))return e;let t=n.find(t=>t.id===e.id);return t?{...e,parked_at:t.parked_at}:e}));let o=i.find(e=>e.status===`rejected`),s=a.size===e.tickets.length?o?.reason instanceof Ke?o.reason.message:P(`board.errors.moveBundleToDone`):P(`board.toasts.movedBundleToDonePartial`,{movedCount:e.tickets.length-a.size,totalCount:e.tickets.length});$.error(s,{id:`board-bundle-park-error`})},[re,dr,ue,le,L,P]),vr=(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}));le(e.tickets.map(e=>e.id),null),L(e=>e.map(e=>t.has(e.id)?{...e,parked_at:null}:e));let r=await Promise.allSettled(e.tickets.map(e=>Tn(e.id,e.project_id??re.current))),i=new Set;if(r.forEach((t,n)=>{if(t.status===`fulfilled`){ue([t.value.id]),dr(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&i.add(r.id)}),i.size===0)return;ue([...i]),L(e=>e.map(e=>{if(!i.has(e.id))return e;let t=n.find(t=>t.id===e.id);return t?{...e,parked_at:t.parked_at}:e}));let a=r.find(e=>e.status===`rejected`),o=i.size===e.tickets.length?a?.reason instanceof Ke?a.reason.message:P(`board.errors.restoreBundle`):P(`board.toasts.restoredBundlePartial`,{restoredCount:e.tickets.length-i.size,totalCount:e.tickets.length});$.error(o,{id:`board-bundle-unpark-error`})},[re,dr,ue,le,L,P]),yr=async t=>{e&&(await Ft(e,t),z(e=>e.filter(e=>e.id!==t)))},br=(0,p.useCallback)(async t=>{let n=t.tickets.map(e=>({ticket:e,index:I.findIndex(t=>t.id===e.id)})).filter(e=>e.index!==-1);if(n.length===0)return;for(let e of n)ie.current.set(e.ticket.id,e);let r=new Set(n.map(e=>e.ticket.id));L(e=>e.filter(e=>!r.has(e.id))),ee(e=>e.filter(e=>!r.has(e.blocker_ticket_id)&&!r.has(e.dependent_ticket_id)));let i=await Promise.allSettled(n.map(async t=>(await Sn(t.ticket.id,t.ticket.project_id??e),ie.current.delete(t.ticket.id),t.ticket.id)));t.tickets.some(e=>e.project_id===re.current)&&oe().catch(()=>{});let a=n.filter((e,t)=>i[t]?.status===`rejected`);if(a.length===0)return;for(let e of a)ie.current.delete(e.ticket.id);a.some(e=>e.ticket.project_id===re.current)&&L(e=>[...a].sort((e,t)=>e.index-t.index).reduce((e,t)=>F8(e,t),e));let o=i.find(e=>e.status===`rejected`),s=a.length===n.length?o?.reason instanceof Ke?o.reason.message:P(`board.errors.deleteBundleTickets`):P(`board.toasts.deletedBundleTicketsPartial`,{deletedCount:n.length-a.length,totalCount:n.length});$.error(s,{id:`board-delete-bundle-wrapper-error`})},[e,re,ie,oe,ee,L,I,P]),xr=e=>{let t=on.get(e.id);dr(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&&z(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===re.current&&oe().catch(()=>{})},Sr=async t=>{let n=I.find(e=>e.id===t),r=I.findIndex(e=>e.id===t);if(!(!n||r===-1)){ie.current.set(t,{ticket:n,index:r}),L(e=>o8(e,t)),ee(e=>$v(e,t));try{await Sn(t,n.project_id??e),n.project_id===re.current&&oe().catch(()=>{}),ie.current.delete(t)}catch(e){let n=ie.current.get(t);ie.current.delete(t),n&&n.ticket.project_id===re.current&&(L(e=>F8(e,n)),$.error(e instanceof Ke?e.message:P(`board.errors.deleteTicket`),{id:`board-delete-error`}))}}},Cr=async t=>{let n=I.find(e=>e.id===t);if(!n)return;let r=n.state===`review`?`review`:`build`;try{if(He(r),n.project_id&&n.worktree_bundle_id&&n.state===`review`){Hr(await Ot(n.project_id,n.worktree_bundle_id));return}dr(await Cn(t,n.project_id??e),{reorderInState:!0})}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.undoTicket`),{id:`board-undo-error`}),e}finally{He(e=>e===r?null:e)}},wr=t=>{Dn(t,I.find(e=>e.id===t)?.project_id??e)},Tr=async t=>{let n=I.find(e=>e.id===t),r=n?fy(n):t;try{Wt(r),await On(t,n?.project_id??e),s?.()}catch(e){Wt(e=>e===r?null:e),$.error(e instanceof Ke?e.message:P(`board.errors.startRun`),{id:`board-run-error`})}},Er=(0,p.useCallback)(async t=>{let n=I.find(e=>e.id===t);try{await kn(t,n?.project_id??e)}catch(e){$.error(e instanceof Ke?e.message:P(`board.errors.openIde`),{id:`board-open-ide-error`})}},[e,P,I]),Dr=async t=>{let n=I.find(e=>e.id===t),i=r?.kind===`ticket`&&n&&Jt===fy(n)?qt:null;try{await An(t,n?.project_id??e),o?.(i),s?.()}catch{}},Or=t=>{jn(t,I.find(e=>e.id===t)?.project_id??e).then(()=>{L(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e))})},kr=async t=>{let n=I.find(e=>e.id===t);try{await Mn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:P(`reviewInterrupt.error`))}},Ar=t=>{Nn(t,I.find(e=>e.id===t)?.project_id??e).then(()=>{L(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e))})},jr=(0,p.useCallback)(e=>{let t=er(e);!t||!Zn(t)||Er(t.id)},[Zn,er,Er]),Mr=(0,p.useCallback)((e,t)=>{let n=er(e),r=t===`files`?nr(e):tr(e);if(!(!n||!r)){if(D){D({kind:`bundle`,bundleId:e},t);return}ft({target:{kind:`bundle`,bundleId:e,ticketId:n.id},projectId:n.project_id,title:n.bundle?Gy(n.bundle):n.title,bundleTargetName:n.bundle&&Gy(n.bundle)||null,initialMode:t,followUpMode:`build`})}},[nr,tr,er,D]),Nr=(0,p.useCallback)((e,t)=>{let n=er(e);if(!n?.project_id||!Iy(n))return;let r=n.latest_check_gate_evaluation?.id??I.find(t=>t.worktree_bundle_id===e&&t.latest_check_gate_evaluation)?.latest_check_gate_evaluation?.id??null;if(en.length===0&&!r)return;let i=te.find(t=>t.id===e)??n.bundle;i&&mt({bundleId:e,label:Gy(i),requestedInitialTab:t,gateEvaluationId:r,requiredCheckPolicy:i.required_check_policy??null})},[te,er,en.length,I]),Pr=(0,p.useCallback)((e,t)=>{let n=I.find(t=>t.id===e);if(!(!n||!Qn(n))){if(D){D({kind:`ticket`,ticketId:e},t);return}ft({target:{kind:`ticket`,ticketId:n.id},projectId:n.project_id,title:n.title,bundleTargetName:null,initialMode:t,followUpMode:`build`})}},[Qn,D,I]),Fr=(0,p.useCallback)(e=>Mr(e,`files`),[Mr]),Ir=(0,p.useCallback)(e=>Mr(e,`changes`),[Mr]),Lr=(0,p.useCallback)(e=>Pr(e,`files`),[Pr]),Rr=(0,p.useCallback)(e=>Pr(e,`changes`),[Pr]),zr=(0,p.useCallback)(e=>{let t=I.find(t=>t.id===e);!t?.project_id||!Iy(t)||ut({ticketId:t.id,label:t.title})},[I]),Br=(0,p.useCallback)(async(t,n,r=`build`,i)=>{let a=I.find(e=>e.id===t);if(a)try{dr(a.state===`plan`?await Rn(t,a.project_id??e,n):await Pn(t,a.project_id??e,n,r,i))}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.sendFollowUp`),{id:`board-follow-up-error`}),e}},[e,dr,P,I]),Vr=(0,p.useCallback)(e=>{L(t=>e.reduce((e,t)=>{let n=e.find(e=>e.id===t.id),r=W(n,t);if(!r)return e;let i=$6(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 e8(n,i)?a8(e,i):i8(e,i)},t))},[W,L]),Hr=(0,p.useCallback)(e=>{rt(e),z(t=>r8(t,e.bundle)),Vr(e.tickets)},[Vr,z]),Ur=(0,p.useCallback)((e,t)=>{Array.isArray(t.tickets)&&rt(n=>{if(!n||n.bundle.id!==e)return n;let r=ane(n.tickets,t.tickets),i=n.tickets.find(e=>e.id===n.review_owner_ticket_id&&e.state===`review`&&e.agent_status===`running`&&e.updated_at>=(t.tickets.find(t=>t.id===e.id)?.updated_at??``))??null;return{...n,tickets:r,execution_order_ticket_ids:t.execution_order_ticket_ids,latest_session_ticket_id:t.latest_session_ticket_id,latest_session_id:t.latest_session_id,review_owner_ticket_id:t.review_owner_ticket_id??i?.id??null,target_ticket_id:i?.id??t.target_ticket_id}})},[]),Wr=(0,p.useCallback)(async e=>{let t=re.current;if(!t)return null;let n=await bt(t,e);return re.current!==t||$e.current!==e?null:(Hr(n),n)},[re,Hr]),Gr=(0,p.useCallback)(async()=>{let e=ot?.bundle.id,t=re.current;if(!e||!t)return null;let n=++ct.current,r=await bt(t,e);return n!==ct.current||re.current!==t?null:(Hr(r),st(r),r)},[re,Hr,ot?.bundle.id]),Kr=(0,p.useCallback)(async t=>{if(!e)return;at(t),st(null);let n=++ct.current;try{let r=await bt(e,t);if(re.current!==e||n!==ct.current)return;Hr(r),st(r)}catch{if(n!==ct.current||re.current!==e)return;at(null),$.error(P(`buildOpenQuestionsDialog.refreshFailedError`),{id:`board-build-open-questions-load-error`})}},[e,re,Hr,P]),qr=(0,p.useCallback)(async t=>{let n=ot?.bundle.id;if(!e||!n)return;let r=++ct.current;await Rt(e,n,t),r===ct.current&&(at(null),st(null))},[e,ot?.bundle.id]),Jr=ot?.bundle.id??null;(0,p.useEffect)(()=>{if(!Jr)return;let e=new Map(I.map(e=>[e.id,e])),t=te.find(e=>e.id===Jr);st(n=>!n||n.bundle.id!==Jr?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})})},[te,Jr,I]);let Yr=(0,p.useCallback)(async e=>{let t=re.current;if(!t)return null;let n=await xt(t,e);return re.current!==t||$e.current!==e?null:(Ur(e,n),n)},[re,Ur]),Xr=(0,p.useCallback)(async(e,t=null)=>{let n=re.current;if(!n)return;$e.current=e,We(null),qe(null),J(e),tt(t),vt(N8());let r=fn.get(e)??null,i=I.filter(t=>t.worktree_bundle_id===e);if(r&&i.length>0){let e=Py(i),t=Ry(i,{reviewOwnerTicketId:i.find(e=>e.state===`review`)?.id??null,latestSessionTicketId:e?.id??null});rt({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 rt(null);gt(!0);try{await Yr(e)}catch(t){if(t instanceof Ke&&t.status===404&&x===e){dn(),A?.();return}}finally{re.current===n&&gt(!1)}},[re,fn,dn,A,Yr,x,I]),Zr=(0,p.useCallback)((e,t=null)=>{Xr(e,t),T?.(e)},[T,Xr]),Qr=(0,p.useCallback)(async(e,t)=>{vt(t=>({...t,[e]:!0}));try{return await t()}finally{vt(t=>({...t,[e]:!1}))}},[]),$r=(0,p.useCallback)(async t=>{await Qr(`stopBuild`,async()=>{let n=I.find(e=>e.id===t);await jn(t,n?.project_id??e),L(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e)),n?.worktree_bundle_id&&await Wr(n.worktree_bundle_id)})},[e,Wr,Qr,L,I]),ei=(0,p.useCallback)(async t=>{await Qr(`stopBuild`,async()=>{let n=I.find(e=>e.id===t);try{await Mn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:P(`reviewInterrupt.error`))}})},[e,Qr,P,I]),ti=(0,p.useCallback)(async t=>{await Qr(`resumeBuild`,async()=>{let n=I.find(e=>e.id===t);await Nn(t,n?.project_id??e),L(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e)),n?.worktree_bundle_id&&await Wr(n.worktree_bundle_id)})},[e,Wr,Qr,L,I]),ni=(0,p.useCallback)(async t=>{if(e)try{Hr(await Qr(`build`,()=>Tt(e,t))),Qe===t&&tt(`build`),s?.()}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.buildBundle`),{id:`board-bundle-build-error`}),e}},[e,Hr,s,Qr,Qe,P]),ri=(0,p.useCallback)(async t=>{if(e)try{Hr(await Qr(`review`,()=>Et(e,t))),Qe===t&&tt(`review`)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.reviewBundle`),{id:`board-bundle-review-error`}),e}},[e,Hr,Qr,Qe,P]),ii=(0,p.useCallback)(async t=>{if(e)try{Hr(await Qr(`review`,()=>Dt(e,t))),Qe===t&&tt(`review`)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.continueBundleReview`),{id:`board-bundle-continue-review-error`}),e}},[e,Hr,Qr,Qe,P]),ai=(0,p.useCallback)(async t=>{if(e)try{He(`review`),Hr(await Qr(`undoReview`,()=>Ot(e,t))),Qe===t&&tt(`build`)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.undoBundleReview`),{id:`board-bundle-undo-review-error`}),e}finally{He(e=>e===`review`?null:e)}},[e,Hr,Qr,Qe,P]),oi=(0,p.useCallback)(async t=>{if(e)try{Hr(await It(e,t))}catch(e){$.error(e instanceof Ke?e.message:`Unable to resume the automation right now.`,{id:`board-bundle-resume-automation-error`})}},[e,Hr]),si=(0,p.useCallback)(async t=>{if(e)try{Hr(await Lt(e,t))}catch(e){$.error(e instanceof Ke?e.message:`Unable to dismiss the automation pause right now.`,{id:`board-bundle-dismiss-automation-error`})}},[e,Hr]),ci=(0,p.useCallback)(async(e,t,n)=>{if(t===M8||n===M8)return;let r=Ty(t,n);if(!r)return;let i=I.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);se(a,n),or(i,n);try{if(r===`build`){await ni(e),ce(a);return}if(r===`review`){await ri(e),ce(a);return}await ai(e),ce(a)}catch(e){ar(i),ce(a),$.error(e instanceof Ke?e.message:P(`board.errors.moveBundle`),{id:`board-bundle-move-error`})}},[ce,ni,ri,ai,se,or,ar,I,P]),li=async t=>{e&&(Hr(await Qr(`run`,()=>Nt(e,t))),s?.())},ui=async t=>{if(!e)return;let n=r?.kind===`ticket`&&Jt===t?qt:null,i=await Qr(`stop`,()=>Pt(e,t));o?.(n),Hr(i),s?.()},di=(0,p.useCallback)(async(t,n,r=`build`,i)=>{e&&Hr(await Qr(`followUp`,()=>kt(e,t,n,r,i)))},[e,Hr,Qr]);(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:P(`board.preview.disabledProjectRoot`),submitPrompt:null});return}let e=I.find(e=>e.id===r.ticket_id);if(!e){a({target:null,canSelect:!1,disabledReason:P(`board.preview.disabledBuildCapable`),submitPrompt:null});return}if(e.state===`plan`){a({target:{kind:`ticket`,id:e.id},canSelect:!1,disabledReason:P(`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:P(`board.preview.followUpBundlePlaceholder`),submitPrompt:t=>di(e.worktree_bundle_id,t)});return}a({target:{kind:`ticket`,id:e.id},canSelect:!0,disabledReason:null,promptPlaceholder:P(`board.preview.followUpTicketPlaceholder`),submitPrompt:t=>Br(e.id,t)})},[r,Br,di,a,P,I]);let fi=async t=>{let n=I.find(e=>e.id===t),r=n?uy(n.state):null;if(n)try{if(n.state===`review`&&n.can_re_review&&n.agent_status!==`running`){let t=await In(n.id,n.project_id??e);dr(t),t.worktree_bundle_id&&await Wr(t.worktree_bundle_id);return}if(!r)return;if(n.worktree_bundle_id&&r===`review`){await ri(n.worktree_bundle_id);return}await pr(n,r)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.moveTicket`),{id:`board-move-error`}),e}},pi=async t=>{let n=I.find(e=>e.id===t);try{dr(await bn(t,n?.project_id??e))}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.startBuildChain`),{id:`board-build-chain-error`}),e}},mi=async t=>{let n=I.find(e=>e.id===t);try{await xn(t,n?.project_id??e)}catch(e){throw $.error(e instanceof Ke?e.message:P(`board.errors.stopBuildChain`),{id:`board-stop-build-chain-error`}),e}},hi=async()=>{if(!(!e||ze)){Be(!0);try{let t=await En(e);L(e=>e.filter(e=>!t.deleted_ticket_ids.includes(e.id))),ee(e=>t.deleted_ticket_ids.reduce($v,e)),await oe(),Re(!1),t.failed_count>0?$.error(P(`board.toasts.deleteDonePartial`,{count:t.deleted_count,deletedCount:t.deleted_count,failedCount:t.failed_count}),{id:`board-delete-parked-error`}):$.success(P(`board.toasts.deleteDoneSuccess`,{count:t.deleted_count}),{id:`board-delete-parked-success`})}catch(e){$.error(e instanceof Ke?e.message:P(`board.errors.emptyDone`),{id:`board-delete-parked-error`})}finally{Be(!1)}}},gi=({delta:e})=>{Ce(e)},_i=(0,p.useCallback)((t=null)=>{e&&Te({initialWorktreeBundleId:t})},[e]);(0,p.useEffect)(()=>{!j||!e||(Te({initialWorktreeBundleId:null,initialImportedDraft:j}),M?.())},[j,e,M]),(0,p.useEffect)(()=>{if(!Je||!e){q.current=null;return}let t=`${e}:${Je}`;if(H!==e||q.current===t)return;q.current=t;let n=on.get(Je);n?ln(n):_?.(),v===void 0&&g?.()},[e,H,g,_,ln,Je,v,on]),(0,p.useEffect)(()=>{v===void 0||v||!Ge||(We(null),qe(null))},[v,Ge]),(0,p.useEffect)(()=>{!v||!e||H!==e||q.current!==`${e}:${v}`||Ue!==v||on.has(v)||(We(null),qe(null),_?.())},[e,H,_,v,Ue,on]),(0,p.useEffect)(()=>{if(!x){let e=S?.target.kind===`bundle`?S.target.bundleId:null,t=e!==null&&$e.current===e;Ye.current&&!t&&(Ye.current=null,e===null&&dn());return}let t=`${e}:${x}`;if(!(!e||H!==e||U!==e||Ye.current===t)){if(Ye.current=t,!fn.has(x)){A?.();return}Xr(x)}},[e,fn,U,dn,H,A,Xr,x,S,nt,Qe]),(0,p.useEffect)(()=>{!x||!e||H!==e||U!==e||Ye.current!==`${e}:${x}`||Qe!==x||fn.has(x)||(dn(),A?.())},[e,fn,U,dn,H,A,x,Qe]),(0,p.useEffect)(()=>{if(!S){Ze.current=null,ft(e=>e?.isRouteOwned?null:e);return}let t=S?.target.kind===`bundle`?H===e&&U===e:H===e;if(!e||!t)return;let n=`${e}:${S.target.kind===`ticket`?`ticket:${S.target.ticketId}`:`bundle:${S.target.bundleId}`}`;if(Ze.current===n)return;if(Ze.current=n,We(null),qe(null),S.target.kind===`ticket`&&dn(),ft(e=>e?.isRouteOwned?null:e),S.target.kind===`ticket`){let e=on.get(S.target.ticketId);if(!e||!Qn(e)){A?.();return}ft({target:{kind:`ticket`,ticketId:e.id},projectId:e.project_id,title:e.title,bundleTargetName:null,initialMode:S.mode,followUpMode:`build`,isRouteOwned:!0});return}let{bundleId:r}=S.target,i=er(r),a=S.mode===`files`?nr(r):tr(r);if(!i||!a){A?.();return}let o=fn.get(r)??i.bundle??null;ft({target:{kind:`bundle`,bundleId:r,ticketId:i.id},projectId:i.project_id,title:o?Gy(o):i.title,bundleTargetName:o&&Gy(o)||null,initialMode:S.mode,followUpMode:`build`,isRouteOwned:!0})},[e,fn,U,nr,tr,Qn,dn,er,H,A,S,nt,Qe,on]),(0,p.useEffect)(()=>{let t=S?.target.kind===`bundle`?H===e&&U===e:H===e;if(!S||!e||!t)return;let n=S.target.kind===`ticket`?`ticket:${S.target.ticketId}`:`bundle:${S.target.bundleId}`;if(Ze.current!==`${e}:${n}`||!dt?.isRouteOwned)return;if(S.target.kind===`ticket`){if(dt.target.kind!==`ticket`||dt.target.ticketId!==S.target.ticketId)return;let e=on.get(S.target.ticketId);(!e||!Qn(e))&&(ft(null),A?.());return}if(dt.target.kind!==`bundle`||dt.target.bundleId!==S.target.bundleId)return;let{bundleId:r}=S.target,i=er(r),a=S.mode===`files`?nr(r):tr(r);if(!i||!a){ft(null),A?.();return}if(dt.target.ticketId!==i.id){let e=fn.get(r)??i.bundle??null;ft(t=>t?.isRouteOwned?{...t,target:{kind:`bundle`,bundleId:r,ticketId:i.id},projectId:i.project_id,title:e?Gy(e):i.title,bundleTargetName:e&&Gy(e)||null}:t)}},[e,fn,U,nr,tr,Qn,er,H,A,S,dt,on]);let vi=(0,p.useCallback)(()=>{Ht.current?.focus({preventScroll:!0})},[]);return Xde([{key:`n`,onKeyDown:_i,disabled:!e},{key:`k`,ctrlKey:!0,onKeyDown:vi}],{isBlocked:Yde}),(0,Y.jsxs)(Y.Fragment,{children:[!w&&(0,Y.jsxs)(Kae,{sensors:F,collisionDetection:XN,onDragStart:rr,onDragMove:gi,onDragCancel:ir,onDragEnd:cr,children:[(0,Y.jsx)(`div`,{className:`relative flex min-h-0 flex-1 overflow-hidden`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 overflow-hidden p-6`,children:[(0,Y.jsx)(gle,{query:At.query,inputRef:Ht,hideStaleTickets:At.hideStaleTickets,hideBundlesWithPullRequests:At.hideBundlesWithPullRequests,onQueryChange:e=>jt({query:e}),onClear:()=>{jt({query:``}),Ht.current?.focus()},onHideStaleTicketsChange:e=>jt({hideStaleTickets:e}),onHideBundlesWithPullRequestsChange:e=>jt({hideBundlesWithPullRequests:e})}),(0,Y.jsx)(`div`,{ref:vn,className:`flex min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,children:(0,Y.jsxs)(`div`,{ref:yn,className:`relative flex min-h-0 w-max min-w-full gap-4`,children:[(0,Y.jsx)(Fde,{dependencies:R,cardRects:Bn,clipRects:Vn,preview:Hn,ticketsById:on,overlaySize:Un}),j8.map(t=>{let n=I.filter(e=>e.state===t&&!_y(e)),r=mn.filter(e=>e.state===t&&!_y(e)),a=zy(r,te,t),o=$t&&n.length===0?t===`plan`?1:t===`build`?2:0:0;return(0,Y.jsx)(d3,{id:t,title:P(`card.columnLabels.${t}`),items:a,ticketCount:r.length,allTickets:I,dependencies:R,bundles:te,activeTool:i,modelsByTool:Pe,availableSkills:Fe,activeRunContextKey:Xt,automationStatuses:fe,isProjectRootRunActive:Yt,isBundleRunDisabled:Zt,getDependencyTargetState:Wn,onDependencyStart:Gn,onDeleteDependency:Kn,onRegisterTicketNode:Fn,onRegisterDependencyClipNodes:Ln,onAddTicket:t===`plan`&&e?_i:void 0,onCreateBundle:t===`plan`&&e?ur:void 0,onDeleteBundle:t===`plan`&&e?yr:void 0,onDeleteBundleWrapper:br,onRefreshBundles:t===`plan`&&e?oe:void 0,onUpdateTicket:xr,onDeleteTicket:Sr,onUndoTicket:Cr,undoingColumn:Ve,onRetryTicket:wr,onAdvanceTicket:fi,onParkTicket:hr,onUnparkTicket:gr,onBuildChainTicket:pi,onRunTicket:Tr,onOpenVerificationTicket:en.length>0?zr:void 0,canOpenChangesForTicket:Qn,onOpenFilesTicket:Lr,onOpenChangesTicket:Rr,canOpenIdeForTicket:Zn,onOpenIdeTicket:Er,onStopTicket:Dr,onStopBuildTicket:Or,onStopBuildChainTicket:mi,onResumeBuildTicket:Ar,onInterruptReviewTicket:kr,onOpenBundleFiles:Fr,onOpenBundleChanges:Ir,canOpenReviewForBundle:tr,canOpenFilesForBundle:nr,onOpenBundleVerification:en.length>0?e=>Nr(e):void 0,onOpenBundleChecks:e=>Nr(e,`checks`),hasConfiguredChecks:en.length>0,onOpenBundleIde:jr,onAddTicketToBundle:_i,onStartChatFromBundle:u,onFollowUpTicket:Br,bundleActionState:X,onBuildBundle:ni,onReviewBundle:ri,onUndoBundleReview:ai,onRunBundle:li,onStopBundle:ui,onParkBundleWrapper:_r,onUnparkBundleWrapper:vr,onOpenTicketDetails:ln,onOpenBundleDetails:(e,t)=>{Zr(e,t)},onRequestBundleRefresh:e=>{Qr(`bundleRefresh`,()=>Wr(e))},onRequestTicketRefresh:ae,hoveredBundleId:_e,onHoverBundleChange:ye,multiColumnBundleIds:hn,onResumeBundleAutomation:oi,onDismissBundleAutomationPause:si,onOpenBuildQuestions:e=>{Kr(e)},loadingSkeletonCount:o},t)}),(0,Y.jsx)(d3,{id:M8,title:P(`card.columnLabels.done`),items:_n,ticketCount:gn.length,allTickets:I,dependencies:R,activeTool:i,modelsByTool:Pe,availableSkills:Fe,bundles:te,activeRunContextKey:Xt,automationStatuses:fe,isProjectRootRunActive:Yt,isBundleRunDisabled:Zt,getDependencyTargetState:Wn,onDependencyStart:Gn,onDeleteDependency:Kn,onRegisterTicketNode:Fn,onRegisterDependencyClipNodes:Ln,onUpdateTicket:xr,onDeleteTicket:Sr,onUndoTicket:Cr,undoingColumn:Ve,onRetryTicket:wr,onAdvanceTicket:fi,onParkTicket:hr,onUnparkTicket:gr,onBuildChainTicket:pi,onRunTicket:Tr,onOpenVerificationTicket:en.length>0?zr:void 0,canOpenChangesForTicket:Qn,onOpenFilesTicket:Lr,onOpenChangesTicket:Rr,canOpenIdeForTicket:Zn,onOpenIdeTicket:Er,onStopTicket:Dr,onStopBuildTicket:Or,onStopBuildChainTicket:mi,onResumeBuildTicket:Ar,onInterruptReviewTicket:kr,onOpenBundleFiles:Fr,onOpenBundleChanges:Ir,canOpenReviewForBundle:tr,canOpenFilesForBundle:nr,onOpenBundleVerification:en.length>0?e=>Nr(e):void 0,onOpenBundleChecks:e=>Nr(e,`checks`),hasConfiguredChecks:en.length>0,onOpenBundleIde:jr,onAddTicketToBundle:_i,onStartChatFromBundle:u,onFollowUpTicket:Br,bundleActionState:X,onBuildBundle:ni,onReviewBundle:ri,onUndoBundleReview:ai,onRunBundle:li,onStopBundle:ui,onParkBundleWrapper:_r,onUnparkBundleWrapper:vr,onOpenTicketDetails:ln,onOpenBundleDetails:(e,t)=>{Zr(e,t)},onRequestBundleRefresh:e=>{Qr(`bundleRefresh`,()=>Wr(e))},onRequestTicketRefresh:ae,hoveredBundleId:_e,onHoverBundleChange:ye,multiColumnBundleIds:hn,onResumeBundleAutomation:oi,onDismissBundleAutomationPause:si,onOpenBuildQuestions:e=>{Kr(e)},className:`min-w-[272px] max-w-[272px] flex-[0.98] bg-card/65`,headerAccessory:(0,Y.jsxs)(Q,{type:`button`,variant:`destructive`,size:`xs`,className:`gap-1.5`,disabled:gn.length===0||ze,onClick:()=>Re(!0),children:[(0,Y.jsx)(kC,{className:`h-3.5 w-3.5`}),(0,Y.jsx)(`span`,{children:P(`board.doneColumn.emptyAction`)})]})})]})})]})}),(0,Y.jsxs)(coe,{zIndex:5,dropAnimation:Ie?null:void 0,children:[pe&&(0,Y.jsx)(u3,{ticket:pe,allTickets:I,dependencies:R,bundles:te,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:pe.worktree_bundle_id?fe.get(pe.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:(()=>{let e=PF(pe,i);return FF(e)&&Ne(e).length>0})(),availableModels:Ne(PF(pe,i)),runDisabled:py(pe,Xt,Yt,P(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:py(pe,Xt,Yt,P(`board.errors.runBlockedByActive`)),onDependencyStart:Gn,onDeleteDependency:Kn,onRegisterOverlayNode:xe,onCreateBundle:ur,onDeleteBundle:yr,onRefreshBundles:oe,onUpdate:xr,onDelete:()=>Sr(pe.id),onUndo:()=>Cr(pe.id),undoInProgress:Ve===pe.state&&(pe.state===`build`||pe.state===`review`),onRetry:()=>wr(pe.id),onAdvance:()=>fi(pe.id),onPark:()=>hr(pe.id),onUnpark:()=>gr(pe.id),onBuildChain:()=>pi(pe.id),onRun:pe.worktree_bundle_id===null&&Iy(pe)&&pe.has_run_config?()=>Tr(pe.id):void 0,onOpenIde:pe.worktree_bundle_id===null&&Zn(pe)?()=>Er(pe.id):void 0,onStop:pe.worktree_bundle_id===null?()=>Dr(pe.id):void 0,onStopBuild:()=>Or(pe.id),onStopBuildChain:()=>mi(pe.id),onResumeBuild:()=>Ar(pe.id),onInterruptReview:()=>void kr(pe.id),onFollowUp:e=>Br(pe.id,e),onRequestTicketRefresh:ae}),!pe&&he&&(0,Y.jsx)(RF,{group:he,activeTool:i,modelsByTool:Pe,automationStatus:fe.get(he.bundle.id),overlay:!0,renderTicket:Xn})]}),Qt&&(0,Y.jsx)(Rde,{className:`pointer-events-auto fixed left-1/2 top-4 z-20 w-[min(14rem,calc(100vw-2rem))] -translate-x-1/2`})]}),we&&(()=>{let r=Ne(i),a=zt&&qn.model&&IF(qn.model,r),o=a?qn.model:``,s=a?qn.variant:``;return(0,Y.jsx)(Lde,{onSubmit:lr,bundles:te,projectId:e,projectBranchState:n,tool:i,showModelSelector:zt,showSkillsSelector:i===`opencode`,showDockerSandboxModelNotice:t?.build_execution_provider===`docker_sandbox`,onOpenProjectExecutionSettings:N,availableModels:r,availableSkills:Fe,initialModel:o,initialVariant:s,initialSkills:zt&&i===`opencode`?qn.skills:[],initialWorktreeBundleId:we.initialWorktreeBundleId,initialImportedDraft:we.initialImportedDraft,onCreateBundle:ur,onDeleteBundle:yr,onRefreshBundles:oe,onClose:()=>Te(null)})})(),G&&(0,Y.jsx)(_le,{ticketCount:gn.length,isDeleting:ze,onCancel:()=>Re(!1),onConfirm:()=>{hi()}}),Ge&&(0,Y.jsx)(l3,{ticket:Ge,allTickets:I,dependencies:R,bundles:te,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:Ge.automation_paused_reason?null:Ge.worktree_bundle_id?fe.get(Ge.worktree_bundle_id):null,projectBranchState:n,onClose:()=>{let e=Ge.id;We(null),qe(null),L(t=>t.map(t=>t.id===e?$6(t):t)),b?.()},showModelSelector:Bt,showSkillsSelector:PF(Ge,i)===`opencode`,activeTool:i,availableModels:Ne(PF(Ge,i)),availableReviewerModels:Me.opencode,availableSkills:Fe,runDisabled:py(Ge,Xt,Yt,P(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:py(Ge,Xt,Yt,P(`board.errors.runBlockedByActive`)),onDeleteDependency:Kn,onCreateBundle:ur,onDeleteBundle:yr,onRefreshBundles:oe,onUpdate:xr,onAdvance:()=>fi(Ge.id),onBuildChain:()=>pi(Ge.id),onRun:Iy(Ge)&&Ge.has_run_config?()=>Tr(Ge.id):void 0,onOpenIde:Zn(Ge)?()=>Er(Ge.id):void 0,onStop:()=>Dr(Ge.id),onStopBuild:()=>Or(Ge.id),onStopBuildChain:()=>mi(Ge.id),onResumeBuild:()=>Ar(Ge.id),onInterruptReview:()=>void kr(Ge.id),onFollowUp:(e,t)=>Br(Ge.id,e,t),onReviewFollowUp:(e,t)=>Ge.worktree_bundle_id?di(Ge.worktree_bundle_id,e,t,`changes`):Br(Ge.id,e,t,`changes`),onProjectMemorySuggestionsChanged:()=>{St(e=>e+1)},onRequestTicketRefresh:e=>{sn(e)},onWorkspaceReviewOpen:D?e=>{D({kind:`ticket`,ticketId:Ge.id},e)}:void 0,onViewSourceSpec:c,onNavigateToLifecycleSource:l,onOpenBuildQuestions:e=>{Kr(e)},onOpenChecks:Ge.worktree_bundle_id&&(en.length>0||Ge.latest_check_gate_evaluation)?()=>{Nr(Ge.worktree_bundle_id,`checks`)}:void 0,onStopAutomation:Ge.worktree_bundle_id?()=>ui(Ge.worktree_bundle_id):void 0}),lt&&e&&t&&(()=>{let t=I.find(e=>e.id===lt.ticketId);if(!t)return null;let n=!!t.worktree_bundle_id,r=t.worktree_bundle_id?fn.get(t.worktree_bundle_id)?.required_check_policy??t.bundle?.required_check_policy:void 0,i=r?.required_check_definition_ids??nn,a=r?.pre_review_check_definition_ids??rn,o=n?{projectId:e,targetKind:`bundle`,targetBundleId:t.worktree_bundle_id}:null,s={scope:`ticket`,ticketId:t.id,projectId:t.project_id};return(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(D8,{targetLabel:lt.label,definitions:en,requiredDefinitionIds:i,preReviewDefinitionIds:a,checksTarget:o,testsTarget:s,onClose:()=>ut(null),requestedInitialTab:lt.requestedInitialTab})})})(),dt&&(()=>{let{target:e}=dt,t=I.find(t=>t.id===e.ticketId),n=e.kind===`bundle`,r=n?I.some(t=>t.worktree_bundle_id===e.bundleId):!!t,i=n?I.some(t=>t.worktree_bundle_id===e.bundleId&&t.agent_status===`running`):t?.agent_status===`running`,a=n?r&&!i:!!t&&!i,o=!!(dt.isRouteOwned&&C!==void 0),s=o?C:null,l=o?s?.canSubmitReviewPrompt??!1:a,u=i?P(`board.changes.reviewPromptDisabledReason`):r?!n&&t?o3(t).disabledReason??void 0:void 0:P(`board.changes.targetUnavailableReason`),d=!i&&(n||t?.state===`build`||t?.state===`review`),f=n?fn.get(e.bundleId):void 0;return(0,Y.jsx)(I6,{target:{scope:`ticket`,ticketId:e.ticketId,onTicketUpdate:xr,onRequestTicketRefresh:ae},initialMode:dt.initialMode,reviewMode:dt.isRouteOwned?S?.mode:void 0,onReviewModeChange:dt.isRouteOwned?O:void 0,enabledModes:[`changes`,`files`],projectId:dt.projectId,reviewCommentsBundleId:n?e.bundleId:null,title:dt.title,bundleTargetName:dt.bundleTargetName,fileTarget:f?.kind===`project_root`?{kind:`repo_root`,bundle_id:null,ticket_id:null}:void 0,onSubmitReviewPrompt:o?s?.submitPrompt:t=>n?di(e.bundleId,t,dt.followUpMode,`changes`):Br(e.ticketId,t,dt.followUpMode,`changes`),canSubmitReviewPrompt:l,reviewSubmitDisabledReason:o?s?.reviewSubmitDisabledReason??P(`workspaceReviewModal.chatRequired`):u,canAddReviewComments:l,canModifyChanges:a,changesDisabledReason:i?P(`board.changes.modifyChangesDisabledReason`):u,mode:o?s?.mode:dt.followUpMode,onModeChange:o?s?.onModeChange:e=>{ft(t=>t&&{...t,followUpMode:e})},canToggleMode:o?s?.canSubmitReviewPrompt??!1:d,isUpdatingMode:s?.isUpdatingMode??!1,onClose:()=>{if(ft(null),dt.isRouteOwned&&k?.(),n){Wr(e.bundleId);return}sn(e.ticketId)},onViewSourceSpec:c,originSpecSessionId:t?.origin_spec_session_id??null,originSpecSnapshotId:t?.origin_spec_snapshot_id??null})})(),pt&&e&&t&&(()=>{let t=fn.get(pt.bundleId)?.required_check_policy??pt.requiredCheckPolicy,n=t?.required_check_definition_ids??nn,r=t?.pre_review_check_definition_ids??rn;return(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(D8,{targetLabel:pt.label,definitions:en,requiredDefinitionIds:n,preReviewDefinitionIds:r,checksTarget:{projectId:e,targetKind:`bundle`,targetBundleId:pt.bundleId,gateEvaluationId:pt.gateEvaluationId},testsTarget:an?{scope:`project`,projectId:e,targetKind:`bundle`,targetBundleId:pt.bundleId}:null,onClose:()=>mt(null),requestedInitialTab:pt.requestedInitialTab})})})(),Qe&&pn&&(0,Y.jsx)(Dle,{details:pn,activeColumn:et,isLoading:ht||X.bundleRefresh,actionState:X,canOpenIde:$n(pn),projectMemoryEnabled:!!t?.memory_enabled,memorySuggestionsRefreshKey:yt,automationStatus:pn.tickets.some(e=>e.automation_paused_reason)?null:fe.get(pn.bundle.id),runDisabled:Zt(pn.bundle.id),showModelSelector:Vt,activeTool:i,modelsByTool:Pe,availableSkills:Fe,onClose:()=>{let e=pn.bundle.id;J(null),tt(null),rt(null),gt(!1),vt(N8()),L(t=>t.map(t=>t.worktree_bundle_id===e&&t.id!==Ue?$6(t):t)),E?.()},onOpenTicketDetails:ln,onNavigateToLifecycleSource:l,onUpdateTicket:xr,onOpenIde:()=>{let e=pn.tickets.find(e=>e.id===pn.target_ticket_id)??pn.tickets.find(e=>e.has_worktree);e&&Er(e.id)},onOpenVerification:en.length>0?()=>{Nr(pn.bundle.id)}:void 0,onOpenChecks:en.length>0||pn.tickets.some(e=>e.latest_check_gate_evaluation)?()=>{Nr(pn.bundle.id,`checks`)}:void 0,onRefresh:e=>{Qr(`bundleRefresh`,()=>Wr(e))},onWorkspaceReviewOpen:D?e=>{D({kind:`bundle`,bundleId:pn.bundle.id},e)}:void 0,onUpdateBundle:fr,onBuildBundle:ni,onStopBuildTicket:$r,onResumeBuildTicket:ti,onInterruptReviewTicket:ei,onReviewBundle:ri,onContinueReviewBundle:ii,onUndoBundleReview:ai,onRunBundle:li,onStopBundle:ui,onFollowUpBundle:di,onOpenBuildQuestions:e=>{Kr(e)},onResumeBundleAutomation:oi,onDismissBundleAutomationPause:si}),it&&ot&&(0,Y.jsx)(Dde,{details:ot,onClose:()=>{ct.current+=1,at(null),st(null)},onRefresh:Gr,onSubmit:qr})]})},I8=({count:e,title:t,isDeleting:n,onConfirm:r,onCancel:i,labels:a})=>{let o=e>1;return(0,Y.jsxs)(gC,{onClose:i,overlayClassName:`bg-black/60`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,Y.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:o?a.bulkTitle:a.title}),t?(0,Y.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:t}):null,(0,Y.jsx)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:o?a.bulkDescription(e):a.description}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,onClick:i,disabled:n,children:a.cancel}),(0,Y.jsx)(Q,{type:`button`,variant:`destructive`,onClick:r,disabled:n,children:n?a.deleting:a.delete})]})]})},L8=({label:e})=>(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),R8=({label:e})=>(0,Y.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,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6`,children:(0,Y.jsxs)(xC,{className:`w-full max-w-lg border-dashed border-border/70 bg-card/40`,children:[(0,Y.jsxs)(SC,{children:[(0,Y.jsx)(CC,{children:e}),(0,Y.jsx)(wC,{children:t})]}),(0,Y.jsx)(EC,{children:(0,Y.jsx)(Q,{type:`button`,onClick:r,disabled:!i,children:n})})]})}),Ife=({className:e})=>(0,Y.jsx)(zg,{"aria-hidden":`true`,className:e}),Lfe=({className:e})=>(0,Y.jsx)(ate,{"aria-hidden":`true`,className:e}),Rfe=({className:e})=>(0,Y.jsx)(ote,{"aria-hidden":`true`,className:e}),B8=({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)},[]),ee=(0,p.useCallback)(()=>{R(),L.current=window.setTimeout(()=>{I.current=!1,L.current=null},0)},[R]),te=(0,p.useCallback)(()=>{F.current&&(F.current=null,ee())},[ee]),z=(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]),B=(0,p.useCallback)(e=>{let t=F.current;!t||e.pointerId!==t.pointerId||te()},[te]);return(0,p.useEffect)(()=>{if(!h){te();return}return window.addEventListener(`pointerup`,B),window.addEventListener(`pointercancel`,B),()=>{window.removeEventListener(`pointerup`,B),window.removeEventListener(`pointercancel`,B),te(),R()}},[R,B,h,te]),(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-start gap-2 border-b border-border/70 px-4 py-3.5`,children:[(0,Y.jsxs)(Q,{type:`button`,size:`sm`,className:`gap-2`,onClick:l,disabled:u||d,children:[(0,Y.jsx)(wv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:N.newSession}),f]}),(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":N.collapseAriaLabel,"aria-expanded":a,className:`ml-auto`,onClick:o,children:(0,Y.jsx)(Lfe,{className:`h-4 w-4`})})]}),e.length>0?(0,Y.jsx)(`div`,{className:`px-4 py-2.5`,children:h?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.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,Y.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,Y.jsx)(`div`,{className:`flex justify-end text-xs font-medium text-muted-foreground`,children:N.selectedCount(_)})]}):v?(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2 text-xs`,onClick:b,children:[(0,Y.jsx)(Ife,{className:`h-3.5 w-3.5`}),N.select]}):null}):null,(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2`,children:i&&e.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground`,children:N.loadingSessions}):e.length===0?(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground`,children:N.noSessions}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-3`,children:t.map(e=>(0,Y.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,Y.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,Y.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},z(t))},onPointerMove:e=>{let n=F.current;!n||n.pointerId!==e.pointerId||z(t)},children:[(0,Y.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,Y.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,Y.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,Y.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,Y.jsx)(kC,{className:`h-4 w-4`})})]},t)})]},e.key))})})]}):(0,Y.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,Y.jsx)(vv,{content:m,side:`right`,children:(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":N.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,Y.jsx)(wv,{className:`h-4 w-4`})})}):(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":N.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,Y.jsx)(wv,{className:`h-4 w-4`})}),(0,Y.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,Y.jsx)(Rfe,{className:`h-4 w-4`})})]})})},V8=({isInterrupting:e,onStop:t,interruptLabel:n,interruptingLabel:r})=>(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:e,onClick:t,children:[e?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:e?r:n})]}),H8=4,zfe=5e3,U8=(e,t)=>Wb.t(`common:chatChangesPanel.${e}`,t),W8=e=>e.replace(/^[ab]\//,``),G8=e=>{let t=`oldPath`in e&&typeof e.oldPath==`string`?W8(e.oldPath):``,n=`newPath`in e&&typeof e.newPath==`string`?W8(e.newPath):``;return[...new Set([n,t].filter(e=>e&&e!==`/dev/null`))]},K8=e=>{let[t,n]=G8(e);return!t&&!n?U8(`unknownFile`):t&&n&&t!==n?`${n} -> ${t}`:t??n??U8(`unknownFile`)},q8=e=>{let t=DG((()=>{let[t,n]=G8(e);return t??n??null})());if(!t)return null;try{return vj(e.hunks,{highlight:!0,refractor:SK.default,language:t,enhancers:[gj(e.hunks)]})}catch{return null}},J8=(e,t)=>e instanceof Error?e.message:t,Bfe=(e,t)=>{if(!t)return e;let n=K8(t);return[t,...e.filter(e=>K8(e)!==n)]},Vfe=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}),Hfe=({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}))},Y8=e=>{let t=e.split(/[\\/]/);return t[t.length-1]||e},Ufe={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`},Wfe=e=>U8(`fileStatus.${e}`),Gfe=({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`?U8(`picker.diff`):s?Y8(s.path):U8(`picker.file`):e===`all`?U8(`picker.allChanges`):s?Y8(s.path):e;return(0,Y.jsxs)(Y_,{open:a,onOpenChange:o,children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.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":U8(`picker.openChangedFilesAriaLabel`),title:e===`all`?void 0:s?.path??e,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:c}),r===`full`&&(0,Y.jsx)(bC,{variant:`outline`,className:`shrink-0 text-[10px] uppercase tracking-wide`,children:U8(`picker.fileCount`,{count:t.length})}),(0,Y.jsx)(Cv,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,Y.jsxs)(Z_,{align:`start`,className:`z-[90] w-[28rem] max-w-[calc(100vw-2rem)] p-0`,children:[(0,Y.jsx)(`div`,{className:`border-b border-border/80 px-4 py-3`,children:(0,Y.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:U8(`picker.title`)})}),(0,Y.jsx)(`div`,{className:`max-h-[min(28rem,calc(100vh-10rem))] overflow-y-auto p-3`,children:(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.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`,K3(e===`all`),`justify-between`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:U8(`picker.allChanges`)}),(0,Y.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground transition-colors group-hover:text-foreground/70`,children:U8(`picker.allChangesDescription`)})]}),n&&(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-[11px]`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground transition-colors group-hover:text-foreground/70`,children:U8(`picker.fileCount`,{count:n.files_changed})}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,n.additions]}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,n.deletions]})]})]}),t.map(t=>(0,Y.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`,K3(e===t.path)),children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:Y8(t.path)}),(0,Y.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,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-[11px]`,children:[(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,t.additions]}),(0,Y.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,t.deletions]})]})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[t.status&&(0,Y.jsx)(bC,{variant:`outline`,className:Ufe[t.status],children:Wfe(t.status)}),t.staged&&(0,Y.jsx)(bC,{variant:`outline`,children:U8(`fileStatus.staged`)}),t.unstaged&&(0,Y.jsx)(bC,{variant:`outline`,children:U8(`fileStatus.unstaged`)}),t.conflicted&&(0,Y.jsx)(bC,{variant:`destructive`,children:U8(`fileStatus.conflicted`)}),t.originalPath&&(0,Y.jsx)(`span`,{className:`break-all font-mono text-[11px] text-muted-foreground transition-colors group-hover:text-foreground/70`,children:t.status===`renamed`?U8(`fileStatus.renamedFrom`,{path:t.originalPath}):t.originalPath})]})]})},`${t.path}:${t.originalPath??``}`))]})})]})]})},X8=(0,p.memo)(({projectId:e,chatSessionId:t=null,canSubmitReviewPrompt:n,reviewSubmitDisabledReason:r,onSubmitReviewPrompt:i,state:a,onStateChange:o,isResizing:s=!1,onClose:c,desktopWidth:l,panelElementRef:u})=>{let[d,f]=(0,p.useState)(null),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(!1),[,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(new Map),[C,w]=(0,p.useState)(!1),T=(0,p.useRef)(0),E=(0,p.useRef)(0),D=(0,p.useRef)(null),O=(0,p.useRef)(null),k=a.selectedDiffPath,A=a.activeReviewTarget,j=a.editingReviewCommentKey,M=A?.commentKey??j??`chat`,N=a.reviewDraftInput,P=(0,p.useMemo)(()=>new Map(a.reviewComments.map(e=>[Fj(e.filePath,e.changeKey),e])),[a.reviewComments]),F=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await PM(e,t):await rr(e)},[t,e]),I=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await FM(e,t):await ur(e)},[t,e]);(0,p.useEffect)(()=>{D.current=d},[d]),(0,p.useEffect)(()=>{O.current=m},[m]);let L=(0,p.useCallback)(async()=>{if(!e){E.current+=1,f(null),h(null),_(null),y(!1),b(!1);return}let t=T.current+1,n=E.current+1;T.current=t,E.current=n,y(!0),b(!0);let r=F().then(e=>{T.current===t&&(D.current=e,f(e),_(null))}).catch(e=>{T.current===t&&_(J8(e,U8(`errors.loadDiff`)))}).finally(()=>{T.current===t&&E.current===n&&y(!1)}),i=I().then(e=>{T.current===t&&(O.current=e,h(e))}).catch(()=>{}).finally(()=>{T.current===t&&b(!1)});await Promise.allSettled([r,i])},[F,I,e]),R=(0,p.useCallback)(async(t={})=>{if(!e)return;let{broadcastOnSignatureChange:n=!1}=t,r=T.current+1;T.current=r,b(!0);try{let t=await I();if(T.current!==r)return;let i=O.current?.workspace_signature??null,a=t.workspace_signature??null,o=!D.current||i!==a;if(O.current=t,h(t),!o){E.current+=1,y(!1);return}let s=!D.current,c=E.current+1;E.current=c,s&&y(!0);try{let t=await F();if(T.current!==r)return;D.current=t,f(t),_(null),n&&i!==a&&$3(e)}catch(e){if(T.current!==r)return;D.current||_(J8(e,U8(`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 e6(t=>{t===e&&R()})},[e,R]),(0,p.useEffect)(()=>{if(!e)return;let t=ax(()=>{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})},zfe);return()=>{window.clearInterval(t)}},[e,R]);let ee=(0,p.useMemo)(()=>{let e=typeof d?.diff==`string`?d.diff:``;return e.trim()?YE(e,{nearbySequences:`zip`}).map(e=>({...e,pathCandidates:G8(e)})):[]},[d]),te=(0,p.useMemo)(()=>{let e=new Map;for(let t of ee)for(let n of t.pathCandidates)e.has(n)||e.set(n,t);return e},[ee]),z=(0,p.useMemo)(()=>Hfe({diffResponse:d,gitStatus:m}),[d,m]);(0,p.useEffect)(()=>{if(k!==`all`&&!(!d&&!m)){if(z.length===0){o(e=>({...e,selectedDiffPath:`all`}));return}z.some(e=>e.path===k)||o(e=>({...e,selectedDiffPath:`all`}))}},[d,m,o,k,z]);let B=k===`all`?null:te.get(k)??null,V=(0,p.useMemo)(()=>Bfe(ee,B),[ee,B]),H=(0,p.useMemo)(()=>k===`all`?ee:B?[B]:[],[ee,k,B]);(0,p.useEffect)(()=>{S(new Map)},[ee]),(0,p.useEffect)(()=>{if(V.length===0)return;let e=!1,t=null,n=0,r=()=>{if(e)return;let i=V.slice(n,n+H8);i.length!==0&&(S(e=>{let t=new Map(e);for(let e of i){let n=K8(e);t.has(n)||t.set(n,q8(e))}return t}),n+=H8,n<V.length&&(t=window.setTimeout(r,0)))};return t=window.setTimeout(r,0),()=>{e=!0,t!==null&&window.clearTimeout(t)}},[V]);let U=(0,p.useMemo)(()=>{let e=new Map;for(let t of V.slice(0,H8))e.set(K8(t),q8(t));return e},[V]),ne=(0,p.useMemo)(()=>H.map(e=>({...e,tokens:x.get(K8(e))??U.get(K8(e))??null})),[U,x,H]),re=(0,p.useMemo)(()=>ee.map(e=>({...e,tokens:null})),[ee]),ie=(0,p.useMemo)(()=>Vfe(a.reviewComments),[a.reviewComments]),ae=ie.length,oe=n&&!C&&ae>0,W=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}))},[o]),se=(0,p.useCallback)(({filePath:e,changeKey:t,commentKey:r})=>{let i=P.get(r);if(i){o(e=>({...e,selectedDiffPath:i.filePath,activeReviewTarget:null,editingReviewCommentKey:r,reviewDraftInput:i.comment}));return}n&&o(n=>({...n,activeReviewTarget:{filePath:e,changeKey:t,commentKey:r},editingReviewCommentKey:null,reviewDraftInput:``}))},[n,o,P]),ce=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``}))},[o]),le=(0,p.useCallback)(e=>{let t=P.has(e.commentKey);if(!n&&!t)return;let r=N.trim();if(!r)return;let i=e.change.type===`insert`?null:`oldLineNumber`in e.change?e.change.oldLineNumber:e.change.lineNumber,a=e.change.type===`delete`?null:`newLineNumber`in e.change?e.change.newLineNumber:e.change.lineNumber;o(t=>{let n=new Map(t.reviewComments.map(e=>[Fj(e.filePath,e.changeKey),e]));return n.set(e.commentKey,{scope:`uncommitted`,filePath:e.filePath,changeKey:e.changeKey,changeType:e.change.type,oldLineNumber:i,newLineNumber:a,hunkHeader:e.hunk.content,lineContent:e.change.content,diffSnippet:Ij(e.hunk,e.change),comment:r}),{...t,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[...n.values()]}})},[n,o,P,N]),ue=(0,p.useCallback)(e=>{let t=P.get(e);t&&o(n=>({...n,selectedDiffPath:t.filePath,activeReviewTarget:null,editingReviewCommentKey:e,reviewDraftInput:t.comment}))},[o,P]),de=(0,p.useCallback)(e=>{o(t=>({...t,activeReviewTarget:t.activeReviewTarget?.commentKey===e?null:t.activeReviewTarget,editingReviewCommentKey:t.editingReviewCommentKey===e?null:t.editingReviewCommentKey,reviewDraftInput:t.activeReviewTarget?.commentKey===e||t.editingReviewCommentKey===e?``:t.reviewDraftInput,reviewComments:t.reviewComments.filter(t=>Fj(t.filePath,t.changeKey)!==e)}))},[o]),fe=(0,p.useCallback)(async()=>{if(!oe)return;w(!0);let e=Gj({drafts:ie,findings:[],githubComments:[],uncommittedFiles:ee});try{await i(e),W(),$.success(U8(`toasts.sendChangesSuccess`),{id:`chat-diff-review-submit-success`})}catch(e){$.error(J8(e,U8(`errors.sendChanges`)),{id:`chat-diff-review-submit-error`})}finally{w(!1)}},[oe,W,i,ee,ie]),pe=(0,p.useCallback)(e=>(0,Y.jsx)(T3,{reviewComments:ie,pendingFixCount:ae,triggerMode:e===`wide`?`full`:`compact`,canSendReview:oe,isSubmittingReview:C,reviewSubmitDisabledReason:r??void 0,onClearPendingFixes:W,onSubmitReview:()=>{fe()}}),[oe,W,fe,C,ae,ie,r]),me=c?(0,Y.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":U8(`closeAriaLabel`),className:`text-muted-foreground hover:text-foreground`,onClick:c,children:(0,Y.jsx)(Xb,{className:`h-4 w-4`})}):null,he=l?{"--chat-changes-panel-width":`${l}px`}:void 0;return(0,Y.jsx)(`aside`,{"data-testid":`chat-changes-panel`,"data-desktop-width":l?String(l):void 0,ref:u,style:he,className:Z(`flex h-[26rem] min-h-0 w-full shrink-0 flex-col overflow-hidden border-t border-border/70 bg-background/20 xl:h-full xl:border-l xl:border-t-0`,l?`xl:w-[var(--chat-changes-panel-width)]`:`xl:w-[32rem]`),children:(0,Y.jsx)(G3,{selectedDiffPath:k,sidebarFiles:z,diffResponse:d,isDiffLoading:v,diffError:g,allDiffFiles:re,renderedFiles:ne,viewType:`unified`,onViewTypeChange:()=>{},onRetry:()=>{L()},activeReviewTarget:A,editingReviewCommentKey:j,reviewDraftInstanceKey:M,reviewDraftInput:N,reviewComments:ie,reviewFindings:[],githubComments:[],selectedReviewFindingIds:[],selectedGitHubCommentIds:[],canSelectReviewTarget:n,canEditActiveReviewDraft:n,reviewFindingsError:null,gitHubCommentsError:null,hasStaleReviewFindings:!1,onSelectReviewTarget:se,onToggleReviewFindingSelection:()=>{},onToggleGitHubCommentSelection:()=>{},onReviewDraftInputChange:e=>{o(t=>({...t,reviewDraftInput:e}))},onCancelReviewDraft:ce,onEditReviewDraft:ue,onRemoveReviewDraft:de,onSaveReviewDraft:le,diffThemeClassName:q3,resolveFilePath:K8,normalizeDiffPath:W8,emptyStateTitle:U8(`emptyStateTitle`),emptyStateDescription:U8(`emptyStateDescription`),filePickerControl:e=>(0,Y.jsx)(Gfe,{selectedDiffPath:k,sidebarFiles:z,diffStats:d?.stats??null,triggerMode:e===`wide`?`full`:`compact`,onSelectDiffPath:e=>{o(t=>({...t,selectedDiffPath:e}))}}),reviewSummaryControl:pe,extraHeaderControl:me,surfaceVariant:`flat`,showViewTypeToggle:!1,gutterVariant:`compact`,isResizing:s,resizePlaceholderLineThreshold:200})})});X8.displayName=`ChatChangesPanel`;var Z8=({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:ee=null,onFollowUpPromptChange:te,onFollowUpKeyDown:z,onFollowUpPaste:B,onUploadAttachments:V,onRemoveAttachment:H,onFollowUpSubmit:U})=>(0,Y.jsx)(XJ,{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:ee,hidePendingAgentTitle:b,onFollowUpPromptChange:te,onFollowUpKeyDown:z,onFollowUpPaste:B,onUploadAttachments:V,onRemoveAttachment:H,onFollowUpSubmit:U}),Q8=({disabled:e=!1,onClick:t})=>{let n=Wb.t(`chatView.startBuilding.label`);return(0,Y.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":Wb.t(`chatView.startBuilding.ariaLabel`),disabled:e,onClick:t,children:[(0,Y.jsx)(Fv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:n})]})},Kfe=`mt-1 flex min-h-5 flex-wrap items-center gap-2 text-xs text-muted-foreground`,qfe=({label:e})=>(0,Y.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}),$8=({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,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`truncate text-sm font-semibold text-foreground`,children:e}),(0,Y.jsxs)(`div`,{className:Kfe,children:[(0,Y.jsx)(KF,{tool:t,className:`text-[11px]`}),n?(0,Y.jsx)(`p`,{children:n}):null,r?(0,Y.jsx)(qfe,{label:i}):null,a?(0,Y.jsx)(qF,{totalTokens:a.totalTokens,contextWindow:a.contextWindow,cost:a.cost,tool:a.tool,model:a.model,availableModels:a.availableModels}):null,o]})]}),s]}),c]}),e5=({projectId:e,suggestions:t,title:n,description:r,emptyState:i=null,onSuggestionsChanged:a})=>(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(n||r)&&(0,Y.jsxs)(`div`,{children:[n&&(0,Y.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-[0.2em] text-muted-foreground`,children:n}),r&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r})]}),t.length>0?(0,Y.jsx)(mT,{projectId:e,suggestions:t,onChanged:(e,t)=>a?.(e,t)}):i&&(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground`,children:i})]}),t5=()=>({selectedDiffPath:`all`,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}),Jfe=[{key:`today`,label:`Today`},{key:`yesterday`,label:`Yesterday`},{key:`last_7_days`,label:`Last 7 Days`},{key:`older`,label:`Older`}],Yfe=e=>{if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t},n5=e=>e.activity_at??e.last_user_message_at??e.created_at,Xfe=(e,t)=>{let n=n5(e),r=n5(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)},r5=e=>[...e].sort(Xfe),Zfe=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Qfe=(e,t=new Date)=>{let n=Yfe(n5(e));if(!n)return`older`;let r=Zfe(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`},i5=(e,t=new Date)=>{let n=new Map;for(let r of r5(e)){let e=Qfe(r,t);n.set(e,[...n.get(e)??[],r])}return Jfe.flatMap(e=>{let t=n.get(e.key)??[];return t.length===0?[]:[{key:e.key,label:e.label,sessions:t}]})},a5=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},o5=e=>e===`claude`?Wb.t(`chatView.tool.claude`):Wb.t(`chatView.tool.opencode`),s5=e=>new Map(e.map(e=>[e.id,e.label])),c5=({availableModelsById:e,model:t})=>t?e.get(t)??t:null,l5=({modelLabel:e,tool:t})=>e??o5(t),u5=()=>Wb.t(`chatView.user.you`),d5=`archon.chat-draft`,f5=({projectId:e,tool:t,chatSessionId:n})=>n?`${d5}:${e}:session:${n}`:`${d5}:${e}:draft:${t}`,p5=e=>{if(!e)return``;try{return window.localStorage.getItem(e)??``}catch{return``}},m5=({storageKey:e,value:t})=>{if(e)try{if(t){window.localStorage.setItem(e,t);return}window.localStorage.removeItem(e)}catch{}},h5=({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,g5=({session:e,activeProject:t,activeProjectBranchState:n})=>e.target_kind===`bundle`?e.target_label_snapshot||Wb.t(`common:chatView.targets.bundleFallback`):!t||t.active_target_kind===`bundle`||n?.status!==`ready`||!n.branch||!e.target_branch_snapshot||n.branch===e.target_branch_snapshot?null:Wb.t(`common:chatView.targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}),_5=e=>e.target_kind===`bundle`?e.target_label_snapshot||Wb.t(`common:chatView.targets.bundleFallback`):e.target_branch_snapshot?Wb.t(`common:chatView.targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}):Wb.t(`common:chatView.targets.repoRoot`),v5=({activeProject:e,activeProjectBranchState:t})=>e?e.active_target_kind===`bundle`?Wb.t(`common:chatView.targets.selectedBundleTarget`):t?.branch?Wb.t(`common:chatView.targets.repoRootWithBranch`,{branch:t.branch}):Wb.t(`common:chatView.targets.repoRoot`):Wb.t(`common:chatView.targets.currentTarget`),y5=(e,t)=>Wb.t(`chatView.${e}`,t),$fe=1500,epe=`archon.chat-run-config`,tpe=`archon.chat-changes-panel-layout`,npe=`archon.chat-session-list-layout`,b5=512,x5=360,rpe=.6,ipe=6,S5=`/`,ape=`Slash`,ope=`NumpadDivide`,spe=600,C5=4,w5=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):b5;if(!Number.isFinite(t))return Math.max(x5,n);let r=Math.max(x5,Math.round(t*rpe));return Math.max(x5,Math.min(r,n))},cpe=e=>y5(e===`plan`?`mode.plan`:`mode.build`),T5=e=>y5(e===`plan`?`placeholders.plan`:`placeholders.build`),E5=e=>y5(`pendingMemorySuggestions`,{count:e}),lpe=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===S5||e.code===ape||e.code===ope),D5=({modifierLabel:e,keys:t,ariaHidden:n=!1})=>(0,Y.jsxs)(`span`,{"aria-hidden":n,className:`flex items-center gap-0.5 text-[10px] leading-none`,children:[(0,Y.jsx)(eX,{"aria-hidden":n,children:e}),t.map(e=>(0,Y.jsxs)(`span`,{className:`contents`,children:[(0,Y.jsx)(`span`,{children:`+`}),(0,Y.jsx)(eX,{"aria-hidden":n,children:e})]},e))]}),upe=({label:e,modifierLabel:t,keys:n})=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{children:e}),(0,Y.jsx)(D5,{modifierLabel:t,keys:n,ariaHidden:!0})]}),O5=({projectId:e,tool:t})=>`${epe}:${e}:${t}`,k5=e=>`${tpe}:${e}`,A5=e=>`${npe}:${e}`,dpe=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t):[],j5=e=>{if(!e)return{isOpen:!0,width:b5};try{let t=window.localStorage.getItem(k5(e));if(!t)return{isOpen:!0,width:b5};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(x5,Math.round(n.width)):b5;return{isOpen:n.isOpen!==!1,width:r}}catch{return{isOpen:!0,width:b5}}},M5=e=>{if(!e)return{isOpen:!0};try{let t=window.localStorage.getItem(A5(e));return t?{isOpen:JSON.parse(t).isOpen!==!1}:{isOpen:!0}}catch{return{isOpen:!0}}},fpe=({projectId:e,isOpen:t,width:n})=>{if(e)try{window.localStorage.setItem(k5(e),JSON.stringify({isOpen:t,width:n}))}catch{}},ppe=({projectId:e,isOpen:t})=>{if(e)try{window.localStorage.setItem(A5(e),JSON.stringify({isOpen:t}))}catch{}},N5=({projectId:e,tool:t})=>{if(!e||t!==`opencode`&&t!==`claude`)return null;try{let n=window.localStorage.getItem(O5({projectId:e,tool:t}));if(!n)return null;let r=JSON.parse(n),i=(typeof r.model==`string`?r.model.trim():``)||null,a=r.mode===`plan`||r.mode===`build`?r.mode:null;return!i&&!a?null:{model:i,variant:i&&typeof r.variant==`string`&&r.variant.trim()||null,mode:a,skills:dpe(r.skills)}}catch{return null}},P5=({projectId:e,tool:t,model:n,variant:r,mode:i,skills:a})=>{if(!(!e||t!==`opencode`&&t!==`claude`||!n&&!i))try{window.localStorage.setItem(O5({projectId:e,tool:t}),JSON.stringify({model:n,variant:n?r:null,mode:i,skills:a}))}catch{}},mpe=({projectId:e,tool:t})=>{let n=N5({projectId:e,tool:t});!n||n.skills.length===0||P5({projectId:e,tool:t,...n,skills:[]})},F5=({projectId:e,tool:t})=>N5({projectId:e,tool:t})?.mode??`plan`,I5=({activeProjectId:e,helperModel:t,helperVariant:n,activeTool:r,availableModels:i,availableSkills:a})=>{let o=N5({projectId:e,tool:r}),s=t??``,c=o?.model??``,l=IF(c,i)?c:IF(s,i)?s:``,u=l===c?o?.variant??null:l&&l===s?n??null:null,d=i.find(e=>e.id===l)??null,f=d?d.variants.includes(u??``)?u??``:``:l?u??``:``,p=new Set(a.map(e=>e.name));return{model:l,variant:f,mode:o?.mode??`plan`,skills:r===`opencode`?(o?.skills??[]).filter(e=>p.has(e)):[]}},L5=e=>e&&e.replace(/\s+/g,` `).trim()||null,hpe=e=>{let t=L5(e.first_user_message_preview);if(t)return t;let n=e.messages?.find(e=>e.role===`user`)?.content;return L5(n)},gpe=({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}),_pe=({session:e,instruction:t,attachments:n,createdAt:r})=>({...e,messages:[...e.messages??[],gpe({chatSessionId:e.id,instruction:t,attachments:n,createdAt:r})],activity_at:r,last_user_message_at:r,updated_at:r}),vpe=e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),R5=e=>e.agent_status===`running`?y5(`sidebar.deleteDisabledReason`):null,ype=({proposals:e,isApplying:t,onApply:n})=>e.status===`applied`?(0,Y.jsxs)(`div`,{className:`w-full rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-3 text-sm`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-foreground`,children:y5(`ticketProposal.createdTitle`)}),(0,Y.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:y5(`ticketProposal.createdDescription`,{count:e.created_tickets.length})}),e.created_tickets.length>0?(0,Y.jsx)(`ul`,{className:`mt-3 space-y-1 text-foreground`,children:e.created_tickets.map(e=>(0,Y.jsx)(`li`,{children:e.title},e.ticket_id))}):null]}):(0,Y.jsxs)(`div`,{className:`w-full rounded-md border border-sky-500/30 bg-sky-500/10 px-3 py-3 text-sm`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-foreground`,children:y5(`ticketProposal.proposedTitle`)}),(0,Y.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:y5(`ticketProposal.proposedDescription`)}),(0,Y.jsx)(`ul`,{className:`mt-3 space-y-3`,children:e.tickets.map(e=>(0,Y.jsxs)(`li`,{className:`rounded border border-border/60 bg-background/80 px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-foreground`,children:e.title}),(0,Y.jsx)(`div`,{className:`mt-1 whitespace-pre-wrap text-muted-foreground`,children:e.description})]},e.key))}),e.dependencies.length>0?(0,Y.jsx)(`div`,{className:`mt-3 text-muted-foreground`,children:y5(`ticketProposal.dependenciesLabel`,{value:e.dependencies.map(e=>`${e.blocker_key} -> ${e.dependent_key}`).join(`, `)})}):null,(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsx)(Q,{type:`button`,size:`sm`,onClick:n,disabled:t,children:y5(t?`ticketProposal.creating`:`ticketProposal.create`)})})]}),bpe=({activeProjectId:e,activeProject:t,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c=async()=>!1,onSelectRepoRootTarget:l=async()=>!1,activeTool:u,routedChatSessionId:d,onRoutedChatNavigationUnavailable:f,onSessionNavigation:m,initialDraftOpen:h=!1,onInitialDraftOpenConsumed:g,initialSpecDraft:_=null,onInitialSpecDraftConsumed:v,onViewSourceSpec:y,onNavigateToLifecycleSource:b,onRestoreSessionTarget:x,onReviewCapabilityChange:S,isExternallyResizing:C=!1,showChangesPanel:w=!0})=>{let T=bq(),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(null),M=OF(A?.post_build_check),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[ee,te]=(0,p.useState)(()=>F5({projectId:e,tool:u})),[z,B]=(0,p.useState)({}),[V,H]=(0,p.useState)({}),[U,ne]=(0,p.useState)({}),[re,ie]=(0,p.useState)([]),[ae,oe]=(0,p.useState)(``),[W,se]=(0,p.useState)(``),[ce,le]=(0,p.useState)([]),[ue,de]=(0,p.useState)(!1),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)([]),[we,Te]=(0,p.useState)(()=>new Set),[Ee,De]=(0,p.useState)(!1),[Oe,ke]=(0,p.useState)(()=>new Set),[Ae,je]=(0,p.useState)(!1),[Me,Ne]=(0,p.useState)(!1),[Pe,Fe]=(0,p.useState)(null),[Ie,Le]=(0,p.useState)(null),[G,Re]=(0,p.useState)([]),[ze,Be]=(0,p.useState)(!1),[Ve,He]=(0,p.useState)(!1),[Ue,K]=(0,p.useState)(0),[We,Ge]=(0,p.useState)(t5),[q,Je]=(0,p.useState)(()=>M5(e).isOpen),[Ye,Ze]=(0,p.useState)(()=>j5(e).isOpen),[Qe,J]=(0,p.useState)(!1),[$e,et]=(0,p.useState)(!1),[tt,nt]=(0,p.useState)(()=>j5(e).width),[rt,it]=(0,p.useState)(0),[at,ot]=(0,p.useState)(null),[st,ct]=(0,p.useState)(()=>new Set),lt=(0,p.useRef)({model:``,variant:``,skills:[],showModelSelector:!1}),ut=(0,p.useRef)(!1),dt=(0,p.useRef)(L),ft=(0,p.useRef)(null),pt=(0,p.useRef)(null),mt=(0,p.useRef)(new Set),ht=(0,p.useRef)(0),gt=(0,p.useRef)(0),X=(0,p.useRef)(d),_t=(0,p.useRef)(!1),vt=(0,p.useRef)(null),yt=(0,p.useRef)(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)(!1),Tt=(0,p.useRef)(!1),Et=(0,p.useRef)(0),Dt=(0,p.useRef)(b5),Ot=(0,p.useRef)(b5),kt=(0,p.useRef)(!1),At=(0,p.useRef)(0),jt=(0,p.useRef)({id:null,status:null}),Mt=(0,p.useRef)(new Map),Nt=(0,p.useRef)({}),Pt=(0,p.useRef)({}),Ft=(0,p.useRef)(new Set),It=(0,p.useRef)(!1),Lt=e?f5({projectId:e,tool:F?u:A?.tool??u,chatSessionId:F?null:O}):null,Rt=Lt?z[Lt]??``:``,zt=F?u:A?.tool??u,Bt=A?V[A.id]??[]:[],Vt=(A?U[A.id]??0:0)>0,{models:Ht,isLoading:Ut}=pF(zt),Wt=(0,p.useCallback)(()=>{le([]),mpe({projectId:e,tool:u})},[e,u]);(0,p.useEffect)(()=>{ut.current=F},[F]),(0,p.useEffect)(()=>{Nt.current=z},[z]),(0,p.useEffect)(()=>{Pt.current=V},[V]),X.current=d,(0,p.useEffect)(()=>{if(!(d===void 0||!fe)){if(!d){ut.current||Wt(),P(null),xe(null),k(null),j(null),I(!0);return}if(!(E.some(e=>e.id===d)||A?.id===d)){k(null),j(null),I(!1),f?.();return}O!==d&&(P(null),xe(null),k(d),j(null),I(!1),kt.current=!0)}},[A?.id,O,fe,f,Wt,d,E]),(0,p.useEffect)(()=>{if(!Lt||Ft.current.has(Lt))return;Ft.current.add(Lt);let e=p5(Lt);e&&B(t=>Object.prototype.hasOwnProperty.call(t,Lt)?t:{...t,[Lt]:e})},[Lt]),(0,p.useEffect)(()=>{!Lt||!Object.prototype.hasOwnProperty.call(z,Lt)||m5({storageKey:Lt,value:z[Lt]??``})},[Lt,z]),(0,p.useEffect)(()=>{if(!F){ft.current=null;return}let e=ft.current;!e||!Lt||Rt||B(t=>t[Lt]?t:{...t,[Lt]:e})},[F,Lt,Rt]),(0,p.useEffect)(()=>{pt.current=O},[O]),(0,p.useEffect)(()=>{dt.current=L},[L]);let Gt=(0,p.useCallback)(()=>{gt.current+=1},[]),Kt=(0,p.useCallback)(e=>{Gt(),j(e)},[Gt]);(0,p.useEffect)(()=>{if(!It.current){It.current=!0;return}let t=j5(e),n=M5(e);ut.current=!1,kt.current=!1,Ft.current=new Set,mt.current.clear(),k(null),Kt(null),I(!1),B({}),H({}),ne({}),xe(null),Ce([]),Te(new Set),De(!1),ke(new Set),ot(null),Re([]),He(!1),pe(!1),Ge(t5()),ct(new Set),Mt.current=new Map,Ot.current=t.width,Je(n.isOpen),nt(t.width),Ze(t.isOpen)},[e,Kt]),(0,p.useEffect)(()=>{Qe||(Ot.current=tt,bt.current&&(bt.current.style.setProperty(`--chat-changes-panel-width`,`${tt}px`),bt.current.setAttribute(`data-desktop-width`,String(tt))))},[tt,Qe]),(0,p.useEffect)(()=>{if(!w||!vt.current)return;let e=vt.current.getBoundingClientRect().width;if(e<=0)return;let t=w5(tt,e);t!==tt&&(Ot.current=t,nt(t))},[tt,w]),(0,p.useEffect)(()=>{ppe({projectId:e,isOpen:q})},[e,q]),(0,p.useEffect)(()=>{w&&fpe({projectId:e,isOpen:Ye,width:tt})},[e,tt,Ye,w]),(0,p.useEffect)(()=>{He(!1)},[O,F]);let qt=(0,p.useCallback)(e=>{let t=a5(e);D(e=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return r5([...e,t]);let r=[...e];return r[n]=t,r5(r)})},[]),Jt=(0,p.useCallback)((t,n={})=>{let r=Array.from(new Set(t));if(r.length===0)return;let i=new Set(r),a=pt.current,o=n.preserveDraftRoute===!0,s=!!(o&&a&&i.has(a)&&X.current===a),c=!!(!o&&a&&i.has(a)),l=c?E.find(e=>!i.has(e.id))??null:null;s&&(Wt(),m?.(null)),c&&(l||Wt(),m?.(l?.id??null));let d=e?r.map(t=>f5({projectId:e,tool:u,chatSessionId:t})):[];B(e=>{let t=d.filter(t=>Object.prototype.hasOwnProperty.call(e,t));if(t.length===0)return e;let n={...e};for(let e of t)delete n[e];return n}),H(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e}),ne(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e});for(let e of d)m5({storageKey:e,value:``});D(e=>{let t=e.filter(e=>!i.has(e.id));if(a&&i.has(a)){if(X.current===a)return o?(k(null),Kt(null),I(!0),t):(k(null),Kt(null),I(l===null),Re([]),Be(!1),He(!1),t);let e=t[0]??null;k(e?.id??null),Kt(null),I(e===null),Re([]),Be(!1),He(!1)}return t}),ct(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),ot(e=>e&&i.has(e.parentId)?null:e),xe(e=>e&&i.has(e)?null:e),Ce(e=>e.filter(e=>!i.has(e))),Te(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),ke(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,u,m,Kt,Wt,E]),Yt=(0,p.useCallback)((e,t)=>{Jt([e],t)},[Jt]),Xt=(0,p.useCallback)((e,t)=>{e&&B(n=>n[e]===t?n:{...n,[e]:t})},[]),Zt=(0,p.useCallback)(e=>{e&&(B(t=>t[e]===``?t:{...t,[e]:``}),m5({storageKey:e,value:``}))},[]),Qt=(0,p.useCallback)((e,t)=>{H(n=>{if(t.length===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),$t=(0,p.useCallback)(e=>{H(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),ne(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),en=(0,p.useCallback)((e,t)=>{ne(n=>{let r=Math.max(0,(n[e]??0)+t);if(r===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:r}})},[]),tn=(0,p.useCallback)(({fromStorageKey:e,toStorageKey:t})=>{if(!e||!t||e===t)return;let n=Object.prototype.hasOwnProperty.call(Nt.current,e)?Nt.current[e]??``:p5(e);B(r=>{let i={...r,[t]:n};return delete i[e],i}),m5({storageKey:t,value:n}),m5({storageKey:e,value:``})},[]),nn=(0,p.useCallback)((e,t)=>{D(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n[r];if(i.pending_memory_suggestion_count===t)return n;let a=[...n];return a[r]={...i,pending_memory_suggestion_count:t},a}),j(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:(gt.current+=1,{...n,pending_memory_suggestion_count:t}))},[]),rn=(0,p.useCallback)(async r=>{if(!e){D([]),k(null),Kt(null),I(!1),pe(!1);return}de(!0);try{let i=await CM(e,r);if(r?.aborted)return;let a=r5(i.map(a5)),o=a[0]??null,s=t?.active_target_kind===`bundle`||n?.status!==`loading`;D(a),pe(!0),k(e=>d===void 0?ut.current?null:e&&a.some(t=>t.id===e)?e:e?a[0]?.id??null:kt.current?null:o?s?(kt.current=!0,h5({activeProject:t,activeProjectBranchState:n,session:o})?o.id:null):null:(kt.current=!0,null):e),a.length===0&&!d&&!ut.current&&(Wt(),I(!0))}catch(e){Xe(e)||$.error(e instanceof Error?e.message:y5(`errors.loadSessions`))}finally{r?.aborted||de(!1)}},[t,n,e,Wt,Kt,d]),an=(0,p.useCallback)(async(t,n)=>{if(!e){Kt(null);return}he(!0);let r=ht.current+1;ht.current=r;let i=gt.current;try{let a=await TM(e,t,n);if(n?.aborted)return;let o=gt.current!==i,s=ht.current===r,c=pt.current===t&&!ut.current;if(!s||o||!c)return;Kt(a),qt(a)}catch(e){e instanceof Ke&&e.status===404&&X.current===t&&pt.current===t?f?.():Xe(e)||$.error(e instanceof Error?e.message:y5(`errors.loadSession`))}finally{n?.aborted||he(!1)}},[e,f,Kt,qt]),on=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){Re([]),Be(!1);return}Be(!0);try{let t=await Ar(e,null,r,n);if(r?.aborted)return;Re(t.suggestions),nn(n,t.suggestions.length)}catch(e){Xe(e)||$.error(e instanceof Error?e.message:y5(`errors.loadMemorySuggestions`))}finally{r?.aborted||Be(!1)}},[t?.memory_enabled,e,nn]),sn=(0,p.useCallback)(e=>{Re(t=>{let n=t.filter(t=>t.id!==e);return O&&nn(O,n.length),n}),K(e=>e+1),rn(),O&&an(O)},[O,an,rn,nn]);(0,p.useEffect)(()=>{let e=new AbortController;return rn(e.signal),()=>{e.abort()}},[rn]),(0,p.useEffect)(()=>{if(d!==void 0||ut.current||F||O||kt.current||E.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;kt.current=!0;let e=E[0]??null;e&&h5({activeProject:t,activeProjectBranchState:n,session:e})&&k(e.id)},[t,n,O,F,d,E]),(0,p.useEffect)(()=>{if(zt!==`opencode`&&zt!==`claude`){ie([]),Ne(!1);return}if(zt!==`opencode`){ie([]);return}let t=new AbortController;return(async()=>{Ne(!0);try{ie(await mF(zt,t.signal,e))}catch(e){Xe(e)||ie(e=>e)}finally{t.signal.aborted||Ne(!1)}})(),()=>{t.abort()}},[e,zt]),(0,p.useEffect)(()=>{if(F||!O){Kt(null);return}if(A?.id===O)return;Kt(null);let e=new AbortController;return an(O,e.signal),()=>{e.abort()}},[A,O,F,an,Kt]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||F||!O){Re([]),Be(!1);return}let e=new AbortController;return on(O,e.signal),()=>{e.abort()}},[t?.memory_enabled,O,F,on,Ue]),(0,p.useEffect)(()=>{!Ve||ze||G.length>0||He(!1)},[ze,Ve,G.length]),(0,p.useEffect)(()=>{if(!O||A?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([rn(e.signal),an(O,e.signal)])},$fe);return()=>{e.abort(),window.clearInterval(t)}},[A?.agent_status,O,an,rn]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(t.id===O&&Kt(t),vpe(t)&&qt(t))},n=t=>{if(!t||t.project_id!==e)return;let n=mt.current.delete(t.id);Yt(t.id,n?{preserveDraftRoute:!0}:void 0)},r=()=>{rn();let e=pt.current;e&&!ut.current&&an(e)};return T.on(`connect`,r),T.on(`chat-session:created`,t),T.on(`chat-session:updated`,t),T.on(`chat-session:deleted`,n),()=>{T.off(`connect`,r),T.off(`chat-session:created`,t),T.off(`chat-session:updated`,t),T.off(`chat-session:deleted`,n)}},[e,O,an,rn,Yt,Kt,T,qt]),(0,p.useEffect)(()=>{F&&(dt.current||te(F5({projectId:e,tool:u})))},[e,u,F]),(0,p.useEffect)(()=>{if(zt!==`opencode`&&zt!==`claude`){oe(``),se(``),le([]);return}if(F){let n=I5({activeProjectId:e,helperModel:t?.helper_model??null,helperVariant:t?.helper_variant??null,activeTool:zt,availableModels:Ht,availableSkills:re});oe(n.model),se(n.variant),le(n.skills);return}oe(A?.model??``),se(A?.variant??``)},[e,t?.helper_model,t?.helper_variant,A?.id,A?.model,A?.variant,Ht,re,zt,F]),(0,p.useEffect)(()=>{if(zt!==`opencode`){le([]);return}F||le(A?.skills??[])},[A?.skills,zt,F]),(0,p.useEffect)(()=>{let e=Ht.find(e=>e.id===ae)??null;se(t=>e?e.variants.includes(t)?t:``:t)},[Ht,ae]),(0,p.useEffect)(()=>{if(zt!==`opencode`||!F||!ae||W)return;let n=I5({activeProjectId:e,helperModel:t?.helper_model??null,helperVariant:t?.helper_variant??null,activeTool:zt,availableModels:Ht,availableSkills:re});n.model===ae&&n.variant&&se(n.variant)},[e,t?.helper_model,t?.helper_variant,zt,Ht,re,F,ae,W]),(0,p.useEffect)(()=>{if(!be)return;let e=A?.id===be?A:E.find(e=>e.id===be)??null;(!e||e.agent_status!==`running`)&&xe(null)},[A,be,E]),(0,p.useEffect)(()=>{let e=jt.current,n=A?.id??null,r=A?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&K(e=>e+1),jt.current={id:n,status:r}},[t?.memory_enabled,e,A?.agent_status,A?.id,A?.title]),(0,p.useEffect)(()=>{O&&ct(e=>{if(!e.has(O))return e;let t=new Set(e);return t.delete(O),t})},[O]),(0,p.useEffect)(()=>{at&&(at.parentId===O&&(ve||A?.agent_status===`running`)||ot(null))},[A?.agent_status,O,ve,at]),(0,p.useEffect)(()=>{let e=Mt.current,t=new Map,n=[];for(let r of E){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&a===`done`&&r.id!==O&&n.push(r),t.set(r.id,a)}Mt.current=t,ct(e=>{let t=new Set(e),r=!1,i=new Set(E.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of E){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===O||i!==`done`)&&t.delete(e.id)){r=!0;continue}a&&!t.has(e.id)&&(t.add(e.id),r=!0)}return r?t:e})},[e,O,E]);let cn=(0,p.useMemo)(()=>s5(Ht),[Ht]),ln=(0,p.useMemo)(()=>i5(E),[E]),un=(0,p.useMemo)(()=>Se.length===0?[]:Se.flatMap(e=>{let t=E.find(t=>t.id===e)??(A?.id===e?A:null);return t?[t]:[]}),[A,Se,E]),dn=un.length===1?un[0]?.title??null:null;(0,p.useEffect)(()=>{Se.length>0&&un.length!==Se.length&&Ce(un.map(e=>e.id))},[Se,un]),(0,p.useEffect)(()=>{let e=new Set(E.filter(e=>!R5(e)&&!we.has(e.id)).map(e=>e.id));ke(t=>{let n=new Set(Array.from(t).filter(t=>e.has(t)));return n.size===t.size?t:n})},[we,E]),(0,p.useEffect)(()=>{!Ee||q||(De(!1),ke(new Set))},[q,Ee]);let fn=(0,p.useMemo)(()=>A?l5({modelLabel:c5({availableModelsById:cn,model:A.model}),tool:A.tool}):null,[A,cn]),pn=(0,p.useMemo)(()=>A?(A.messages??[]).map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],ticket_proposals:e.ticket_proposals??null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,responseTiming:e.response_timing?nq(e.response_timing):null,created_at:e.created_at,displayTitle:e.role===`assistant`?fn??o5(A.tool):u5()})):[],[A,fn]),mn=(0,p.useMemo)(()=>[...A?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[A]),hn=!!mn,gn=(0,p.useCallback)(async(t,n)=>{if(!e||!A||Ie)return;let r=$J({parentType:`chat`,parentId:A.id,setId:n.set_id});Le(n.set_id);try{let r=await kM(e,A.id,t,n);Kt(r),qt(r)}catch(e){if(e instanceof Ke&&e.status===409){tY(r);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?(Kt(t),qt(t)):await an(A.id)}throw $.error(e instanceof Error?e.message:y5(`errors.resolveQuestions`)),e}finally{Le(null)}},[e,A,an,Kt,Ie,qt]),_n=(0,p.useCallback)(e=>{let t=e.metadata?.ask_question;if(e.role!==`assistant`||!t||!A)return;let n=$J({parentType:`chat`,parentId:A.id,setId:t.id});return(0,Y.jsx)(cY,{messageContent:e.content,questionSet:t,storageKey:n,isActive:t.status===`pending`&&mn?.id===e.id,isDisabled:A.agent_status===`running`||Ie===t.id,onResolve:t=>gn(e.id,t)})},[A,mn?.id,gn,Ie]),vn=A?.id&&A.agent_status===`running`&&at?.parentId===A.id?at.turnKey:null,yn=(zt===`opencode`||zt===`claude`)&&Ht.length>0,bn=(zt===`opencode`||zt===`claude`)&&!yn&&(Me||Ut);(0,p.useEffect)(()=>{lt.current={model:ae,variant:W,skills:ce,showModelSelector:yn}},[ae,ce,W,yn]);let xn=(0,p.useMemo)(()=>Ht.find(e=>e.id===ae)??null,[Ht,ae]),Sn=F?ee:A?.mode??`build`,Cn=F?y5(`composer.newChatTitle`):A?.title??y5(`composer.chatTitle`),wn=F?u:A?.tool??u,Tn=(0,p.useMemo)(()=>iX(),[]),En=yn?ae||null:A?.model??null,Dn=wn===`opencode`||wn===`claude`,On=c5({availableModelsById:cn,model:En}),kn=F?`draft:${e??`none`}:${u}`:A?.id,An=(0,p.useCallback)(({model:t=ae,variant:n=W,skills:r=ce}={})=>{F&&P5({projectId:e,tool:u,model:yn&&t||null,variant:yn&&t&&n||null,mode:ee,skills:yn&&u===`opencode`?r:[]})},[e,u,ee,F,ae,ce,W,yn]),jn=(0,p.useCallback)(()=>{ut.current=!0,I(!0),Wt(),te(F5({projectId:e,tool:u})),P(null),k(null),Kt(null),xe(null),De(!1),ke(new Set),ot(null),R(null),ft.current=null,m?.(null)},[e,u,m,Kt,Wt]);(0,p.useEffect)(()=>{_&&(jn(),te(`build`),R({specSessionId:_.specSessionId,specSnapshotId:_.specSnapshotId}),ft.current=_.text,v?.())},[_,jn,v]),(0,p.useEffect)(()=>{h&&(jn(),g?.())},[h,jn,g]);let Mn=(0,p.useCallback)((e,t=null)=>{ut.current=!1,I(!1),P(null),k(e),Kt(t),R(null),m?.(e)},[m,Kt]),Nn=(0,p.useCallback)(async()=>{if(!(!A||!x)){P(A.id);try{await x(A)}catch(e){$.error(e instanceof Error?e.message:y5(`errors.restoreTarget`))}finally{P(e=>e===A.id?null:e)}}},[A,x]),Pn=!!(A&&A.target_available!==!1&&!F&&!h5({activeProject:t,activeProjectBranchState:n,session:A})),Fn=Pn&&A?y5(`review.mismatchReason`,{sessionTarget:_5(A),currentTarget:v5({activeProject:t,activeProjectBranchState:n})}):null,In=Pn&&N===null,Ln=(0,p.useCallback)(async r=>{P(r.id);let i=r;if(e)try{let t=await TM(e,r.id);i=t,qt(t)}catch(e){$.error(e instanceof Error?e.message:y5(`errors.loadSession`)),P(e=>e===r.id?null:e);return}if(i.target_available===!1){Mn(i.id,i);return}if(!h5({activeProject:t,activeProjectBranchState:n,session:i})&&x)try{if(!await x(i)){P(e=>e===i.id?null:e);return}}catch(e){$.error(e instanceof Error?e.message:y5(`errors.restoreTarget`)),P(e=>e===i.id?null:e);return}Mn(i.id,i)},[t,n,e,x,Mn,qt]),Rn=(0,p.useCallback)(()=>{it(e=>e+1)},[]),zn=(0,p.useCallback)(async t=>{if(F){let n=lt.current;return te(t),P5({projectId:e,tool:u,model:n.showModelSelector&&n.model||null,variant:n.showModelSelector&&n.model&&n.variant||null,mode:t,skills:n.showModelSelector?n.skills:[]}),Rn(),null}if(!e||!A||A.mode===t||Ae||hn)return null;je(!0);try{let n=await DM(e,A.id,{mode:t});return P5({projectId:e,tool:n.tool,model:n.model,variant:n.variant,mode:n.mode,skills:n.skills}),Kt(n),qt(n),Rn(),n}catch(e){return $.error(e instanceof Error?e.message:y5(`errors.updateMode`)),null}finally{je(!1)}},[e,A,u,Rn,hn,F,Ae,Kt,qt]),Bn=(0,p.useCallback)(async({instruction:t,attachments:n,targetSession:r,startedAt:i})=>{if(!e)return null;let a=lt.current;At.current+=1;let o={parentType:`chat`,parentId:r.id,turnKey:`${r.id}:${At.current}`,startedAt:i};ot(o);try{let i=await OM(e,r.id,{instruction:t,...n.length>0?{attachment_ids:n.map(e=>e.id)}:{},tool:r.tool,model:a.showModelSelector&&a.model||null,variant:a.showModelSelector&&a.model&&a.variant||null,skills:a.showModelSelector?a.skills:[]});return P5({projectId:e,tool:i.tool,model:i.model,variant:i.variant,mode:i.mode,skills:i.skills}),ut.current=!1,Kt(i),k(i.id),I(!1),qt(i),i}catch(e){throw ot(e=>e?.turnKey===o.turnKey?null:e),e}},[e,Kt,qt]),Vn=(0,p.useCallback)(async({fromStorageKey:t})=>{if(!e)return null;let n=lt.current,r=dt.current,i=await wM(e,{mode:Sn,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});ut.current=!1,I(!1),k(i.id),Kt(i),m?.(i.id),R(null);let a=f5({projectId:e,tool:i.tool,chatSessionId:i.id});return tn({fromStorageKey:t,toStorageKey:a}),{session:i,storageKey:a}},[e,u,Sn,tn,m,Kt]),Hn=(0,p.useCallback)(async(t,n={})=>{let r=n.targetSession??A,i=!r||r.messages?.length===0;if(!e||ve||ge||Vt||r?.agent_status===`running`||OF(r?.post_build_check)||r?.target_available===!1||In||hn)return!1;let a=t.trim(),o=n.preserveComposerDraft===!0,s=o?[]:r?Pt.current[r.id]??[]:[];if(!a&&s.length===0)return!1;ye(!0);let c=null,l=r,u=performance.now(),d=e&&r?f5({projectId:e,tool:r.tool,chatSessionId:r.id}):null,f=s;try{let t=r;if(!t){_e(!0);let e=await Vn({fromStorageKey:Lt});c=e?.session??null,t=c,d=e?.storageKey??null,f=c?Pt.current[c.id]??[]:[]}if(!t)return!1;o||Zt(d??Lt);let n=_pe({session:t,instruction:a,attachments:f,createdAt:new Date().toISOString()});Kt(n),k(n.id),qt(n);let s=await Bn({instruction:a,attachments:f,targetSession:t,startedAt:u});return s&&i&&P5({projectId:e,tool:s.tool,model:s.model,variant:s.variant,mode:s.mode,skills:[]}),o||Zt(s&&e?f5({projectId:e,tool:s.tool,chatSessionId:s.id}):d),s&&!o&&$t(s.id),!0}catch(e){o||Xt(d??Lt,a);let t=qe(e,`chat_session`);if(t?(ut.current=!1,Kt(t),k(t.id),I(!1),qt(t)):c?(Kt(c),k(c.id),I(!1),qt(c)):l&&(Kt(l),qt(l)),e instanceof Ke&&e.status===409&&!t){let e=c?.id??l?.id;e&&await an(e)}throw e}finally{_e(!1),ye(!1)}},[e,A,$t,Zt,Vn,Lt,hn,ge,ve,Vt,an,Kt,Bn,Xt,In,qt]),Un=(0,p.useCallback)(async()=>{if(!(!A||!rX(A,hn)||_t.current)){_t.current=!0;try{let e=await zn(`build`);if(!e)return;await Hn(nX,{preserveComposerDraft:!0,targetSession:e})}catch(e){$.error(e instanceof Error?e.message:y5(`errors.sendPrompt`))}finally{_t.current=!1}}},[A,zn,hn,Hn]),Wn=(0,p.useCallback)(e=>{ut.current=!0,I(!0),Wt(),te(e),P(null),k(null),Kt(null),xe(null),ot(null)},[Kt,Wt]),Gn=(0,p.useCallback)(async t=>{if(e){mt.current.add(t.id);try{await NM(e,t.id),Yt(t.id,{preserveDraftRoute:!0}),Wn(t.mode)}catch(e){throw mt.current.delete(t.id),e}}},[e,Wn,Yt]),Kn=(0,p.useCallback)(async t=>{if(!e||t.length===0||zt!==`opencode`&&zt!==`claude`)return;let n=t.slice(0,C5);if(n.length===0)return;let r=null,i=A;try{if(i||=(_e(!0),r=await Vn({fromStorageKey:Lt}),r?.session??null),!i)return;if((Pt.current[i.id]??[]).length+n.length>C5){$.error(`You can attach up to 4 images per turn.`);return}en(i.id,1);let t=await AM(e,i.id,n),a=Pt.current[i.id]??[];Qt(i.id,[...a,...t.attachments])}catch(e){if(r&&!Rt.trim())try{await Gn(r.session)}catch{}$.error(e instanceof Error?e.message:y5(`errors.uploadAttachments`))}finally{i&&en(i.id,-1),_e(!1)}},[e,A,Vn,Gn,Rt,Lt,en,Qt,zt]),qn=(0,p.useCallback)(async t=>{if(!e||!A)return;let n=(Pt.current[A.id]??[]).filter(e=>e.id!==t);try{await jM(e,A.id,t),Qt(A.id,n),n.length===0&&!Rt.trim()&&(A.messages?.length??0)===0&&await Gn(A)}catch(e){$.error(e instanceof Error?e.message:y5(`errors.removeAttachment`))}},[e,A,Gn,Rt,Qt]),Jn=(0,p.useCallback)(e=>{if(zt!==`opencode`&&zt!==`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(),Kn(t))},[zt,Kn]),Yn=(0,p.useCallback)(async e=>{await Hn(e)},[Hn]),Xn=!!(e&&(F||A&&A.target_available!==!1&&!In)),Zn=A?.agent_status===`running`,Qn=A?.agent_status===`stopped`,$n=Zn&&be===A?.id,er=Xn&&!hn&&!Zn&&!M&&!ve&&!ge&&!Vt,tr=Xn?A?.target_available===!1?A.target_unavailable_reason??y5(`review.unavailableTarget`):In?Fn??y5(`review.restoreTargetFallback`):hn?Wb.t(`common:questionSet.waitForResolution`):Zn?y5(`review.waitTurn`):M?Wb.t(`common:postBuildChecks.blockedReason`):Vt?y5(`review.waitUpload`):ge||ve?y5(`review.waitPrompt`):null:y5(`review.missingTarget`),nr=(0,p.useCallback)(async()=>{if(!(!e||!A||A.agent_status!==`running`||$n)){xe(A.id);try{await MM(e,A.id)}catch(e){xe(e=>e===A.id?null:e),$.error(e instanceof Error?e.message:y5(`errors.interruptResponse`))}}},[e,A,$n]),rr=(0,p.useCallback)(async()=>{if(!e||Se.length===0||we.size>0)return;let t=Array.from(new Set(Se)),n=Ee||t.length>1;Te(new Set(t));let r=await Promise.allSettled(t.map(async t=>(await NM(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&&Jt(i),Te(new Set),a.length===0){Ce([]),n&&(De(!1),ke(new Set),$.success(y5(`toasts.deleteSelectedSuccess`,{count:i.length})));return}let o=a.map(e=>e.sessionId);if(Ce(o),n&&ke(new Set(o)),i.length>0){$.error(y5(`toasts.deleteSelectedPartial`,{count:i.length,deletedCount:i.length,failedCount:a.length}));return}$.error(a[0]?.message??y5(`errors.deleteSession`))},[e,Se,we,Ee,Jt]),ir=(0,p.useMemo)(()=>E.some(e=>!R5(e)),[E]),ar=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:e.agent_status===`stopped`?`interrupted`:!t&&st.has(e.id)?`finished`:null,[st]),or=(0,p.useCallback)((e,n)=>[e.title,cpe(e.mode),o5(e.tool),t?.memory_enabled&&e.pending_memory_suggestion_count>0?E5(e.pending_memory_suggestion_count):null,n===`running`?y5(`sidebar.running`):n===`interrupted`?y5(`sidebar.interrupted`):n===`finished`?y5(`sidebar.finished`):null].filter(Boolean).join(` `),[t]),sr=(0,p.useCallback)(({session:e,isActive:r,activityState:i})=>{let a=hpe(e),o=g5({session:e,activeProject:t,activeProjectBranchState:n}),s=i===`interrupted`?null:i;return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o?(0,Y.jsx)(`div`,{className:`mb-1 truncate text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground/75`,children:o}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[13px] font-medium leading-5`,children:e.title}),t?.memory_enabled&&e.pending_memory_suggestion_count>0?(0,Y.jsx)(oT,{tone:r?`default`:`muted`,className:`shrink-0`,"aria-label":E5(e.pending_memory_suggestion_count),title:E5(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null]}),a?(0,Y.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,Y.jsx)(`div`,{className:`mt-1 line-clamp-1 text-[11px] leading-4 text-amber-200/90`,children:e.target_unavailable_reason??y5(`sidebar.targetUnavailable`)}):null]}),(0,Y.jsx)(tb,{state:s,className:`mt-1`})]})},[t,n]),cr=(0,p.useMemo)(()=>({ariaLabel:y5(`sidebar.ariaLabel`),newSession:y5(`sidebar.newSession`),collapseAriaLabel:y5(`sidebar.collapseAriaLabel`),openAriaLabel:y5(`sidebar.openAriaLabel`),cancelSelection:y5(`sidebar.cancelSelection`),deleteSelected:y5(`sidebar.deleteSelected`),selectedCount:e=>y5(`sidebar.selectedCount`,{count:e}),select:y5(`sidebar.select`),loadingSessions:y5(`sidebar.loadingSessions`),noSessions:y5(`sidebar.noSessions`),deleteSessionAriaLabel:y5(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>y5(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>y5(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>y5(`sidebar.deleteSessionTitle`,{title:e})}),[]),lr=(0,p.useMemo)(()=>({title:y5(`deleteSessionModal.title`),bulkTitle:y5(`deleteSessionModal.bulkTitle`),description:y5(`deleteSessionModal.description`),bulkDescription:e=>y5(`deleteSessionModal.bulkDescription`,{count:e}),cancel:y5(`deleteSessionModal.cancel`),delete:y5(`deleteSessionModal.delete`),deleting:y5(`deleteSessionModal.deleting`)}),[]),ur=(0,p.useMemo)(()=>(0,Y.jsx)(D5,{modifierLabel:Tn,keys:[S5],ariaHidden:!0}),[Tn]),dr=(0,p.useMemo)(()=>(0,Y.jsx)(upe,{label:y5(`shortcuts.startNewSession`),modifierLabel:Tn,keys:[S5]}),[Tn]),fr=(0,p.useCallback)((e,t)=>{ke(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),pr=(0,p.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)($Y,{value:Sn,planInactiveTooltip:(0,Y.jsx)(lX,{label:y5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,Y.jsx)(lX,{label:y5(`shortcuts.switchToBuild`)}),disabled:Ae||hn,onChange:e=>{zn(e)}}),Zn?(0,Y.jsx)(V8,{isInterrupting:$n,onStop:()=>{nr()},interruptLabel:y5(`review.interrupt`),interruptingLabel:y5(`review.interrupting`)}):null]}),[Sn,nr,zn,hn,$n,Zn,Ae]),mr=(0,p.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)($Y,{value:Sn,planInactiveTooltip:(0,Y.jsx)(lX,{label:y5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,Y.jsx)(lX,{label:y5(`shortcuts.switchToBuild`)}),disabled:Ae||hn,onChange:e=>{zn(e)}}),A&&rX(A,hn)&&(0,Y.jsx)(Q8,{disabled:ve||Ae,onClick:()=>void Un()}),F&&t&&(0,Y.jsx)(Jy,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:Wb.t(`common:projectTargetSelector.newChatAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l}),Zn&&(0,Y.jsx)(V8,{isInterrupting:$n,onStop:()=>{nr()},interruptLabel:y5(`review.interrupt`),interruptingLabel:y5(`review.interrupting`)})]}),[t,n,A,Sn,nr,zn,Un,hn,F,$n,ve,Zn,a,o,Ae,c,l,s,i,r]),hr=(0,p.useMemo)(()=>yn?(0,Y.jsx)(OY,{model:ae,variant:W,skills:ce,showModelSelector:!0,showSkillsSelector:re.length>0,availableModels:Ht,availableSkills:re,selectedModel:xn,onModelChange:e=>{let t=Ht.find(t=>t.id===e)??null,n=t&&t.variants.includes(W)?W:``;oe(e),se(n),An({model:e,variant:n})},onVariantChange:e=>{se(e),An({variant:e})},onSkillsChange:e=>{le(e),An({skills:e})},modelSelectId:`project-chat-model-selector`,variantSelectId:`project-chat-variant-selector`,skillsSelectId:`project-chat-skills-selector`,disabled:ve||ge||A?.agent_status===`running`}):bn?(0,Y.jsx)(DY,{dataTestId:`chat-model-selector-skeleton`}):null,[A?.agent_status,Ht,re,ge,ve,An,xn,ae,ce,W,yn,bn]);(0,p.useEffect)(()=>{if(S)return()=>{S(null)}},[S]),(0,p.useEffect)(()=>{if(S){if(!e||!Xn){S(null);return}S({chatSessionId:A?.id??null,canSubmitReviewPrompt:er,reviewSubmitDisabledReason:tr,mode:Sn,onModeChange:async e=>{await zn(e)},isUpdatingMode:Ae,promptPlaceholder:T5(Sn),promptComposerControls:pr,promptComposerInlineControls:hr,submitPrompt:Yn})}},[e,A,er,Sn,zn,Yn,Xn,Ae,S,pr,hr,tr]);let gr=async()=>{if(!(!Rt.trim()&&Bt.length===0||Vt||hn||M))try{if(!await Hn(Rt))return}catch(e){$.error(e instanceof Error?e.message:y5(`errors.sendPrompt`))}},_r=e=>{e.key!==`Enter`||e.shiftKey||A?.agent_status===`running`||M||ge||ve||Vt||hn||(e.preventDefault(),gr())};(0,p.useEffect)(()=>{let t=t=>{if(lpe(t)){if(!e||ge||ve)return;t.preventDefault(),jn(),Rn();return}oX(t)&&(!e||!F&&!A||(t.preventDefault(),zn(aX(Sn))))};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,A,Sn,Rn,jn,zn,ge,F,ve]);let vr=(0,p.useCallback)(async t=>{if(!(!e||!A)){Fe(t);try{let n=await IM(e,A.id,t);Kt(n.chatSession),qt(n.chatSession),$.success(y5(`ticketProposal.createdFromChat`,{count:n.created_tickets.length}))}catch(e){$.error(e instanceof Error?e.message:y5(`errors.createTickets`))}finally{Fe(e=>e===t?null:e)}}},[e,A,Kt,qt]),yr=(0,p.useCallback)(e=>e.ticket_proposals?(0,Y.jsx)(ype,{proposals:e.ticket_proposals,isApplying:Pe===e.id,onApply:()=>{vr(e.id)}}):null,[Pe,vr]),br=(0,p.useCallback)(e=>{if(!vt.current)return;let t=vt.current.getBoundingClientRect().width,n=w5(e,t);Ot.current=n,bt.current&&(bt.current.style.setProperty(`--chat-changes-panel-width`,`${n}px`),bt.current.setAttribute(`data-desktop-width`,String(n)))},[]),xr=(0,p.useCallback)(()=>{Ct.current?.(),Ct.current=null},[]),Sr=(0,p.useCallback)(e=>{let t=xt.current,n=St.current,r=wt.current;if(t!==null){if(xt.current=null,St.current=null,wt.current=!1,J(!1),et(!1),xr(),e!==null&&typeof yt.current?.hasPointerCapture==`function`&&yt.current.hasPointerCapture(e)&&typeof yt.current.releasePointerCapture==`function`&&yt.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;nt(Ot.current),Ze(!0);return}nt(Ot.current)}},[xr]),Cr=(0,p.useCallback)((e,t)=>{if(xt.current!==e)return;let n=t-Et.current,r=Dt.current-n;if(St.current===`collapsed`){if(!wt.current&&r<ipe)return;wt.current||(wt.current=!0,Tt.current=!0,et(!0),J(!0))}br(r)},[br]),wr=(0,p.useCallback)((e,t)=>{if(xt.current===e){if(t!==null&&(St.current===`inline`||wt.current)){let e=t-Et.current;br(Dt.current-e)}Sr(e)}},[Sr,br]),Tr=(0,p.useCallback)(e=>{if(!w)return;e.preventDefault(),xt.current=e.pointerId,St.current=Ye?`inline`:`collapsed`,wt.current=!1,Tt.current=!1,Et.current=e.clientX,Dt.current=Ye?Ot.current:0,J(Ye),xr(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{Cr(e.pointerId,e.clientX)},n=e=>{wr(e.pointerId,e.clientX)},r=e=>{wr(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Ct.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[wr,Cr,Ye,w,xr]),Er=(0,p.useCallback)(e=>{Cr(e.pointerId,e.clientX)},[Cr]),Dr=(0,p.useCallback)(e=>{wr(e.pointerId,e.clientX)},[wr]),Or=(0,p.useCallback)(e=>{wr(e.pointerId,e.clientX)},[wr]),kr=(0,p.useCallback)(e=>{xt.current===e.pointerId&&Sr(e.pointerId)},[Sr]),jr=(0,p.useCallback)(()=>{if(Tt.current){Tt.current=!1;return}Ze(!0)},[]),Mr=(0,p.useCallback)(()=>{Ze(!1)},[]),Nr=(0,p.useCallback)(e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),jr())},[jr]);(0,p.useEffect)(()=>{w||(xt.current=null,St.current=null,wt.current=!1,Tt.current=!1,J(!1),et(!1),xr())},[w,xr]),(0,p.useEffect)(()=>()=>{xr()},[xr]);let Pr=!!O,Fr=A?.target_available===!1,Ir=Fr?A?.target_unavailable_reason??y5(`review.unavailableTarget`):null,Lr=F||!!(A&&A.target_available!==!1&&!In),Rr=!!(t?.memory_enabled&&A&&(G.length>0||ze)),zr=w&&(F||Pr)&&!Fr&&!In,Br=zr&&!Ye&&!$e,Vr=zr&&(Ye||$e),Hr=`${kn??`none`}:${zr?`changes-enabled`:`changes-disabled`}:${Vr?`panel-visible`:`panel-hidden`}`,Ur=(0,p.useCallback)(e=>{ft.current=null,Xt(Lt,e)},[Lt,Xt]),Wr=A||F?(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(Z8,{projectId:e,agentRunParentType:A?`chat`:null,agentRunParentId:A?.id??null,messages:A?pn:[],internalLog:A?.agent_log??null,currentThinkingMessageId:A?.agent_message_id??null,previousThinkingLog:A?.previous_agent_log??null,previousThinkingMessageId:A?.previous_agent_message_id??null,pendingAgentTitle:fn,streamingResponse:A?.streaming_response??null,isRunning:A?.agent_status===`running`,isLoading:!F&&me,canShowComposer:Lr,cardClassName:`border-t-0`,isExternallyResizing:C||Qe,pendingAgentRevealKey:vn,pendingAgentRevealDelayMs:spe,liveResponseTiming:at,composerFocusNonce:rt,header:(0,Y.jsx)($8,{title:Cn,tool:F?null:A?.tool??null,modelLabel:On,interrupted:Qn,interruptedLabel:y5(`sidebar.interrupted`),usage:{totalTokens:A?.usage_snapshot_total_tokens??null,contextWindow:A?.usage_snapshot_context_window??null,cost:A?.usage_snapshot_cost??null,tool:wn,model:En,availableModels:Ht},metadataExtra:(0,Y.jsxs)(Y.Fragment,{children:[A?.external_source?(0,Y.jsx)(ZF,{externalSource:A.external_source}):null,A?.origin_spec_session_id&&A.origin_spec_snapshot_id&&y?(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`ghost`,className:`h-6 px-2 text-[11px] text-violet-200 hover:text-violet-100`,onClick:()=>{y(A.origin_spec_session_id,A.origin_spec_snapshot_id)},children:Wb.t(`common:specView.provenance.viewSourceSpec`)}):null]}),actions:A&&e?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Rr&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>He(!0),children:ze?y5(`composer.loadingMemory`):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:y5(`composer.memorySuggestions`)}),(0,Y.jsx)(oT,{children:G.length})]})}),(0,Y.jsx)(r3,{projectId:e,scope:{type:`chat`,id:A.id},size:`xs`,onNavigateToLifecycleSource:b})]}):null,warnings:In&&Fn?(0,Y.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,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`div`,{children:Fn}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{Nn()},children:y5(`composer.switchBack`)}),(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:jn,children:y5(`composer.startNewSession`)})]})]})}):Fr&&Ir?(0,Y.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:Ir}):null}),composerControls:mr,composerInlineControls:hr,composerTheme:Sn,layoutKey:kn,scrollLayoutKey:Hr,followUpPrompt:Rt,draftAttachments:Bt,followUpPlaceholder:T5(Sn),emptyStateText:null,renderMessageFooter:yr,renderMessageBody:_n,isSendingFollowUp:ve||ge,isComposerSubmitDisabled:hn||M,postBuildCheck:A?.post_build_check,isUploadingAttachments:Vt,canAttachImages:Dn,followUpDisabledReason:Fr?Ir??void 0:A?.agent_status===`running`?y5(`review.waitTurnShort`):M?Wb.t(`common:postBuildChecks.blockedReason`):Vt?y5(`review.waitUpload`):hn?Wb.t(`common:questionSet.waitForResolution`):void 0,onFollowUpPromptChange:Ur,onFollowUpKeyDown:_r,onFollowUpPaste:Jn,onUploadAttachments:e=>{Kn(e)},onRemoveAttachment:e=>{qn(e)},onFollowUpSubmit:()=>{gr()}})}):Pr?(0,Y.jsx)(L8,{label:y5(`composer.loadingSession`)}):!fe||ue?(0,Y.jsx)(R8,{label:y5(`sidebar.loadingSessions`)}):(0,Y.jsx)(z8,{title:y5(`composer.noSessionSelectedTitle`),description:y5(`composer.noSessionSelectedDescription`),startNewSessionLabel:y5(`composer.startNewSession`),onStartNewSession:jn,canStartNewSession:!!e&&!ge&&!ve}),Gr=zr?(0,Y.jsx)(`div`,{ref:yt,"aria-label":y5(Br?`composer.openDiff`:`composer.resizeDiffPanel`),"aria-orientation":Br?void 0:`vertical`,className:Z(Br?`group flex h-8 w-full shrink-0 touch-none select-none items-center justify-center border-t border-border/70 bg-background/90 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground xl:h-auto xl:w-7 xl:cursor-col-resize xl:border-l xl:border-t-0`:`group hidden w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 transition-colors xl:flex`,Qe&&!Br&&`bg-background`),"data-testid":Br?`collapsed-changes-rail`:void 0,onLostPointerCapture:kr,onPointerCancel:Or,onPointerDown:Tr,onPointerMove:Er,onPointerUp:Dr,onClick:Br?jr:void 0,onKeyDown:Br?Nr:void 0,role:Br?`button`:`separator`,tabIndex:Br?0:void 0,children:Br?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`hidden h-full w-full items-center justify-center xl:flex`,children:(0,Y.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,Y.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,Y.jsx)(Mv,{className:`h-3 w-3 shrink-0`})}),(0,Y.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,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium xl:hidden`,children:[(0,Y.jsx)(Mv,{className:`h-3.5 w-3.5`}),(0,Y.jsx)(`span`,{children:y5(`composer.diff`)})]})]}):(0,Y.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,Qe?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})}):null,Kr=Ve&&e&&t?.memory_enabled?(0,Y.jsx)(gC,{onClose:()=>He(!1),overlayClassName:`bg-background/45 p-4 backdrop-blur-sm`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,Y.jsxs)(xC,{size:`sm`,className:`max-h-[calc(100vh-2rem)] w-full gap-0 overflow-hidden border-border/80 bg-card/95 shadow-2xl`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/80 pb-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(CC,{children:y5(`composer.memorySuggestionsTitle`)}),(0,Y.jsx)(wC,{children:y5(`composer.memorySuggestionsDescription`)})]}),(0,Y.jsx)(TC,{children:t})]}),(0,Y.jsx)(EC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,Y.jsx)(e5,{projectId:e,suggestions:G,emptyState:y5(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:sn})})]}),closeButtonLabel:y5(`composer.closeMemorySuggestions`)}):null,qr=un.length>0?(0,Y.jsx)(I8,{count:un.length,title:dn,isDeleting:we.size>0,onConfirm:()=>{rr()},onCancel:()=>{we.size>0||Ce([])},labels:lr}):null;return(0,Y.jsxs)(`div`,{"data-testid":`chat-view-shell`,className:`relative flex min-h-0 flex-1 overflow-hidden border-t border-border/70`,children:[(0,Y.jsx)(B8,{sessions:E,sessionGroups:ln,activeSessionId:O,isDraftOpen:F,isLoadingSessions:ue,isOpen:q,onToggleOpen:()=>{Je(e=>!e)},testId:`chat-sessions-sidebar`,railTestId:`chat-sessions-rail`,onDraftOpen:jn,isCreatingSession:ge||!e,isSendingPrompt:ve,newSessionShortcutHint:ur,newSessionTooltip:dr,isSelectionMode:Ee,selectedSessionIds:Oe,selectedSessionCount:Oe.size,hasDeletableSessions:ir,deletingSessionIds:we,onEnterSelectionMode:()=>{De(!0),ke(new Set)},onExitSelectionMode:()=>{De(!1),ke(new Set)},onToggleSessionSelection:e=>{ke(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:fr,onConfirmDeleteSelectedSessions:()=>{Ce(Array.from(Oe))},onSessionSelect:e=>{Ln(e)},onConfirmDeleteSession:e=>{Ce([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:R5,getActivityState:ar,getRowAriaLabel:or,renderRowContent:sr,labels:cr}),(0,Y.jsxs)(`div`,{ref:vt,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden xl:flex-row`,children:[(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:Wr}),zr?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(vv,{content:y5(`composer.openDiff`),disabled:!Br,side:`left`,children:Gr}),Vr?(0,Y.jsx)(X8,{projectId:e,chatSessionId:F?null:O,canSubmitReviewPrompt:er,reviewSubmitDisabledReason:tr,onSubmitReviewPrompt:Yn,state:We,onStateChange:Ge,isResizing:Qe,onClose:Mr,desktopWidth:tt,panelElementRef:bt}):null]}):null]}),Kr,qr]})},xpe=({className:e})=>(0,Y.jsx)(ite,{"aria-hidden":`true`,className:e}),Spe=({activeProject:e,onNavigateToSource:t})=>{let{t:n}=K(`projects`);return e?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-6`,children:(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col gap-5`,children:[(0,Y.jsx)(`div`,{className:`border-b border-border/60 pb-4`,children:(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground`,children:n(`memory.workspace.title`)}),(0,Y.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:e.name})]})}),(0,Y.jsx)(UT,{mode:`edit`,projectId:e.id,memoryEnabled:e.memory_enabled,persistedMemoryEnabled:e.memory_enabled,onMemoryEnabledChange:()=>{},showActivationControls:!1,archiveLayout:!0,onNavigateToSource:t})]})}):(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:n(`memory.workspace.selectProject`)})},Cpe=(e,t,n,r)=>J(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{method:`POST`,body:r,fallbackErrorMessage:`Unable to start the spec review right now.`}),wpe=(e,t,n)=>J(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the spec review right now.`}),z5=(e,t,n,r)=>J(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{signal:r,fallbackErrorMessage:`Unable to load the spec review right now.`}),Tpe=(e,t,n,r)=>J(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review-runs/${r}/revision-draft`),{method:`POST`,fallbackErrorMessage:`Unable to build the revision draft right now.`}),Epe=(e,t)=>!!t&&e===t,Dpe=({suggestion:e,isRecommended:t,recommendedLabel:n,onPick:r})=>(0,Y.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,Y.jsx)(`span`,{className:`truncate`,children:e.label}),t?(0,Y.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]}),Ope=({question:e,labels:t})=>(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm font-medium leading-relaxed text-foreground`,children:e.question}),e.rationale?(0,Y.jsxs)(`p`,{className:`whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-semibold`,children:[t.rationaleLabel,`: `]}),e.rationale]}):null]}),B5=({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&&DE(s.current)},[a]),!t)return(0,Y.jsx)(Ope,{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,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(cb,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-amber-300`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm font-medium leading-relaxed text-foreground`,children:e.question}),e.rationale?(0,Y.jsxs)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-semibold`,children:[i.rationaleLabel,`: `]}),e.rationale]}):null]})]}),e.suggestions.length>0?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:i.suggestionsLabel}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.suggestions.map(e=>(0,Y.jsx)(Dpe,{suggestion:e,isRecommended:Epe(e.id,l),recommendedLabel:i.recommendedSuggestionLabel,onPick:u},e.id))})]}):null,(0,Y.jsx)(I_,{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,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,disabled:!c,onClick:d,children:n?i.submittingLabel:i.submitLabel})})]})},kpe=({className:e})=>(0,Y.jsx)(Vee,{"aria-hidden":`true`,className:e}),Ape=[`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(` `),jpe=[`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(` `),V5=({on:e,disabled:t=!1,onToggle:n,tooltipContent:r,ariaLabelOn:i,ariaLabelOff:a,className:o})=>(0,Y.jsx)(vv,{content:r,children:(0,Y.jsx)(`span`,{className:`inline-flex`,children:(0,Y.jsx)(Q,{type:`button`,size:`icon`,variant:e?`warning`:`ghost`,"aria-pressed":e,"aria-label":e?i:a,disabled:t,className:Z(e?Ape:jpe,o),onClick:()=>{t||n(!e)},children:(0,Y.jsx)(kpe,{className:`h-5 w-5`})})})}),Mpe=({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:ee,onFollowUpPaste:te,onUploadAttachments:z,onRemoveAttachment:B,onFollowUpSubmit:V})=>(0,Y.jsx)(XJ,{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:ee,onFollowUpPaste:te,onUploadAttachments:z,onRemoveAttachment:B,onFollowUpSubmit:V}),H5=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},U5=new Set([`deterministic`,`structural_heuristic`,`historical_heuristic`]),W5=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Npe=e=>W5(e)&&typeof e.seed_path==`string`&&typeof e.candidate_path==`string`&&U5.has(e.evidence_class)&&typeof e.depth==`number`&&Array.isArray(e.edge_ids),G5=e=>W5(e)&&typeof e.path==`string`&&typeof e.is_test==`boolean`&&U5.has(e.evidence_class)&&Array.isArray(e.chains)&&e.chains.length>0&&e.chains.every(Npe),Ppe=e=>!W5(e)||e.version!==1||![`complete`,`stale`,`truncated`,`unavailable`].includes(e.capture_state)||!Array.isArray(e.affected_files)||!Array.isArray(e.affected_tests)||!e.affected_files.every(G5)||!e.affected_tests.every(G5)?null:e,Fpe=e=>e.likely_files.length>0,K5=({evidenceClass:e})=>{let{t}=K(`common`);return(0,Y.jsx)(bC,{variant:`outline`,className:`shrink-0 px-1.5 py-0 text-[10px] ${e===`deterministic`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e===`structural_heuristic`?`border-amber-400/30 bg-amber-500/10 text-amber-200`:`border-sky-400/30 bg-sky-500/10 text-sky-200`}`,children:t(`specView.artifactPanel.repositoryEvidence.class.${e}`)})},Ipe=({candidate:e})=>{let{t}=K(`common`),n=e.chains.slice(0,2);return(0,Y.jsxs)(`details`,{className:`group mt-2 border-t border-border/40 pt-2`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer list-none rounded-sm text-xs font-medium text-violet-300 outline-none hover:text-violet-200 focus-visible:ring-2 focus-visible:ring-ring/60 [&::-webkit-details-marker]:hidden`,children:t(`specView.artifactPanel.repositoryEvidence.showChains`,{count:n.length})}),(0,Y.jsx)(`ol`,{className:`mt-2 space-y-2`,children:n.map((e,n)=>(0,Y.jsxs)(`li`,{className:`min-w-0 rounded-md bg-background/35 px-2.5 py-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-foreground`,children:t(`specView.artifactPanel.repositoryEvidence.chainLabel`,{number:n+1})}),(0,Y.jsx)(K5,{evidenceClass:e.evidence_class})]}),(0,Y.jsx)(`p`,{className:`mt-1 break-words text-xs leading-relaxed text-muted-foreground`,children:t(`specView.artifactPanel.repositoryEvidence.chainSummary`,{seed:e.seed_path,candidate:e.candidate_path,count:e.depth})})]},`${e.seed_path}:${e.candidate_path}:${e.edge_ids.join(`:`)}`))})]})},Lpe=({row:e,affectedTest:t=!1})=>{let{t:n}=K(`common`);return(0,Y.jsxs)(`li`,{className:`min-w-0 overflow-hidden rounded-md border border-border/50 bg-surface-hover px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`code`,{className:`min-w-0 break-all text-xs font-medium text-foreground`,children:e.path}),e.isNew&&(0,Y.jsx)(bC,{variant:`success`,className:`shrink-0 px-1.5 py-0 text-[10px]`,children:n(`specView.artifactPanel.newFile`)})]}),(0,Y.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:n(`specView.artifactPanel.repositoryEvidence.origin.${e.origin}`)}),t&&(0,Y.jsx)(bC,{variant:`outline`,className:`px-1.5 py-0 text-[10px] text-violet-200`,children:n(`specView.artifactPanel.repositoryEvidence.affectedTest`)}),e.candidate&&(0,Y.jsx)(K5,{evidenceClass:e.candidate.evidence_class})]}),e.reason&&(0,Y.jsx)(`p`,{className:`mt-1 break-words text-xs leading-relaxed text-muted-foreground`,children:e.reason}),e.candidate&&(0,Y.jsx)(Ipe,{candidate:e.candidate})]})},q5=e=>e.replace(/\\/g,`/`),Rpe=({snapshot:e,onMermaidClick:t})=>{let{t:n}=K(`common`);Ppe(e.repository_evidence);let r=[],i=[],a=new Map(i.map(e=>[q5(e.path),e])),o=e.likely_files.filter(e=>e.origin!==`graph`),s=new Map(o.map(e=>[e.normalized_path??q5(e.path),e])),c=o.flatMap(e=>{let t=e.normalized_path??q5(e.path);return a.has(t)?[]:[{path:e.path,reason:e.reason||null,isNew:e.is_new,origin:e.origin??`planner`,candidate:null}]}),l=r.map(e=>{let t=s.get(q5(e.path));return{path:t?.path??e.path,reason:null,isNew:!1,origin:t?`both`:`graph`,candidate:e}}),u=new Set(r.map(e=>q5(e.path)));for(let t of e.likely_files.filter(e=>e.origin===`graph`)){let e=t.normalized_path??q5(t.path);u.has(e)||l.push({path:t.path,reason:t.reason||null,isNew:t.is_new,origin:`graph`,candidate:null})}return i.map(e=>{let t=s.get(q5(e.path));return{path:t?.path??e.path,reason:t?.reason??null,isNew:t?.is_new??!1,origin:t?`both`:`graph`,candidate:e}}),(0,Y.jsxs)(`section`,{children:[c.length>0&&(0,Y.jsx)(`ul`,{className:`space-y-1.5`,children:c.map(e=>(0,Y.jsx)(Lpe,{row:e},`${e.origin}:${e.path}`))}),!1,!1]})},J5=({className:e})=>(0,Y.jsx)(Rg,{"aria-hidden":`true`,className:e}),zpe=({className:e})=>(0,Y.jsx)(Ng,{"aria-hidden":`true`,className:e}),Y5=({className:e})=>(0,Y.jsx)(Pee,{"aria-hidden":`true`,className:e}),X5=({heading:e,open:t,onOpenChange:n,children:r})=>(0,Y.jsxs)(iw,{open:t,onOpenChange:n,children:[(0,Y.jsx)(aw,{asChild:!0,children:(0,Y.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,Y.jsx)(Cv,{className:`h-3 w-3 shrink-0 transition-transform ${t?``:`-rotate-90`}`}),e]})}),(0,Y.jsx)(ow,{children:r})]}),Bpe=({actions:e})=>{let{t}=K(`common`);return e.hasExistingTicketsFromSnapshot?(0,Y.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,Y.jsx)(lb,{className:`h-3.5 w-3.5 text-emerald-400`}),t(`specView.actions.ticketsCreated`)]}):(0,Y.jsxs)(Q,{type:`button`,size:`sm`,onClick:e.onCreateTickets,disabled:!!e.unavailableReason||e.isCreatingTickets||e.isImplementingInChat||e.isExporting,title:e.unavailableReason??void 0,className:`w-full justify-center gap-1.5 border-violet-300/70 bg-violet-500/15 text-violet-100 hover:bg-violet-500/25`,children:[(0,Y.jsx)(J5,{className:`h-3.5 w-3.5`}),e.isCreatingTickets?t(`specView.actions.creatingTickets`):t(`specView.actions.createTickets`)]})},Z5=({ticket:e})=>(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`break-words text-xs font-medium text-foreground`,children:e.title}),e.key&&(0,Y.jsx)(`div`,{className:`mt-0.5 break-all text-xs text-violet-400`,children:e.key})]}),Vpe=({snapshot:e})=>{let{t}=K(`common`),n=new Map(e.tickets.map(e=>[e.key,e]));return(0,Y.jsx)(`section`,{className:`space-y-2.5`,children:e.bundle_groups.map(e=>{let r=e.ticket_keys.map(e=>n.get(e)).filter(e=>e!==void 0);return(0,Y.jsxs)(`article`,{className:`min-w-0 rounded-md border border-border/50 bg-surface px-3 py-2.5`,children:[(0,Y.jsx)(`h4`,{className:`break-all text-sm font-semibold text-foreground`,children:e.name}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t(`specView.artifactPanel.proposedTicketCount`,{count:r.length})}),r.length>0&&(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:r.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Z5,{ticket:e})},e.key))})]},e.key)})})},Q5={high:0,medium:1,low:2},Hpe=e=>[...e].sort((e,t)=>{let n=Q5[e.severity]??99,r=Q5[t.severity]??99;return n===r?e.ordinal-t.ordinal:n-r}),Upe=e=>{let t={high:0,medium:0,low:0};for(let n of e)t[n.severity]+=1;return t},Wpe=({run:e})=>{let{t}=K(`common`),n=e.agent_status,r=t(`specView.review.status.${n}`,{defaultValue:n});return(0,Y.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})},Gpe=({review:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)(!0),i=e.review?.run??null,a=e.review?.findings??[],o=Hpe(a),s=Upe(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?c5({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,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Y5,{className:`h-3.5 w-3.5`}),t(`specView.review.heading`)]}),open:n,onOpenChange:r,children:(0,Y.jsxs)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-3`,children:[i&&(0,Y.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(Wpe,{run:i}),c&&(0,Y.jsx)(`span`,{className:`inline-flex items-center gap-1 text-violet-300`,"aria-hidden":`true`,children:(0,Y.jsx)(`span`,{className:`h-3 w-3 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})}),h&&(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:h})]}),e.isLoading&&!i&&(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:t(`specView.review.loading`)}),o.length>0?(0,Y.jsx)(`ul`,{className:`space-y-2`,children:o.map(e=>(0,Y.jsxs)(`li`,{className:`rounded-md border border-border/40 bg-surface px-2.5 py-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.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,Y.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e.title})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-foreground`,children:e.what_text}),e.why_text&&(0,Y.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[t(`specView.review.why`),`:`]}),` `,e.why_text]}),e.suggestion_text&&(0,Y.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[t(`specView.review.suggestion`),`:`]}),` `,e.suggestion_text]})]},e.id))}):d?(0,Y.jsx)(`p`,{className:`text-xs ${i?.agent_status===`completed`?`text-emerald-300`:`text-muted-foreground`}`,children:t(d)}):null,l&&(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:e.onStopReview,className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(Lv,{className:`h-3.5 w-3.5`}),t(`specView.review.stop`)]})}),u&&(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:e.onSendToPlanner,disabled:!!e.disabledReason||e.isSendingToPlanner,title:e.disabledReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(SE,{className:`h-3.5 w-3.5`}),e.isSendingToPlanner?t(`specView.review.sendingToPlanner`):t(`specView.review.sendToPlanner`)]})})]})})},Kpe=({review:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)(!1),i=e.isRunning||e.review?.run?.agent_status===`running`,a=e.showModelSelector&&e.selectedDiscoveredModel!==null&&e.selectedDiscoveredModel.variants.length>0,o=t(i?`specView.review.running`:`specView.review.launch`);return(0,Y.jsxs)(Y_,{open:n&&!i,onOpenChange:r,children:[(0,Y.jsx)(X_,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,disabled:i||!!e.disabledReason,title:e.disabledReason??void 0,"aria-label":o,className:`gap-1.5 text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(Y5,{className:`h-4 w-4`}),t(`specView.review.heading`)]})}),(0,Y.jsx)(Z_,{align:`end`,className:`w-72 max-w-[calc(100vw-2rem)] p-3`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,children:t(`specView.review.popoverTitle`)}),(0,Y.jsx)(uv,{model:e.runConfigModel,showModelSelector:e.showModelSelector,availableModels:e.availableModels,onModelChange:e.onRunConfigModelChange,selectId:`spec-review-model`,label:t(`specView.review.model`)}),(0,Y.jsx)(dv,{variant:e.runConfigVariant,selectedModel:e.selectedDiscoveredModel,showVariantSelector:a,onVariantChange:e.onRunConfigVariantChange,selectId:`spec-review-variant`,label:t(`specView.review.variant`)}),(0,Y.jsxs)(Q,{type:`button`,size:`sm`,onClick:()=>{r(!1),e.onLaunchReview()},className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(Y5,{className:`h-3.5 w-3.5`}),t(`specView.review.launchAction`)]})]})})]})},qpe=(0,p.memo)((0,p.forwardRef)(({snapshot:e,isLoading:t,desktopWidth:n,onClose:r,actions:i,review:a,className:o},s)=>{let{t:c}=K(`common`),[l,u]=(0,p.useState)(null),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(!0),[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(!0),[b,x]=(0,p.useState)(!0),[S,C]=(0,p.useState)(!0),[w,T]=(0,p.useState)(!0),[E,D]=(0,p.useState)(!0),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(!0),M=(0,p.useCallback)(e=>{u(e)},[]),N=(0,p.useCallback)(()=>{f(!0)},[]),P=`flex h-[26rem] min-h-0 w-full shrink-0 flex-col overflow-hidden border-t border-border/70 bg-surface xl:h-full xl:border-l xl:border-t-0 ${o??``}`;if(t)return(0,Y.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,Y.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,Y.jsx)(Xb,{className:`h-4 w-4`})})]}),(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,Y.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})})]});if(!e)return(0,Y.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,Y.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,Y.jsx)(Xb,{className:`h-4 w-4`})})]}),(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4`,children:(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`specView.artifactPanel.noSnapshot`)})})]});let F=Fpe(e),I=e.tickets.length>0,L=e.bundle_groups.length>0,R=e.dependencies.length>0,ee=e.open_questions.length>0,te=e.assumptions.length>0;return(0,Y.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a&&(0,Y.jsx)(Kpe,{review:a}),(0,Y.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,Y.jsx)(Xb,{className:`h-4 w-4`})})]})]}),(0,Y.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,Y.jsx)(Gpe,{review:a}),(0,Y.jsx)(X5,{heading:c(`specView.artifactPanel.summary`),open:m,onOpenChange:h,children:(0,Y.jsx)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap`,children:e.summary})})}),e.mermaid&&(0,Y.jsx)(X5,{heading:c(`specView.artifactPanel.visualization`),open:g,onOpenChange:_,children:(0,Y.jsx)(`section`,{className:`overflow-auto rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,Y.jsx)(oG,{mermaid:e.mermaid,onClick:()=>{M(e.mermaid)}})})}),e.mockup&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(zpe,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.uiMockup`)]}),open:v,onOpenChange:y,children:(0,Y.jsx)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,Y.jsx)(wG,{html:e.mockup,onClick:N})})}),F&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(jv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.likelyFiles`)]}),open:b,onOpenChange:x,children:(0,Y.jsx)(Rpe,{snapshot:e,onMermaidClick:M})}),I&&!L&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(J5,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.proposedTickets`)]}),open:S,onOpenChange:C,children:(0,Y.jsx)(`section`,{children:(0,Y.jsx)(`ul`,{className:`space-y-1.5`,children:e.tickets.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Z5,{ticket:e})},e.key))})})}),L&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Yv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.bundleGroups`)]}),open:w,onOpenChange:T,children:(0,Y.jsx)(Vpe,{snapshot:e})}),R&&(0,Y.jsx)(X5,{heading:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Bw,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.dependencies`)]}),open:E,onOpenChange:D,children:(0,Y.jsx)(`section`,{children:(0,Y.jsx)(`ul`,{className:`space-y-1`,children:e.dependencies.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.blocker_key}),(0,Y.jsx)(`span`,{children:`→`}),(0,Y.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.dependent_key})]},t))})})}),ee&&(0,Y.jsx)(X5,{heading:c(`specView.artifactPanel.openQuestions`),open:O,onOpenChange:k,children:(0,Y.jsx)(`section`,{children:(0,Y.jsx)(`ul`,{className:`space-y-1.5`,children:e.open_questions.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex gap-2 text-sm text-amber-300`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 shrink-0 text-amber-500`,children:`?`}),(0,Y.jsx)(`span`,{children:e})]},t))})})}),te&&(0,Y.jsx)(X5,{heading:c(`specView.artifactPanel.assumptions`),open:A,onOpenChange:j,children:(0,Y.jsx)(`section`,{children:(0,Y.jsx)(`ul`,{className:`space-y-1.5`,children:e.assumptions.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 shrink-0 text-violet-500`,children:`•`}),(0,Y.jsx)(`span`,{children:e})]},t))})})})]}),i&&(0,Y.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,Y.jsx)(Bpe,{actions:i}),(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onImplementInChat,disabled:!!(i.unavailableReason||i.implementInChatUnavailableReason)||i.isCreatingTickets||i.isImplementingInChat||i.isExporting,title:i.unavailableReason??i.implementInChatUnavailableReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(SE,{className:`h-3.5 w-3.5`}),i.isImplementingInChat?c(`specView.actions.startingImplementation`):c(`specView.actions.implementInChat`)]}),(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onExport,disabled:!!i.unavailableReason||i.isCreatingTickets||i.isImplementingInChat||i.isExporting,title:i.unavailableReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,Y.jsx)(db,{className:`h-3.5 w-3.5`}),i.isExporting?c(`specView.actions.exportingSpec`):c(`specView.actions.exportSpec`)]})]}),l&&(0,Y.jsx)(xG,{mermaid:l,open:!0,onClose:()=>{u(null)}}),e.mockup&&(0,Y.jsx)(TG,{html:e.mockup,open:d,onClose:()=>{f(!1)}})]})})),$5=({className:e})=>(0,Y.jsx)(Hee,{"aria-hidden":`true`,className:e}),e7=(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},t7=(e,t)=>Wb.t(`specView.${e}`,t),n7=e=>t7(`pendingMemorySuggestions`,{count:e}),Jpe=1500,r7=`archon.spec-draft`,i7=`archon.spec-run-config`,a7=`archon.spec-review-run-config`,o7=`archon.spec-session-list-layout`,s7=`archon.spec-artifact-panel-layout`,Ype=`archon.spec-import-notice`,c7=420,l7=320,u7=.5,Xpe=6,d7=`/`,Zpe=`Slash`,Qpe=`NumpadDivide`,$pe=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===d7||e.code===Zpe||e.code===Qpe),f7=({modifierLabel:e,keys:t,ariaHidden:n=!1})=>(0,Y.jsxs)(`span`,{"aria-hidden":n,className:`flex items-center gap-0.5 text-[10px] leading-none`,children:[(0,Y.jsx)(eX,{"aria-hidden":n,children:e}),t.map(e=>(0,Y.jsxs)(`span`,{className:`contents`,children:[(0,Y.jsx)(`span`,{children:`+`}),(0,Y.jsx)(eX,{"aria-hidden":n,children:e})]},e))]}),eme=({label:e,modifierLabel:t,keys:n})=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{children:e}),(0,Y.jsx)(f7,{modifierLabel:t,keys:n,ariaHidden:!0})]}),p7=({projectId:e,tool:t,sessionId:n=null})=>e?n?`${r7}/${e}/sessions/${n}`:`${r7}/${e}/draft/${t}`:null,m7=({projectId:e,sessionId:t})=>e&&t?`${Ype}/${e}/${t}`:null,h7=({projectId:e,tool:t})=>{if(e)try{localStorage.setItem(`${r7}/${e}/tool`,t)}catch{}},g7=e=>{if(!e)return{isOpen:!0};try{let t=localStorage.getItem(`${o7}/${e}`);return{isOpen:(t?JSON.parse(t):null)?.isOpen??!0}}catch{return{isOpen:!0}}},tme=({projectId:e,isOpen:t})=>{if(e)try{localStorage.setItem(`${o7}/${e}`,JSON.stringify({isOpen:t}))}catch{}},nme=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):c7;if(!Number.isFinite(t))return Math.max(l7,n);let r=Math.max(l7,Math.round(t*u7));return Math.max(l7,Math.min(r,n))},_7=e=>{if(!e)return{isOpen:!1,width:c7};try{let t=localStorage.getItem(`${s7}/${e}`);if(!t)return{isOpen:!1,width:c7};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(l7,Math.round(n.width)):c7;return{isOpen:n.isOpen===!0,width:r}}catch{return{isOpen:!1,width:c7}}},rme=({projectId:e,isOpen:t,width:n})=>{if(e)try{localStorage.setItem(`${s7}/${e}`,JSON.stringify({isOpen:t,width:n}))}catch{}},ime=e=>{if(!e)return null;try{return localStorage.getItem(e)}catch{return null}},v7=({storageKey:e,value:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,t)}catch{}},ame=e=>{if(!e)return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},y7=({storageKey:e,notice:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(t))}catch{}},ome=e=>{if(!e)return null;let t=e.skipped.reduce((e,t)=>e+t.count,0),n=e.skipped.map(e=>t7(`importNotice.skipReasons.${e.code}`,{count:e.count})).join(`, `);return e.imported_count>0&&t>0?t7(`importNotice.importedWithSkips`,{importedCount:e.imported_count,skippedCount:t,skippedSummary:n}):e.imported_count>0?t7(`importNotice.importedOnly`,{importedCount:e.imported_count}):t>0?t7(`importNotice.skippedOnly`,{skippedCount:t,skippedSummary:n}):null},b7=({keyPrefix:e,projectId:t,tool:n})=>`${e}:${t}:${n}`,sme=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t):[],x7=({keyPrefix:e,projectId:t,tool:n})=>{if(!t||n!==`opencode`&&n!==`claude`)return null;try{let r=window.localStorage.getItem(b7({keyPrefix:e,projectId:t,tool:n}));if(!r)return null;let i=JSON.parse(r),a=(typeof i.model==`string`?i.model.trim():``)||null;return a?{model:a,variant:a&&typeof i.variant==`string`&&i.variant.trim()||null,skills:sme(i.skills)}:null}catch{return null}},S7=({keyPrefix:e,projectId:t,tool:n,model:r,variant:i,skills:a})=>{if(!(!t||n!==`opencode`&&n!==`claude`||!r))try{let o={model:r,variant:r?i:null,...a?{skills:a}:{}};window.localStorage.setItem(b7({keyPrefix:e,projectId:t,tool:n}),JSON.stringify(o))}catch{}},C7=({projectId:e,tool:t})=>x7({keyPrefix:i7,projectId:e,tool:t}),w7=({projectId:e,tool:t,model:n,variant:r,skills:i})=>S7({keyPrefix:i7,projectId:e,tool:t,model:n,variant:r,skills:i}),cme=({projectId:e,tool:t})=>{let n=C7({projectId:e,tool:t});!n||n.skills.length===0||w7({projectId:e,tool:t,...n,skills:[]})},lme=({projectId:e,tool:t})=>x7({keyPrefix:a7,projectId:e,tool:t}),ume=({projectId:e,tool:t,model:n,variant:r})=>S7({keyPrefix:a7,projectId:e,tool:t,model:n,variant:r}),dme=({projectId:e,tool:t})=>{if(e)try{window.localStorage.removeItem(b7({keyPrefix:a7,projectId:e,tool:t}))}catch{}},fme=`archon.spec-draft-grill`,T7=e=>e?`${fme}/${e}`:null,E7=e=>{let t=T7(e);if(!t)return!1;try{return window.localStorage.getItem(t)===`true`}catch{return!1}},D7=({projectId:e,grillOn:t})=>{let n=T7(e);if(n)try{t?window.localStorage.setItem(n,`true`):window.localStorage.removeItem(n)}catch{}},pme=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c=async()=>!1,onSelectRepoRootTarget:l=async()=>!1,onRestoreSessionTarget:u,activeTool:d,routedSpecSessionId:f,routedSpecSnapshotId:m,initialIssueDraft:h=null,onRoutedSpecNavigationUnavailable:g,onSessionNavigation:_,onInitialIssueDraftConsumed:v,onImplementInChat:y,onNavigateToLifecycleSource:b})=>{let x=bq(),{t:S}=K(`common`),{jiraImportState:C,prepareSpecImportFromJira:w}=Jw(e),{gitHubImportState:T,prepareSpecImportFromGitHub:E}=vw(e),[D,O]=(0,p.useState)([]),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(null),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[ee,te]=(0,p.useState)({}),[z,B]=(0,p.useState)({}),[V,H]=(0,p.useState)(null),[U,ne]=(0,p.useState)({}),[re,ie]=(0,p.useState)({}),[ae,oe]=(0,p.useState)([]),[W,se]=(0,p.useState)(``),[ce,le]=(0,p.useState)(``),[ue,de]=(0,p.useState)([]),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)(!1),[Se,Ce]=(0,p.useState)(null),[we,Te]=(0,p.useState)([]),[Ee,De]=(0,p.useState)(()=>new Set),[Oe,ke]=(0,p.useState)(!1),[Ae,je]=(0,p.useState)(()=>new Set),[Me,Ne]=(0,p.useState)(!1),[Pe,Fe]=(0,p.useState)(()=>g7(e).isOpen),[Ie,Le]=(0,p.useState)(0),[G,Re]=(0,p.useState)(null),[ze,Be]=(0,p.useState)(()=>new Set),[Ve,He]=(0,p.useState)(null),[Ue,We]=(0,p.useState)(null),[Ge,q]=(0,p.useState)(!1),[Je,Ye]=(0,p.useState)(()=>_7(e).isOpen),[Ze,Qe]=(0,p.useState)(()=>_7(e).width),[J,$e]=(0,p.useState)(!1),[et,tt]=(0,p.useState)(!1),[nt,rt]=(0,p.useState)(!1),[it,at]=(0,p.useState)(!1),[ot,st]=(0,p.useState)(!1),[ct,lt]=(0,p.useState)(null),[ut,dt]=(0,p.useState)(!1),[ft,pt]=(0,p.useState)(null),[mt,ht]=(0,p.useState)(()=>E7(e)),[gt,X]=(0,p.useState)(!1),[_t,vt]=(0,p.useState)([]),[yt,bt]=(0,p.useState)(!1),[xt,St]=(0,p.useState)(!1),[Ct,wt]=(0,p.useState)(0),[Tt,Et]=(0,p.useState)(null),[Dt,Ot]=(0,p.useState)(!1),[kt,At]=(0,p.useState)(!1),[jt,Mt]=(0,p.useState)(!1),[Nt,Pt]=(0,p.useState)(!1),[Ft,It]=(0,p.useState)(``),[Lt,Rt]=(0,p.useState)(``),[zt,Bt]=(0,p.useState)(!1),Vt=(0,p.useRef)(null),Ht=(0,p.useRef)(null),Ut=(0,p.useRef)(null),Wt=(0,p.useRef)(null),Gt=(0,p.useRef)(null),Kt=(0,p.useRef)(null),qt=(0,p.useRef)(!1),Jt=(0,p.useRef)(!1),Yt=(0,p.useRef)(0),Xt=(0,p.useRef)(c7),Zt=(0,p.useRef)(c7),Qt=(0,p.useRef)(null),$t=(0,p.useRef)(new Set),en=(0,p.useRef)(0),tn=(0,p.useRef)(0),nn=(0,p.useRef)(f),rn=(0,p.useRef)(!1),an=(0,p.useRef)(!1),on=(0,p.useRef)(!1),sn=(0,p.useRef)({}),cn=(0,p.useRef)({}),ln=(0,p.useRef)({}),un=(0,p.useRef)(new Set),dn=(0,p.useRef)(new Set),fn=(0,p.useRef)(0),pn=(0,p.useRef)({id:null,status:null}),mn=(0,p.useRef)(new Map),hn=(0,p.useRef)(!1),gn=(0,p.useRef)(!1),_n=(0,p.useRef)(()=>{}),vn=m===void 0?Ue:m;nn.current=f;let yn=e?p7({projectId:e,tool:F?d:j?.tool??d,sessionId:j?.id??null}):null,bn=m7({projectId:e,sessionId:j?.id??null}),xn=yn?ee[yn]??``:``,Sn=j?z[bn??``]??null:V,Cn=F?d:j?.tool??d,wn=(0,p.useMemo)(()=>j?U[j.id]??[]:[],[j,U]),Tn=(0,p.useMemo)(()=>j?re[j.id]??0:0,[j,re])>0,{models:En,isLoading:Dn}=pF(Cn),On=(0,p.useCallback)(()=>{de(e=>e.length===0?e:[]),cme({projectId:e,tool:d})},[e,d]);(0,p.useEffect)(()=>{rn.current=F},[F]),(0,p.useEffect)(()=>{sn.current=ee},[ee]),(0,p.useEffect)(()=>{cn.current=z},[z]),(0,p.useEffect)(()=>{ln.current=U},[U]),(0,p.useEffect)(()=>{if(!yn||un.current.has(yn))return;un.current.add(yn);let e=ime(yn);e&&te(t=>Object.prototype.hasOwnProperty.call(t,yn)?t:{...t,[yn]:e})},[yn]),(0,p.useEffect)(()=>{if(!bn||dn.current.has(bn))return;dn.current.add(bn);let e=ame(bn);e&&B(t=>({...t,[bn]:e}))},[bn]),(0,p.useEffect)(()=>{!yn||!Object.prototype.hasOwnProperty.call(ee,yn)||v7({storageKey:yn,value:ee[yn]??``})},[yn,ee]),(0,p.useEffect)(()=>{!bn||!Object.prototype.hasOwnProperty.call(z,bn)||y7({storageKey:bn,notice:z[bn]??null})},[bn,z]),(0,p.useEffect)(()=>{Qt.current=k},[k]),(0,p.useEffect)(()=>{let t=vn??j?.latest_snapshot_id;if(!j?.id||!t||!e){He(null),dt(!1),Ye(!1);return}let n=!1;return q(!0),JM(e,j.id,t).then(e=>{if(!n){if(vn&&e.spec_session_id!==j.id){He(null),dt(!1),g?.();return}He(e),dt((e.created_ticket_ids?.length??0)>0),Ye(!0)}}).catch(e=>{n||(He(null),dt(!1),vn&&e instanceof Ke&&e.status===404?g?.():$.error(e instanceof Error?e.message:t7(`errors.loadSession`)))}).finally(()=>{n||q(!1)}),()=>{n=!0}},[j?.latest_snapshot_id,j?.id,e,vn,g]);let kn=Ve?.id??null,An=j?.id??null;(0,p.useEffect)(()=>{if(!e||!An||!kn){Et(null);return}let t=!1;return Ot(!0),z5(e,An,kn).then(e=>{t||Et(e)}).catch(()=>{t||Et(null)}).finally(()=>{t||Ot(!1)}),()=>{t=!0}},[e,An,kn]);let jn=(0,p.useCallback)(()=>{!e||!An||!kn||z5(e,An,kn).then(Et).catch(()=>{})},[e,An,kn]);(0,p.useEffect)(()=>{rme({projectId:e,isOpen:Je,width:Ze})},[e,Je,Ze]),(0,p.useEffect)(()=>{if(!(f===void 0||!me)){if(!f){rn.current||On(),Ce(null),A(null),M(null),We(null),I(!0);return}if(!(D.some(e=>e.id===f)||j?.id===f)){$.error(t7(`errors.initialSessionMissing`)),an.current=!0,A(null),M(null),I(!1),g?.();return}k!==f&&(Ce(null),A(f),M(null),I(!1),an.current=!0)}},[j?.id,k,me,g,On,f,D]),(0,p.useEffect)(()=>{J||(Zt.current=Ze,Ut.current&&(Ut.current.style.setProperty(`--spec-artifact-panel-width`,`${Ze}px`),Ut.current.setAttribute(`data-desktop-width`,String(Ze))))},[Ze,J]);let Mn=(0,p.useCallback)(async t=>{if(!e){O([]),pe(!1);return}pe(!me);try{let n=await LM(e,t);if(t?.aborted)return;O(r5(n)),he(!0);let r=new Set(n.map(e=>e.id));Be(e=>{let t=new Set([...e].filter(e=>r.has(e)));return t.size===e.size?e:t})}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.loadSessions`))}finally{t?.aborted||pe(!1)}},[e,me]);(0,p.useEffect)(()=>{let e=mn.current,t=new Map,n=[];for(let r of D){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&(a===`done`||a===`error`)&&r.id!==k&&n.push(r),t.set(r.id,a)}mn.current=t,Be(e=>{let t=new Set(e),r=!1,i=new Set(D.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of D){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===k||i!==`done`&&i!==`error`)&&t.delete(e.id)){r=!0;continue}a&&!t.has(e.id)&&(t.add(e.id),r=!0)}return r?t:e})},[e,k,D]);let Nn=(0,p.useCallback)(async(t,n)=>{if(!e)return;_e(!0);let r=en.current+1;en.current=r;let i=tn.current;try{let a=await zM(e,t,n);if(n?.aborted)return;let o=tn.current!==i,s=en.current===r,c=Qt.current===t&&!rn.current;if(!s||o||!c)return;M(a)}catch(e){e instanceof Ke&&e.status===404&&nn.current===t&&Qt.current===t?g?.():Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.loadSession`))}finally{n?.aborted||_e(!1)}},[e,g]),Pn=(0,p.useCallback)(e=>{O(t=>{let n=t.findIndex(t=>t.id===e.id);if(n===-1)return r5([...t,H5(e)]);let r=t.slice();return r[n]=H5(e),r5(r)})},[]),Fn=(0,p.useCallback)((e,t)=>{O(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n[r];if(i.pending_memory_suggestion_count===t)return n;let a=[...n];return a[r]={...i,pending_memory_suggestion_count:t},a}),M(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:{...n,pending_memory_suggestion_count:t})},[]),In=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){vt([]),bt(!1);return}bt(!0);try{let t=await Ar(e,null,r,void 0,n);if(r?.aborted)return;vt(t.suggestions),Fn(n,t.suggestions.length)}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.loadMemorySuggestions`))}finally{r?.aborted||bt(!1)}},[t?.memory_enabled,e,Fn]),Ln=(0,p.useCallback)(e=>{vt(t=>{let n=t.filter(t=>t.id!==e);return k&&Fn(k,n.length),n}),wt(e=>e+1),Mn(),k&&Nn(k)},[k,Nn,Mn,Fn]),Rn=(0,p.useCallback)(e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),[]),zn=(0,p.useCallback)(()=>({tool:d,mode:mt?`grill`:`standard`,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[]}),[d,mt,En.length,W,ce,ae.length,ue]),Bn=(0,p.useCallback)(()=>{rn.current=!0,Qt.current=null,I(!0),On(),A(null),We(null),M(null),He(null),R(null),H(null),Ce(null),Re(null)},[On]),Vn=(0,p.useCallback)(()=>{ve||be||(Bn(),_?.(null))},[ve,be,_,Bn]),Hn=(0,p.useMemo)(()=>iX(),[]),Un=(0,p.useMemo)(()=>(0,Y.jsx)(f7,{modifierLabel:Hn,keys:[d7],ariaHidden:!0}),[Hn]),Wn=(0,p.useMemo)(()=>(0,Y.jsx)(eme,{label:t7(`sidebar.newSessionTooltip`),modifierLabel:Hn,keys:[d7]}),[Hn]);(0,p.useEffect)(()=>{let t=t=>{if($pe(t)){if(!e||ve||be)return;t.preventDefault(),Vn(),Le(e=>e+1);return}};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,ve,be,Vn]);let Gn=(0,p.useCallback)(e=>{be||(Ce(null),A(e.id),We(null),I(!1),R(null),H(null),fn.current+=1,_?.(e.id))},[be,_]),Kn=(0,p.useCallback)(async r=>{if(!e)return!1;lt(r.id);try{let i=await zM(e,r.id);return Pn(i),Qt.current===i.id&&M(i),i.target_available===!1?($.error(i.target_unavailable_reason??t7(`targets.unavailable`)),!1):!t||h5({activeProject:t,activeProjectBranchState:n,session:i})?!0:u?await u(i):!1}catch(e){return Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.restoreTarget`)),!1}finally{lt(e=>e===r.id?null:e)}},[t,n,e,u,Pn]),qn=(0,p.useCallback)(async t=>{if(e){Ce(t);try{await KM(e,t)}catch(e){Ce(e=>e===t?null:e),Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.stopSession`))}}},[e]);(0,p.useEffect)(()=>{if(!Se)return;let e=j?.id===Se?j:D.find(e=>e.id===Se)??null;(!e||e.agent_status!==`running`)&&Ce(null)},[j,Se,D]);let Jn=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ve)){rt(!0);try{if(!await Kn(j))return;let t=await ZM(e,j.id,Ve.id);dt(!0),$.success(t7(`actions.createTicketsSuccess`,{count:t.tickets.length})),Mn()}catch(e){if(Xe(e))return;if(qe(e,`existing_ticket_ids`)){dt(!0);return}$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{rt(!1)}}},[e,j,Ve,Mn,Kn]),Yn=(0,p.useCallback)(()=>{Jn()},[Jn]),Xn=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ve)&&y){at(!0);try{if(!await Kn(j))return;let t=await QM(e,j.id,Ve.id);y(t.draft_text,t.spec_session_id,t.spec_snapshot_id)}catch(e){if(Xe(e))return;e instanceof Ke&&e.status===409&&await Nn(j.id),$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{at(!1)}}},[e,j,Ve,Nn,y,Kn]),Zn=(0,p.useCallback)(async t=>{let n=t?.projectId??e,r=t?.sessionId??j?.id,i=t?.snapshotId??Ve?.id;if(!(!n||!r||!i)){st(!0);try{if(!j||j.id!==r||!await Kn(j))return;await XM(n,r,i,{overwrite:t?.overwrite}),pt(null),$.success(t7(`actions.exportSuccess`))}catch(e){if(Xe(e))return;if(e instanceof YM){pt({path:e.conflictingPath,projectId:n,sessionId:r,snapshotId:i});return}e instanceof Ke&&e.status===409&&j&&await Nn(j.id),$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{st(!1)}}},[e,j,Ve,Nn,Kn]),Qn=(0,p.useCallback)(()=>{Kt.current?.(),Kt.current=null},[]),$n=(0,p.useCallback)(e=>{if(!Vt.current)return;let t=Vt.current.getBoundingClientRect().width,n=nme(e,t);Zt.current=n,Ut.current&&(Ut.current.style.setProperty(`--spec-artifact-panel-width`,`${n}px`),Ut.current.setAttribute(`data-desktop-width`,String(n)))},[]),er=(0,p.useCallback)(e=>{let t=Wt.current,n=Gt.current,r=qt.current;if(t!==null){if(Wt.current=null,Gt.current=null,qt.current=!1,$e(!1),tt(!1),Qn(),e!==null&&typeof Ht.current?.hasPointerCapture==`function`&&Ht.current.hasPointerCapture(e)&&typeof Ht.current.releasePointerCapture==`function`&&Ht.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;Qe(Zt.current),Ye(!0);return}Qe(Zt.current)}},[Qn]),tr=(0,p.useCallback)((e,t)=>{if(Wt.current!==e)return;let n=t-Yt.current,r=Xt.current-n;if(Gt.current===`collapsed`){if(!qt.current&&r<Xpe)return;qt.current||(qt.current=!0,Jt.current=!0,tt(!0),$e(!0))}$n(r)},[$n]),nr=(0,p.useCallback)((e,t)=>{if(Wt.current===e){if(t!==null&&(Gt.current===`inline`||qt.current)){let e=t-Yt.current;$n(Xt.current-e)}er(e)}},[er,$n]),rr=(0,p.useCallback)(e=>{e.preventDefault(),Wt.current=e.pointerId,Gt.current=Je?`inline`:`collapsed`,qt.current=!1,Jt.current=!1,Yt.current=e.clientX,Xt.current=Je?Zt.current:0,$e(Je),Qn(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{tr(e.pointerId,e.clientX)},n=e=>{nr(e.pointerId,e.clientX)},r=e=>{nr(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Kt.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[nr,tr,Je,Qn]),ir=(0,p.useCallback)(e=>{tr(e.pointerId,e.clientX)},[tr]),ar=(0,p.useCallback)(e=>{nr(e.pointerId,e.clientX)},[nr]),or=(0,p.useCallback)(e=>{nr(e.pointerId,e.clientX)},[nr]),sr=(0,p.useCallback)(e=>{Wt.current===e.pointerId&&er(e.pointerId)},[er]),cr=(0,p.useCallback)(()=>{Ye(!1)},[]),lr=(0,p.useCallback)(async()=>{if(!e||we.length===0)return;let t=we;De(e=>{let n=new Set(e);for(let e of t)n.add(e);return n});let n=[],r=[];for(let i of t)try{await qM(e,i),r.push(i)}catch(e){Xe(e)||n.push(e instanceof Error?e.message:t7(`errors.deleteSession`))}if(De(e=>{let n=new Set(e);for(let e of t)n.delete(e);return n}),Te([]),_n.current(r),n.length>0){$.error(n.join(`
275
+ `));return}Oe&&(ke(!1),je(new Set),$.success(t7(`toasts.deleteSelectedSuccess`,{count:t.length})))},[e,we,Oe]),ur=(0,p.useCallback)((t,n={})=>{let r=new Set(t);if(r.size===0)return;let i=Qt.current,a=n.preserveDraftRoute===!0,o=!!(a&&i&&r.has(i)&&nn.current===i),s=!!(!a&&i&&r.has(i)),c=s?D.find(e=>!r.has(e.id))??null:null;o&&(On(),_?.(null)),s&&(c||On(),_?.(c?.id??null));for(let t of r)v7({storageKey:p7({projectId:e,tool:d,sessionId:t}),value:``}),y7({storageKey:m7({projectId:e,sessionId:t}),notice:null});ne(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e}),B(t=>{let n={...t},i=!1;for(let t of r){let r=m7({projectId:e,sessionId:t});r&&Object.prototype.hasOwnProperty.call(n,r)&&(delete n[r],i=!0)}return i?n:t}),O(e=>{let t=e.filter(e=>!r.has(e.id));if(i&&r.has(i)){if(nn.current===i)return a?(A(null),M(null),We(null),I(!0),t):(A(null),M(null),We(null),I(c===null),t);let e=t[0]??null;A(e?.id??null),M(null),We(null),I(e===null)}return t}),Be(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),Re(e=>e&&r.has(e.parentId)?null:e),Ce(e=>e&&r.has(e)?null:e),Te(e=>e.filter(e=>!r.has(e))),De(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),je(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,d,_,On,D]),dr=(0,p.useCallback)((e,t)=>{ur([e],t)},[ur]);_n.current=ur;let fr=(0,p.useCallback)((e,t)=>{e&&te(n=>n[e]===t?n:{...n,[e]:t})},[]),pr=(0,p.useCallback)((e,t)=>{ne(n=>{if(t.length===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),mr=(0,p.useCallback)(e=>{ne(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),ie(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),hr=(0,p.useCallback)((e,t)=>{e&&B(n=>(n[e]??null)===t?n:{...n,[e]:t})},[]),gr=(0,p.useCallback)(e=>{e&&(B(t=>!Object.prototype.hasOwnProperty.call(t,e)||t[e]===null?t:{...t,[e]:null}),y7({storageKey:e,notice:null}))},[]),_r=(0,p.useCallback)(t=>{if(e){if(t.spec_session){let n=p7({projectId:e,tool:t.spec_session.tool,sessionId:t.spec_session.id}),r=m7({projectId:e,sessionId:t.spec_session.id});fr(n,t.prompt_text),hr(r,t.import_notice),pr(t.spec_session.id,t.imported_attachments),Pn(t.spec_session),M(t.spec_session),A(t.spec_session.id),I(!1),R(null),H(null),Le(e=>e+1);return}R(t.external_source),H(t.import_notice),On(),I(!0),A(null),M(null),We(null),He(null),fr(p7({projectId:e,tool:d}),t.prompt_text),Le(e=>e+1)}},[e,d,On,fr,hr,pr,Pn]),vr=(0,p.useCallback)(async({provider:e,issueReference:t})=>{let n=$.loading(t7(`toasts.importPreparing`));try{let r=e===`jira`?await w?.({issueReference:t,...zn()}):await E?.({issueReference:t,...zn()});if(!r)throw Error(t7(`toasts.importError`));return(r.import_notice?.skipped.reduce((e,t)=>e+t.count,0)??0)>0?$.warning(t7(`toasts.importPartialSuccess`),{id:n}):$.success(t7(`toasts.importSuccess`),{id:n}),r}catch(e){if(Xe(e))$.dismiss(n);else{let t=e instanceof Error&&e.message?e.message:t7(`toasts.importError`);$.error(t,{id:n})}throw e}},[zn,E,w]),yr=(0,p.useMemo)(()=>[{key:`jira`,label:S(`jiraImportField.label`),placeholder:S(`jiraImportField.placeholder`),state:C,onImport:e=>vr({provider:`jira`,issueReference:e})},{key:`github`,label:S(`githubImportField.label`),placeholder:S(`githubImportField.placeholder`),state:T,onImport:e=>vr({provider:`github`,issueReference:e})}],[S,C,T,vr]),br=yr.some(e=>e.state===`enabled`);(0,p.useEffect)(()=>{h&&(vr({provider:h.external_source.provider,issueReference:h.external_source.external_key}).then(_r).catch(()=>void 0),v?.())},[h,vr,_r,v]);let xr=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ve)){At(!0);try{await Cpe(e,j.id,Ve.id,{tool:j.tool,...zt?{model:Ft||null,variant:Lt||null}:{},skills:j.skills}),zt&&ume({projectId:e,tool:j.tool,model:Ft||null,variant:Lt||null}),jn()}catch(e){if(Xe(e))return;e instanceof Ke&&e.status===409&&await Nn(j.id),$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{At(!1)}}},[e,j,Ve,zt,Ft,Lt,jn,Nn]),Sr=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ve)){Mt(!0);try{await wpe(e,j.id,Ve.id),jn()}catch(e){if(Xe(e))return;$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{Mt(!1)}}},[e,j,Ve,jn]),Cr=(0,p.useCallback)(async()=>{if(!e||!j||!Ve)return;let t=Tt?.run;if(t){Pt(!0);try{fr(yn,(await Tpe(e,j.id,Ve.id,t.id)).draft_text),Le(e=>e+1)}catch(e){if(Xe(e))return;$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{Pt(!1)}}},[e,j,Ve,Tt,fr,yn]),wr=(0,p.useCallback)(e=>{e&&(te(t=>t[e]===``?t:{...t,[e]:``}),v7({storageKey:e,value:``}))},[]),Tr=(0,p.useCallback)((e,t)=>{ie(n=>{let r=Math.max(0,(n[e]??0)+t);if(r===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:r}})},[]),Er=(0,p.useCallback)(async t=>{if(!(!e||gt||gn.current)&&!(j&&j.agent_status===`running`)){if(!k||!j){ht(t),D7({projectId:e,grillOn:t});return}if(j.mode===(t?`grill`:`standard`)){ht(t);return}X(!0);try{let n=await VM(e,j.id,{mode:t?`grill`:`standard`});M(n),Pn(n),ht(t),t||e7(n.messages,n.latest_snapshot_created_at)&&await HM(e,n.id,{instruction:t7(`grill.finalizePrompt`),tool:n.tool,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[]})}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`grill.updateModeError`))}finally{X(!1)}}},[e,j,k,gt,Pn,En,W,ce,ae,ue]),Dr=(0,p.useCallback)(async()=>{if(!e||ve||be||hn.current||gn.current||t&&j&&!h5({activeProject:t,activeProjectBranchState:n,session:j}))return;let r=xn.trim();if(!r&&wn.length===0)return;xe(!0);let i=yn,a=performance.now();fn.current+=1;let o=`spec:${fn.current}`;try{let t=k,n=!t,s=n;if(t&&!j){let r=await zM(e,t);r?s=r.messages?.length===0:(n=!0,s=!0,t=null)}else j&&(s=j.messages?.length===0);if(n){ye(!0);let n=await RM(e,{tool:d,mode:mt?`grill`:`standard`,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[],external_source:L??null});t=n.id,A(t),M(n),I(!1),_?.(t),R(null),ht(!1),D7({projectId:e,grillOn:!1}),h7({projectId:e,tool:d}),ye(!1)}if(!t)throw Error(`Unable to resolve the spec session.`);Ce(e=>e===t?null:e),Re({parentType:`spec`,parentId:t,turnKey:o,startedAt:a});let c=wn.map(e=>e.id),l=await HM(e,t,{instruction:r,tool:d,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[],attachment_ids:c.length>0?c:void 0});M(l),w7({projectId:e,tool:l.tool,model:l.model,variant:l.variant,skills:s?[]:l.skills}),Le(e=>e+1),mr(t),wr(i),gr(m7({projectId:e,sessionId:t})),H(null)}catch(e){Re(e=>e?.turnKey===o?null:e);let t=qe(e,`spec_session`);t?(M(t),Pn(t)):e instanceof Ke&&e.status===409&&Qt.current&&await Nn(Qt.current),Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{xe(!1),ye(!1)}},[t,n,e,ve,be,xn,wn,yn,k,j,d,mt,En,W,ce,ae,ue,L,Nn,Pn,mr,wr,gr,_]),Or=(0,p.useCallback)(async t=>{if(e){$t.current.add(t.id);try{await qM(e,t.id),dr(t.id,{preserveDraftRoute:!0}),Bn()}catch(e){throw $t.current.delete(t.id),e}}},[e,Bn,dr]),kr=(0,p.useCallback)(async t=>{if(!e||Cn!==`opencode`&&Cn!==`claude`)return;let n=k,r=null;if(!n&&t.length>0)try{ye(!0);let t=await RM(e,{tool:d,mode:mt?`grill`:`standard`,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[],external_source:L??null});r=t,n=t.id,A(n),M(t),I(!1),_?.(n),h7({projectId:e,tool:d})}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.upload`));return}finally{ye(!1)}if(n){Tr(n,t.length);try{let r=await WM(e,n,t),i=[...ln.current[n]??[],...r.attachments];pr(n,i)}catch(e){if(r&&!xn.trim())try{await Or(r)}catch{}Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.upload`))}finally{Tr(n,-t.length)}}},[e,k,d,Cn,En,W,ce,ae,ue,mt,L,xn,Or,Tr,_,pr]),jr=(0,p.useCallback)(async t=>{if(!e||!j)return;let n=j,r=n.id,i=(ln.current[r]??[]).filter(e=>e.id!==t);try{await GM(e,r,t),pr(r,i),i.length===0&&!xn.trim()&&(n.messages?.length??0)===0&&await Or(n)}catch(e){Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.removeAttachment`))}},[e,j,Or,xn,pr]);(0,p.useEffect)(()=>{G&&(G.parentId===k&&(be||j?.agent_status===`running`)||Re(null))},[j?.agent_status,k,be,G]),(0,p.useEffect)(()=>{if(!on.current){on.current=!0;return}let t=g7(e),n=_7(e);rn.current=!1,an.current=!1,un.current=new Set,dn.current=new Set,A(null),M(null),We(null),He(null),I(!1),R(null),te({}),B({}),H(null),ne({}),ie({}),$t.current.clear(),Ce(null),Te([]),De(new Set),ke(!1),je(new Set),Re(null),vt([]),bt(!1),St(!1),he(!1),Be(new Set),mn.current=new Map,Zt.current=n.width,Fe(t.isOpen),Qe(n.width),Ye(n.isOpen),ht(E7(e)),X(!1)},[e]);let Mr=(0,p.useCallback)((e,t)=>{je(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,p.useEffect)(()=>{let e=new AbortController;return Mn(e.signal),()=>{e.abort()}},[Mn]),(0,p.useEffect)(()=>{if(f!==void 0||rn.current||F||k||an.current||D.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;let e=t?D.find(e=>h5({activeProject:t,activeProjectBranchState:n,session:e}))??null:D[0]??null;an.current=!0,e&&A(e.id)},[t,n,k,F,f,D]),(0,p.useEffect)(()=>{if(Cn!==`opencode`&&Cn!==`claude`){oe([]),Ne(!1);return}if(Cn!==`opencode`){oe([]);return}let t=new AbortController;return(async()=>{Ne(!0);try{oe(await mF(Cn,t.signal,e))}catch(e){Xe(e)||oe(e=>e)}finally{t.signal.aborted||Ne(!1)}})(),()=>{t.abort()}},[e,Cn]),(0,p.useEffect)(()=>{if(Cn!==`opencode`&&Cn!==`claude`){se(``),le(``),de([]);return}if(F){let t=C7({projectId:e,tool:Cn}),n=new Set(En.map(e=>e.id)),r=t?.model??``,i=r&&(n.size===0||n.has(r)),a=En.find(e=>e.id===r)??null,o=t?.variant??``,s=!a||a.variants.includes(o),c=new Set(ae.map(e=>e.name));se(i?r:``),le(e=>!i||!s?``:o||e),de(Cn===`opencode`?(t?.skills??[]).filter(e=>c.has(e)):[]);return}se(j?.model??``),le(j?.variant??``),de(j?.skills??[])},[e,j?.id,j?.model,j?.skills,j?.variant,En,ae,Cn,F]),(0,p.useEffect)(()=>{if(F||!k){M(null);return}if(j?.id===k)return;M(null);let e=new AbortController;return Nn(k,e.signal),()=>{e.abort()}},[j,k,F,Nn]),(0,p.useEffect)(()=>{St(!1)},[k,F]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||F||!k){vt([]),bt(!1);return}let e=new AbortController;return In(k,e.signal),()=>{e.abort()}},[t?.memory_enabled,k,F,In,Ct]),(0,p.useEffect)(()=>{!xt||yt||_t.length>0||St(!1)},[yt,xt,_t.length]),(0,p.useEffect)(()=>{let e=pn.current,n=j?.id??null,r=j?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&wt(e=>e+1),pn.current={id:n,status:r}},[t?.memory_enabled,j?.agent_status,j?.id]),(0,p.useEffect)(()=>{if(!k||j?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([Mn(e.signal),Nn(k,e.signal)])},Jpe);return()=>{e.abort(),window.clearInterval(t)}},[j?.agent_status,k,Nn,Mn]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(!F&&t.id===Qt.current&&(tn.current+=1,M(t)),Rn(t)&&Pn(t))},n=t=>{if(!t||t.project_id!==e)return;let n=$t.current.delete(t.id);dr(t.id,n?{preserveDraftRoute:!0}:void 0)},r=()=>{Mn();let e=Qt.current;e&&!rn.current&&Nn(e)};return x.on(`connect`,r),x.on(`spec-session:created`,t),x.on(`spec-session:updated`,t),x.on(`spec-session:deleted`,n),()=>{x.off(`connect`,r),x.off(`spec-session:created`,t),x.off(`spec-session:updated`,t),x.off(`spec-session:deleted`,n)}},[e,F,Nn,Mn,Rn,Pn,dr,x]),(0,p.useEffect)(()=>{if(!e||!kn)return;let t=e=>{!e||e.spec_snapshot_id!==kn||jn()};return x.on(`spec-review:updated`,t),()=>{x.off(`spec-review:updated`,t)}},[e,kn,jn,x]);let Nr=(0,p.useMemo)(()=>i5(D),[D]),Pr=(0,p.useCallback)(e=>{e.key!==`Enter`||e.shiftKey||j?.agent_status===`running`||ve||be||Tn||hn.current||gn.current||(e.preventDefault(),Dr())},[Dr,j?.agent_status,ve,be,Tn]),Fr=(0,p.useCallback)(t=>{if(!e||Cn!==`opencode`&&Cn!==`claude`)return;let n=Array.from(t.clipboardData.files).filter(e=>e.type.startsWith(`image/`));n.length!==0&&(t.preventDefault(),kr(n))},[e,Cn,kr]),Ir=(0,p.useMemo)(()=>s5(En),[En]),Lr=(0,p.useMemo)(()=>j?l5({modelLabel:c5({availableModelsById:Ir,model:j.model}),tool:j.tool}):null,[j,Ir]),Rr=(0,p.useMemo)(()=>j?.messages?j.messages.map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],responseTiming:e.response_timing?nq(e.response_timing):null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,created_at:e.created_at,displayTitle:e.role===`assistant`?Lr??o5(j.tool):u5()})):[],[j,Lr]),zr=k!==null||F,Br=F?null:j,Vr=Br?.target_available===!1,Hr=!!(t&&Br&&!Vr&&!h5({activeProject:t,activeProjectBranchState:n,session:Br})),Ur=Hr&&Br?t7(`targets.mismatchReason`,{sessionTarget:_5(Br),currentTarget:v5({activeProject:t,activeProjectBranchState:n})}):null,Wr=Vr?Br?.target_unavailable_reason??t7(`targets.unavailable`):null,Gr=Vr||Hr,Kr=Br?.streaming_response??null,qr=Br?.agent_status===`running`,Jr=!!(be&&G?.parentType===`spec`&&G.parentId===k),Yr=qr||Jr,Xr=Yr?Lr:null,Zr=qr&&Se===k,Qr=!!e&&!ve&&(F||k!==null&&!Gr),$r=!!(t?.memory_enabled&&j&&!F&&(j.pending_memory_suggestion_count>0||yt)),ei=(Cn===`opencode`||Cn===`claude`)&&(F||k!==null)&&Br?.agent_status!==`running`,ti=(0,p.useMemo)(()=>{if(!j?.messages)return null;for(let e=j.messages.length-1;e>=0;--e){let t=j.messages[e];if(t.kind===`grill-question`)return t.id}return null},[j]),ni=(0,p.useMemo)(()=>!j||j.mode!==`grill`?!1:e7(j.messages,j.latest_snapshot_created_at),[j]),ri=(0,p.useMemo)(()=>[...j?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[j]),ii=!!ri,ai=(0,p.useCallback)(async t=>{if(!e||!k||!j)return;xe(!0),fn.current+=1;let n={parentType:`spec`,parentId:k,turnKey:`spec:${fn.current}`,startedAt:performance.now()};Re(n);try{M(await HM(e,k,{instruction:t,tool:j.tool,model:En.length>0&&W||null,variant:En.length>0&&ce||null,skills:ae.length>0?ue:[]})),Le(e=>e+1)}catch(e){Re(e=>e?.turnKey===n.turnKey?null:e),Xe(e)||$.error(e instanceof Error?e.message:t7(`errors.sendPrompt`))}finally{xe(!1)}},[e,k,j,En,W,ce,ae,ue]),oi=(0,p.useCallback)(async(t,n)=>{if(!e||!j||N)return;let r=$J({parentType:`spec`,parentId:j.id,setId:n.set_id});P(n.set_id),xe(!0),fn.current+=1;let i={parentType:`spec`,parentId:j.id,turnKey:`spec:${fn.current}`,startedAt:performance.now()};Re(i);try{let r=await UM(e,j.id,t,n);M(r),Pn(r)}catch(e){if(e instanceof Ke&&e.status===409){tY(r);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?(M(t),Pn(t)):await Nn(j.id)}throw Re(e=>e?.turnKey===i.turnKey?null:e),$.error(e instanceof Error?e.message:t7(`errors.resolveQuestions`)),e}finally{P(null),xe(!1)}},[e,j,Nn,N,Pn]),si=(0,p.useCallback)(e=>{if(e.role!==`assistant`)return;let t=e.metadata,n=t?.ask_question;if(n&&j)return(0,Y.jsx)(cY,{messageContent:e.content,questionSet:n,storageKey:$J({parentType:`spec`,parentId:j.id,setId:n.id}),isActive:n.status===`pending`&&ri?.id===e.id,isDisabled:Gr||j.agent_status===`running`||N===n.id,onResolve:t=>oi(e.id,t)});if(e.kind!==`grill-question`)return;let r=t?.grill_question;if(r)return(0,Y.jsx)(B5,{question:r,isActive:Yr?!1:e.id===ti&&j?.agent_status!==`running`&&j?.mode===`grill`,isDisabled:Gr||be||ve||gt,labels:{rationaleLabel:t7(`grill.rationaleLabel`),suggestionsLabel:t7(`grill.suggestionsLabel`),recommendedSuggestionLabel:t7(`grill.recommendedSuggestionLabel`),answerPlaceholder:t7(`grill.answerPlaceholder`),submitLabel:t7(`grill.submitLabel`),submittingLabel:t7(`grill.submittingLabel`)},onSubmitAnswer:e=>{ai(e)}})},[j,Yr,be,ve,Gr,gt,ti,ri?.id,oi,N,ai]),ci=(Cn===`opencode`||Cn===`claude`)&&En.length>0,li=Cn,ui=F?t7(`composer.newSpecTitle`):j?.title??t7(`composer.specTitle`),di=ci?W||null:j?.model??null,fi=c5({availableModelsById:Ir,model:di}),pi=j?.agent_status===`stopped`,mi=t7(`composer.placeholderSpec`),hi=D.some(e=>e.agent_status!==`running`),gi=(0,p.useMemo)(()=>({ariaLabel:t7(`sidebar.ariaLabel`),newSession:t7(`sidebar.newSession`),collapseAriaLabel:t7(`sidebar.collapseAriaLabel`),openAriaLabel:t7(`sidebar.openAriaLabel`),cancelSelection:t7(`sidebar.cancelSelection`),deleteSelected:t7(`sidebar.deleteSelected`),selectedCount:e=>`${e} selected`,select:t7(`sidebar.select`),loadingSessions:t7(`sidebar.loadingSessions`),noSessions:t7(`sidebar.noSessions`),deleteSessionAriaLabel:t7(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>t7(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>t7(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>t7(`sidebar.deleteSessionTitle`,{title:e})}),[]),_i=(0,p.useMemo)(()=>({title:t7(`deleteModal.title`),bulkTitle:t7(`deleteModal.bulkTitle`),description:t7(`deleteModal.description`),bulkDescription:e=>t7(`deleteModal.bulkDescription`,{count:e}),cancel:t7(`deleteModal.cancel`),delete:t7(`deleteModal.delete`),deleting:t7(`deleteModal.deleting`)}),[]),vi=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:!t&&ze.has(e.id)?`finished`:null,[ze]),yi=(0,p.useCallback)(e=>e.agent_status===`running`?t7(`sidebar.cannotDeleteRunning`):null,[]),bi=!!(t?.memory_enabled&&k&&!F),xi=(0,p.useCallback)(e=>{let r=g5({session:e,activeProject:t,activeProjectBranchState:n}),i=bi&&e.pending_memory_suggestion_count>0?n7(e.pending_memory_suggestion_count):null,a=(e.linked_ticket_count??0)+(e.linked_chat_count??0);return a>0?[e.title,r,i,t7(`sidebar.linkedImplementationsAriaLabel`,{itemCount:a})].filter(Boolean).join(` `):e.has_completed_work===1?[e.title,r,i,t7(`sidebar.linkedImplementationsAriaLabelHistorical`)].filter(Boolean).join(` `):[e.title,r,i].filter(Boolean).join(` `)},[t,n,bi]),Si=e=>{let t=e.first_user_message_preview??e.messages?.find(e=>e.role===`user`)?.content;return t&&t.replace(/\s+/g,` `).trim()||null},Ci=(0,p.useCallback)(({session:e,activityState:r})=>{let i=Si(e),a=g5({session:e,activeProject:t,activeProjectBranchState:n}),o=e.linked_ticket_count??0,s=e.linked_chat_count??0,c=o+s,l=e.has_completed_work===1||c>0,u=c>0,d=u?t7(`sidebar.linkedImplementationsTooltip`,{ticketCount:o,chatCount:s}):t7(`sidebar.linkedImplementationsTooltipHistorical`),f=bi&&e.pending_memory_suggestion_count>0;return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,Y.jsx)(`div`,{className:`mb-1 truncate text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground/75`,children:a}):null,(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 truncate text-[13px] font-medium leading-5`,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:e.title}),f?(0,Y.jsx)(oT,{tone:`muted`,className:`shrink-0`,"aria-label":n7(e.pending_memory_suggestion_count),title:n7(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null,l&&(0,Y.jsx)(vv,{content:d,children:(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 text-[11px] text-indigo-500 dark:text-indigo-400`,children:[(0,Y.jsx)(zF,{className:`size-3`}),u&&(0,Y.jsx)(`span`,{children:c})]})})]}),i?(0,Y.jsx)(`div`,{className:`mt-0.5 line-clamp-1 text-xs leading-4 text-muted-foreground`,children:i}):null,e.target_available===!1?(0,Y.jsx)(`div`,{className:`mt-1 line-clamp-1 text-[11px] leading-4 text-amber-200/90`,children:e.target_unavailable_reason??t7(`targets.unavailable`)}):null]}),(0,Y.jsx)(tb,{state:r,className:`mt-1`})]})},[t,n,bi]),wi=qr?(0,Y.jsx)(V8,{isInterrupting:Zr,onStop:()=>{k&&qn(k)},interruptLabel:t7(`composer.interrupt`),interruptingLabel:t7(`composer.interrupting`)}):null,Ti=(0,p.useMemo)(()=>En.find(e=>e.id===W)??null,[En,W]),Ei=({model:t=W,variant:n=ce,skills:r=ue}={})=>{F&&w7({projectId:e,tool:d,model:t||null,variant:t&&n||null,skills:d===`opencode`?r:[]})},Di=Cn===`opencode`||Cn===`claude`?Me||Dn?(0,Y.jsx)(DY,{}):En.length>0?(0,Y.jsx)(OY,{model:W,variant:ce,skills:ue,showModelSelector:!0,showSkillsSelector:ae.length>0,availableModels:En,availableSkills:ae,selectedModel:Ti,onModelChange:e=>{let t=En.find(t=>t.id===e)??null,n=t&&t.variants.includes(ce)?ce:``;se(e),le(n),Ei({model:e,variant:n})},onVariantChange:e=>{le(e),Ei({variant:e})},onSkillsChange:e=>{de(e),Ei({skills:e})},modelSelectId:`spec-model-select`,variantSelectId:`spec-variant-select`,skillsSelectId:`spec-skills-select`}):null:null,Oi=(0,p.useMemo)(()=>we.length===1?D.find(e=>e.id===we[0])?.title??``:``,[we,D]),ki=(0,p.useMemo)(()=>D.filter(e=>we.includes(e.id)),[D,we]),Ai=zr&&j!==null,ji=Ai&&!Je&&!et,Mi=Ai&&(Je||et),Ni=j?.tool??d,Pi=Ni===`opencode`&&En.length>0,Fi=(0,p.useMemo)(()=>En.find(e=>e.id===Ft)??null,[En,Ft]),Ii=Ve&&Ai?{review:Tt,isRunning:kt||jt,isLoading:Dt,availableModels:En,showModelSelector:Pi,runConfigTool:Ni,runConfigModel:Ft,runConfigVariant:Lt,selectedDiscoveredModel:Fi,onRunConfigModelChange:t=>{let n=En.find(e=>e.id===t)??null;It(t),Bt(!!t),t||dme({projectId:e,tool:Ni}),Rt(e=>n&&n.variants.includes(e)?e:``)},onRunConfigVariantChange:e=>{Rt(e),Bt(!!Ft)},onLaunchReview:()=>{xr()},onStopReview:()=>{Sr()},onSendToPlanner:()=>{Cr()},isSendingToPlanner:Nt,disabledReason:Wr??Ur}:void 0;(0,p.useEffect)(()=>{if(Ni!==`opencode`){It(``),Rt(``),Bt(!1);return}let t=lme({projectId:e,tool:Ni}),n=t?.model??``;It(n),Rt(n?t?.variant??``:``),Bt(!!n)},[e,Ni]),(0,p.useEffect)(()=>{Ai||(Wt.current=null,Gt.current=null,qt.current=!1,Jt.current=!1,$e(!1),tt(!1),Qn())},[Ai,Qn]),(0,p.useEffect)(()=>()=>{Qn()},[Qn]);let Li=(0,Y.jsx)(vv,{content:t7(`artifactPanel.open`),disabled:!ji,side:`left`,children:(0,Y.jsx)(`div`,{ref:Ht,className:Z(ji?`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`,J&&!ji&&`bg-background`),role:ji?`button`:`separator`,tabIndex:ji?0:void 0,"aria-label":t7(ji?`artifactPanel.open`:`artifactPanel.resize`),"aria-valuemin":ji?void 0:l7,"aria-valuemax":ji?void 0:Vt.current?Math.round(Vt.current.clientWidth*u7):800,"aria-valuenow":ji?void 0:Ze,onClick:ji?()=>{if(Jt.current){Jt.current=!1;return}Ye(!0)}:void 0,onPointerDown:rr,onPointerMove:ir,onPointerUp:ar,onPointerCancel:or,onLostPointerCapture:sr,children:ji?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`hidden h-full w-full items-center justify-center xl:flex`,children:(0,Y.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,Y.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,Y.jsx)($5,{className:`h-3 w-3 shrink-0`})}),(0,Y.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,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium xl:hidden`,children:[(0,Y.jsx)($5,{className:`h-3.5 w-3.5`}),(0,Y.jsx)(`span`,{children:t7(`artifactPanel.title`)})]})]}):(0,Y.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,J?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})})}),Ri=F&&br?(0,Y.jsx)(BY,{providers:yr,onImported:_r,inputId:`spec-draft-external-import`,className:`max-w-md`,showImportSpinner:!0,showImportErrorToast:!1}):null,zi=j?j.mode===`grill`:mt,Bi=ni;hn.current=Bi,gn.current=ii;let Vi=(0,Y.jsx)(V5,{on:zi,disabled:gt||qr||ve||be||ii||Gr,tooltipContent:t7(`grill.toggleTooltip`),ariaLabelOn:t7(`grill.toggleAriaLabelOn`),ariaLabelOff:t7(`grill.toggleAriaLabelOff`),onToggle:e=>{Er(e)}}),Hi=ome(Sn),Ui=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Hi?(0,Y.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,Y.jsx)(`div`,{className:`font-medium`,children:t7(`importNotice.title`)}),(0,Y.jsx)(`div`,{children:Hi})]}):null,(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[Vi,Ri,wi,F&&t&&(0,Y.jsx)(Jy,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:Wb.t(`common:projectTargetSelector.newSpecAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l})]})]}),Wi=Di,Gi=(0,p.useCallback)(t=>{j?gr(m7({projectId:e,sessionId:j.id})):H(null),fr(yn,t)},[j,e,yn,fr,gr]),Ki=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(Mpe,{projectId:e,specSessionId:F?null:k,messages:Rr,internalLog:Br?.agent_log??null,currentThinkingMessageId:Br?.agent_message_id??null,previousThinkingLog:Br?.previous_agent_log??null,previousThinkingMessageId:Br?.previous_agent_message_id??null,pendingAgentTitle:Xr,streamingResponse:Kr,isRunning:Yr,isLoading:!F&&ge,canShowComposer:Qr,isExternallyResizing:J,layoutKey:j?.id??`spec-draft`,scrollLayoutKey:Ai?Mi?`artifact-visible`:`artifact-hidden`:`artifact-disabled`,header:(0,Y.jsx)($8,{title:ui,tool:F?null:j?.tool??null,modelLabel:fi,interrupted:pi,interruptedLabel:t7(`sidebar.interrupted`),usage:{totalTokens:j?.usage_snapshot_total_tokens??null,contextWindow:j?.usage_snapshot_context_window??null,cost:j?.usage_snapshot_cost??null,tool:li,model:di,availableModels:En},metadataExtra:j?.external_source?(0,Y.jsx)(ZF,{externalSource:j.external_source}):null,actions:j&&e?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[$r&&(0,Y.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>St(!0),children:yt?t7(`composer.loadingMemory`):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:t7(`composer.memorySuggestions`)}),(0,Y.jsx)(oT,{children:_t.length})]})}),(0,Y.jsx)(r3,{projectId:e,scope:{type:`spec`,id:j.id},size:`xs`,onNavigateToLifecycleSource:b})]}):null,warnings:Hr&&Ur?(0,Y.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,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`div`,{children:Ur}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,disabled:ct===j?.id,onClick:()=>{j&&Kn(j)},children:ct===j?.id?t7(`targets.switchingBack`):t7(`targets.switchBack`)}),(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:Vn,children:t7(`composer.startNewSession`)})]})]})}):Vr&&Wr?(0,Y.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:Wr}):null}),composerControls:Ui,composerInlineControls:Wi,composerTheme:`default`,composerFocusNonce:Ie,pendingAgentRevealKey:Yr&&G?.parentId===k?G?.turnKey??null:null,pendingAgentRevealDelayMs:Yr&&G?.parentId===k?400:0,liveResponseTiming:G,followUpPrompt:xn,draftAttachments:wn,followUpPlaceholder:mi,emptyStateText:null,isSendingFollowUp:be||ve,isComposerSubmitDisabled:Bi||ii||Gr,isUploadingAttachments:Tn,canAttachImages:ei,followUpDisabledReason:Wr??Ur??(Br?.agent_status===`running`?t7(`composer.waitTurn`):Tn?t7(`composer.waitUpload`):Bi?t7(`composer.waitGrill`):ii?Wb.t(`common:questionSet.waitForResolution`):void 0),renderMessageBody:si,onFollowUpPromptChange:Gi,onFollowUpKeyDown:Pr,onFollowUpPaste:Fr,onUploadAttachments:e=>{kr(e)},onRemoveAttachment:e=>{jr(e)},onFollowUpSubmit:()=>{Dr()}})}),qi=!zr&&me&&!fe?(0,Y.jsx)(z8,{title:t7(`composer.noSessionSelectedTitle`),description:t7(`composer.noSessionSelectedDescription`),startNewSessionLabel:t7(`composer.startNewSession`),onStartNewSession:Vn,canStartNewSession:!!e&&!ve&&!be}):zr&&!F&&!ge&&!j?(0,Y.jsx)(L8,{label:t7(`composer.loadingSession`)}):!me||fe?(0,Y.jsx)(R8,{label:t7(`sidebar.loadingSessions`)}):Ki,Ji=xt&&e&&t?.memory_enabled?(0,Y.jsx)(gC,{onClose:()=>St(!1),overlayClassName:`bg-background/45 p-4 backdrop-blur-sm`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,Y.jsxs)(xC,{size:`sm`,className:`max-h-[calc(100vh-2rem)] w-full gap-0 overflow-hidden border-border/80 bg-card/95 shadow-2xl`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/80 pb-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(CC,{children:t7(`composer.memorySuggestionsTitle`)}),(0,Y.jsx)(wC,{children:t7(`composer.memorySuggestionsDescription`)})]}),(0,Y.jsx)(TC,{children:t})]}),(0,Y.jsx)(EC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,Y.jsx)(e5,{projectId:e,suggestions:_t,emptyState:t7(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:Ln})})]}),closeButtonLabel:t7(`composer.closeMemorySuggestions`)}):null,Yi=ki.length>0?(0,Y.jsx)(I8,{count:ki.length,title:Oi,isDeleting:Ee.size>0,onConfirm:()=>{lr()},onCancel:()=>{Ee.size>0||Te([])},labels:_i}):null,Xi=ft===null?null:(0,Y.jsx)(_C,{title:t7(`actions.exportConflictTitle`),description:t7(`actions.exportConflictDescription`,{path:ft.path}),confirmLabel:t7(`actions.exportConflictConfirm`),cancelLabel:t7(`actions.exportConflictCancel`),confirmVariant:`destructive`,onConfirm:()=>{pt(null),Zn({projectId:ft.projectId,sessionId:ft.sessionId,snapshotId:ft.snapshotId,overwrite:!0})},onCancel:()=>{pt(null)}});return(0,Y.jsxs)(`div`,{"data-testid":`spec-view-shell`,className:`relative flex min-h-0 flex-1 overflow-hidden border-t border-border/70`,children:[(0,Y.jsx)(B8,{sessions:D,sessionGroups:Nr,activeSessionId:k,isDraftOpen:F,isLoadingSessions:fe,isOpen:Pe,onToggleOpen:()=>{Fe(t=>{let n=!t;return tme({projectId:e,isOpen:n}),n})},testId:`spec-sessions-sidebar`,railTestId:`spec-sessions-rail`,onDraftOpen:Vn,isCreatingSession:ve||!e,isSendingPrompt:be,newSessionShortcutHint:Un,newSessionTooltip:Wn,isSelectionMode:Oe,selectedSessionIds:Ae,selectedSessionCount:Ae.size,hasDeletableSessions:hi,deletingSessionIds:Ee,onEnterSelectionMode:()=>{ke(!0),je(new Set)},onExitSelectionMode:()=>{ke(!1),je(new Set)},onToggleSessionSelection:e=>{je(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:Mr,onConfirmDeleteSelectedSessions:()=>{Te(Array.from(Ae))},onSessionSelect:e=>{Gn(e)},onConfirmDeleteSession:e=>{Te([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:yi,getActivityState:vi,getRowAriaLabel:xi,renderRowContent:Ci,labels:gi}),(0,Y.jsxs)(`div`,{ref:Vt,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden xl:flex-row`,children:[(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:qi}),Ai?(0,Y.jsxs)(Y.Fragment,{children:[Li,Mi?(0,Y.jsx)(qpe,{snapshot:Ve,isLoading:Ge,desktopWidth:Ze,onClose:cr,ref:Ut,actions:Ve?{onCreateTickets:Yn,onImplementInChat:()=>{Xn()},onExport:()=>{Zn()},isCreatingTickets:nt,isImplementingInChat:it,isExporting:ot,hasExistingTicketsFromSnapshot:ut,unavailableReason:Wr,implementInChatUnavailableReason:Ve.bundle_groups.length>1?t7(`actions.implementInChatMultiBundleUnavailable`):null}:void 0,review:Ii}):null]}):null]}),Ji,Yi,Xi]})},O7=()=>({hasRunning:!1,hasFinishedUnseen:!1,hasErrorUnseen:!1}),k7=()=>({board:O7(),chat:O7(),spec:O7(),memory:O7()}),A7=(e,t)=>{let n=e[t];return!n.hasFinishedUnseen&&!n.hasErrorUnseen?e:{...e,[t]:{...n,hasFinishedUnseen:!1,hasErrorUnseen:!1}}},mme=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}),j7=e=>e.hasErrorUnseen?`error`:e.hasRunning?`running`:e.hasFinishedUnseen?`finished`:null,hme=(e,t)=>t?null:j7(e),M7=320,gme=.7,_me=28,vme=6,yme=(e,t)=>{let n=Math.max(M7,Math.round(t*gme));return Math.max(M7,Math.min(n,Math.round(e)))},bme=(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},xme=(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},Sme=(e,t)=>{if(t.type===`reset`)return k7();if(t.type===`mark-workspace-visible`)return A7(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}},Cme=({activeProjectId:e,onActivity:t})=>{let{tickets:n}=E8(),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},wme=({activeProjectId:e,onActivity:t})=>{let n=bq(),[r,i]=(0,p.useState)([]),a=(0,p.useRef)(new Map);return(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController;return(async()=>{try{let n=await CM(e,t.signal);if(t.signal.aborted)return;i(n)}catch(e){Xe(e)}})(),()=>{t.abort()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=ax(()=>{document.visibilityState===`visible`&&CM(e,t.signal).then(e=>{t.signal.aborted||i(e)}).catch(e=>{Xe(e)})});return()=>{t.abort(),n()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||i(e=>bme(e,t))},r=t=>{!t||t.project_id!==e||i(e=>e.filter(e=>e.id!==t.id))};return n.on(`chat-session:created`,t),n.on(`chat-session:updated`,t),n.on(`chat-session:deleted`,r),()=>{n.off(`chat-session:created`,t),n.off(`chat-session:updated`,t),n.off(`chat-session:deleted`,r)}},[e,n]),(0,p.useEffect)(()=>{let n=a.current,i=new Map,o=[],s=!1;for(let e of r){let t=n.get(e.id)??null,r=e.agent_status??null;t===`running`&&r===`done`&&o.push(e),t===`running`&&r===`error`&&(s=!0),i.set(e.id,r)}a.current=i;for(let e of o)if(e.title){let t=Tfe({projectId:e.project_id,chatSessionId:e.id,agentMessageId:e.agent_message_id});t&&C8({title:`Chat response ready`,body:e.title,key:t,destination:{kind:`chat-session`,projectId:e.project_id,chatSessionId:e.id}})}o.length>0&&e&&$3(e),t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:o.length>0,didError:s})},[e,t,r]),null},Tme=({activeProjectId:e,onActivity:t})=>{let n=bq(),[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 LM(e,t.signal);if(t.signal.aborted)return;i(n)}catch(e){Xe(e)}})(),()=>{t.abort()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=ax(()=>{document.visibilityState===`visible`&&LM(e,t.signal).then(e=>{t.signal.aborted||i(e)}).catch(e=>{Xe(e)})});return()=>{t.abort(),n()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||i(e=>xme(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)if(e.title){let t=Efe({projectId:e.project_id,specSessionId:e.id,agentMessageId:e.agent_message_id,latestSnapshotId:e.latest_snapshot_id});t&&C8({title:`Spec response ready`,body:e.title,key:t,destination:{kind:`spec-session`,projectId:e.project_id,specSessionId:e.id}})}t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:i.length>0,didError:o})},[e,t,r]),null},Eme=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeRun:u,activeTool:d,onRestoreSessionTarget:f,onChatReviewCapabilityChange:m,routedInspectionReviewCapability:h,onPreviewReviewCapabilityChange:g,previewDisplayMode:_=`hidden`,previewPane:v=null,previewPaneWidth:y=480,isPreviewButtonDisabled:b=!1,previewButtonTitle:x,visibleWorkspace:S,onProjectUsageChange:C,onBundlesChange:w,onBundlesLoadingChange:T,onBoardLoadedProjectIdChange:E,onPreviewToggle:D,onPreviewPaneWidthChange:O,onRunStopped:k,onRunStatusChange:A,onWorkspaceActivityChange:j,onWorkspaceActivityEvent:M,pendingWorkspaceNavigation:N=null,onPendingWorkspaceNavigationConsumed:P,routedTicketId:F=null,onRoutedTicketOpen:I,onRoutedTicketClose:L,onRoutedTicketUnavailable:R,routedBundleId:ee=null,routedChatSessionId:te,routedSpecSessionId:z,routedSpecSnapshotId:B,routedInspection:V=null,onRoutedBundleOpen:H,onRoutedBundleClose:U,onRoutedInspectionOpen:ne,onRoutedInspectionModeChange:re,onRoutedInspectionClose:ie,onChatSessionNavigation:ae,onSpecSessionNavigation:oe,onRoutedEntityUnavailable:W,onSpecImplementationChatReady:se,onViewSourceSpec:ce,onNavigateToLifecycleSource:le,onViewMemorySource:ue,onStartChatFromBundle:de,onOpenProjectExecutionSettings:fe,refreshKey:pe=0,boardFilterState:me,onBoardFilterStateChange:he})=>{let ge=(0,p.useRef)(null),_e=(0,p.useRef)(null),ve=(0,p.useRef)(null),ye=(0,p.useRef)(null),be=(0,p.useRef)(!1),xe=(0,p.useRef)(!1),Se=(0,p.useRef)(0),Ce=(0,p.useRef)(y),we=(0,p.useRef)(y),Te=S===`board`||S===`chat`,Ee=v!==null,[De,Oe]=(0,p.useState)(!1),[ke,Ae]=(0,p.useState)(!1),[je,Me]=(0,p.useState)(y),[Ne,Pe]=(0,p.useReducer)(Sme,void 0,k7),Fe=Te&&Ee&&_===`expanded`,Ie=Te&&Ee&&_===`inline`,Le=Te&&Ee&&_===`hidden`&&!ke,G=(Ie||ke)&&!Fe,Re=Fe||G,ze=Te&&Ee&&!Fe,Be=De?je:y,Ve=S!==`chat`||!G,He=e=>{let t=ve.current,n=ye.current,r=be.current;if(t!==null){if(ve.current=null,ye.current=null,be.current=!1,Oe(!1),Ae(!1),e!==null&&_e.current?.hasPointerCapture(e)&&_e.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;O?.(we.current),D?.();return}O?.(we.current)}},Ue=e=>{if(!ge.current)return;let t=ge.current.getBoundingClientRect().width,n=yme(e,t);we.current=n,Me(n)},K=e=>{O&&(Le&&b||(e.preventDefault(),ve.current=e.pointerId,ye.current=Le?`collapsed`:`inline`,be.current=!1,xe.current=!1,Se.current=e.clientX,Ce.current=Le?0:we.current,Oe(!Le),e.currentTarget.setPointerCapture(e.pointerId)))},We=e=>{if(ve.current!==e.pointerId)return;let t=e.clientX-Se.current,n=Ce.current-t;if(ye.current===`collapsed`){if(!be.current&&n<vme)return;be.current||(be.current=!0,xe.current=!0,Ae(!0),Oe(!0))}Ue(n)},Ge=e=>{if(ve.current===e.pointerId){if(ye.current===`inline`||be.current){let t=e.clientX-Se.current;Ue(Ce.current-t)}He(e.pointerId)}},Ke=e=>{ve.current===e.pointerId&&He(e.pointerId)},qe=(0,p.useCallback)((e,t)=>{M?.(e,t),Pe({type:`update-workspace`,workspace:e,activity:t,visibleWorkspace:S})},[M,S]);(0,p.useEffect)(()=>{Pe({type:`reset`})},[e]),(0,p.useEffect)(()=>{S!==`memory`&&Pe({type:`mark-workspace-visible`,workspace:S})},[S]),(0,p.useEffect)(()=>{j?.(Ne)},[j,Ne]),(0,p.useEffect)(()=>{De||(we.current=y),!Ee&&(ve.current=null,ye.current=null,be.current=!1,xe.current=!1,we.current=y)},[Ee,De,y]);let q=()=>{if(xe.current){xe.current=!1;return}b||D?.()},Je=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),q())},Ye=(r=!1)=>(0,Y.jsx)(Ffe,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,activeRun:u,activeTool:d,inspectionOnly:r,onPreviewReviewCapabilityChange:r?void 0:g,onRunStopped:k,onRunStatusChange:A,onViewSourceSpec:ce,onNavigateToLifecycleSource:le,onStartChatFromBundle:de,onOpenProjectExecutionSettings:fe,refreshKey:pe,boardFilterState:me,onBoardFilterStateChange:he,onInitialTicketNavigationUnavailable:R,routedTicketId:F,onTicketOpen:I,onTicketClose:L,routedBundleId:ee,routedInspection:V,routedInspectionReviewCapability:r&&S===`chat`?h:void 0,onBundleOpen:H,onBundleClose:U,onInspectionOpen:ne,onInspectionModeChange:re,onInspectionClose:ie,onInspectionUnavailable:W,initialImportedDraft:N?.workspace===`board`&&`issueDraft`in N?N.draft:null,onInitialImportedDraftConsumed:P});return(0,Y.jsx)(jfe,{activeProjectId:e,refreshKey:pe,onLoadedProjectIdChange:E,onProjectUsageChange:C,onBundlesChange:w,onBundlesLoadingChange:T,children:(0,Y.jsxs)(`div`,{ref:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(Cme,{activeProjectId:e,onActivity:e=>{qe(`board`,e)}}),(0,Y.jsx)(wme,{activeProjectId:e,onActivity:e=>{qe(`chat`,e)}}),(0,Y.jsx)(Tme,{activeProjectId:e,onActivity:e=>{qe(`spec`,e)}}),S===`spec`?(0,Y.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,Y.jsx)(pme,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,onRestoreSessionTarget:f,activeTool:d,routedSpecSessionId:z,routedSpecSnapshotId:B,initialIssueDraft:N?.workspace===`spec`&&`issueDraft`in N?N.draft:null,onRoutedSpecNavigationUnavailable:W,onSessionNavigation:oe,onInitialIssueDraftConsumed:P,onImplementInChat:se,onNavigateToLifecycleSource:le})}):S===`memory`?(0,Y.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,Y.jsx)(Spe,{activeProject:t,onNavigateToSource:ue})}):(0,Y.jsxs)(`div`,{id:S===`chat`?`project-workspace-panel-chat`:`project-workspace-panel-board`,role:`tabpanel`,"aria-labelledby":S===`chat`?`project-workspace-tab-chat`:`project-workspace-tab-board`,className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:S===`chat`?(0,Y.jsx)(bpe,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeTool:d,routedChatSessionId:te,initialDraftOpen:N?.workspace===`chat`&&`startNewDraft`in N,onInitialDraftOpenConsumed:P,initialSpecDraft:N?.workspace===`chat`&&`draft`in N?{text:N.draftText,specSessionId:N.specSessionId,specSnapshotId:N.specSnapshotId}:null,onInitialSpecDraftConsumed:P,onRoutedChatNavigationUnavailable:W,onSessionNavigation:ae,onViewSourceSpec:ce,onNavigateToLifecycleSource:le,isExternallyResizing:De,onRestoreSessionTarget:f,onReviewCapabilityChange:m,showChangesPanel:Ve}):Ye()}),[ze?(0,Y.jsx)(vv,{content:b?x??`Preview unavailable`:`Open preview`,disabled:!Le,side:`left`,children:(0,Y.jsx)(`div`,{"aria-label":Le?x??`Show preview`:`Resize preview pane`,"aria-orientation":Le?void 0:`vertical`,className:Le?`group flex shrink-0 touch-none select-none items-center justify-center border-l border-border/70 bg-background/90 transition-colors ${b?`cursor-not-allowed text-muted-foreground/60`:`cursor-col-resize text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`:`group flex w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 ${De?`bg-background`:``}`,"data-preview-divider":`true`,"data-testid":Le?`collapsed-preview-rail`:void 0,onLostPointerCapture:Ke,onPointerCancel:Ge,onPointerDown:K,onPointerMove:We,onPointerUp:Ge,onClick:Le?q:void 0,onKeyDown:Le?Je:void 0,ref:_e,role:Le?`button`:`separator`,style:Le?{width:`${_me}px`}:void 0,tabIndex:Le?b?-1:0:void 0,children:Le?(0,Y.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,Y.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,Y.jsx)(xpe,{className:`h-3 w-3 shrink-0`})}),(0,Y.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,Y.jsx)(`div`,{className:`h-14 w-1.5 rounded-full transition-colors ${De?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`}`})})},`preview-divider`):null,Re?(0,Y.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:`${Be}px`},children:(0,Y.jsx)(`div`,{className:`h-full w-full`,children:v})},`preview-container`):null]]}),S!==`board`&&V&&Ye(!0)]})})},Dme=({isExpanded:e,isVisible:t,project:n,onClose:r,onToggleExpanded:i})=>(0,Y.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,Y.jsx)(L4,{createSession:()=>Doe(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})}),Ome=({activeWorkspace:e,activityByWorkspace:t,className:n,memoryEnabled:r=!1,onWorkspaceChange:i})=>{let{t:a}=K(`common`,{keyPrefix:`workspaceTabs`}),o=r?[`board`,`chat`,`spec`,`memory`]:[`board`,`chat`,`spec`],s={board:a(`board`),chat:a(`chat`),spec:a(`spec`),memory:a(`memory`)};return(0,Y.jsx)(`div`,{className:Z(`min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,n),children:(0,Y.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=hme(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,Y.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,Y.jsxs)(`span`,{className:`inline-flex items-center gap-2 whitespace-nowrap`,children:[(0,Y.jsx)(`span`,{children:s[n]}),(0,Y.jsx)(tb,{state:a,className:`mt-0`})]})},n)})})})},N7=32,kme=5.5,Ame=2,jme=24,Mme=8,P7=new Map,Nme={running:{fill:`#fcd34d`,stroke:`#f59e0b`},finished:{fill:`#34d399`,stroke:`#059669`},error:{fill:`#fb7185`,stroke:`#e11d48`}},F7=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),I7=e=>{if(!e)return null;let t=e.trim().match(/^([0-9]+(?:\.[0-9]+)?)/);return t?Number(t[1]):null},L7=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=I7(n.getAttribute(`width`)),a=I7(n.getAttribute(`height`)),o=r??(i&&a?`0 0 ${i} ${a}`:`0 0 ${N7} ${N7}`);return`<svg ${[Array.from(n.attributes).filter(e=>![`width`,`height`,`viewBox`,`x`,`y`,`preserveAspectRatio`].includes(e.name)).map(e=>`${e.name}="${F7(e.value)}"`).join(` `),`x="0"`,`y="0"`,`width="${N7}"`,`height="${N7}"`,`viewBox="${F7(o)}"`,`preserveAspectRatio="xMidYMid meet"`].filter(e=>e.length>0).join(` `)}>${n.innerHTML}</svg>`},Pme=async e=>{if(!e)return null;let t=P7.get(e);if(t)return t;let n=(async()=>{try{if(e.startsWith(`data:image/svg+xml,`))return L7(decodeURIComponent(e.slice(19)));if(e.startsWith(`data:image/svg+xml;base64,`))return L7(atob(e.slice(26)));let t=await fetch(e);return t.ok?L7(await t.text()):null}catch{return null}})();return P7.set(e,n),n},Fme=async(e,t)=>{let{fill:n,stroke:r}=Nme[e],i=await Pme(t);return i?[`<svg xmlns="http://www.w3.org/2000/svg" width="${N7}" height="${N7}" viewBox="0 0 ${N7} ${N7}">`,i,`<circle cx="${jme}" cy="${Mme}" r="${kme}" fill="${n}" stroke="${r}" stroke-width="${Ame}"/>`,`</svg>`].join(``):null},Ime=async(e,t)=>{if(!e)return t;let n=await Fme(e,t);return n?`data:image/svg+xml,${encodeURIComponent(n)}`:t},Lme=()=>{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},R7=({defaultHref:e,state:t})=>{let n=Lme(),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}Ime(t,e).then(e=>{if(n.dataset.browserTabActivityRequestId===String(r)){if(e){n.href=e;return}n.removeAttribute(`href`)}})},Rme=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.archonDesktop===!0&&typeof t.modalHasParentEntry==`boolean`&&(t.modalParentDepth===void 0||Number.isInteger(t.modalParentDepth)&&t.modalParentDepth>0)},z7=e=>!Rme(e)||!e.modalHasParentEntry?0:e.modalParentDepth??1,zme=(e=p8)=>{let[t,n]=(0,p.useState)(()=>e.parse(window.location.pathname)),[r,i]=(0,p.useState)(0),a=(0,p.useRef)(!1);(0,p.useEffect)(()=>{a.current||(a.current=!0,t&&e.isModal(t)&&window.history.replaceState({archonDesktop:!0,modalHasParentEntry:!1},``,e.build(t)))},[e,t]),(0,p.useEffect)(()=>{let t=()=>{n(e.parse(window.location.pathname)),i(e=>e+1)};return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let o=(0,p.useCallback)(t=>{let r=e.isModal(t)?z7(window.history.state):0,a={archonDesktop:!0,modalHasParentEntry:r>0,...r>1?{modalParentDepth:r}:{}};window.history.replaceState(a,``,e.build(t)),n(t),i(e=>e+1)},[e]),s=(0,p.useCallback)(t=>{let r=e.isModal(t);window.history.pushState({archonDesktop:!0,modalHasParentEntry:r},``,e.build(t)),n(t),i(e=>e+1)},[e]),c=(0,p.useCallback)(t=>{let r=z7(window.history.state);if(r===0){o(t);return}let a=r>0?r+1:0,s={archonDesktop:!0,modalHasParentEntry:a>0,...a>1?{modalParentDepth:a}:{}};window.history.pushState(s,``,e.build(t)),n(t),i(e=>e+1)},[e,o]);return{closeModal:(0,p.useCallback)((t,n)=>{let r=z7(window.history.state);if(r===1){window.history.back();return}if(r>1){window.history.go(-r);return}let i=e.parent(t),a=n??i;a&&o(a)},[e,o]),navigationVersion:r,push:s,pushModalSibling:c,replace:o,route:t}},B7=(e,t)=>Wb.t(`common:projectFooter.${e}`,t),Bme=1e3,V7=`archon.active-project-id`,H7=`archon.workspace-by-project`,U7=`archon.preview-mode-by-project`,W7=`archon.dismissed-preview-run-context-by-project`,G7=5e3,K7=`archon.preview-pane-width`,q7=`archon.preview-viewport-preset`,J7=`archon.preview-zoom`,Vme=480,Hme=`responsive`,Ume=1,Y7={hasMounted:!1,isOpen:!1,isExpanded:!1},X7=`hidden`,Wme=(0,p.lazy)(()=>iG(()=>Promise.resolve().then(()=>P6).then(e=>({default:e.WorkspaceReviewModal})),void 0)),Gme=(0,p.lazy)(()=>iG(()=>import(`./VerificationDialog-ayyiyvGt.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),Kme=(0,p.lazy)(()=>iG(()=>import(`./GitHubActionsDialog-D7iT7xTt.js`).then(e=>({default:e.GitHubActionsDialog})),__vite__mapDeps([20,3]))),qme=(0,p.lazy)(()=>iG(()=>import(`./ActivityView-BaoAJ8JM.js`).then(e=>({default:e.ActivityView})),[])),Z7=e=>{if(!e)return null;try{return JSON.parse(e)}catch{return null}},Jme=e=>{let t=e.startsWith(`/`)?e.slice(1).split(`/`):[];if(t[0]!==`app`||t[1]!==`projects`||!t[2])return null;try{return decodeURIComponent(t[2])||null}catch{return null}},Yme=e=>e?.kind===`workspace`?e.workspace:e?.kind===`chat-session`?`chat`:e?.kind===`spec-session`||e?.kind===`spec-snapshot`?`spec`:`board`,Q7=e=>{let t=Z7(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]},$7=e=>{let t=Z7(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}]}):[]},Xme=e=>{let t=Z7(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}]}):[]},Zme=e=>{let t=new Set(kw(e)),n=new Set(Aw(e)),r=new Set(Bne(e)),i=new Set(Vne(e));return{name:e.name,repoPath:e.repo_path,buildExecutionProvider:e.build_execution_provider??`host`,linkedProjectIds:e.linked_project_ids,runSetup:Q7(e.run_setup),runServices:$7(e.run_services),checkDefinitions:Ow(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),autoFix:i.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??``,reviewerModel:e.reviewer_model??``,reviewerVariant:e.reviewer_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:Xme(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}},e9=e=>{let t=e.previewServiceName?.trim()||null,n=e.previewPath?.trim()||``,r=n===``||n===`/`?null:n,i=t||r||e.previewCapabilityMode===`force_web`||e.previewCapabilityMode===`force_disabled`?e.previewCapabilityMode??`auto`:null;return{name:e.name,repo_path:e.repoPath,build_execution_provider:e.buildExecutionProvider??`host`,linked_project_ids:e.linkedProjectIds,run_setup:e.runSetup.length>0?e.runSetup:null,run_services:e.runServices.length>0?e.runServices.map(e=>({...e.name?{name:e.name}:{},cmd:e.cmd,...e.cwd?{cwd:e.cwd}:{}})):null,check_definitions:(e.checkDefinitions??[]).map(e=>e.category===`test`?{id:e.id,name:e.name,category:`test`,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs),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)),auto_fix_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.autoFix).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),run_ide:e.runIde||null,preview_service_name:t,preview_path:r,preview_capability_mode:i,helper_model:e.helperModel||null,helper_variant:e.helperModel&&e.helperVariant||null,...e.reviewerModel===void 0?{}:{reviewer_model:e.reviewerModel||null,reviewer_variant:e.reviewerModel&&e.reviewerVariant||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}},Qme=e=>e?Q7(e.run_setup).length>0||$7(e.run_services).length>0||(e.run_ide?.trim().length??0)>0:!1,t9=(e,t,n)=>`${e} ${e===1?t:n}`,$me=e=>{if(!e.repo_path_locked)return null;let t=[];return e.ticket_count>0&&t.push(t9(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&t.push(t9(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 `)}.`},ehe=(e,t)=>{if(t.length<=1)return`Keep at least one project in Archon.`;let n=[];e.ticket_count>0&&n.push(t9(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&n.push(t9(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(t9(r,`project links to it`,`projects link to it`)),n.length===0?null:`This project can't be deleted while ${n.join(` and `)}.`},the=(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},nhe=(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}),n9=e=>({projectId:e,branch:null,status:`loading`,ahead:0,behind:0,hasUpstream:!1,canPull:!1,diffStats:null}),r9=(e,t)=>t?e[t]??Y7:Y7,i9=(e,t)=>t?e[t]??X7:X7,rhe=()=>{let e=window.localStorage.getItem(K7),t=Number(e);return Number.isFinite(t)&&t>=320?t:Vme},ihe=()=>{let e=window.localStorage.getItem(q7);return e===`phone`||e===`tablet`||e===`laptop`||e===`responsive`?e:Hme},ahe=()=>{let e=Number(window.localStorage.getItem(J7));return Number.isFinite(e)&&e>0?e:Ume},ohe=()=>{let e=Z7(window.localStorage.getItem(H7));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]]:[]))},she=()=>{let e=Z7(window.localStorage.getItem(U7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>e===`hidden`||e===`inline`||e===`expanded`))},che=()=>{let e=Z7(window.localStorage.getItem(W7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`||e===null))},a9=e=>!!e?.preview_service_name?.trim()&&e?.preview_capability_mode!==`force_disabled`,lhe=({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)},uhe=({activeRun:e,project:t,projectId:n})=>!e||!n?null:e.kind===`ticket`?e.project_id===n?e:null:lhe({activeRun:e,project:t})?e:null,o9=`Project root has uncommitted changes. Confirm branch switch to continue.`,dhe=({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,fhe=()=>{let e=zme(),{closeModal:t,navigationVersion:n,push:r,pushModalSibling:i,replace:a,route:o}=e,[s,c]=(0,p.useState)(`opencode`),[l,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)([]),[m,h]=(0,p.useState)(()=>window.localStorage.getItem(V7)),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(null),[S,C]=(0,p.useState)({}),[w,T]=(0,p.useState)({}),[E,D]=(0,p.useState)({}),[O,k]=(0,p.useState)({}),[A,j]=(0,p.useState)({}),[M,N]=(0,p.useState)(she),[P,F]=(0,p.useState)(che),[I,L]=(0,p.useState)(rhe),[R,ee]=(0,p.useState)(ihe),[te,z]=(0,p.useState)(ahe),[B,V]=(0,p.useState)(null),[H,U]=(0,p.useState)([]),[ne,re]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(``),[oe,W]=(0,p.useState)(``),[se,ce]=(0,p.useState)(!1),[le,ue]=(0,p.useState)(null),[de,fe]=(0,p.useState)(`general`),[pe,me]=(0,p.useState)(null),[he,ge]=(0,p.useState)(!1),[_e,ve]=(0,p.useState)({}),[ye,be]=(0,p.useState)(ohe),[xe,Se]=(0,p.useState)(null),[Ce,we]=(0,p.useState)(()=>k7()),[Te,Ee]=(0,p.useState)(()=>O7()),[De,Oe]=(0,p.useState)(0),[ke,Ae]=(0,p.useState)(()=>({query:``,hideStaleTickets:!1,hideBundlesWithPullRequests:!1})),[je,Me]=(0,p.useState)(null),[Ne,Pe]=(0,p.useState)(null),[Fe,Ie]=(0,p.useState)({}),[Le,G]=(0,p.useState)({}),[Re,ze]=(0,p.useState)({}),[Be,Ve]=(0,p.useState)({}),[He,Ue]=(0,p.useState)(!1),[K,We]=(0,p.useState)(!1),[Ge,qe]=(0,p.useState)(!1),[q,Je]=(0,p.useState)(!1),[Ye,Ze]=(0,p.useState)(!1),[Qe,J]=(0,p.useState)(!1),[$e,et]=(0,p.useState)(`idle`),[tt,nt]=(0,p.useState)(0),[rt,it]=(0,p.useState)(!1),{isGitHubConnected:at,defaultBaseBranch:st}=vw(m),[ct,lt]=(0,p.useState)(null),ut=(0,p.useRef)(null),dt=(0,p.useRef)(null),ft=(0,p.useRef)(null),pt=(0,p.useRef)(-1),mt=(0,p.useRef)(!1),ht=(0,p.useRef)(0),gt=(0,p.useRef)(window.localStorage.getItem(V7)),X=d.find(e=>e.id===m)??null,vt=!!X?.memory_enabled,yt=m?ye[m]??`board`:`board`,bt=yt===`memory`?vt?`memory`:`board`:yt,xt=o?.projectId??Jme(window.location.pathname),St=xt?d.find(e=>e.id===xt)??null:null,Ct=o?.kind===`repository-inspection`?o:null,wt=o?.kind===`workspace`&&o.workspace===`memory`&&St?.memory_enabled!==!0,Tt=$e===`error`,Et=!!(o&&St&&m!==o.projectId),Dt=se&&window.location.pathname.startsWith(`/app`)&&(!o||!St||wt||Qe),Ot=d.find(e=>e.id===gt.current)??null,kt=d[0]??null,At=(0,p.useCallback)(t=>{if(!m)return;be(e=>({...e,[m]:t.workspace})),we(e=>A7(e,t.workspace));let n=t.workspace===`board`?{kind:`ticket`,projectId:m,ticketId:t.ticketId}:t.workspace===`chat`?{kind:`chat-session`,projectId:m,chatSessionId:t.chatSessionId}:t.specSnapshotId?{kind:`spec-snapshot`,projectId:m,specSessionId:t.specSessionId,specSnapshotId:t.specSnapshotId}:{kind:`spec-session`,projectId:m,specSessionId:t.specSessionId};e.push(n)},[m,e]),jt=(0,p.useCallback)(t=>{m&&(be(e=>({...e,[m]:t.workspace})),we(e=>A7(e,t.workspace)),Se(t),e.push({kind:`workspace`,projectId:m,workspace:t.workspace}))},[m,e]),Mt=(0,p.useCallback)((e,t,n)=>{m&&jt({workspace:`chat`,draft:!0,draftText:e,specSessionId:t,specSnapshotId:n})},[m,jt]),Nt=(0,p.useCallback)((e,t)=>{At({workspace:`spec`,specSessionId:e,specSnapshotId:t})},[At]),Pt=(0,p.useCallback)(e=>{if(e.source_available){if(e.ticket_id){At({workspace:`board`,ticketId:e.ticket_id});return}if(e.chat_session_id){At({workspace:`chat`,chatSessionId:e.chat_session_id});return}e.spec_session_id&&At({workspace:`spec`,specSessionId:e.spec_session_id})}},[At]),It=(0,p.useCallback)(e=>{if(e.available){if(qe(!1),e.kind===`ticket`){At({workspace:`board`,ticketId:e.id});return}if(e.kind===`chat_session`){At({workspace:`chat`,chatSessionId:e.id});return}e.kind===`spec_session`&&At({workspace:`spec`,specSessionId:e.id})}},[At]),Lt=(0,p.useCallback)(e=>{jt({workspace:`spec`,issueDraft:!0,draft:e})},[jt]),Rt=(0,p.useCallback)(e=>{jt({workspace:`board`,issueDraft:!0,draft:e})},[jt]),Bt=(0,p.useCallback)(()=>{Se(null)},[]),Vt=X!==null,Ht=Qme(X),Ut=!!X?.run_ide?.trim(),Gt=m!==null&&v===m,Kt=m!==null&&(!Ht||b===m),Jt=m?S[m]??n9(m):null,Yt=m?w[m]??null:null,Xt=m?!!E[m]:!1,Zt=m?O[m]??null:null,Qt=(0,p.useMemo)(()=>m?Fe[m]??[]:[],[m,Fe]),$t=m?!!Le[m]:!1,en=m?Re[m]??{current_branch:null,default_branch:null,previous_branch:null}:{current_branch:null,default_branch:null,previous_branch:null},an=m?!!Be[m]:!1,on=m?A[m]??null:null,sn=i9(M,m),cn=sn!==`hidden`,ln=uhe({activeRun:g,project:X,projectId:m}),un=ln?.context_key??null,dn=m?P[m]??null:null,fn=a9(X),pn=un===B,mn=(0,p.useMemo)(()=>mme(Ce),[Ce]),hn=(0,p.useMemo)(()=>j7({hasRunning:mn.hasRunning,hasFinishedUnseen:Te.hasFinishedUnseen,hasErrorUnseen:Te.hasErrorUnseen}),[mn.hasRunning,Te.hasErrorUnseen,Te.hasFinishedUnseen]);(0,p.useEffect)(()=>{Me(null),Pe(null),dt.current=null},[m]),(0,p.useEffect)(()=>{Pe(null)},[bt]),(0,p.useEffect)(()=>{cn||(dt.current=null)},[cn]),(0,p.useEffect)(()=>{let e=je?.target?.kind??null;if(e===`ticket`||e===`bundle`){dt.current=je;return}(bt===`board`||!cn)&&(dt.current=je)},[cn,je,bt]),(0,p.useEffect)(()=>{we(k7())},[m]),(0,p.useEffect)(()=>{Ee(O7())},[m]),(0,p.useEffect)(()=>{if(!m||dx(m))return;let e=new AbortController;return ot(m,e.signal).then(e=>{ux(m,e.connections)}).catch(e=>{Xe(e)}),()=>{e.abort()}},[m]);let gn=(0,p.useCallback)((e,t)=>{document.visibilityState!==`visible`&&(!t.didFinish&&!t.didError||Ee(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`&&Ee(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)(()=>(ut.current===null&&(ut.current=document.querySelector(`link[rel="icon"]`)?.getAttribute(`href`)??`/favicon.svg`),R7({defaultHref:ut.current,state:hn}),()=>{R7({defaultHref:ut.current,state:null})}),[hn]);let _n=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r}=t;try{let t=await $n(e,r,{refreshRemote:n});if(r?.aborted)return;C(n=>({...n,[e]:nhe(e,t)}))}catch(t){if(Xe(t))return;if(t instanceof Ke&&t.status===404){C(t=>({...t,[e]:{...n9(e),status:`unknown`}}));return}C(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}}))}},[]),vn=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r,suppressLoading:i=!1}=t;i||D(t=>({...t,[e]:!0}));try{let t=await ur(e,{refreshRemote:n,signal:r});if(r?.aborted)return;T(n=>({...n,[e]:t}))}catch(t){if(Xe(t))return;t instanceof Ke&&t.status===404&&T(t=>({...t,[e]:null}))}finally{!r?.aborted&&!i&&D(t=>({...t,[e]:!1}))}},[]),yn=(0,p.useCallback)((e,t)=>{k(n=>({...n,[e]:t}))},[]),bn=(0,p.useCallback)(async(e,t)=>{T(n=>({...n,[e.id]:t})),e.active_target_kind!==`bundle`&&await _n(e.id),$3(e.id)},[_n]);(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let{tool:t}=await zr(e.signal);c(t)}catch(e){Xe(e)}finally{e.signal.aborted||u(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!se||d.length>0&&le===null||ne)return;let e=new AbortController;return(async()=>{try{U(await Rr(`opencode`,e.signal))}catch(e){Xe(e)||U(e=>e)}finally{e.signal.aborted||re(!0)}})(),()=>{e.abort()}},[ne,le,d.length,se]),(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let t=await Vn(e.signal);if(e.signal.aborted)return;f(t)}catch(e){Xe(e)||f([])}finally{e.signal.aborted||ce(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!se||pt.current===n)return;if(pt.current=n,J(!1),et(`idle`),Se(e=>e&&o?.kind===`workspace`&&o.workspace===e.workspace?e:null),qe(!1),me(null),window.location.pathname===`/`){let e=d.find(e=>e.id===gt.current)??d[0]??null;if(!e){h(null);return}let t=ye[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;h(e.id),be(t=>({...t,[e.id]:n})),a({kind:`workspace`,projectId:e.id,workspace:n});return}if(!o)return;let e=d.find(e=>e.id===o.projectId);if(!e)return;h(e.id);let t=o.kind===`workspace`?o.workspace:o.kind===`ticket`||o.kind===`bundle`?`board`:o.kind===`repository-inspection`||o.kind===`bundle-inspection`||o.kind===`ticket-inspection`?ye[e.id]??`board`:o.kind===`chat-session`?`chat`:o.kind===`spec-session`||o.kind===`spec-snapshot`?`spec`:ye[e.id]??`board`;be(n=>({...n,[e.id]:t})),mt.current&&o.kind!==`checks`&&(mt.current=!1,qe(!0)),o.kind===`activity-run`&&qe(!0),m8(o)!==window.location.pathname&&a(o)},[o,n,d,se,a,ye]),(0,p.useEffect)(()=>{if(o?.kind!==`checks`||!se)return;let e=d.find(e=>e.id===o.projectId);if(!e)return;let t=new AbortController,n=++ht.current;return et(`loading`),qt(e.id,o.batchRunId,t.signal).then(({batch:r})=>{t.signal.aborted||ht.current!==n||(me({projectId:e.id,targetKind:r.target_kind,targetBundleId:r.target_bundle_id,targetLabel:r.target_label??e.name,definitions:r.selected_definition_snapshots,requiredDefinitionIds:[],preReviewDefinitionIds:[]}),et(`idle`))}).catch(e=>{if(!Xe(e)){if(e instanceof Ke&&e.status===404){J(!0);return}et(`error`)}}),()=>t.abort()},[o,d,se,tt]),(0,p.useEffect)(()=>{if(it(!1),!m||!at||Ye)return;let e=new AbortController,t=async()=>{try{let t=await Wt(m,e.signal);e.signal.aborted||it(t.activeCount>0)}catch(e){Xe(e)}};t();let n=window.setInterval(()=>{t()},G7);return()=>{e.abort(),window.clearInterval(n)}},[m,Ye,at]),(0,p.useEffect)(()=>{if(se){if(m){gt.current=m,window.localStorage.setItem(V7,m);return}window.localStorage.removeItem(V7)}},[m,se]),(0,p.useEffect)(()=>{window.localStorage.setItem(H7,JSON.stringify(ye))},[ye]),(0,p.useEffect)(()=>{window.localStorage.setItem(U7,JSON.stringify(M))},[M]),(0,p.useEffect)(()=>{window.localStorage.setItem(W7,JSON.stringify(P))},[P]),(0,p.useEffect)(()=>{C(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),T(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),D(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[d]),(0,p.useEffect)(()=>{ve(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[d]),(0,p.useEffect)(()=>{let e=new Set(d.map(e=>e.id));Ie(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),G(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),ze(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),Ve(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t))))},[d]),(0,p.useEffect)(()=>{se&&(j(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),N(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),F(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}))},[d,se]),(0,p.useEffect)(()=>{se&&be(e=>{let t=new Set(d.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[d,se]),(0,p.useEffect)(()=>{if(!se||!m||!Vt)return;let e=!1,t=null,n=null;C(e=>e[m]?e:{...e,[m]:n9(m)});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([_n(m,{refreshRemote:r,signal:a.signal}),vn(m,{refreshRemote:r,signal:a.signal})])}catch{if(e||a.signal.aborted)return}finally{t===a&&(t=null,n=null)}};r(!1);let i=ax(()=>{document.visibilityState===`visible`&&r(!1)});return()=>{e=!0,t?.abort(),i()}},[m,Vt,se,_n,vn]),(0,p.useEffect)(()=>{if(m)return e6(e=>{e===m&&(_n(e),vn(e))})},[m,_n,vn]),(0,p.useEffect)(()=>{if(!m||!Vt)return;let e=Yt?.operation_state??`idle`;if(!(Zt===`rebase`||e!==`idle`))return;let t=!1,n=null,r=null,i=async()=>{r?.abort(),r=new AbortController;try{await vn(m,{signal:r.signal,suppressLoading:!0})}catch{}finally{t||(n=window.setTimeout(()=>{i()},Bme))}};return i(),()=>{t=!0,r?.abort(),n!==null&&window.clearTimeout(n)}},[Zt,m,Yt?.operation_state,Vt,vn]);let xn=(0,p.useCallback)(async e=>{let t=m;if(!t){_(null),x(null);return}try{let n=await tn(t,e);e?.aborted||(_(n.active_run),x(t))}catch(e){Xe(e)}},[m]),Sn=(0,p.useCallback)(async e=>{let t=m;if(t)try{let n=await zt(t,e);e?.aborted||j(e=>({...e,[t]:n}))}catch(e){Xe(e)}},[m]);(0,p.useEffect)(()=>{if(!se)return;if(!Ht){_(null),x(null);return}if(!Gt)return;let e=new AbortController;x(null),xn(e.signal);let t=window.setInterval(()=>{xn(e.signal)},G7),n=ax(()=>{document.visibilityState===`visible`&&xn(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[Gt,Ht,se,xn]),(0,p.useEffect)(()=>{if(!se||!m||!Gt||!fn)return;let e=new AbortController;Sn(e.signal);let t=window.setInterval(()=>{Sn(e.signal)},G7),n=ax(()=>{document.visibilityState===`visible`&&Sn(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[m,Gt,fn,se,Sn]),(0,p.useEffect)(()=>{window.localStorage.setItem(K7,String(I))},[I]),(0,p.useEffect)(()=>{window.localStorage.setItem(q7,R)},[R]),(0,p.useEffect)(()=>{window.localStorage.setItem(J7,String(te))},[te]),(0,p.useEffect)(()=>{m&&un&&F(e=>{let t=e[m]??null;return!t||t===un?e:{...e,[m]:null}})},[m,un]),(0,p.useEffect)(()=>{!m||!ln||!a9(X)||dn!==ln.context_key&&N(e=>i9(e,m)===`hidden`?{...e,[m]:`inline`}:e)},[X,m,dn,ln]);let Cn=async e=>{try{c((await Br(e)).tool)}catch{}},wn=(0,p.useCallback)(e=>{f(t=>t.map(t=>t.id===e.id?e:t))},[]),Tn=(0,p.useCallback)((e,t)=>{Ie(n=>{let r=[t,...(n[e]??[]).filter(e=>e.id!==t.id)];return{...n,[e]:r}})},[]),En=(0,p.useCallback)(async e=>{Ve(t=>({...t,[e]:!0}));try{let t=await qn(e);ze(n=>({...n,[e]:t}))}catch(e){$.error(e instanceof Ke?e.message:`Unable to load the project target options right now.`,{id:`project-target-selector-load-error`})}finally{Ve(t=>({...t,[e]:!1}))}},[]),Dn=async e=>{try{let t=await Hn(e9(e));return f(e=>[...e,t]),h(t.id),a({kind:`workspace`,projectId:t.id,workspace:`board`}),ue(null),null}catch(e){return e instanceof Ke?e.message:`Unable to create the project right now.`}},On=async e=>{if(!X)return`Select a project before editing settings.`;try{let t=await Un(X.id,e9(e));return f(e=>e.map(e=>e.id===t.id?t:e)),Oe(e=>e+1),ue(null),null}catch(e){return e instanceof Ke?e.message:`Unable to update the project right now.`}},kn=async()=>{if(!X)return`Select a project before deleting it.`;try{await Gn(X.id);let e=d.filter(e=>e.id!==X.id);return f(e),h(e[0]?.id??null),e[0]&&a({kind:`workspace`,projectId:e[0].id,workspace:`board`}),ue(null),null}catch(e){return e instanceof Ke?e.message:`Unable to delete the project right now.`}},jn=(0,p.useCallback)(e=>{f(t=>t.map(t=>the(t,e)))},[]),Mn=(0,p.useCallback)((e,t)=>{e&&Ie(n=>({...n,[e]:t}))},[]),Nn=(0,p.useCallback)((e,t)=>{e&&G(n=>({...n,[e]:t}))},[]),Pn=async(e,t,n)=>await Yn({repo_path:e,helper_model:t||null,helper_variant:t&&n||null}),Fn=async()=>(await Xn()).repo_path,In=(0,p.useCallback)(async e=>{let t=await Zn({repo_path:e});return{valid:t.valid,repoRoot:t.repo_root,error:t.error,willInitialize:t.will_initialize,hasInitialCommit:t.has_initial_commit}},[]),Ln=(0,p.useCallback)(async()=>{if(!(!X||he)){ge(!0);try{let e=await Wn(X.id);f(t=>t.map(t=>t.id===e.id?e:t)),$.success(`Initial commit created.`,{id:`project-initial-commit-success`}),_n(e.id),vn(e.id)}catch(e){$.error(e instanceof Ke?e.message:`Unable to create the initial commit right now.`,{id:`project-initial-commit-error`})}finally{ge(!1)}}},[X,he,_n,vn]),Rn=(0,p.useCallback)((e,t)=>{N(t=>({...t,[e]:`hidden`})),t&&F(n=>({...n,[e]:t}))},[]),zn=(0,p.useCallback)(()=>{m&&Rn(m,un)},[m,Rn,un]),Bn=(0,p.useCallback)(e=>{m&&(N(e=>({...e,[m]:`hidden`})),e&&_(t=>t?.context_key===e?null:t))},[m]),Qn=(0,p.useCallback)(async()=>{if(!ln||B===ln.context_key)return;let{context_key:e}=ln;V(e);try{ln.kind===`ticket`?await An(ln.ticket_id,ln.project_id):_((await rn(ln.project_id)).active_run),Bn(e),await Promise.all([xn(),Sn()])}catch(e){$.error(e instanceof Ke?e.message:`Unable to stop the preview run right now.`,{id:`app-preview-run-stop-error`})}finally{V(t=>t===e?null:t)}},[Bn,ln,Sn,xn,B]),rr=(0,p.useCallback)(e=>{!e||!m||En(m)},[m,En]),ir=(0,p.useCallback)(e=>new Promise(t=>{ft.current=t,lt(e)}),[]),ar=(0,p.useCallback)(e=>{let t=ft.current;ft.current=null,lt(null),t?.(e)},[]),or=(0,p.useCallback)(async e=>{if(!X||!m)throw Error(`Select a project first.`);if(!dhe({activeProject:X,activeProjectBranchState:Jt,nextTarget:e})||!g||g.kind!==`project`||g.project_id!==X.id)return!0;if(!await ir({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=g.context_key,t=await rn(X.id);return Bn(e),_(t.active_run),await Sn(),!0}catch(e){return $.error(e instanceof Ke?e.message:`Unable to stop the project run right now.`,{id:`project-target-switch-stop-run-error`}),!1}},[X,Jt,m,g,Bn,Sn,ir]),sr=(0,p.useCallback)(async e=>{if(!m)throw Error(`Select a project first.`);return await or({kind:`bundle`,bundleId:e})?(wn(await Jn(m,{kind:`bundle`,bundle_id:e})),T(e=>({...e,[m]:null})),await Promise.all([_n(m),vn(m)]),!0):!1},[m,or,_n,vn,wn]),cr=(0,p.useCallback)(async(e,t={})=>{if(!m)throw Error(`Select a project first.`);if(!await or({kind:`repo_root`,branch:e}))return!1;let n=n=>Jn(m,{kind:`repo_root`,...e?{branch:e}:{},...t.createBranch===!1?{create_branch:!1}:{},...n?{confirm_dirty_switch:!0}:{}}),r;try{r=await n(t.confirmDirtySwitch===!0)}catch(e){if(!t.confirmDirtySwitch&&e instanceof Ke&&e.status===409&&e.message===o9){if(!await ir({title:`Switch repo root branch?`,description:`${o9}\n\nSwitch anyway?`,confirmLabel:`Switch anyway`,cancelLabel:`Keep current branch`}))return!1;r=await n(!0)}else throw e}return wn(r),T(e=>({...e,[m]:null})),await Promise.all([_n(m),vn(m),En(m)]),!0},[m,or,En,_n,vn,wn,ir]),lr=(0,p.useCallback)(async e=>!e.target_kind||e.target_available===!1?!0:e.target_kind===`bundle`?e.target_bundle_id?await sr(e.target_bundle_id):!1:await cr(e.target_branch_snapshot??null,{createBranch:!1}),[sr,cr]),dr=(0,p.useCallback)(async e=>{m&&await sr(e)&&jt({workspace:`chat`,startNewDraft:!0})},[m,sr,jt]),fr=(0,p.useCallback)(()=>{Ue(!0)},[]),pr=(0,p.useCallback)(()=>{Ue(!1)},[]),mr=(0,p.useCallback)(e=>{if(e){sr(e);return}cr(null)},[sr,cr]),hr=(0,p.useCallback)(async e=>{if(!m)throw Error(`Select a project first.`);let t=await _t(m,{name:e,prepare:!0});return Tn(m,t),Oe(e=>e+1),t},[m,Tn]),gr=(0,p.useCallback)(async e=>{if(!m)throw Error(`Select a project first.`);await Ft(m,e),Ie(t=>({...t,[m]:(t[m]??[]).filter(t=>t.id!==e)})),Oe(e=>e+1)},[m]),_r=(0,p.useCallback)(async()=>{if(!X)return;let e=X.active_target_kind??`repo_root`,t=X.active_target_bundle_id??null,n=g?.kind===`project`&&g.project_id===X.id&&(g.target_kind??`repo_root`)===e&&((g.target_kind??`repo_root`)!==`bundle`||g.target_bundle_id===t),r=n?g?.context_key??null:null,i=!n&&a9(X)&&sn===`hidden`;i&&(N(e=>({...e,[X.id]:`inline`})),F(e=>({...e,[X.id]:null})));try{let e=n?await rn(X.id):await nn(X.id);n&&Bn(r),_(e.active_run),Sn()}catch(e){i&&N(e=>({...e,[X.id]:`hidden`})),$.error(e instanceof Ke?e.message:`Unable to update the project run right now.`,{id:`app-project-run-error`})}},[sn,X,g,Bn,Sn]),vr=(0,p.useCallback)(async()=>{if(!(!X||!Ut))try{await Kn(X.id)}catch(e){$.error(e instanceof Error?e.message:`Unable to open the IDE right now.`,{id:`app-project-open-ide-error`})}},[X,Ut]),yr=(0,p.useCallback)(async()=>{if(X){yn(X.id,`pull`);try{let e=await er(X.id);await bn(X,e),$.success(e.behind===0?B7(`branchSynced`):B7(`branchUpdated`),{id:`app-project-pull-success`})}catch(e){$.error(e instanceof Ke?e.message:B7(`syncFallbackError`),{id:`app-project-pull-error`})}finally{yn(X.id,null)}}},[X,bn,yn]),br=(0,p.useCallback)(async()=>{if(!X)return;let e=Yt?.base_branch??null;yn(X.id,`rebase`);try{let t=await tr(X.id);await bn(X,t);let n=t.base_branch??e;$.success(n?B7(`branchRebasedOnto`,{branch:n}):B7(`branchRebased`),{id:`app-project-rebase-success`})}catch(e){await Promise.allSettled([_n(X.id),vn(X.id,{suppressLoading:!0})]),$.error(e instanceof Ke?e.message:B7(`rebaseFallbackError`),{id:`app-project-rebase-error`})}finally{yn(X.id,null)}},[X,Yt?.base_branch,bn,_n,vn,yn]),xr=(0,p.useCallback)(async()=>{if(X){yn(X.id,`abort`);try{await bn(X,await nr(X.id)),$.success(B7(`gitOperationAborted`),{id:`app-project-abort-success`})}catch(e){$.error(e instanceof Ke?e.message:B7(`abortFallbackError`),{id:`app-project-abort-error`})}finally{yn(X.id,null)}}},[X,bn,yn]),Sr=(0,p.useCallback)(e=>{X&&r(X.active_target_kind===`bundle`&&X.active_target_bundle_id?{kind:`bundle-inspection`,projectId:X.id,bundleId:X.active_target_bundle_id,mode:e}:{kind:`repository-inspection`,projectId:X.id,mode:e})},[X,r]),Cr=(0,p.useCallback)(()=>{if(o?.kind!==`repository-inspection`)return;let{projectId:e}=o;t(o,{kind:`workspace`,projectId:e,workspace:`board`}),_n(e),vn(e)},[t,o,_n,vn]),wr=(0,p.useCallback)(()=>{if(!X)return;let e=X.active_target_kind??`repo_root`,t=X.active_target_bundle_id??null,n=e===`bundle`?Qt.find(e=>e.id===t):null,r=n?.required_check_policy;me({projectId:X.id,targetKind:e,targetBundleId:t,targetLabel:n?Gy(n):X.name,definitions:Ow(X),requiredDefinitionIds:r?.required_check_definition_ids??kw(X),preReviewDefinitionIds:r?.pre_review_check_definition_ids??Aw(X)})},[X,Qt]),Tr=(0,p.useCallback)(()=>{me(null),o?.kind===`checks`&&t(o)},[t,o]),Er=(0,p.useCallback)(()=>{qe(!1),me(null),o?.kind===`activity-run`&&t(o)},[t,o]),Dr=(0,p.useCallback)(()=>{J(!0)},[]),Or=(0,p.useCallback)((e,t)=>{if(!m)return;if(e.kind===`check_batch`){qe(!1);let t={kind:`checks`,projectId:m,batchRunId:e.id};o?.kind===`activity-run`?a(t):r(t);return}if(e.kind===`check_attempt`&&t){qe(!1);let n={kind:`checks`,projectId:m,batchRunId:t,attemptRunId:e.id};o?.kind===`activity-run`?a(n):r(n);return}let n={kind:`activity-run`,projectId:m,runId:e.id};o?.kind===`activity-run`?a(n):r(n)},[m,o,r,a]),kr=(0,p.useCallback)((e,t)=>{if(!m)return;let n={kind:`checks`,projectId:m,batchRunId:e,attemptRunId:t};if(o?.kind===`checks`){m8(o)!==m8(n)&&a(n);return}r(n)},[m,o,r,a]),Ar=r9(_e,m),jr=X?Mw(X).length>0:!1,Mr=X?Ow(X).length>0:!1,Nr=bt===`chat`?Ne:null,Pr=dt.current,Fr=Pr?.target?.kind??null,Ir=bt===`chat`?Fr===`ticket`||Fr===`bundle`?{target:Pr?.target??null,canSelect:!1,disabledReason:`This preview belongs to a ticket run. Return to Board to send preview comments.`,promptMode:Pr?.promptMode??null,onPromptModeChange:Pr?.onPromptModeChange??null,isUpdatingPromptMode:Pr?.isUpdatingPromptMode??!1,promptPlaceholder:Pr?.promptPlaceholder??null,promptComposerControls:Pr?.promptComposerControls,promptComposerInlineControls:Pr?.promptComposerInlineControls,submitPrompt:null}:Nr?{target:{kind:`chat_session`,id:Nr.chatSessionId??`draft:${m}`},canSelect:Nr.canSubmitReviewPrompt,disabledReason:Nr.canSubmitReviewPrompt?null:Nr.reviewSubmitDisabledReason??`Wait for the current chat turn to finish before sending preview comments.`,promptMode:Nr.mode,onPromptModeChange:Nr.onModeChange,isUpdatingPromptMode:Nr.isUpdatingMode,promptPlaceholder:Nr.promptPlaceholder,promptComposerControls:Nr.promptComposerControls,promptComposerInlineControls:Nr.promptComposerInlineControls,submitPrompt:Nr.canSubmitReviewPrompt?Nr.submitPrompt:null}:{target:null,canSelect:!1,disabledReason:`Select a chat session to send preview comments.`,submitPrompt:null}:je,Lr=Nr?.canSubmitReviewPrompt??!1,Vr=bt===`chat`?Nr?Nr.reviewSubmitDisabledReason:`Select a chat session to send review comments.`:Wb.t(`common:workspaceReviewModal.chatRequired`),Hr=(0,p.useCallback)(()=>{m&&ve(e=>{let t=e[m]??Y7;return{...e,[m]:{hasMounted:!0,isOpen:!t.isOpen,isExpanded:t.isExpanded}}})},[m]),Ur=(0,p.useCallback)(e=>{ve(t=>{let n=t[e]??Y7;return!n.hasMounted||!n.isOpen?t:{...t,[e]:Y7}})},[]),Wr=(0,p.useCallback)(e=>{ve(t=>{let n=t[e]??Y7;return{...t,[e]:{hasMounted:!0,isOpen:n.isOpen,isExpanded:!n.isExpanded}}})},[]),Gr=(0,p.useCallback)(()=>{fe(`general`),ue(`create`)},[]),Kr=(0,p.useCallback)((e=`general`)=>{fe(e),ue(`edit`)},[]),qr=(0,p.useCallback)(e=>{let t=ye[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;h(e.id),r({kind:`workspace`,projectId:e.id,workspace:n})},[r,ye]),Jr=(0,p.useCallback)(e=>{m&&(o?.kind===`ticket`&&o.ticketId===e||r({kind:`ticket`,projectId:m,ticketId:e}))},[m,o,r]),Yr=(0,p.useCallback)(()=>{o?.kind===`ticket`&&t(o)},[t,o]),Xr=(0,p.useCallback)(e=>{m&&(o?.kind===`bundle`&&o.bundleId===e||r({kind:`bundle`,projectId:m,bundleId:e}))},[m,o,r]),Zr=(0,p.useCallback)(()=>{o?.kind===`bundle`&&t(o)},[t,o]),Qr=(0,p.useCallback)((e,t)=>{m&&r(e.kind===`ticket`?{kind:`ticket-inspection`,projectId:m,ticketId:e.ticketId,mode:t}:{kind:`bundle-inspection`,projectId:m,bundleId:e.bundleId,mode:t})},[m,r]),$r=(0,p.useCallback)(e=>{if(o?.kind===`repository-inspection`){if(o.mode===e)return;i({...o,mode:e});return}if(o?.kind===`ticket-inspection`||o?.kind===`bundle-inspection`){if(o.mode===e)return;i({...o,mode:e})}},[o,i]),ei=(0,p.useCallback)(()=>{o?.kind!==`ticket-inspection`&&o?.kind!==`bundle-inspection`||t(o)},[t,o]),ti=(0,p.useCallback)(e=>{if(!m)return;let t=e?{kind:`chat-session`,projectId:m,chatSessionId:e}:{kind:`workspace`,projectId:m,workspace:`chat`};o&&m8(o)===m8(t)||r(t)},[m,o,r]),ni=(0,p.useCallback)(e=>{if(!m)return;let t=e?{kind:`spec-session`,projectId:m,specSessionId:e}:{kind:`workspace`,projectId:m,workspace:`spec`};o&&m8(o)===m8(t)||r(t)},[m,o,r]),ri=(0,p.useCallback)(()=>{if(m){if(cn){zn();return}N(e=>({...e,[m]:`inline`})),F(e=>({...e,[m]:null}))}},[m,zn,cn]),ii=(0,p.useCallback)(()=>{m&&N(e=>{let t=i9(e,m);return{...e,[m]:t===`expanded`?`inline`:`expanded`}})},[m]),ai=X?X.preview_service_name?.trim()?X.preview_capability_mode===`force_disabled`?`Preview is disabled for this project.`:on?.state===`unsupported`?on.message??`Preview is unavailable for this project.`:cn?`Hide preview`:`Show preview`:`Choose a named preview service in project settings first.`:`Select a project first.`,oi=!X||!X.preview_service_name?.trim()||X.preview_capability_mode===`force_disabled`||on?.state===`unsupported`,si=X&&X.preview_service_name?.trim()?(0,Y.jsx)(SM,{project:X,mode:sn===`expanded`?`expanded`:`inline`,status:on,viewportPreset:R,zoom:te,activeRun:ln,reviewCapability:Ir,isStoppingActiveRun:pn,onHide:zn,onStopActiveRun:()=>{Qn()},onToggleExpanded:ii,onViewportPresetChange:ee,onZoomChange:z}):null;return(0,Y.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,Y.jsx)(rx,{}),d.length>0&&(0,Y.jsx)(`header`,{className:`border-b border-border bg-background/95 px-6 py-3 backdrop-blur`,children:(0,Y.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,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 w-full sm:w-[20rem] sm:min-w-[20rem] sm:max-w-[20rem]`,children:(0,Y.jsx)(Ev,{activeProjectId:m,onCreateProject:Gr,projects:d,onEditProject:()=>Kr(),onProjectChange:e=>{let t=d.find(t=>t.id===e);t&&qr(t)}})}),m&&(0,Y.jsx)(lC,{projectId:m,onStartSpecFromDraft:Lt,onCreateTicketFromDraft:Rt})]})}),(0,Y.jsx)(`div`,{className:`min-w-0 justify-self-end min-[1440px]:col-start-3 min-[1440px]:row-start-1`,children:(0,Y.jsx)(Bb,{activeTool:s,onMobileAccessOpen:()=>We(!0),onOpenActivity:()=>qe(!0),onOpenExecutionRuntimes:()=>Je(!0),onToolChange:Cn,...at?{hasActiveGitHubRuns:rt,onOpenGitHubActions:()=>Ze(!0)}:{}})}),m&&(0,Y.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,Y.jsx)(Ome,{activeWorkspace:bt,activityByWorkspace:Ce,className:`w-fit max-w-full`,memoryEnabled:vt,onWorkspaceChange:e=>{m&&(be(t=>({...t,[m]:e})),we(t=>A7(t,e)),r({kind:`workspace`,projectId:m,workspace:e}))}})})]})}),!se||Et?(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Loading projects...`}):Dt||Tt?(0,Y.jsx)(Sv,{isTransientError:Tt,requestedProjectExists:St!==null,retainedProject:Ot?.id===St?.id?null:Ot,defaultProject:kt,onCreateProject:Gr,onRetry:()=>nt(e=>e+1),onOpenProject:e=>{let t=ye[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;h(e.id),a({kind:`workspace`,projectId:e.id,workspace:n})},onOpenWorkspace:()=>{if(!St)return;let e=Yme(o),t=e===`memory`&&!St.memory_enabled?`board`:e;h(St.id),a({kind:`workspace`,projectId:St.id,workspace:t})}}):d.length===0?(0,Y.jsx)(xv,{activeTool:s,availableHelperModels:H,helperModel:ie,helperVariant:oe,isHelperModelsLoaded:ne,isToolLoaded:l,onCreateProject:Gr,onHelperModelChange:e=>{ae(e),W(``)},onHelperVariantChange:W,onToolChange:Cn}):(0,Y.jsxs)(Y.Fragment,{children:[X?.has_initial_commit===!1&&(0,Y.jsx)(vC,{isSubmitting:he,onCreateInitialCommit:()=>{Ln()}}),(0,Y.jsx)(Eme,{activeProjectId:m,activeProject:X,activeProjectBranchState:Jt,targetBundles:Qt,targetBranchSuggestions:en,isTargetBundleLoading:$t,isTargetSelectorLoading:an,onTargetSelectorOpenChange:rr,onSelectBundleTarget:sr,onSelectRepoRootTarget:cr,activeRun:g,activeTool:s,onOpenProjectExecutionSettings:()=>Kr(`execution`),onRestoreSessionTarget:lr,onChatReviewCapabilityChange:Pe,routedInspectionReviewCapability:bt===`chat`?Ne:null,isPreviewButtonDisabled:oi,onPreviewReviewCapabilityChange:Me,onPreviewToggle:ri,onRunStopped:Bn,onWorkspaceActivityChange:we,onWorkspaceActivityEvent:gn,pendingWorkspaceNavigation:xe,onPendingWorkspaceNavigationConsumed:Bt,routedTicketId:o?.kind===`ticket`?o.ticketId:null,onRoutedTicketOpen:Jr,onRoutedTicketClose:Yr,onRoutedTicketUnavailable:Dr,routedBundleId:o?.kind===`bundle`?o.bundleId:null,routedChatSessionId:o?.kind===`chat-session`?o.chatSessionId:void 0,routedSpecSessionId:o?.kind===`spec-session`||o?.kind===`spec-snapshot`?o.specSessionId:void 0,routedSpecSnapshotId:o?.kind===`spec-snapshot`?o.specSnapshotId:void 0,routedInspection:o?.kind===`ticket-inspection`?{target:{kind:`ticket`,ticketId:o.ticketId},mode:o.mode}:o?.kind===`bundle-inspection`?{target:{kind:`bundle`,bundleId:o.bundleId},mode:o.mode}:null,onRoutedBundleOpen:Xr,onRoutedBundleClose:Zr,onRoutedInspectionOpen:Qr,onRoutedInspectionModeChange:$r,onRoutedInspectionClose:ei,onChatSessionNavigation:ti,onSpecSessionNavigation:ni,onRoutedEntityUnavailable:Dr,onSpecImplementationChatReady:Mt,onViewSourceSpec:Nt,onNavigateToLifecycleSource:It,onViewMemorySource:Pt,onStartChatFromBundle:dr,previewDisplayMode:sn,previewPane:si,previewPaneWidth:I,previewButtonTitle:ai,visibleWorkspace:bt,refreshKey:De,boardFilterState:ke,onBoardFilterStateChange:Ae,onBoardLoadedProjectIdChange:y,onBundlesChange:Mn,onBundlesLoadingChange:Nn,onPreviewPaneWidthChange:L,onProjectUsageChange:jn,onRunStatusChange:()=>{xn(),Sn()}},m??`no-project`)]}),d.length>0&&(0,Y.jsx)(Xy,{activeProject:X,activeRun:g,branchState:Jt,targetGitStatus:Yt,isBoardLoadedForActiveProject:Gt,activeProjectBranchAction:Zt,isProjectIdeAvailable:Ut,isProjectRunAvailable:Ht,isRunStatusLoadedForActiveProject:Kt,isTerminalOpen:Ar.isOpen,targetBundles:Qt,targetBranchSuggestions:en,isTargetBundleLoading:$t,isTargetSelectorLoading:an,isTargetGitStatusLoading:Xt,hasConfiguredTests:jr,hasConfiguredChecks:Mr,onProjectIdeOpen:()=>{vr()},onProjectPull:()=>{yr()},onProjectRebase:br,onProjectAbortGitOperation:xr,onProjectRunToggle:()=>{_r()},onProjectFilesOpen:()=>Sr(`files`),onProjectChangesOpen:()=>Sr(`changes`),onProjectVerificationOpen:wr,onTerminalToggle:Hr,onTargetSelectorOpenChange:rr,onSelectBundleTarget:sr,onSelectRepoRootTarget:cr,onManageBundles:fr}),(0,Y.jsx)(Nne,{activeProjectId:m,open:K,onOpenChange:We}),(Ge||o?.kind===`activity-run`)&&m&&!Dt&&(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(qme,{projectId:m,initialRunId:o?.kind===`activity-run`?o.runId:null,initialEventId:o?.kind===`activity-run`?o.eventId:null,onClose:Er,onRunSelectionChange:Or,onUnavailable:o?.kind===`activity-run`?Dr:void 0,onNavigateToLifecycleSource:It})}),Ye&&m&&(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(Kme,{projectId:m,defaultBranch:st,onClose:()=>Ze(!1)})}),He&&X&&(0,Y.jsx)(jC,{bundles:Qt,selectedBundleId:X.active_target_kind===`bundle`?X.active_target_bundle_id??null:null,activeTargetBundleId:X.active_target_kind===`bundle`?X.active_target_bundle_id??null:null,onSelectBundle:mr,onCreateBundle:hr,onDeleteBundle:gr,onClose:pr}),ct&&(0,Y.jsx)(_C,{title:ct.title,description:ct.description,confirmLabel:ct.confirmLabel,cancelLabel:ct.cancelLabel,confirmVariant:ct.confirmVariant,onConfirm:()=>ar(!0),onCancel:()=>ar(!1)}),d.map(e=>{let t=r9(_e,e.id);return t.hasMounted?(0,Y.jsx)(Dme,{project:e,isExpanded:t.isExpanded,isVisible:e.id===m&&t.isOpen,onClose:()=>Ur(e.id),onToggleExpanded:()=>Wr(e.id)},e.id):null}),le&&(0,Y.jsx)(gie,{mode:le,initialSection:de,projectId:le===`edit`&&X?X.id:null,availableHelperModels:H,isLoadingHelperModels:!ne,isAutoConfigReady:l,initialValues:le===`edit`&&X?Zme(X):d.length===0?{name:``,repoPath:``,linkedProjectIds:[],runSetup:[],runServices:[],checkDefinitions:[],runIde:``,previewServiceName:``,previewPath:``,previewCapabilityMode:`auto`,helperModel:ie,helperVariant:oe,commitMessageRules:``,commitAfterEachTicket:!1,autoParkStaleTickets:!1,memoryEnabled:!1,worktreeSync:[],specAwareCodeReviewEnabled:!1,automationDepth:`manual`,automationReviewFixEnabled:!1,automationPauseOnOpenQuestions:!1,automationReviewSeverity:`medium`,automationReviewMaxIterations:3}:void 0,linkedProjectOptions:d.filter(e=>e.id!==X?.id).map(e=>({id:e.id,name:e.name})),repoPathLocked:le===`edit`&&X?X.repo_path_locked:!1,repoPathLockedMessage:le===`edit`&&X?$me(X):null,deleteBlockedMessage:le===`edit`&&X?ehe(X,d):null,onDelete:le===`edit`?kn:void 0,onAutoConfig:Pn,onBrowseRepoPath:Fn,onValidateRepoPath:In,onOpenExecutionRuntimes:()=>Je(!0),onClose:()=>ue(null),onSubmit:le===`edit`?On:Dn}),q&&(0,Y.jsx)(ex,{onClose:()=>Je(!1)}),Ct&&Ct.projectId===m&&X&&Jt?.status!==`loading`&&!Dt&&(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(Wme,{target:{scope:`project_root`},initialMode:Ct.mode,reviewMode:Ct.mode,onReviewModeChange:$r,enabledModes:[`changes`,`files`],projectId:Ct.projectId,targetKind:`repo_root`,reviewCommentsBundleId:null,title:X.name,bundleTargetName:null,hasHelperModel:!!X.helper_model,repoRootDefaultBranch:en.default_branch,onSubmitReviewPrompt:Nr?.submitPrompt,canSubmitReviewPrompt:Lr,reviewSubmitDisabledReason:Vr??void 0,canAddReviewComments:Lr,canModifyChanges:!0,mode:Nr?.mode,onModeChange:Nr?.onModeChange,canToggleMode:!!Nr?.canSubmitReviewPrompt,isUpdatingMode:Nr?.isUpdatingMode??!1,onClose:Cr})}),pe&&!Ge&&!Dt&&pe.projectId===m&&(0,Y.jsx)(p.Suspense,{fallback:null,children:(0,Y.jsx)(Gme,{targetLabel:pe.targetLabel,definitions:pe.definitions,requiredDefinitionIds:pe.requiredDefinitionIds,preReviewDefinitionIds:pe.preReviewDefinitionIds,checksTarget:{projectId:pe.projectId,targetKind:pe.targetKind,targetBundleId:pe.targetBundleId},requestedInitialTab:o?.kind===`checks`?`checks`:void 0,directBatchRunId:o?.kind===`checks`?o.batchRunId:null,directAttemptRunId:o?.kind===`checks`?o.attemptRunId:null,onCheckSelectionChange:o?.kind===`checks`?kr:void 0,onUnavailable:o?.kind===`checks`?Dr:void 0,testsTarget:{scope:`project`,projectId:pe.projectId,targetKind:pe.targetKind,targetBundleId:pe.targetBundleId},onClose:Tr,onOpenActivity:()=>{if(ht.current+=1,me(null),o?.kind===`checks`){mt.current=!0,a({kind:`workspace`,projectId:o.projectId,workspace:`board`});return}qe(!0)}})})]})},phe=({className:e})=>(0,Y.jsx)($ee,{"aria-hidden":`true`,className:e}),s9=`X-Archon-Mobile-CSRF`,mhe=async(e,t={})=>{let n=await fetch(e,{credentials:`include`,...t});if(!n.ok){let e=null;try{e=await n.clone().json()}catch{}throw new Ke(await Ze(n,`Mobile request failed.`),n.status,e)}return n},c9=async(e,t={})=>await(await mhe(e,t)).json(),l9=e=>c9(`/mobile/projects`,{signal:e}),hhe=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/summary`,{signal:t}),ghe=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/target-options`,{signal:t}),_he=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,{signal:t}),vhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,{signal:n}),yhe=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets`,{signal:t}),bhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,{signal:n}),xhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/agent-runs`,{signal:n}),She=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),Che=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),whe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}`,{signal:n}),The=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/build`,u9(n)),Ehe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/review`,u9(n)),u9=(e,t,n=`POST`)=>({method:n,headers:{"Content-Type":`application/json`,[s9]:e},body:t===void 0?void 0:JSON.stringify(t)}),Dhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,u9(t,n)),Ohe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/messages`,u9(n,r)),khe=(e,t,n,r,i)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Ahe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),jhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/stop`,u9(n)),Mhe=(e,t)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,{signal:t}),Nhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,{signal:n}),Phe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,u9(t,n)),d9=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/messages`,u9(n,r)),Fhe=(e,t,n,r,i)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Ihe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),Lhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/stop`,u9(n)),f9=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/state`,u9(n,{state:r},`PATCH`)),Rhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/run`,u9(n)),zhe=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop`,u9(n)),p9=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop-build`,u9(n)),m9=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/resume-build`,u9(n)),Bhe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,u9(n,r,`PATCH`)),Vhe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-follow-up`,u9(n,{instruction:r})),Hhe=(e,t,n,r,i)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,u9(r,i)),Uhe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/follow-up`,u9(n,{instruction:r})),Whe=(e,t,n,r)=>c9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/follow-up`,u9(n,{instruction:r})),h9=(e,t,n)=>c9(`/mobile/projects/${encodeURIComponent(e)}/target`,u9(t,n)),Ghe=(e,t)=>c9(`/mobile/models?tool=${encodeURIComponent(e)}`,{signal:t}),Khe=(e,t,n)=>{let r=new URLSearchParams({tool:e});return t&&r.set(`project_id`,t),c9(`/mobile/skills?${r.toString()}`,{signal:n})},qhe=({className:e})=>(0,Y.jsx)(Jee,{"aria-hidden":`true`,className:e}),g9=e=>Wb.t(`common:mobileApp.${e}`),Jhe={key:`overview`,label:g9(`navigation.overview`),Icon:qhe},_9={key:`tickets`,label:g9(`navigation.tickets`),Icon:J5,ctaAriaLabel:g9(`overviewActions.ticketsAriaLabel`)},v9={key:`chats`,label:g9(`navigation.chats`),Icon:SE,ctaAriaLabel:g9(`overviewActions.chatsAriaLabel`)},y9={key:`spec`,label:g9(`navigation.spec`),Icon:oC,ctaAriaLabel:g9(`overviewActions.specAriaLabel`)},Yhe=[Jhe,_9,v9,y9],Xhe=({children:e})=>(0,Y.jsx)(`main`,{className:`min-h-screen bg-background text-foreground`,children:(0,Y.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-lg items-center px-4 py-8`,children:(0,Y.jsx)(`div`,{className:`w-full`,children:e})})}),b9=({title:e,description:t,children:n})=>(0,Y.jsx)(Xhe,{children:(0,Y.jsxs)(xC,{className:`w-full border-border/80 bg-card/90 shadow-2xl shadow-black/20`,children:[(0,Y.jsxs)(SC,{children:[(0,Y.jsx)(CC,{children:e}),(0,Y.jsx)(wC,{children:t})]}),n&&(0,Y.jsx)(EC,{className:`space-y-4`,children:n})]})}),Zhe=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`},Qhe=({status:e})=>{let t=Zhe(e);return(0,Y.jsxs)(bC,{variant:t.variant,className:`gap-1.5 px-2.5 py-1 text-[11px] uppercase tracking-[0.14em]`,children:[(0,Y.jsx)(tb,{state:t.indicatorState,className:`mt-0`}),t.label]})},$he=({status:e,onRetry:t})=>e===`connected`?null:e===`unavailable`?(0,Y.jsx)(xC,{className:`border-red-500/25 bg-destructive/10 shadow-none`,children:(0,Y.jsxs)(EC,{className:`flex flex-col gap-3 pt-5`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-medium text-red-100`,children:`Desktop Archon is currently unreachable.`}),(0,Y.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,Y.jsx)(`div`,{children:(0,Y.jsx)(Q,{variant:`warning`,onClick:t,children:`Retry connection`})})]})}):(0,Y.jsx)(xC,{className:`border-amber-500/25 bg-amber-500/10 shadow-none`,children:(0,Y.jsx)(EC,{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.`})}),ege=({selectedProject:e,targetLabel:t,isTargetLoading:n,isTargetDisabled:r,connectionState:i,onOpenProjects:a,onOpenTargetSelector:o})=>(0,Y.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,Y.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,Y.jsxs)(`button`,{type:`button`,"aria-label":`Choose project`,className:`min-w-0 flex-1 text-left`,onClick:a,children:[(0,Y.jsx)(`div`,{className:`truncate text-base font-medium text-foreground`,children:e?.name??`Choose a project`}),(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e?.repo_path??`Select a desktop project to continue`})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(Qhe,{status:i}),(0,Y.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,Y.jsx)(Yv,{className:`h-3.5 w-3.5 shrink-0`}),n?(0,Y.jsx)(Ov,{className:`h-3.5 w-16`}):(0,Y.jsx)(`span`,{className:`truncate text-xs sm:text-sm`,children:t})]}),(0,Y.jsx)(Q,{variant:`outline`,size:`icon-sm`,"aria-label":`Choose project`,onClick:a,children:(0,Y.jsx)(jv,{className:`h-4 w-4`})})]})]})}),tge=({activeSection:e,onChange:t})=>(0,Y.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,Y.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:Yhe.map(n=>{let r=n.key===e,i=n.Icon;return(0,Y.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,Y.jsx)(i,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:n.label})]},n.key)})})}),x9=({title:e,description:t,action:n})=>(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsxs)(SC,{children:[(0,Y.jsx)(CC,{children:e}),(0,Y.jsx)(wC,{children:t})]}),n&&(0,Y.jsx)(EC,{children:n})]}),S9=({text:e})=>(0,Y.jsxs)(`div`,{"aria-live":`polite`,className:`flex items-center gap-2 px-1 py-3 text-sm text-muted-foreground`,role:`status`,children:[(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}),(0,Y.jsx)(`span`,{children:e})]}),nge=e=>e?`Repo root (${e})`:`Repo root`,rge=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?Gy(n):`Selected bundle`}return rge(t?.current_branch??null)},w9=({title:e,description:t,children:n})=>(0,Y.jsxs)(`div`,{className:`flex max-h-[80vh] flex-col overflow-hidden`,children:[(0,Y.jsxs)(j_,{className:`border-b border-border/70 px-4 py-4`,children:[(0,Y.jsx)(N_,{children:e}),t&&(0,Y.jsx)(P_,{children:t})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:n})]}),ige=({projects:e,selectedProjectId:t,error:n,onSelectProject:r,onRetry:i})=>n?(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-red-200`,children:n}),(0,Y.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry projects`})]}):e?e.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No projects are available on the desktop instance yet.`}):(0,Y.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let n=e.id===t;return(0,Y.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,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.repo_path})]}),n&&(0,Y.jsx)(bC,{variant:`info`,children:`Current`})]}),(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:(0,Y.jsxs)(`span`,{children:[e.ticket_count,` tickets`]})})]},e.id)})}):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading projects...`}),age=({open:e,projects:t,selectedProjectId:n,error:r,onOpenChange:i,onSelectProject:a,onRetry:o})=>(0,Y.jsx)(O_,{open:e,onOpenChange:i,children:(0,Y.jsx)(A_,{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,Y.jsx)(w9,{title:`Projects`,children:(0,Y.jsx)(ige,{projects:t,selectedProjectId:n,error:r,onSelectProject:e=>{a(e),i(!1)},onRetry:o})})})}),oge=({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=Ny(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,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-red-200`,children:r}),(0,Y.jsx)(Q,{variant:`warning`,onClick:s,children:`Retry target options`})]}):n?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`Project target`}),(0,Y.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,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:`Target`}),(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-2`,children:[(0,Y.jsx)(Q,{type:`button`,variant:f?`secondary`:`ghost`,className:`w-full justify-start`,disabled:a,onClick:()=>l(null),children:nge(n.current_branch)}),(0,Y.jsxs)(`div`,{className:`relative min-h-10`,"data-testid":`mobile-target-options`,children:[i&&(0,Y.jsx)(`div`,{className:`pointer-events-none absolute right-2 top-2 z-10 text-muted-foreground`,"data-testid":`mobile-target-options-spinner`,children:(0,Y.jsx)(Pv,{className:`h-3.5 w-3.5 animate-spin`})}),(0,Y.jsx)(`div`,{className:`max-h-40 overflow-y-auto pr-7`,children:m.length===0&&!i?(0,Y.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No prepared bundles are available yet.`}):m.map(e=>(0,Y.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,Y.jsx)(`span`,{className:`truncate`,children:Gy(e)})},e.id))})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(J_,{className:`text-xs font-medium text-muted-foreground`,children:`Repo root branch`}),(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-3`,children:[(0,Y.jsx)(`div`,{className:`space-y-2`,children:h.length>0?h.map(({key:e,label:t,branch:n})=>(0,Y.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between gap-3`,disabled:!f||a||!n,onClick:()=>l(n),children:[(0,Y.jsx)(`span`,{children:t}),(0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n})]},e)):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i?`Loading branch suggestions...`:`No suggested branches available.`})}),(0,Y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Y.jsx)(J_,{htmlFor:`mobile-project-target-branch-input`,className:`text-xs text-muted-foreground`,children:`Switch or create branch`}),(0,Y.jsx)(F_,{id:`mobile-project-target-branch-input`,value:u,disabled:!f||a,onChange:e=>d(e.target.value),placeholder:`feature/quick-fix`})]}),(0,Y.jsx)(Q,{type:`button`,disabled:!f||!u.trim()||a,onClick:()=>l(u.trim()),children:`Switch`})]}),!f&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Switch to repo root to choose a branch.`})]})]})]}):(0,Y.jsx)(S9,{text:`Loading target options...`}):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a project before choosing a target.`});return(0,Y.jsx)(O_,{open:e,onOpenChange:o,children:(0,Y.jsx)(A_,{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,Y.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,Y.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,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.title})}),(0,Y.jsx)(bC,{variant:D9(T9(e)),children:E9(e)})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:[e.agent_status&&(0,Y.jsx)(`span`,{children:e.agent_status}),e.branch&&(0,Y.jsx)(`span`,{children:e.branch}),e.bundle?.name&&(0,Y.jsx)(`span`,{children:e.bundle.name})]})]}),sge=({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=Gy(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,Y.jsxs)(iw,{open:s,onOpenChange:c,children:[(0,Y.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,Y.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,"aria-label":`Open bundle ${l}`,onClick:()=>r(e.bundle.id),children:(0,Y.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(bC,{variant:`outline`,children:`Bundle`}),(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:l})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[e.tickets.length,` ticket`,e.tickets.length===1?``:`s`]}),u>0&&(0,Y.jsxs)(`span`,{children:[u,` running`]}),e.bundle.branch&&(0,Y.jsx)(`span`,{children:e.bundle.branch})]})]})})}),(0,Y.jsx)(aw,{asChild:!0,children:(0,Y.jsx)(Q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`mt-0.5 shrink-0`,"aria-label":`Toggle bundle tickets for ${l}`,children:(0,Y.jsx)(Cv,{className:Z(`h-4 w-4 transition-transform`,s&&`rotate-180`)})})})]}),(0,Y.jsx)(ow,{className:`pt-2`,children:(0,Y.jsx)(`div`,{className:`space-y-2 pl-3`,children:e.tickets.map(t=>(0,Y.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),cge=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,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before browsing tickets from this phone.`});if(i)return(0,Y.jsx)(x9,{title:`Tickets unavailable`,description:i,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:a,children:`Retry tickets`})});if(!t)return(0,Y.jsx)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,Y.jsx)(EC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading tickets...`})});if(t.length===0)return(0,Y.jsx)(x9,{title:`No tickets`,description:`This project does not have any tickets yet.`});let c=cge(t);return(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/70 pb-4`,children:[(0,Y.jsx)(CC,{children:`Tickets`}),(0,Y.jsxs)(wC,{children:[t.length,` total`]})]}),(0,Y.jsx)(EC,{className:`space-y-4 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:c.map(e=>(0,Y.jsxs)(`section`,{className:`space-y-2`,"aria-label":`${e.label} tickets`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsx)(`span`,{children:e.tickets.length})]}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:e.items.map(e=>e.kind===`bundle`?(0,Y.jsx)(sge,{group:e.group,selectedBundleId:n,selectedTicketId:r,onSelectBundle:o,onSelectTicket:s},e.group.id):(0,Y.jsx)(O9,{ticket:e.ticket,isSelected:e.ticket.id===r,onSelectTicket:e=>s(e,null)},e.ticket.id))})]},e.key))})]})},lge=e=>c9(`/mobile-auth/status`,{signal:e}),uge=(e,t)=>c9(`/mobile-auth/pair/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t}),dge=e=>c9(`/mobile-auth/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),fge=e=>c9(`/mobile-auth/logout`,{method:`POST`,headers:{[s9]:e}}),pge=()=>nC(window.location.origin,{withCredentials:!0}),j9=e=>Wb.t(`common:mobileApp.${e}`),M9=`Project root has uncommitted changes. Confirm branch switch to continue.`,mge=()=>{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,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-card/70 p-3`,children:[(0,Y.jsx)(`div`,{className:Z(`text-xl font-semibold text-foreground`,n),children:t}),(0,Y.jsx)(`div`,{className:`mt-1 text-xs uppercase tracking-[0.14em] text-muted-foreground`,children:e})]}),hge=()=>(0,Y.jsxs)(`div`,{className:`space-y-3`,"data-testid":`mobile-overview-skeleton`,children:[(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsx)(SC,{className:`border-b border-border/70 pb-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(Ov,{className:`h-6 w-28`}),(0,Y.jsx)(Ov,{className:`h-6 w-28 rounded-full`})]})}),(0,Y.jsxs)(EC,{className:`space-y-4 pt-5`,children:[(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-card/70 p-3`,children:[(0,Y.jsx)(Ov,{className:`h-6 w-10`}),(0,Y.jsx)(Ov,{className:`mt-2 h-3 w-16`})]},t))}),(0,Y.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,Y.jsx)(Ov,{className:`h-10 w-full rounded-xl`}),(0,Y.jsx)(Ov,{className:`h-10 w-full rounded-xl`})]})]})]}),(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsx)(SC,{children:(0,Y.jsx)(Ov,{className:`h-6 w-20`})}),(0,Y.jsx)(EC,{children:(0,Y.jsx)(Ov,{className:`h-10 w-40 rounded-xl`})})]})]}),gge=({isLoggingOut:e,onLogout:t})=>(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsx)(SC,{children:(0,Y.jsx)(CC,{children:`Session`})}),(0,Y.jsx)(EC,{children:(0,Y.jsxs)(Q,{variant:`destructive`,className:`gap-2`,disabled:e,onClick:t,children:[(0,Y.jsx)(phe,{className:`h-4 w-4`}),e?`Logging out...`:`Log out this phone`]})})]}),_ge=({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=jF(a.filter(e=>e.state===`review`));return o===`building`?{label:Wb.t(`common:statusBadge.building`),variant:`success`}:o===`reviewing`?{label:Wb.t(`common:statusBadge.reviewing`),variant:`warning`}:a.some(e=>e.state===`build`)?{label:Wb.t(`common:statusBadge.building`),variant:`success`}:a.some(e=>e.state===`plan`)?{label:`Planning`,variant:`info`}:{label:`Idle`,variant:`outline`}},vge=({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r})=>{let i=_ge({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r});return(0,Y.jsx)(bC,{variant:i.variant,children:i.label})},yge=({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,Y.jsx)(x9,{title:`Project summary unavailable`,description:r,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:o,children:`Retry summary`})}):e?!t||t.project.id!==e?(0,Y.jsx)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,Y.jsx)(EC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading project summary...`})}):(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/70 pb-4`,children:[(0,Y.jsx)(CC,{children:`Overview`}),(0,Y.jsx)(TC,{children:(0,Y.jsx)(vge,{activeRun:t.active_run,tickets:n,chatSessions:i,chatSessionDetail:a})})]}),(0,Y.jsxs)(EC,{className:`space-y-4 pt-5`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:[(0,Y.jsx)(N9,{label:`Tickets`,value:t.tickets.total}),(0,Y.jsx)(N9,{label:`Plan`,value:t.tickets.plan,accentClassName:`text-sky-200`}),(0,Y.jsx)(N9,{label:`Build`,value:t.tickets.build,accentClassName:`text-emerald-200`}),(0,Y.jsx)(N9,{label:`Review`,value:t.tickets.review,accentClassName:`text-amber-200`}),(0,Y.jsx)(N9,{label:`Done`,value:t.tickets.parked}),(0,Y.jsx)(N9,{label:`Bundles`,value:t.project.bundle_count??0})]}),(0,Y.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,Y.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":_9.ctaAriaLabel,onClick:s,children:[(0,Y.jsx)(u,{className:`h-4 w-4`}),_9.label]}),(0,Y.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":v9.ctaAriaLabel,onClick:c,children:[(0,Y.jsx)(d,{className:`h-4 w-4`}),v9.label]}),(0,Y.jsxs)(Q,{variant:`outline`,className:`gap-2 sm:col-span-2`,"aria-label":y9.ctaAriaLabel,onClick:l,children:[(0,Y.jsx)(f,{className:`h-4 w-4`}),y9.label]})]})]})]}):(0,Y.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,Y.jsx)(x9,{title:`Chats unavailable`,description:r,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry chats`})}):(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/70 pb-4`,children:[(0,Y.jsx)(CC,{children:`Chats`}),(0,Y.jsx)(wC,{children:t?`${t.length} recent`:`Loading chats...`}),(0,Y.jsx)(TC,{children:(0,Y.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:`New chat`})})]}),(0,Y.jsx)(EC,{className:`space-y-2 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:t?t.length===0?(0,Y.jsx)(x9,{title:`No chats`,description:`Start a new chat to plan or build from this project.`,action:(0,Y.jsx)(Q,{onClick:a,children:`Start a chat`})}):t.map(e=>(0,Y.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,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.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,Y.jsx)(bC,{variant:e.agent_status===`running`?`warning`:e.mode===`plan`?`info`:`success`,children:e.agent_status??e.mode})]})},e.id)):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading chats...`})})]}):(0,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before browsing chats from this phone.`}),I9=({label:e,disabled:t,onClick:n})=>(0,Y.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=>hy(e)&&e.agent_status===`running`&&!!e.session_id)??null,s=t.find(e=>hy(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}},bge=({ticket:e,actionState:t,actionError:n,onAction:r})=>{let i=a3(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,Y.jsx)(R4,{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,Y.jsx)(I9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},xge=({bundleDetail:e,actionState:t,actionError:n,onAction:r})=>{let{actions:i}=L9(e);return i.length===0?null:(0,Y.jsx)(R4,{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,Y.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?nq(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,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[i?(0,Y.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 px-2.5 lg:hidden`,"aria-label":r,onClick:i,children:[(0,Y.jsx)(CF,{className:`h-4 w-4`}),`Back`]}):null,(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e}),t?(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t}):null]})]}),a?(0,Y.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),n?(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n}):null]}),Sge=({title:e,backLabel:t,onBack:n,action:r})=>(0,Y.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,Y.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 px-2.5`,"aria-label":t,onClick:n,children:[(0,Y.jsx)(CF,{className:`h-4 w-4`}),`Back`]}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground`,children:e}),(0,Y.jsx)(`div`,{className:`shrink-0`,children:r})]}),V9=({title:e,backLabel:t,onBack:n,action:r,subheader:i,children:a})=>(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(Sge,{title:e,backLabel:t,onBack:n,action:r}),i?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-border/70 py-2 lg:hidden`,children:i}):null,(0,Y.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,Y.jsxs)(`div`,{className:`flex gap-2 px-3 sm:px-0`,children:[(0,Y.jsx)(Q,{type:`button`,variant:e===`transcript`?`secondary`:`ghost`,className:`h-9 flex-1`,"aria-pressed":e===`transcript`,onClick:t,children:`Transcript`}),(0,Y.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,Y.jsxs)(iw,{open:t,onOpenChange:n,children:[(0,Y.jsx)(`div`,{className:`px-1 pb-1`,children:(0,Y.jsx)(aw,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2 text-xs text-muted-foreground`,children:[`Options`,(0,Y.jsx)(Cv,{className:Z(`h-3.5 w-3.5 transition-transform`,t&&`rotate-180`)})]})})}),(0,Y.jsx)(ow,{className:`px-1 pb-1`,children:(0,Y.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-background/35 p-2`,children:e})})]})},Cge=({ticket:e})=>{let t=[{label:`State`,value:E9(e)},{label:`Tool`,value:PF(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,Y.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-xl border border-border/70 bg-background/40 px-3 py-3`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Details`}),(0,Y.jsx)(`dl`,{className:`grid gap-2 text-sm sm:grid-cols-2`,children:t.map(e=>(0,Y.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border/60 bg-background/50 px-3 py-2`,children:[(0,Y.jsx)(`dt`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:e.label}),(0,Y.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,Y.jsxs)(xC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,a),children:[(0,Y.jsx)(SC,{className:`min-w-0 pb-3`,children:(0,Y.jsx)(B9,{title:e.title,badges:t})}),(0,Y.jsxs)(EC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,Y.jsx)(bge,{ticket:e,actionState:n,actionError:r,onAction:i}),e.description?(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-xl border border-border/70 bg-background/40 px-3 py-3`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Description`}),(0,Y.jsx)(tq,{content:e.description,className:`min-w-0 text-foreground`})]}):null,(0,Y.jsx)(Cge,{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,Y.jsxs)(xC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,f),children:[(0,Y.jsx)(SC,{className:`min-w-0 pb-3`,children:(0,Y.jsx)(B9,{title:t,subtitle:n,badges:r})}),(0,Y.jsxs)(EC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,Y.jsx)(xge,{bundleDetail:e,actionState:i,actionError:a,onAction:o}),(0,Y.jsxs)(iw,{open:l,onOpenChange:u,children:[(0,Y.jsx)(aw,{asChild:!0,children:(0,Y.jsxs)(Q,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs text-muted-foreground`,children:[`Tickets`,(0,Y.jsx)(Cv,{className:Z(`h-3.5 w-3.5 transition-transform`,l&&`rotate-180`)})]})}),(0,Y.jsx)(ow,{className:`pt-2`,children:(0,Y.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-background/35 p-3`,children:(0,Y.jsx)(p3,{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,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before opening bundle details from this phone.`});if(!t)return(0,Y.jsx)(x9,{title:`Choose a bundle`,description:`Open a bundle to review its transcript and grouped ticket progress.`});if(a)return(0,Y.jsx)(V9,{title:`Bundle unavailable`,backLabel:`Back to tickets`,onBack:f,children:(0,Y.jsx)(x9,{title:`Bundle unavailable`,description:a,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:m,children:`Retry bundle`})})});if(!n||n.bundle.id!==t)return(0,Y.jsx)(V9,{title:`Loading bundle`,backLabel:`Back to tickets`,onBack:f,children:(0,Y.jsx)(S9,{text:`Loading bundle details...`})});let w=Gy(n.bundle)||n.bundle.branch||n.bundle.name||`Bundle`,T=new Map(d.map(e=>[e.id,e.label])),E=_3(n.tickets,T),D=b3(n),O=v3(n.tickets,n.execution_order_ticket_ids),k=y3(n.tickets,T,E,n.execution_order_ticket_ids),A=NF(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`&&Iy(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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(TF,{status:A}),(0,Y.jsx)(bC,{variant:`outline`,children:L}),M?(0,Y.jsxs)(bC,{variant:`outline`,children:[`Target: `,M.title]}):null]});return(0,Y.jsx)(V9,{title:w,backLabel:`Back to tickets`,onBack:f,subheader:x?void 0:(0,Y.jsx)(H9,{value:i,onTranscript:()=>g(`transcript`),onDetails:()=>g(`details`)}),children:x?(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden pt-3`,children:[(0,Y.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,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,Y.jsx)(f3,{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:dy(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,Y.jsx)(`p`,{className:`shrink-0 text-sm text-red-200`,children:u}):null]}):i===`details`?(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,Y.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,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(f3,{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:dy(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,Y.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,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before opening the chat workspace.`});if(n&&i)return(0,Y.jsx)(x9,{title:`Chat unavailable`,description:i,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:b,children:`Retry chat`})});if(n&&(!t||t.id!==n))return(0,Y.jsx)(V9,{title:`Loading chat`,backLabel:`Back to chats`,onBack:y,children:(0,Y.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,ee=OF(t?.post_build_check),te=ee?Wb.t(`common:postBuildChecks.blockedReason`):R?Wb.t(`common:questionSet.waitForResolution`):v,z=t?.agent_status===`running`?(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:a,onClick:x,children:[a?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:a?`Interrupting...`:`Interrupt`})]}):null,B=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(bC,{variant:N===`plan`?`info`:`success`,children:N}),(0,Y.jsx)(bC,{variant:`outline`,children:t?.tool??s}),t?.agent_status?(0,Y.jsx)(bC,{variant:`outline`,children:t.agent_status}):null]}),V=P?(0,Y.jsx)(OY,{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:!!te||h}):s===`opencode`&&m?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,H=!M&&V?(0,Y.jsx)(U9,{controls:V}):V,U=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)($Y,{value:N,disabled:!!te||h||g,onChange:S}),_&&(0,Y.jsx)(Q8,{disabled:h||g,onClick:C})]}),ne=M?void 0:({showThinkingControl:e})=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[U,(0,Y.jsx)(`div`,{className:`ml-auto`,children:e})]}),re=`mobile-chat:${n??`new`}:${r}`;return(0,Y.jsx)(V9,{title:t?.title??`New chat`,backLabel:`Back to chats`,onBack:y,action:z,children:(0,Y.jsx)(Z8,{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,Y.jsx)(B9,{title:t?.title??`New chat`,subtitle:t?.target_label_snapshot??`Project root`,badges:B}):ne,composerControls:M?U:void 0,composerInlineControls:H,composerTheme:N,forceScrollToBottomKey:re,layoutKey:re,scrollLayoutKey:re,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,Y.jsx)(cY,{messageContent:e.content,questionSet:n,storageKey:$J({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||ee,postBuildCheck:t?.post_build_check,followUpDisabledReason:te??void 0,hidePendingAgentTitle:!M,onFollowUpPromptChange:w,onFollowUpKeyDown:O,onFollowUpSubmit:k},re)})},wge=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?nq(e.response_timing):null,transcript_runs:e.transcript_runs??null})),Tge=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,Y.jsx)(x9,{title:j9(`specList.listError`),description:r,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:i,children:j9(`specList.retry`)})}):(0,Y.jsxs)(xC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,Y.jsxs)(SC,{className:`border-b border-border/70 pb-4`,children:[(0,Y.jsx)(CC,{children:j9(`specList.title`)}),(0,Y.jsx)(wC,{children:t?`${t.length} recent`:j9(`specList.loading`)}),(0,Y.jsx)(TC,{children:(0,Y.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:j9(`specList.newSpec`)})})]}),(0,Y.jsx)(EC,{className:`space-y-2 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:t?t.length===0?(0,Y.jsx)(x9,{title:j9(`specList.emptyTitle`),description:j9(`specList.emptyDescription`),action:(0,Y.jsx)(Q,{onClick:a,children:j9(`specList.startSpec`)})}):t.map(e=>(0,Y.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,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.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,Y.jsx)(bC,{variant:e.agent_status===`running`?`warning`:e.mode===`grill`?`info`:`success`,children:e.agent_status??e.mode})]})},e.id)):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:j9(`specList.loading`)})})]}):(0,Y.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:_,targetWarning:v,targetActionLabel:y,targetActionError:b,isRestoringTarget:x,onBack:S,onRetry:C,onStop:w,onModeChange:T,onPromptChange:E,onModelChange:D,onVariantChange:O,onSkillsChange:k,onPromptKeyDown:A,onSubmit:j,onSubmitAnswer:M,onResolveQuestionSet:N,onRestoreTarget:P,liveResponseTiming:F,isLargeScreen:I})=>{if(!e)return(0,Y.jsx)(x9,{title:j9(`specList.emptyTitle`),description:`Select a project before opening the spec workspace.`});if(n&&i)return(0,Y.jsx)(x9,{title:j9(`specDetail.unavailableTitle`),description:i,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:C,children:j9(`specDetail.retry`)})});if(n&&(!t||t.id!==n))return(0,Y.jsx)(V9,{title:j9(`specDetail.loadingTitle`),backLabel:j9(`specDetail.back`),onBack:S,children:(0,Y.jsx)(S9,{text:j9(`specDetail.loading`)})});let L=t?.mode??o,R=s===`opencode`&&f.length>0,ee=f.find(e=>e.id===l)??null,te=wge(t?.messages),z=Tge(t?.messages),B=z9(t?.messages),V=B?Wb.t(`common:questionSet.waitForResolution`):_,H=t?.agent_status===`running`,U=H?(0,Y.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:a,onClick:w,children:[a?(0,Y.jsx)(Pv,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(Lv,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{children:j9(a?`specDetail.interrupting`:`specDetail.interrupt`)})]}):null,ne=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(bC,{variant:L===`grill`?`info`:`success`,children:L}),(0,Y.jsx)(bC,{variant:`outline`,children:t?.tool??s}),t?.agent_status?(0,Y.jsx)(bC,{variant:`outline`,children:t.agent_status}):null]}),re=R?(0,Y.jsx)(OY,{model:l,variant:u,skills:d,showModelSelector:!0,showSkillsSelector:!0,availableModels:f,availableSkills:p,selectedModel:ee,onModelChange:D,onVariantChange:O,onSkillsChange:k,modelSelectId:`mobile-spec-model-selector`,variantSelectId:`mobile-spec-variant-selector`,skillsSelectId:`mobile-spec-skills-selector`,disabled:!!V||h}):s===`opencode`&&m?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,ie=!I&&re?(0,Y.jsx)(U9,{controls:re}):re,ae={rationaleLabel:Wb.t(`common:specView.grill.rationaleLabel`),suggestionsLabel:Wb.t(`common:specView.grill.suggestionsLabel`),recommendedSuggestionLabel:Wb.t(`common:specView.grill.recommendedSuggestionLabel`),answerPlaceholder:Wb.t(`common:specView.grill.answerPlaceholder`),submitLabel:Wb.t(`common:specView.grill.submitLabel`),submittingLabel:Wb.t(`common:specView.grill.submittingLabel`)},oe=e=>{if(e.role!==`assistant`)return;let n=e.metadata,r=n?.ask_question;if(r&&t)return(0,Y.jsx)(cY,{messageContent:e.content,questionSet:r,storageKey:$J({parentType:`spec`,parentId:t.id,setId:r.id}),isActive:r.status===`pending`&&B?.id===e.id,isDisabled:!!v||H||h||g,onResolve:t=>N(e.id,t)});if(e.kind!==`grill-question`)return;let i=n?.grill_question;if(i)return(0,Y.jsx)(B5,{question:i,isActive:H?!1:e.id===z&&t?.agent_status!==`running`&&t?.mode===`grill`,isDisabled:!!v||h||g,labels:ae,onSubmitAnswer:M})},W=(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,Y.jsx)(V5,{on:L===`grill`,disabled:!!V||h||g,onToggle:e=>T(e?`grill`:`standard`),tooltipContent:Wb.t(`common:specView.grill.toggleTooltip`),ariaLabelOn:Wb.t(`common:specView.grill.toggleAriaLabelOn`),ariaLabelOff:Wb.t(`common:specView.grill.toggleAriaLabelOff`)})}),se=I?void 0:({showThinkingControl:e})=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[W,(0,Y.jsx)(`div`,{className:`ml-auto`,children:e})]}),ce=`mobile-spec:${n??`new`}:${r}`;return(0,Y.jsxs)(V9,{title:t?.title??j9(`specDetail.newSpecTitle`),backLabel:j9(`specDetail.back`),onBack:S,action:U,children:[v&&(0,Y.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-100`,children:[(0,Y.jsx)(`p`,{children:v}),y&&(0,Y.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`mt-2`,disabled:x,onClick:P,children:x?j9(`specDetail.switchingBack`):y}),b&&(0,Y.jsx)(`p`,{className:`mt-2 text-red-200`,children:b})]}),(0,Y.jsx)(Z8,{projectId:e,agentRunParentType:n?`spec`:null,agentRunParentId:n,messages:te,internalLog:t?.agent_log??null,currentThinkingMessageId:t?.agent_message_id??null,previousThinkingLog:t?.previous_agent_log??null,previousThinkingMessageId:t?.previous_agent_message_id??null,pendingAgentTitle:t?.title??j9(`specDetail.newSpecTitle`),streamingResponse:t?.streaming_response??null,isRunning:H,pendingAgentRevealKey:F?.turnKey??null,liveResponseTiming:F,canShowComposer:!0,header:I?(0,Y.jsx)(B9,{title:t?.title??j9(`specDetail.newSpecTitle`),subtitle:t?.first_user_message_preview??null,badges:ne}):se,composerControls:I?W:void 0,composerInlineControls:ie,composerTheme:`default`,forceScrollToBottomKey:ce,layoutKey:ce,scrollLayoutKey:ce,composerFocusNonce:r,blurComposerOnSendStart:!I,followUpPrompt:c,followUpPlaceholder:j9(n?`specDetail.composerPlaceholder`:`specDetail.composerPlaceholderDraft`),emptyStateText:j9(n?`specDetail.emptyMessages`:`specDetail.emptyDraft`),renderMessageBody:oe,isSendingFollowUp:h,isComposerSubmitDisabled:!!V,followUpDisabledReason:V??void 0,hidePendingAgentTitle:!I,onFollowUpPromptChange:E,onFollowUpKeyDown:A,onFollowUpSubmit:j},ce)]})},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,Y.jsx)(x9,{title:`Choose a project`,description:`Select a project before opening ticket details from this phone.`});if(!t)return(0,Y.jsx)(x9,{title:`Choose a ticket`,description:`Open a ticket to review its transcript and continue the workflow.`});if(i)return(0,Y.jsx)(x9,{title:`Ticket unavailable`,description:i,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:v,children:`Retry ticket`})});if(!n||n.id!==t)return(0,Y.jsx)(V9,{title:`Loading ticket`,backLabel:`Back to tickets`,onBack:_,children:(0,Y.jsx)(S9,{text:`Loading ticket details...`})});let j=o3(n,{requireWorktree:!0}),M=R9(n.messages,n.id),N=z9(n.messages),P=!!N,F=OF(n.post_build_check),I=F?Wb.t(`common:postBuildChecks.blockedReason`):P?Wb.t(`common:questionSet.waitForResolution`):j.disabledReason,L=d.find(e=>e.id===c)??null,R=PF(n,`opencode`)===`opencode`&&d.length>0?(0,Y.jsx)(OY,{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}):PF(n,`opencode`)===`opencode`&&m?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,ee=!O&&R?(0,Y.jsx)(U9,{controls:R}):R,te=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(bC,{variant:D9(T9(n)),children:E9(n)}),n.tool?(0,Y.jsx)(bC,{variant:`outline`,children:n.tool}):null,n.agent_status?(0,Y.jsx)(bC,{variant:`outline`,children:n.agent_status}):null,n.branch?(0,Y.jsx)(bC,{variant:`outline`,children:n.branch}):null,n.bundle?.name?(0,Y.jsx)(bC,{variant:`outline`,children:n.bundle.name}):null]}),z=`mobile-ticket:${n.id}:${r}`,B=e=>{let t=e.metadata?.ask_question;if(!(e.role!==`assistant`||!t))return(0,Y.jsx)(cY,{messageContent:e.content,questionSet:t,storageKey:$J({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)})},V=(0,Y.jsx)(H9,{value:k,onTranscript:()=>A(`transcript`),onDetails:()=>A(`details`)});return(0,Y.jsx)(V9,{title:n.title,backLabel:`Back to tickets`,onBack:_,subheader:O?void 0:V,children:O?(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden pt-3`,children:[(0,Y.jsx)(W9,{ticket:n,badges:te,actionState:a,actionError:o,onAction:y,className:`shrink-0`}),(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,Y.jsx)(gY,{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:dy(n.state),forceScrollToBottomKey:z,layoutKey:z,scrollLayoutKey:z,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:B,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},z)}),g?(0,Y.jsx)(`p`,{className:`shrink-0 text-sm text-red-200`,children:g}):null]}):k===`details`?(0,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,Y.jsx)(W9,{ticket:n,badges:te,actionState:a,actionError:o,onAction:y,className:`h-full`})}):(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(gY,{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:ee,composerTheme:dy(n.state),surfaceVariant:`chat`,composerSize:`compact-on-laptop`,forceScrollToBottomKey:z,layoutKey:z,scrollLayoutKey:z,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:B,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},z),g?(0,Y.jsx)(`p`,{className:`shrink-0 px-1 pt-2 text-sm text-red-200`,children:g}):null]})})},Ege=()=>{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}},Dge=()=>{window.history.replaceState({},``,`/mobile`)},Oge=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Z9=(e,t)=>e instanceof Ke&&e.message?e.message:t,Q9=e=>({status:`authenticated`,csrfToken:e,projects:null,selectedProjectId:null,projectError:null,projectSummary:null,projectSummaryError:null,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),$9=(e=`pairing_required`)=>({status:`unauthenticated`,reason:e}),kge=e=>e instanceof Ke&&(e.status===401||e.status===403),Age=()=>{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),[ee,te]=(0,p.useState)(!1),[z,B]=(0,p.useState)(null),[V,H]=(0,p.useState)(null),[U,ne]=(0,p.useState)(null),[re,ie]=(0,p.useState)(!1),[ae,oe]=(0,p.useState)(``),[W,se]=(0,p.useState)(`standard`),[ce,le]=(0,p.useState)(``),[ue,de]=(0,p.useState)(``),[fe,pe]=(0,p.useState)([]),[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,Te]=(0,p.useState)(0),[Ee,De]=(0,p.useState)(null),[Oe,ke]=(0,p.useState)(null),[Ae,je]=(0,p.useState)(null),[Me,Ne]=(0,p.useState)(null),[Pe,Fe]=(0,p.useState)(``),[Ie,Le]=(0,p.useState)(``),[G,Re]=(0,p.useState)(``),[ze,Be]=(0,p.useState)([]),[Ve,He]=(0,p.useState)(!1),[Ue,K]=(0,p.useState)(null),[We,Ge]=(0,p.useState)(null),[q,Je]=(0,p.useState)(``),[Ye,Ze]=(0,p.useState)(!1),[Qe,J]=(0,p.useState)(null),[$e,et]=(0,p.useState)(0),[tt,nt]=(0,p.useState)(0),[rt,it]=(0,p.useState)(0),[at,ot]=(0,p.useState)(`transcript`),[st,ct]=(0,p.useState)(null),[lt,ut]=(0,p.useState)(null),[dt,ft]=(0,p.useState)(!1),[pt,mt]=(0,p.useState)(!1),[ht,gt]=(0,p.useState)(!1),[X,_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=>kge(e)?(t($9(`session_revoked`)),r(`unavailable`),l(!1),d(!1),m(!1),g(!1),ie(!1),!0):!1,[]),Ot=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await bhe(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(!Xe(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 whe(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(!Xe(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 yhe(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(!Xe(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 vhe(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(!Xe(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 _he(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(!Xe(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 Nhe(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(!Xe(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 Mhe(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(!Xe(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 hhe(n,r);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,projectSummary:i,projectSummaryError:null})}catch(r){if(!Xe(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,n,r=!1)=>{mt(!0),ut(null);try{let[i,a]=await Promise.all([ghe(e,n),r?l9(n):Promise.resolve(null)]),o=bt.current;if(o&&o!==e)return;if(ct(i),ut(null),_t(null),a){let n=a.find(t=>t.id===e);n&&t(t=>t.status!==`authenticated`||t.selectedProjectId!==e?t:{...t,projects:t.projects?.map(t=>t.id===e?{...t,active_target_kind:n.active_target_kind,active_target_bundle_id:n.active_target_bundle_id}:t)??t.projects})}return!0}catch(t){if(!Xe(t)){if(Dt(t))return;let n=bt.current;if(n&&n!==e)return;ct(null),ut(Z9(t,`Unable to load project target options.`))}return!1}finally{n?.aborted||mt(!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 l9(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(!Xe(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 lge(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){Xe(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=Ege();return Dge(),n?(t({status:`pairing`}),uge(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=!pt&&st&&`current_branch`in st?{status:`ready`,branch:st.current_branch}:null,$t=Zt?.target_available===!1?Zt.target_unavailable_reason??j9(`specDetail.targetUnavailable`):null,en=!!(Zt?.target_kind===`repo_root`&&Zt.target_branch_snapshot&&qt?.active_target_kind!==`bundle`),tn=Zt?.target_kind===`bundle`&&lt?Wb.t(`common:mobileApp.specDetail.targetRefreshError`,{error:lt}):en&&lt?Wb.t(`common:mobileApp.specDetail.targetLoadError`,{error:lt}):null,nn=Zt&&pt||en&&!Qt&&!tn?j9(`specDetail.targetLoading`):tn,rn=!!(Zt&&!$t&&!nn&&!h5({activeProject:qt,activeProjectBranchState:Qt,session:Zt})),an=rn&&Zt?Wb.t(`common:mobileApp.specDetail.targetMismatch`,{sessionTarget:_5(Zt),currentTarget:v5({activeProject:qt,activeProjectBranchState:Qt})}):null,on=C9(qt,st),sn=pt&&(!qt||qt.active_target_kind===`bundle`),cn=mge(),ln=Jt?.tool??`opencode`,un=Zt?.tool??`opencode`,dn=!!z9(Jt?.messages),fn=!!z9(Zt?.messages),pn=!!z9(Xt?.messages),mn=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:ee?`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.`:dn?Wb.t(`common:questionSet.waitForResolution`):null,hn=!!(Jt&&rX(Jt,dn)),gn=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:$t||nn||an||(ge?`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.`:fn?Wb.t(`common:questionSet.waitForResolution`):null),_n=!cn&&(o===`tickets`&&(f&&!!Gt||u&&!!Wt)||o===`chats`&&h||o===`spec`&&re);(0,p.useEffect)(()=>{bt.current=Ht},[Ht]),(0,p.useEffect)(()=>{Ht||(ct(null),ut(null),_t(null),ft(!1),mt(!1),gt(!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(!(ln===`opencode`||Xt?.tool===`opencode`||un===`opencode`)){M([]),P([]),I(!1);return}let e=new AbortController;return I(!0),Promise.all([Ghe(`opencode`,e.signal),Khe(`opencode`,Ht,e.signal)]).then(([e,t])=>{M(e),P(t)}).catch(e=>{Dt(e)||Xe(e)||(M([]),P([]))}).finally(()=>{e.signal.aborted||I(!1)}),()=>e.abort()},[Vt,ln,Dt,Ht,Xt?.tool,un]),(0,p.useEffect)(()=>{if(ln!==`opencode`){E(``),O(``),A([]);return}E(Jt?.model??qt?.helper_model??``),O(Jt?.variant??qt?.helper_variant??``),A(Jt?.skills??[])},[ln,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)(()=>{Fe(``),K(null),Le(Xt?.model??``),Re(Xt?.variant??``),Be(Xt?.skills??[])},[Xt?.id,Xt?.model,Xt?.skills,Xt?.variant]),(0,p.useEffect)(()=>{Je(``),J(null)},[Yt?.bundle.id]),(0,p.useEffect)(()=>{if(un!==`opencode`){le(``),de(``),pe([]);return}le(Zt?.model??qt?.helper_model??``),de(Zt?.variant??qt?.helper_variant??``),pe(Zt?.skills??[])},[un,qt?.helper_model,qt?.helper_variant,Zt?.id,Zt?.model,Zt?.skills,Zt?.variant]),(0,p.useEffect)(()=>{Zt?.mode&&se(Zt.mode)},[Zt?.id,Zt?.mode]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===ce)??null;de(t=>e?e.variants.includes(t)?t:``:t)},[j,ce]),(0,p.useEffect)(()=>{let e=j.find(e=>e.id===Ie)??null;Re(t=>e?e.variants.includes(t)?t:``:t)},[j,Ie]),(0,p.useEffect)(()=>{if(!Vt)return;let e=pge();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 vn=()=>{zt()},yn=e=>{s(e),d(!1),m(!1),g(!1),ie(!1),yt(null)},bn=()=>{l(!0)},xn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(_t(null),ft(!0),!st&&!pt&&It(e.selectedProjectId))},Sn=()=>{e.status===`authenticated`&&(v(!0),fge(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)))},Cn=()=>{if(e.status!==`pairing_confirmation`||y)return;let n=e.payload;b(!0),t({...e,error:null}),dge(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))},wn=()=>{window.history.replaceState({},``,`/mobile`),t($9())},Tn=()=>{e.status===`authenticated`&&(t({...e,projects:null,projectError:null}),Rt(e.csrfToken))},En=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,projectSummary:null,projectSummaryError:null}),Ft(e.csrfToken,e.selectedProjectId))},Dn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(ct(null),ut(null),_t(null),It(e.selectedProjectId))},On=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),Mt(e.csrfToken,e.selectedProjectId))},kn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||(t({...e,chatSessionDetail:null,chatSessionDetailError:null}),jt(e.csrfToken,e.selectedProjectId,e.selectedChatSessionId))},An=()=>{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))},jn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||(t({...e,ticketDetail:null,ticketDetailError:null}),Ot(e.csrfToken,e.selectedProjectId,e.selectedTicketId))},Mn=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||(t({...e,bundleDetail:null,bundleDetailError:null}),kt(e.csrfToken,e.selectedProjectId,e.selectedBundleId))},Nn=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}),De(null),ke(null),je(null),Ne(null),H(null),Ne(null),xe(null),J(null),ct(null),ut(null),_t(null),l(!1),ft(!1),d(!1),m(!1),g(!1),ie(!1),ot(`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)},Pn=async t=>{if(!(e.status!==`authenticated`||!e.selectedProjectId)){gt(!0),_t(null);try{Lt(await h9(e.selectedProjectId,e.csrfToken,{kind:`bundle`,bundle_id:t})),ft(!1),Ft(e.csrfToken,e.selectedProjectId),await It(e.selectedProjectId)}catch(e){if(Dt(e))return;_t(Z9(e,j9(`specDetail.updateTargetError`)))}finally{gt(!1)}}},Fn=async(t,n={})=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;gt(!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 Ke&&e.status===409&&e.message===M9){if(!window.confirm(`${M9}\n\nSwitch anyway?`))return;t=await r(!0)}else throw e}Lt(t),ft(!1),Ft(e.csrfToken,e.selectedProjectId),await It(e.selectedProjectId)}catch(e){if(Dt(e))return;_t(Z9(e,j9(`specDetail.updateTargetError`)))}finally{gt(!1)}},In=tn?Dn:()=>{if(!(!Zt||Zt.target_available===!1)){if(Zt.target_kind===`bundle`){Zt.target_bundle_id&&Pn(Zt.target_bundle_id);return}Fn(Zt.target_branch_snapshot??null,{createBranch:!1})}},Ln=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:n,chatSessionDetail:null,chatSessionDetailError:null}),H(null),et(e=>e+1),g(!0),s(`chats`),jt(e.csrfToken,e.selectedProjectId,n))},Rn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),H(null),S(``),et(e=>e+1),g(!0),s(`chats`))},zn=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedBundleId:n,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),De(null),ke(null),Ne(null),J(null),yt(null),ot(`transcript`),nt(e=>e+1),d(!0),m(!1),s(`tickets`),kt(e.csrfToken,e.selectedProjectId,n))},Bn=(n,r)=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedTicketId:n,ticketDetail:null,ticketDetailError:null}),yt(r),it(e=>e+1),d(r!==null),m(!0),s(`tickets`),Ot(e.csrfToken,e.selectedProjectId,n))},Vn=()=>{g(!1)},Hn=async n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return null;if(!e.chatSessionDetail||!e.selectedChatSessionId)return w(n),null;if(e.chatSessionDetail.mode===n||ee||dn)return null;let r=e.selectedProjectId,i=e.selectedChatSessionId,a=e.csrfToken;te(!0),H(null);try{let e=await Ahe(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)||H(Z9(e,`Unable to update the chat mode right now.`)),null}finally{te(!1)}},Un=()=>{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)},Wn=()=>{d(!1)},Gn=e=>{let t=j.find(t=>t.id===e)??null;E(e),O(e=>t&&t.variants.includes(e)?e:``)},Kn=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Yn())},qn=(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})},Jn=(n,r,i=e.status===`authenticated`?e.chatSessionDetail:null)=>{if(e.status!==`authenticated`||!e.selectedProjectId||L||mn)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=ln===`opencode`&&T?T:null,u=ln===`opencode`&&T&&D?D:null,d=ln===`opencode`?k:[],f=performance.now();Tt.current+=1;let p=`mobile-chat:${Tt.current}`;i&&ne({parentType:`chat`,parentId:i.id,turnKey:p,startedAt:f}),H(null),R(!0);let m=e=>Ohe(o,e.id,c,{instruction:a,tool:e.tool,model:l,variant:u,skills:d});return(i?m(i):Dhe(o,c,{mode:C,tool:ln,model:l,variant:u,skills:d}).then(m)).then(e=>(ne({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=>{ne(e=>e?.turnKey===p?null:e);let t=qe(e,`chat_session`);return t&&s?qn(o,s,t):e instanceof Ke&&e.status===409&&s&&await jt(c,o,s),Dt(e)||H(Z9(e,`Unable to send the chat prompt.`)),!1}).finally(()=>{R(!1)})},Yn=()=>{x.trim()&&Jn(x,!0)},Xn=async()=>{let t=e.status===`authenticated`?e.chatSessionDetail:null;if(!(!t||!rX(t,dn)||Et.current||L||mn)){Et.current=!0;try{let e=await Hn(`build`);if(!e)return;await Jn(nX,!1,e)}finally{Et.current=!1}}},Zn=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=$J({parentType:`chat`,parentId:a,setId:r.set_id});H(null);try{let e=await khe(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedChatSessionId!==a?t:{...t,chatSessions:t.chatSessions?.map(t=>t.id===e.id?e:t)??t.chatSessions,chatSessionDetail:e,chatSessionDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){tY(s);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?qn(i,a,t):await jt(o,i,a)}throw Dt(e)||H(Z9(e,`Unable to resolve the chat questions.`)),e}},Qn=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||z)return;let t=e.selectedProjectId,n=e.selectedChatSessionId;H(null),B(n),ne(e=>e?.parentId===n?null:e),jhe(t,n,e.csrfToken).then(()=>jt(e.csrfToken,t,n)).catch(e=>{Dt(e)||H(Z9(e,`Unable to stop the chat response.`))}).finally(()=>B(null))},$n=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),Pt(e.csrfToken,e.selectedProjectId))},er=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||(t({...e,specSessionDetail:null,specSessionDetailError:null}),Nt(e.csrfToken,e.selectedProjectId,e.selectedSpecSessionId))},tr=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:n,specSessionDetail:null,specSessionDetailError:null}),xe(null),_t(null),Te(e=>e+1),ie(!0),s(`spec`),Nt(e.csrfToken,e.selectedProjectId,n),It(e.selectedProjectId,void 0,!0))},nr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),xe(null),oe(``),Te(e=>e+1),ie(!0),s(`spec`))},rr=()=>{ie(!1)},ir=n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;if(!e.specSessionDetail||!e.selectedSpecSessionId){se(n);return}if(e.specSessionDetail.mode===n||ge||fn)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken;_e(!0),xe(null),Ihe(r,i,a,{mode:n}).then(e=>{se(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)||xe(Z9(e,j9(`specDetail.modeError`)))}).finally(()=>_e(!1))},ar=e=>{let t=j.find(t=>t.id===e)??null;le(e),de(e=>t&&t.variants.includes(e)?e:``)},or=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),cr())},sr=(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})},cr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||me||gn)return;let n=ae.trim();if(!n)return;let r=e.selectedProjectId,i=e.specSessionDetail?.id??null,a=e.csrfToken,o=un===`opencode`&&ce?ce:null,s=un===`opencode`&&ce&&ue?ue:null,c=un===`opencode`?fe:[],l=performance.now();Tt.current+=1;let u=`mobile-spec:${Tt.current}`;e.specSessionDetail&&Ce({parentType:`spec`,parentId:e.specSessionDetail.id,turnKey:u,startedAt:l}),xe(null),he(!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):Phe(r,a,{mode:W,tool:un,model:o,variant:s,skills:c}).then(d)).then(e=>{Ce({parentType:`spec`,parentId:e.id,turnKey:u,startedAt:l}),oe(``),ie(!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=>{Ce(e=>e?.turnKey===u?null:e);let t=e instanceof Ke&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&i&&sr(r,i,t),!Dt(e)&&xe(Z9(e,j9(`specDetail.sendError`)))}).finally(()=>he(!1))},lr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||me)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken,o=e.specSessionDetail?.tool??un,s=un===`opencode`&&ce?ce:null,c=un===`opencode`&&ce&&ue?ue:null,l=un===`opencode`?fe:[],u=performance.now();Tt.current+=1;let d=`mobile-spec:${Tt.current}`;Ce({parentType:`spec`,parentId:i,turnKey:d,startedAt:u}),xe(null),he(!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=>{Ce(e=>e?.turnKey===d?null:e);let t=e instanceof Ke&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&sr(r,i,t),!Dt(e)&&xe(Z9(e,j9(`specDetail.sendError`)))}).finally(()=>he(!1))},ur=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=$J({parentType:`spec`,parentId:a,setId:r.set_id});xe(null);try{let e=await Fhe(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedSpecSessionId!==a?t:{...t,specSessions:t.specSessions?.map(t=>t.id===e.id?e:t)??t.specSessions,specSessionDetail:e,specSessionDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){tY(s);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?sr(i,a,t):await Nt(o,i,a)}throw Dt(e)||xe(Z9(e,`Unable to resolve the spec questions.`)),e}},dr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||ve)return;let t=e.selectedProjectId,n=e.selectedSpecSessionId;xe(null),ye(n),Ce(e=>e?.parentId===n?null:e),Lhe(t,n,e.csrfToken).then(()=>Nt(e.csrfToken,t,n)).catch(e=>{Dt(e)||xe(Z9(e,j9(`specDetail.stopError`)))}).finally(()=>ye(null))},fr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||Ae||(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`?Rhe(r,i,a):n===`stop-run`?zhe(r,i,a):n===`pause-build`?p9(r,i,a):m9(r,i,a);je(n),Ne(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)||Ne(Z9(e,`Unable to update this ticket from mobile.`))}).finally(()=>je(null))},pr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||Ee)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`?The(r,i,a):n===`review`?Ehe(r,i,a):n===`pause-build`?s?p9(r,s,a):null:c?m9(r,c,a):null;d&&(De(n),ke(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)||ke(Z9(e,`Unable to update this bundle from mobile.`))}).finally(()=>De(null)))},mr=e=>{let t=j.find(t=>t.id===e)??null;Le(e),Re(e=>t&&t.variants.includes(e)?e:``)},hr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),gr())},gr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||!e.ticketDetail||Ve||pn)return;let n=Pe.trim();if(!n)return;let r=e.selectedProjectId,i=e.ticketDetail,a=e.csrfToken,o=s3(i,{model:Ie||null,variant:G||null,skills:ze});Tt.current+=1;let s={parentType:`ticket`,parentId:i.id,turnKey:`mobile-ticket:${Tt.current}`,startedAt:performance.now()};Ge(s);let c=()=>i.state===`plan`?Vhe(r,i.id,a,n):Uhe(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}})};He(!0),K(null),(async()=>{o.shouldPersist&&l(await Bhe(r,i.id,a,{model:o.model,variant:o.variant,skills:o.skills})),l(await c()),Fe(``),At(a,r),Ot(a,r,i.id)})().catch(async e=>{Ge(e=>e?.turnKey===s.turnKey?null:e);let t=qe(e,`ticket`);t?l(t):e instanceof Ke&&e.status===409&&await Ot(a,r,i.id),!Dt(e)&&K(Z9(e,`Unable to send the ticket follow-up.`))}).finally(()=>He(!1))},_r=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=$J({parentType:`ticket`,parentId:a,setId:r.set_id});K(null);try{let e=await Hhe(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedTicketId!==a?t:{...t,tickets:t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets,ticketDetail:e,ticketDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){tY(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)||K(Z9(e,`Unable to resolve the ticket questions.`)),e}},vr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),yr())},yr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||Ye)return;let n=q.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})};Ze(!0),J(null),Whe(r,i,a,n).then(e=>{o(e),Je(``),At(a,r),kt(a,r,i)}).catch(e=>{Dt(e)||J(Z9(e,`Unable to send the bundle follow-up.`))}).finally(()=>Ze(!1))},br=(0,p.useCallback)(async(e,t,n)=>{try{return await xhe(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]),xr=(0,p.useCallback)(async(e,t,n)=>{try{return await She(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]),Sr=(0,p.useCallback)(async(e,t,n)=>{try{return await Che(t??``,e,n)}catch(e){throw Dt(e),e}},[Dt]);return e.status===`checking`?(0,Y.jsx)(b9,{title:`Checking mobile session`,description:`Archon is validating this browser before showing project controls.`}):e.status===`pairing`?(0,Y.jsx)(b9,{title:`Checking pairing link`,description:`Keep this page open while Archon verifies the one-time pairing link.`}):e.status===`pairing_confirmation`?(0,Y.jsxs)(b9,{title:`Compare pairing code`,description:`Confirm this code matches the desktop dialog before pairing this phone.`,children:[(0,Y.jsx)(xC,{className:`border-primary/25 bg-primary/10 shadow-none`,children:(0,Y.jsxs)(EC,{className:`space-y-2 pt-5 text-center`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-foreground`,children:`Verification code`}),(0,Y.jsx)(`div`,{className:`font-mono text-3xl font-semibold tracking-[0.18em] text-foreground`,children:e.displayCode}),(0,Y.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expires at `,Oge(e.expiresAt)]})]})}),(0,Y.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,Y.jsx)(`p`,{className:`text-sm text-red-200`,children:e.error}):null,(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,Y.jsx)(Q,{size:`lg`,disabled:y,onClick:Cn,children:y?`Pairing...`:`Pair this phone`}),(0,Y.jsx)(Q,{variant:`outline`,size:`lg`,disabled:y,onClick:wn,children:`Cancel`})]})]}):e.status===`unauthenticated`?(0,Y.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,Y.jsx)(Q,{onClick:vn,children:`Retry`})}):e.status===`error`?(0,Y.jsx)(b9,{title:`Mobile access unavailable`,description:e.message,children:(0,Y.jsx)(Q,{onClick:vn,children:`Retry`})}):(0,Y.jsx)(Eq,{socket:i??void 0,fetchTicketRuns:br,fetchChatRuns:xr,fetchSpecRuns:Sr,children:(0,Y.jsxs)(`main`,{className:Z(`bg-background text-foreground`,_n?`flex h-[100dvh] flex-col overflow-hidden`:`min-h-screen`),children:[(0,Y.jsx)(age,{open:c,projects:e.projects,selectedProjectId:e.selectedProjectId,error:e.projectError,onOpenChange:l,onSelectProject:Nn,onRetry:Tn}),(0,Y.jsx)(oge,{open:dt,project:qt,targetOptions:st,error:X??lt,isLoading:pt,isSubmitting:ht,onOpenChange:ft,onRetry:Dn,onSelectBundle:e=>{Pn(e)},onSelectRepoRoot:(e,t)=>{Fn(e,t)}}),(0,Y.jsx)(ege,{selectedProject:qt,targetLabel:on,isTargetLoading:sn,isTargetDisabled:!Ht,connectionState:n,onOpenProjects:bn,onOpenTargetSelector:xn}),_n?(0,Y.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,Y.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:f&&e.selectedTicketId?(0,Y.jsx)(X9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:rt,error:e.ticketDetailError,actionState:Ae,actionError:Me,followUpPrompt:Pe,followUpSelectedModel:Ie,followUpSelectedVariant:G,followUpSelectedSkills:ze,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSendingFollowUp:Ve,liveResponseTiming:Xt?.agent_status===`running`&&We?.parentId===Xt.id?We:null,followUpError:Ue,onBack:Un,onRetry:jn,onAction:fr,onFollowUpPromptChange:Fe,onFollowUpModelChange:mr,onFollowUpVariantChange:Re,onFollowUpSkillsChange:Be,onFollowUpKeyDown:hr,onFollowUpSubmit:gr,onResolveQuestionSet:_r,isLargeScreen:!1}):(0,Y.jsx)(K9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:tt,mobileDetailView:at,error:e.bundleDetailError,actionState:Ee,actionError:Oe,followUpPrompt:q,isSendingFollowUp:Ye,followUpError:Qe,availableModels:j,onBack:Wn,onRetry:Mn,onAction:pr,onDetailViewChange:ot,onSelectTicket:Bn,onFollowUpPromptChange:Je,onFollowUpKeyDown:vr,onFollowUpSubmit:yr,isLargeScreen:!1})}):null,o===`chats`?(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(q9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:$e,error:e.chatSessionDetailError,isStopping:z===e.selectedChatSessionId,composerMode:e.chatSessionDetail?.mode??C,composerTool:ln,prompt:x,selectedModel:T,selectedVariant:D,selectedSkills:k,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:L,liveResponseTiming:Jt?.agent_status===`running`&&U?.parentId===Jt.id?U:null,isUpdatingMode:ee,showStartBuilding:hn,composerDisabledReason:mn,onBack:Vn,onRetry:kn,onStop:Qn,onModeChange:Hn,onStartBuilding:Xn,onPromptChange:S,onModelChange:Gn,onVariantChange:O,onSkillsChange:A,onPromptKeyDown:Kn,onSubmit:Yn,onResolveQuestionSet:Zn,isLargeScreen:!1}),V?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:V}):null]}):null,o===`spec`?(0,Y.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(Y9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:we,error:e.specSessionDetailError,isStopping:ve===e.selectedSpecSessionId,composerMode:e.specSessionDetail?.mode??W,composerTool:un,prompt:ae,selectedModel:ce,selectedVariant:ue,selectedSkills:fe,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:me,liveResponseTiming:Zt?.agent_status===`running`&&Se?.parentId===Zt.id?Se:null,isUpdatingMode:ge,composerDisabledReason:gn,targetWarning:$t??nn??an,targetActionLabel:tn?j9(`specDetail.retryTarget`):rn&&Zt?Wb.t(`common:mobileApp.specDetail.switchBack`,{target:_5(Zt)}):null,targetActionError:X,isRestoringTarget:ht,onBack:rr,onRetry:er,onStop:dr,onModeChange:ir,onPromptChange:oe,onModelChange:ar,onVariantChange:de,onSkillsChange:pe,onPromptKeyDown:or,onSubmit:cr,onSubmitAnswer:lr,onResolveQuestionSet:ur,onRestoreTarget:In,isLargeScreen:!1}),be?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:be}):null]}):null]}):(0,Y.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,Y.jsxs)(`div`,{className:`space-y-3 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col`,children:[(0,Y.jsx)($he,{status:n,onRetry:vn}),o===`overview`?(0,Y.jsx)(`div`,{className:`space-y-3 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col`,children:e.projectError?(0,Y.jsx)(x9,{title:`Projects unavailable`,description:e.projectError,action:(0,Y.jsx)(Q,{variant:`warning`,onClick:Tn,children:`Retry projects`})}):e.selectedProjectId&&!e.projectSummary&&!e.projectSummaryError?(0,Y.jsx)(hge,{}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(yge,{selectedProjectId:e.selectedProjectId,summary:e.projectSummary,tickets:e.tickets,error:e.projectSummaryError,chatSessions:e.chatSessions,chatSessionDetail:e.chatSessionDetail,onRetry:En,onOpenTickets:()=>yn(`tickets`),onOpenChats:()=>yn(`chats`),onOpenSpec:()=>yn(`spec`)}),(0,Y.jsx)(gge,{isLoggingOut:_,onLogout:Sn})]})}):null,o===`tickets`?cn?(0,Y.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(`div`,{className:`min-h-0`,children:(0,Y.jsx)(A9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:An,onSelectBundle:zn,onSelectTicket:Bn})}),(0,Y.jsx)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:f&&e.selectedTicketId?(0,Y.jsx)(X9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:rt,error:e.ticketDetailError,actionState:Ae,actionError:Me,followUpPrompt:Pe,followUpSelectedModel:Ie,followUpSelectedVariant:G,followUpSelectedSkills:ze,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSendingFollowUp:Ve,liveResponseTiming:Xt?.agent_status===`running`&&We?.parentId===Xt.id?We:null,followUpError:Ue,onBack:Un,onRetry:jn,onAction:fr,onFollowUpPromptChange:Fe,onFollowUpModelChange:mr,onFollowUpVariantChange:Re,onFollowUpSkillsChange:Be,onFollowUpKeyDown:hr,onFollowUpSubmit:gr,onResolveQuestionSet:_r,isLargeScreen:!0}):(0,Y.jsx)(K9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:tt,mobileDetailView:at,error:e.bundleDetailError,actionState:Ee,actionError:Oe,followUpPrompt:q,isSendingFollowUp:Ye,followUpError:Qe,availableModels:j,onBack:Wn,onRetry:Mn,onAction:pr,onDetailViewChange:ot,onSelectTicket:Bn,onFollowUpPromptChange:Je,onFollowUpKeyDown:vr,onFollowUpSubmit:yr,isLargeScreen:!0})})]}):(0,Y.jsx)(A9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:An,onSelectBundle:zn,onSelectTicket:Bn}):null,o===`chats`?cn?(0,Y.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(`div`,{className:`min-h-0`,children:(0,Y.jsx)(F9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:On,onOpenNewChat:Rn,onSelectChat:Ln})}),(0,Y.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,Y.jsx)(q9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:$e,error:e.chatSessionDetailError,isStopping:z===e.selectedChatSessionId,composerMode:e.chatSessionDetail?.mode??C,composerTool:ln,prompt:x,selectedModel:T,selectedVariant:D,selectedSkills:k,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:L,liveResponseTiming:Jt?.agent_status===`running`&&U?.parentId===Jt.id?U:null,isUpdatingMode:ee,showStartBuilding:hn,composerDisabledReason:mn,onBack:Vn,onRetry:kn,onStop:Qn,onModeChange:Hn,onStartBuilding:Xn,onPromptChange:S,onModelChange:Gn,onVariantChange:O,onSkillsChange:A,onPromptKeyDown:Kn,onSubmit:Yn,onResolveQuestionSet:Zn,isLargeScreen:!0}),V?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:V}):null]})]}):(0,Y.jsx)(F9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:On,onOpenNewChat:Rn,onSelectChat:Ln}):null,o===`spec`?cn?(0,Y.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(`div`,{className:`min-h-0`,children:(0,Y.jsx)(J9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:$n,onOpenNewSpec:nr,onSelectSpec:tr})}),(0,Y.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,Y.jsx)(Y9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:we,error:e.specSessionDetailError,isStopping:ve===e.selectedSpecSessionId,composerMode:e.specSessionDetail?.mode??W,composerTool:un,prompt:ae,selectedModel:ce,selectedVariant:ue,selectedSkills:fe,availableModels:j,availableSkills:N,isLoadingAgentSettings:F,isSending:me,liveResponseTiming:Zt?.agent_status===`running`&&Se?.parentId===Zt.id?Se:null,isUpdatingMode:ge,composerDisabledReason:gn,targetWarning:$t??nn??an,targetActionLabel:tn?j9(`specDetail.retryTarget`):rn&&Zt?Wb.t(`common:mobileApp.specDetail.switchBack`,{target:_5(Zt)}):null,targetActionError:X,isRestoringTarget:ht,onBack:rr,onRetry:er,onStop:dr,onModeChange:ir,onPromptChange:oe,onModelChange:ar,onVariantChange:de,onSkillsChange:pe,onPromptKeyDown:or,onSubmit:cr,onSubmitAnswer:lr,onResolveQuestionSet:ur,onRestoreTarget:In,isLargeScreen:!0}),be?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:be}):null]})]}):(0,Y.jsx)(J9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:$n,onOpenNewSpec:nr,onSelectSpec:tr}):null]})}),_n?null:(0,Y.jsx)(tge,{activeSection:o,onChange:yn})]})})},jge=({socket:e=rC,children:t})=>(0,Y.jsx)(yq.Provider,{value:e,children:t}),Mge=()=>typeof window<`u`&&window.location.pathname.startsWith(`/mobile`),Nge=()=>{let e=Mge();return Db(e?null:rC),(0,Y.jsx)(We,{i18n:Wb,children:(0,Y.jsx)(at,{children:(0,Y.jsxs)(jge,{children:[e&&(0,Y.jsx)(Age,{}),!e&&(0,Y.jsx)(Eq,{children:(0,Y.jsx)(sfe,{children:(0,Y.jsx)(fhe,{})})})]})})})};document.documentElement.classList.add(`dark`),document.documentElement.style.colorScheme=`dark`,x8(),(0,f.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(Nge,{}));export{Jt as $,eb as A,F_ as B,ax as C,tb as D,ub as E,Pv as F,M_ as G,k_ as H,jv as I,Q as J,j_ as K,Av as L,$ as M,Lv as N,Zy as O,Fv as P,Yt as Q,Cv as R,rC as S,Wb as T,A_ as U,O_ as V,P_ as W,Vn as X,Z as Y,qt as Z,iw as _,K as _t,H4 as a,$t as at,bC as b,bq as c,Vt as ct,Mw as d,it as dt,Zt as et,jw as f,Ke as ft,xw as g,J as gt,bw as h,Qe as ht,W4 as i,Xt as it,Qy as j,$y as k,iG as l,Ut as lt,Sw as m,Xe as mt,Q6 as n,en as nt,U4 as o,Qt as ot,yw as p,q as pt,N_ as q,n3 as r,Gt as rt,Fce as s,Ht as st,$5 as t,Kt as tt,Iw as u,Bt as ut,ow as v,c as vt,Xb as w,aC as x,aw as y,J_ as z};