frizz-server 0.13.1 → 0.13.3

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 (90) hide show
  1. package/dist/claude-agent-broker.js +9091 -9010
  2. package/dist/dev-child.js +2 -2
  3. package/package.json +1 -1
  4. package/web-dist/assets/{TerminalPane-n1ZGMZW4.js → TerminalPane-DuP4bhhj.js} +1 -1
  5. package/web-dist/assets/{abnfDiagram-VRR7QNED-g6lTBgEg.js → abnfDiagram-VRR7QNED-CEh3P4ec.js} +1 -1
  6. package/web-dist/assets/architecture-TIHT7OUA-DljbXMGA.js +1 -0
  7. package/web-dist/assets/{architectureDiagram-ZJ3FMSHR-CLTzSFlG.js → architectureDiagram-ZJ3FMSHR-hB8r_8GD.js} +1 -1
  8. package/web-dist/assets/{blockDiagram-677ZJIJ3-Ct3XdjS7.js → blockDiagram-677ZJIJ3-B_EjnCzl.js} +1 -1
  9. package/web-dist/assets/{c4Diagram-LMCZKHZV-oPOldgP6.js → c4Diagram-LMCZKHZV-CE2lnwzC.js} +1 -1
  10. package/web-dist/assets/channel-DDJsvUil.js +1 -0
  11. package/web-dist/assets/{chunk-32BRIVSS-DaeYRhKy.js → chunk-32BRIVSS-ClStiHFP.js} +1 -1
  12. package/web-dist/assets/{chunk-52WLFC77-DoHA78Bl.js → chunk-52WLFC77-BwoEvnjI.js} +1 -1
  13. package/web-dist/assets/{chunk-C7G6YPKG-C4eGAuXz.js → chunk-C7G6YPKG-Sml7hEgL.js} +1 -1
  14. package/web-dist/assets/{chunk-EX3LRPZG-4jUjJpNs.js → chunk-EX3LRPZG-C5qtRylf.js} +1 -1
  15. package/web-dist/assets/{chunk-FWX5IMBZ-C0QTWKsC.js → chunk-FWX5IMBZ-3V8_Ch9U.js} +2 -2
  16. package/web-dist/assets/{chunk-HOUHSVGY-BWg1UUA7.js → chunk-HOUHSVGY-Jgabn4KJ.js} +1 -1
  17. package/web-dist/assets/{chunk-ICXQ74PX-Buhhrztt.js → chunk-ICXQ74PX-DPC_6w3e.js} +1 -1
  18. package/web-dist/assets/{chunk-MOJQB5TN-B1uQobAX.js → chunk-MOJQB5TN-C2R2l4fd.js} +1 -1
  19. package/web-dist/assets/{chunk-OGEWGWER-D2fVbDzZ.js → chunk-OGEWGWER-snbL2tzP.js} +1 -1
  20. package/web-dist/assets/{chunk-PUDLZKDR-Bd2jPnuW.js → chunk-PUDLZKDR-BH0YK-aj.js} +1 -1
  21. package/web-dist/assets/{chunk-Q4XR5HBZ-DUG71LWC.js → chunk-Q4XR5HBZ-yS4RCJUS.js} +1 -1
  22. package/web-dist/assets/{chunk-V7JOEXUC-3iaWBasd.js → chunk-V7JOEXUC-pTkkxySk.js} +1 -1
  23. package/web-dist/assets/{chunk-VAUOI2AC-D4DQ_foU.js → chunk-VAUOI2AC-ByfRcoJm.js} +1 -1
  24. package/web-dist/assets/{chunk-VR4S4FIN-DX0v6JE_.js → chunk-VR4S4FIN-D0ZL-X9t.js} +1 -1
  25. package/web-dist/assets/{chunk-WYO6CB5R-C2kPBRr2.js → chunk-WYO6CB5R-DR4Z32Vt.js} +1 -1
  26. package/web-dist/assets/{chunk-ZGVPDNZ5-LQEeV0tX.js → chunk-ZGVPDNZ5-BSInEZ5j.js} +1 -1
  27. package/web-dist/assets/classDiagram-OUVF2IWQ-D7o_xZN-.js +1 -0
  28. package/web-dist/assets/classDiagram-v2-EOCWNBFH-D7o_xZN-.js +1 -0
  29. package/web-dist/assets/{cynefin-VYW2F7L2-CQw4jx1p.js → cynefin-VYW2F7L2-5_kg3VC3.js} +1 -1
  30. package/web-dist/assets/{cynefinDiagram-TSTJHNR4-E57Ok6_2.js → cynefinDiagram-TSTJHNR4-I2p0qywZ.js} +1 -1
  31. package/web-dist/assets/{dagre-VKFMJZFB-CjZdhyCy.js → dagre-VKFMJZFB-CqsSUWqR.js} +1 -1
  32. package/web-dist/assets/{diagram-FQU43EPY-BTN7___U.js → diagram-FQU43EPY-LzYRcSp1.js} +1 -1
  33. package/web-dist/assets/{diagram-G47NLZAW-BKAr7n5t.js → diagram-G47NLZAW-j7KoGkdO.js} +1 -1
  34. package/web-dist/assets/{diagram-NH7WQ7WH-BSIn7-k7.js → diagram-NH7WQ7WH-CkKj7Le-.js} +1 -1
  35. package/web-dist/assets/{diagram-OA4YK3LP-CibVz0sb.js → diagram-OA4YK3LP-BbYnMMQ4.js} +1 -1
  36. package/web-dist/assets/{diagram-WEI45ONY-DOR4c9lq.js → diagram-WEI45ONY-ZnaXdrM2.js} +1 -1
  37. package/web-dist/assets/{ebnfDiagram-CCIWWBDH-DCDt7_Vt.js → ebnfDiagram-CCIWWBDH-DlMJ525N.js} +1 -1
  38. package/web-dist/assets/{erDiagram-Q63AITRT-BW-_6fw-.js → erDiagram-Q63AITRT-BNqaRFOq.js} +1 -1
  39. package/web-dist/assets/eventmodeling-45OFAUF4-C7Co2sdQ.js +1 -0
  40. package/web-dist/assets/flowDiagram-23GEKE2U-CU4XpHpz.js +1 -0
  41. package/web-dist/assets/{ganttDiagram-NO4QXBWP-GnebOY1a.js → ganttDiagram-NO4QXBWP-LA2zj1xa.js} +1 -1
  42. package/web-dist/assets/{gitGraph-TEB2WS4Q-CbjyVrfZ.js → gitGraph-TEB2WS4Q-CyxExxvY.js} +1 -1
  43. package/web-dist/assets/{gitGraphDiagram-IHSO6WYX-C_2W052m.js → gitGraphDiagram-IHSO6WYX-DViEDxai.js} +1 -1
  44. package/web-dist/assets/{index-D4NqKvMT.js → index-C7G9HRfv.js} +3 -3
  45. package/web-dist/assets/{info-DKCQHKI2-B0oDbuMM.js → info-DKCQHKI2-CjwMBNAx.js} +1 -1
  46. package/web-dist/assets/{infoDiagram-FWYZ7A6U-8NfKf3or.js → infoDiagram-FWYZ7A6U-CH1w5jOF.js} +1 -1
  47. package/web-dist/assets/{ishikawaDiagram-FXEZZL3T-ClnR5L-V.js → ishikawaDiagram-FXEZZL3T-D6E4RsM0.js} +1 -1
  48. package/web-dist/assets/{journeyDiagram-5HDEW3XC-CymhJMLh.js → journeyDiagram-5HDEW3XC-BqKaYGHB.js} +1 -1
  49. package/web-dist/assets/{kanban-definition-HUTT4EX6-CDztCaFi.js → kanban-definition-HUTT4EX6-BtqDatnY.js} +1 -1
  50. package/web-dist/assets/{line-B39to1V1.js → line-CxNuqMwk.js} +1 -1
  51. package/web-dist/assets/{mermaid-parser.core-Bk8T5jYA.js → mermaid-parser.core-iyBzku_i.js} +3 -3
  52. package/web-dist/assets/{mermaid.core-kc8D7Mjc.js → mermaid.core-Bo-3lWY-.js} +3 -3
  53. package/web-dist/assets/{mindmap-definition-LN4V7U3C-Cv4k9osh.js → mindmap-definition-LN4V7U3C-B6hABfKD.js} +1 -1
  54. package/web-dist/assets/{packet-7NZHBO7P-BMbbM4_4.js → packet-7NZHBO7P-CucMCZHl.js} +1 -1
  55. package/web-dist/assets/{pegDiagram-2B236MQR-Dxqh85fv.js → pegDiagram-2B236MQR-otFk7wnm.js} +1 -1
  56. package/web-dist/assets/{pie-RZYD4A2V-hVxkoyfE.js → pie-RZYD4A2V-Cry4tbtA.js} +1 -1
  57. package/web-dist/assets/{pieDiagram-ENE6RG2P-OhEyekTd.js → pieDiagram-ENE6RG2P-D55Qzck8.js} +1 -1
  58. package/web-dist/assets/{quadrantDiagram-ABIIQ3AL-DzOQ3f3U.js → quadrantDiagram-ABIIQ3AL-CExholO3.js} +1 -1
  59. package/web-dist/assets/{radar-I7S5WNFK-vU2g1Vnw.js → radar-I7S5WNFK-DTEZSaKV.js} +1 -1
  60. package/web-dist/assets/{railroad-3IZDKUUU-DI0KUTKm.js → railroad-3IZDKUUU-wcxq1ncG.js} +1 -1
  61. package/web-dist/assets/railroad-abnf-AHOZXSZD-D37eg4Bf.js +1 -0
  62. package/web-dist/assets/railroad-ebnf-EBAXGLYW-BUsJxSuz.js +1 -0
  63. package/web-dist/assets/railroad-peg-LSFZ7HO6-CqLrwvjX.js +1 -0
  64. package/web-dist/assets/{railroadDiagram-RFXS5EU6-GQ5PH4TX.js → railroadDiagram-RFXS5EU6-fZ4i7gmj.js} +1 -1
  65. package/web-dist/assets/{requirementDiagram-TGXJPOKE-C0FL4DOr.js → requirementDiagram-TGXJPOKE-D_ImY4sL.js} +1 -1
  66. package/web-dist/assets/{sankeyDiagram-HTMAVEWB-DCSyv-JM.js → sankeyDiagram-HTMAVEWB-owSPfb7d.js} +1 -1
  67. package/web-dist/assets/{sequenceDiagram-DBY2YBRQ-1sNWc9Rr.js → sequenceDiagram-DBY2YBRQ-DcJPd0hW.js} +1 -1
  68. package/web-dist/assets/{stateDiagram-2N3HPSRC-CSAKi-V0.js → stateDiagram-2N3HPSRC-Ds82k2nu.js} +1 -1
  69. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-DgtweSx_.js +1 -0
  70. package/web-dist/assets/{swimlanes-5IMT3BWC-CRkAO2Z7.js → swimlanes-5IMT3BWC-CdObiiEk.js} +1 -1
  71. package/web-dist/assets/swimlanesDiagram-G3AALYLV-JzJpN1D7.js +8 -0
  72. package/web-dist/assets/{timeline-definition-FHXFAJF6-D4s77ovn.js → timeline-definition-FHXFAJF6-CyG43nBw.js} +1 -1
  73. package/web-dist/assets/{treeView-QDETBFTQ-CyZKSDpG.js → treeView-QDETBFTQ-Csu3pDsD.js} +1 -1
  74. package/web-dist/assets/{treemap-6X3UGDF4-C-8j18D-.js → treemap-6X3UGDF4-Cz38SD4Z.js} +1 -1
  75. package/web-dist/assets/{vennDiagram-L72KCM5P-CytXN7BL.js → vennDiagram-L72KCM5P-CInmXHU6.js} +1 -1
  76. package/web-dist/assets/{wardley-OPB4EBWU-Bg5QKr0-.js → wardley-OPB4EBWU-RlUfW1zQ.js} +1 -1
  77. package/web-dist/assets/{wardleyDiagram-EHGQE667-DwwZJo7D.js → wardleyDiagram-EHGQE667-pt9lws9S.js} +1 -1
  78. package/web-dist/assets/{xychartDiagram-FW5EYKEG-BY9WfzuI.js → xychartDiagram-FW5EYKEG-Q6zyjSv0.js} +1 -1
  79. package/web-dist/index.html +1 -1
  80. package/web-dist/assets/architecture-TIHT7OUA-DP2UCRIa.js +0 -1
  81. package/web-dist/assets/channel-Dwbakjlm.js +0 -1
  82. package/web-dist/assets/classDiagram-OUVF2IWQ-BtbPy0_X.js +0 -1
  83. package/web-dist/assets/classDiagram-v2-EOCWNBFH-BtbPy0_X.js +0 -1
  84. package/web-dist/assets/eventmodeling-45OFAUF4-Bc9tfVPk.js +0 -1
  85. package/web-dist/assets/flowDiagram-23GEKE2U-CGKxrtIs.js +0 -1
  86. package/web-dist/assets/railroad-abnf-AHOZXSZD-DHrfaWnB.js +0 -1
  87. package/web-dist/assets/railroad-ebnf-EBAXGLYW-Bs5a3WFY.js +0 -1
  88. package/web-dist/assets/railroad-peg-LSFZ7HO6-Baq5ZcQR.js +0 -1
  89. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-Cv7l1H7m.js +0 -1
  90. package/web-dist/assets/swimlanesDiagram-G3AALYLV-BV7TdeGn.js +0 -8
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPane-n1ZGMZW4.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/mermaid.core-kc8D7Mjc.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-C4XfhTaE.js","assets/chunk-WYO6CB5R-C2kPBRr2.js","assets/chunk-ICXQ74PX-Buhhrztt.js","assets/dist-DoH_9pyS.js","assets/chunk-VAUOI2AC-D4DQ_foU.js","assets/chunk-HOUHSVGY-BWg1UUA7.js","assets/chunk-Q4XR5HBZ-DUG71LWC.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-D2fVbDzZ.js","assets/chunk-C7G6YPKG-C4eGAuXz.js","assets/chunk-ZGVPDNZ5-LQEeV0tX.js","assets/rough.esm-CSKSodPl.js","assets/chunk-52WLFC77-DoHA78Bl.js","assets/line-B39to1V1.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-FWX5IMBZ-C0QTWKsC.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPane-DuP4bhhj.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/mermaid.core-Bo-3lWY-.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-C4XfhTaE.js","assets/chunk-WYO6CB5R-DR4Z32Vt.js","assets/chunk-ICXQ74PX-DPC_6w3e.js","assets/dist-DoH_9pyS.js","assets/chunk-VAUOI2AC-ByfRcoJm.js","assets/chunk-HOUHSVGY-Jgabn4KJ.js","assets/chunk-Q4XR5HBZ-yS4RCJUS.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-snbL2tzP.js","assets/chunk-C7G6YPKG-Sml7hEgL.js","assets/chunk-ZGVPDNZ5-BSInEZ5j.js","assets/rough.esm-CSKSodPl.js","assets/chunk-52WLFC77-BwoEvnjI.js","assets/line-CxNuqMwk.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-FWX5IMBZ-3V8_Ch9U.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
2
2
  import{n as e,t}from"./rolldown-runtime-Bh1tDfsg.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 n=t((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}}}})),r=t(((e,t)=>{t.exports=n()})),i=t((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 ee(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 F=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)},te={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=te,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:ee}},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,F)}catch(e){F(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.7`})),a=t(((e,t)=>{t.exports=i()})),o=t((e=>{var t=a();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},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=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 s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=i.p;try{if(c.T=null,i.p=2,e)return e()}finally{c.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 c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),s=t(((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=o()})),c=t((e=>{var t=r(),n=a(),i=s();function o(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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(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 u(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(l(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=a;break}if(c===r){s=!0,r=i,n=a;break}c=c.sibling}if(!s){for(c=a.child;c;){if(c===n){s=!0,n=a,r=i;break}if(c===r){s=!0,r=a,n=i;break}c=c.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(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 ee=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function oe(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function se(e,t){ie++,re[ie]=e.current,e.current=t}var ce=ae(null),le=ae(null),ue=ae(null),de=ae(null);function fe(e,t){switch(se(ue,t),se(le,e),se(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kd(t),e=qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}oe(ce),se(ce,e)}function pe(){oe(ce),oe(le),oe(ue)}function me(e){e.memoizedState!==null&&se(de,e);var t=ce.current,n=qd(t,e.type);t!==n&&(se(le,e),se(ce,n))}function he(e){le.current===e&&(oe(ce),oe(le)),de.current===e&&(oe(de),np._currentValue=ne)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ge+e+_e}var ye=!1;function be(e,t){if(!e||ye)return``;ye=!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(`
@@ -196,7 +196,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
196
196
  `),n=t[0]?.match(/^(@\S+) \((.+?)(?:, line (\d+)|, lines (\d+)-(\d+))?\):$/);if(!n)return null;let r=n[2],a=n[3]===void 0?n[4]===void 0?void 0:Number(n[4]):Number(n[3]),o=n[3]===void 0?n[5]===void 0?void 0:Number(n[5]):Number(n[3]),s=1,c=[];for(;s<t.length&&t[s].startsWith(`>`);s++)c.push(t[s].replace(/^> ?/,``));if(!c.length||s<t.length)return null;i.push({token:n[1],display:r,startLine:a,endLine:o,text:c.join(`
197
197
  `)})}return!i.length||!i.every(e=>VL(n,e.token))?null:{body:n,items:i}}function $L(e){return e.key===`Enter`&&!e.altKey&&!e.shiftKey&&!e.isComposing&&e.keyCode!==229}function eR(e,t){return t&&$L(e)&&!e.metaKey&&!e.ctrlKey}function tR(e,t){return t&&$L(e)&&(e.metaKey||e.ctrlKey)}function nR(e){return $L(e)}function rR(e){return e.key===`Enter`&&e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.isComposing}function iR(e,t,n){return e===`queueComposer`&&t===`Enter`&&n}var aR=`gap-3`,oR=`-mx-1`,sR=`-mx-[3px]`,cR=`right-2`,lR=`right-[71px]`,uR=`right-[44px]`,dR=`pr-[6.6875rem]`,fR=`pr-20`;async function pR(e,t){let n=Id(),r=await e.arrayBuffer(),i=``,a=new Uint8Array(r);for(let e=0;e<a.length;e+=32768)i+=String.fromCharCode(...a.subarray(e,e+32768));let o=await fetch(`${n}/attach`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t,data:btoa(i)})});return o.ok?(await o.json()).path??null:null}var mR={project:`project`,user:`global`,builtin:`built-in`,plugin:`plugin`};function hR(e,t){e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,t)}px`}function gR({value:e,onChange:t,onSubmit:n,surface:r,placeholder:i,id:a,minHeight:o=44,maxHeight:s=220,autoFocus:c,busy:l,footer:u,leftAction:d,contextTokens:f,slashSuggest:p,onInterruptSubmit:m}){let h=(0,I.useRef)(null),g=(0,I.useRef)(null),_=(0,I.useRef)(null),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(!1),{prose:S,attachments:C}=(0,I.useMemo)(()=>FL(e),[e]),w=C.map(e=>e.path),T=(0,I.useRef)(e);T.current=e;let E=e=>t(IL(e,w)),D=e=>t(IL(S,e));async function O(e){if(!e)return;if(b){Z(`An upload is already in progress — try again in a moment`);return}let n=[...e].map(e=>{let t=e.type.startsWith(`image/`)?e.type.slice(6).toLowerCase():``,n=t===`jpeg`?`jpg`:t===`svg+xml`?`svg`:t;return{file:e,name:e.name||(n?`pasted.${n}`:``)}}).filter(({name:e})=>Vc(e)?!0:(Z(`${e||`File`}: unsupported file type`),!1));if(!n.length)return;let r=n.filter(({file:e,name:t})=>e.size>Rc?(Z(`${t} is too large (max ${Math.floor(Rc/1e6)} MB)`),!1):!0);if(!r.length)return;let i=T.current;x(!0);let a=[];try{for(let{file:e,name:t}of r){let n=await pR(e,t);n?a.push(n):Z(`Could not attach ${t}`)}}finally{x(!1)}if(a.length&&i!==``&&T.current===``){Z(`Attachment discarded — the message was sent before the upload finished`),requestAnimationFrame(()=>h.current?.focus());return}if(a.length){let e=FL(T.current);t(IL(e.prose,[...e.attachments.map(e=>e.path),...a]))}requestAnimationFrame(()=>h.current?.focus())}(0,I.useLayoutEffect)(()=>{let e=!0,t=()=>{let t=h.current;!t||!e||hR(t,s)};t();let n=requestAnimationFrame(t);document.fonts?.ready.then(t);let r=h.current,i=r?.clientWidth??0,a,o=r?new ResizeObserver(([e])=>{let n=Math.round(e.contentRect.width);n!==i&&(i=n,a!==void 0&&cancelAnimationFrame(a),a=requestAnimationFrame(t))}):void 0;return r&&o?.observe(r),()=>{e=!1,cancelAnimationFrame(n),a!==void 0&&cancelAnimationFrame(a),o?.disconnect()}},[e,s,!!u]);let k=(0,I.useMemo)(()=>f??[],[f]),A=(0,I.useMemo)(()=>{if(k.length===0)return null;let e=GL(S,k);return e.some(e=>e.token)?e.map((e,t)=>e.token?(0,L.jsx)(`span`,{className:`rounded bg-panel-2 py-0.5 -mx-0.5 px-0.5 ring-1 ring-inset ring-border`,children:e.text},t):e.text):null},[S,k]),j=()=>{let e=h.current,t=g.current;e&&t&&(t.scrollTop=e.scrollTop)};(0,I.useLayoutEffect)(j);let M=(0,I.useRef)(!1);(0,I.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{M.current=e.disabled};return e.addEventListener(`focusout`,t),()=>e.removeEventListener(`focusout`,t)},[]),(0,I.useEffect)(()=>{if(l||!M.current)return;M.current=!1;let e=h.current,t=document.activeElement;e&&(!t||t.contains(e))&&e.focus({preventScroll:!0})},[l]);let[N,P]=(0,I.useState)(null),[ee,F]=(0,I.useState)({prose:``,index:0}),te=ee.prose===S?ee.index:0,ne=e=>F({prose:S,index:typeof e==`function`?e(te):e}),[re,ie]=(0,I.useState)(null),ae=!!p&&/^\/\S*$/.test(S);(0,I.useEffect)(()=>{if(!ae||N!==null)return;let e=!0;return p().then(t=>{e&&P(t)},()=>{e&&P([])}),()=>{e=!1}},[ae,N,p]);let oe=(0,I.useMemo)(()=>{if(!ae||!N||re===S)return[];let e=S.slice(1).toLowerCase(),t=N.filter(t=>t.name.toLowerCase().startsWith(e)),n=N.filter(t=>!t.name.toLowerCase().startsWith(e)&&t.name.toLowerCase().includes(e));return[...t,...n]},[ae,N,re,S]),se=oe.length>0,ce=(0,I.useMemo)(()=>{let e=new Set;for(let t of oe)t.source&&e.add(mR[t.source]);return[...e]},[oe]),le=(0,I.useRef)(null);(0,I.useEffect)(()=>{le.current?.querySelector(`[data-suggest-index="${te}"]`)?.scrollIntoView({block:`nearest`})},[te]);function ue(e){let t=`/${e.name} `;E(t),requestAnimationFrame(()=>h.current?.setSelectionRange(t.length,t.length))}let de=e.trim().length>0,fe=d??null;function pe(e){let t=e.currentTarget,i={key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.keyCode};if(se&&!e.nativeEvent.isComposing){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),ne(t=>(t+(e.key===`ArrowDown`?1:-1)+oe.length)%oe.length);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),ue(oe[te]??oe[0]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),ie(S);return}}if(e.key===`Backspace`&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&k.length>0&&t.selectionStart===t.selectionEnd){let n=t.selectionStart,r=GL(t.value.slice(0,n),k).at(-1);if(r?.token){e.preventDefault();let i=n-r.text.length;E(t.value.slice(0,i)+t.value.slice(n)),requestAnimationFrame(()=>t.setSelectionRange(i,i));return}}if(iR(r,e.key,e.altKey)){e.preventDefault(),e.stopPropagation();let n=t.selectionStart??t.value.length,r=t.selectionEnd??n;E(t.value.slice(0,n)+`
198
198
  `+t.value.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1));return}let a=de&&!l&&!b;if(eR(i,a)){e.preventDefault(),e.stopPropagation(),n();return}if(tR(i,a)){e.preventDefault(),e.stopPropagation(),(m??n)();return}if(rR(i)){let e=t.value,n=t.selectionStart??e.length,r=t.selectionEnd??n;requestAnimationFrame(()=>{t.value===e&&(E(e.slice(0,n)+`
199
- `+e.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1)))})}e.key===`Escape`&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.stopPropagation(),t.blur())}return(0,L.jsxs)(`div`,{className:`group relative rounded-xl border bg-bg transition-colors focus-within:border-accent ${v?`border-dashed border-accent`:`border-border`}`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`)&&(e.preventDefault(),y(!0))},onDragLeave:()=>y(!1),onDrop:e=>{e.preventDefault(),y(!1),O(e.dataTransfer.files)},children:[v&&(0,L.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-bg/80 text-[12px] text-muted`,children:`Drop file to attach`}),se&&(0,L.jsx)(`div`,{ref:le,"data-slash-menu":!0,className:`absolute bottom-full left-0 right-0 z-20 mb-1.5 max-h-56 overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg`,children:oe.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,"data-suggest-index":t,onMouseDown:e=>e.preventDefault(),onClick:()=>ue(e),onMouseEnter:()=>ne(t),className:`flex w-full items-baseline gap-2 px-3.5 py-1.5 text-left ${t===te?`bg-panel-2`:``}`,children:[(0,L.jsxs)(`span`,{className:`shrink-0 text-[12px] font-medium text-fg`,children:[`/`,e.name]}),e.description&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted`,children:e.description}),ce.length>0&&(0,L.jsxs)(`span`,{className:`ml-auto grid shrink-0 text-[10px]`,children:[ce.map(e=>(0,L.jsx)(`span`,{"aria-hidden":!0,className:`petite-caps invisible col-start-1 row-start-1`,children:e},e)),(0,L.jsx)(`span`,{className:`petite-caps col-start-1 row-start-1 text-right text-muted/70`,children:e.source?mR[e.source]:``})]})]},e.name))}),(0,L.jsxs)(`div`,{className:`relative`,children:[A&&(0,L.jsx)(`div`,{ref:g,"aria-hidden":!0,"data-composer-context-backdrop":!0,className:`pointer-events-none absolute inset-0 select-none overflow-hidden whitespace-pre-wrap [overflow-wrap:break-word] px-3.5 ${u?`py-2.5 pb-3`:`py-2.5 ${fe?`pr-[6.6875rem]`:`pr-20`}`} text-[13px] leading-relaxed text-transparent`,children:A}),(0,L.jsx)(`textarea`,{id:a,ref:h,onScroll:A?j:void 0,"data-surface":r,value:S,autoFocus:c,disabled:l,onChange:e=>E(e.target.value),onKeyDown:pe,onPaste:e=>{let t=[...e.clipboardData.items].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(Boolean);t.length&&(e.preventDefault(),O(t))},placeholder:i,rows:1,spellCheck:!1,style:{minHeight:o,maxHeight:s},className:`relative block w-full resize-none bg-transparent px-3.5 ${u?`py-2.5 pb-3`:`py-2.5 ${fe?dR:fR}`} text-[13px] leading-relaxed text-fg outline-none placeholder:text-muted scrollbar-none disabled:opacity-60`})]}),C.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pb-2 ${fe?`pr-[6.6875rem]`:`pr-20`}`,children:C.map((e,t)=>(0,L.jsx)(_R,{attachment:e,disabled:l,onRemove:()=>D(w.filter((e,n)=>n!==t))},`${e.path}-${t}`))}),u&&(0,L.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1 pl-1.5 pb-1.5 ${fe?`pr-[6.6875rem]`:`pr-20`}`,children:u}),fe&&(0,L.jsx)(`div`,{className:`absolute bottom-2 right-[43px] flex items-center`,children:fe}),(0,L.jsx)(`input`,{ref:_,type:`file`,multiple:!0,accept:Hc,className:`hidden`,onChange:e=>{O(e.target.files),e.target.value=``}}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>_.current?.click(),disabled:l||b,title:`Attach files`,"aria-label":`Attach files`,className:`absolute bottom-2 ${fe?lR:uR} flex h-7 w-7 items-center justify-center rounded-lg text-muted transition-[color,background-color] enabled:hover:bg-panel-2/70 enabled:hover:text-fg disabled:opacity-50`,children:b?(0,L.jsx)(Xm,{size:15,strokeWidth:2,className:`animate-spin`}):(0,L.jsx)(ih,{size:15,strokeWidth:2})}),(0,L.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:n,disabled:!de||l||b,title:`Send (Enter · ⌘⏎ sends now)`,"aria-label":`Send`,className:`absolute bottom-2 ${cR} flex h-7 w-7 items-center justify-center rounded-lg transition-all ${de&&!l&&!b?`bg-fg text-bg hover:opacity-90 active:scale-95`:`bg-panel-2 text-muted`}`,children:l?(0,L.jsx)(Xm,{size:14,strokeWidth:2.5,className:`animate-spin`}):(0,L.jsx)(fm,{size:14,strokeWidth:2.5})})]})}function _R({attachment:e,disabled:t,onRemove:n}){let[r,i]=(0,I.useState)(!1),a=Qf(e.path),o=(a.includes(`.`)?a.split(`.`).pop():``).toUpperCase();return(0,L.jsxs)(`div`,{className:`group/att relative h-11 w-11`,title:a,children:[e.kind===`image`&&!r?(0,L.jsx)(`img`,{src:YS(e.path),alt:a,onError:()=>i(!0),className:`h-11 w-11 rounded-md border border-border object-cover`}):(0,L.jsxs)(`div`,{className:`flex h-11 w-11 flex-col items-center justify-center gap-0.5 rounded-md border border-border bg-panel-2 px-1`,children:[(0,L.jsx)(Pm,{size:15,strokeWidth:2,className:`shrink-0 text-muted`}),o&&(0,L.jsx)(`span`,{className:`-mx-1 max-w-[calc(100%+0.5rem)] truncate text-[8px] font-medium leading-none text-muted/80`,children:o})]}),(0,L.jsx)(`button`,{type:`button`,onClick:n,disabled:t,title:`Remove ${a}`,"aria-label":`Remove ${a}`,className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-border bg-bg text-muted opacity-0 transition-opacity hover:text-fg focus-visible:opacity-100 group-hover/att:opacity-100 disabled:hidden`,children:(0,L.jsx)(Ch,{size:10,strokeWidth:2.5})})]})}function vR(){return nt({queryKey:[`githubStatus`],queryFn:()=>Y.githubStatus(),staleTime:3e4,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.data;return t?.inRepo&&t.authed?!1:6e4}})}function yR(){let e=vR();return!!(e.data?.inRepo&&e.data.authed)}function bR({className:e=``}){return yR()?(0,L.jsx)(`button`,{type:`button`,onClick:lp,onMouseDown:e=>e.preventDefault(),title:`Investigate this issue and make recommendations`,"aria-label":`Investigate this issue and make recommendations`,className:`flex h-7 w-7 items-center justify-center rounded-lg text-muted outline-none transition-[color,background-color,box-shadow] enabled:hover:bg-panel-2/70 enabled:hover:text-fg enabled:focus-visible:bg-panel-2/70 enabled:focus-visible:text-muted enabled:focus-visible:ring-1 enabled:focus-visible:ring-muted/80 enabled:focus-visible:ring-offset-1 enabled:focus-visible:ring-offset-bg enabled:active:bg-elevated enabled:active:text-muted disabled:bg-transparent disabled:text-muted/35 ${e}`,children:(0,L.jsx)(Hm,{size:15,strokeWidth:2})}):null}var xR=`prompt-control-type petite-caps`,SR=xR,CR=xR,wR=`profile-grid-cell relative flex h-6 cursor-pointer select-none items-center justify-start rounded border border-transparent px-1 text-left text-muted outline-none transition-colors ${SR} data-[highlighted]:border-border data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[highlighted]:outline data-[highlighted]:outline-1 data-[highlighted]:outline-offset-1 data-[highlighted]:outline-fg/55 data-[state=checked]:border-accent/70 data-[state=checked]:bg-accent/10 data-[state=checked]:font-medium data-[state=checked]:text-fg data-[state=checked]:ring-1 data-[state=checked]:ring-inset data-[state=checked]:ring-accent/90`;function TR(e){return`minmax(6rem, 7rem) repeat(${Math.max(0,e)}, auto)`}var ER=[`ultra`,`ultracode`],DR=[`low`,`medium`,`high`,`xhigh`,`max`,...ER];function OR(e){return[...new Set(e.flatMap(e=>e.options.flatMap(e=>e.efforts)))].sort((e,t)=>{let n=DR.indexOf(e),r=DR.indexOf(t);return n===-1&&r===-1?e.localeCompare(t):n===-1?1:r===-1?-1:n-r})}function kR(e){let t=[];for(let n of OR(e)){let e=ER.includes(n)?t.find(e=>ER.includes(e[0])):void 0;e?e.push(n):t.push([n])}return t}function AR(e){return e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n}))))}function jR(e){return JSON.stringify([e.provider,e.model,e.effort])}function MR(e,t){return AR(e).find(e=>jR(e)===t)}function NR(e,t){return!t?.model||!t.effort?!1:e.some(e=>(!t.provider||e.id===t.provider)&&e.options.some(e=>e.model===t.model&&e.efforts.includes(t.effort)))}function PR(e,t,n=`Profile unknown`){if(!t?.model&&!t?.effort)return n;let r=e.flatMap(e=>e.options).find(e=>e.model===t.model)?.label??t.model??`Model unknown`;return t.effort?`${r} › ${t.effort}`:r}function FR(e,t,n){let r=kR(e),i=e=>r.findIndex(t=>t.includes(e)),a=e.flatMap(e=>e.options.map(t=>({provider:e.id,option:t}))),o=a.findIndex(e=>e.provider===t.provider&&e.option.model===t.model);if(o===-1)return null;let s=a[o],c=s.option.efforts.indexOf(t.effort);if(c===-1)return null;if(n===`Home`||n===`End`||n===`ArrowLeft`||n===`ArrowRight`){let e=n===`Home`?0:n===`End`?s.option.efforts.length-1:c+(n===`ArrowLeft`?-1:1),t=s.option.efforts[e];return t?{provider:s.provider,model:s.option.model,effort:t}:null}let l=a[o+(n===`ArrowUp`?-1:1)];if(!l)return null;let u=i(t.effort),d=l.option.efforts.reduce((e,t)=>e?Math.abs(i(t)-u)<Math.abs(i(e)-u)?t:e:t,void 0);return d?{provider:l.provider,model:l.option.model,effort:d}:null}var IR,LR=!1;function RR(){LR||typeof window>`u`||(LR=!0,window.addEventListener(`keydown`,e=>{e.key!==`Escape`||!IR||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),BR())},{capture:!0}))}function zR(e){RR();let t={dismiss:e};return IR=t,()=>{IR===t&&(IR=void 0)}}function BR(){let e=IR;return e?(IR=void 0,e.dismiss(),!0):!1}function VR(e){BR()&&e.preventDefault(),e.stopPropagation()}function HR(e){return e===`xhigh`?`X-high`:e.charAt(0).toUpperCase()+e.slice(1)}function UR({groups:e,value:t,pending:n,onValueChange:r,placeholder:i,ariaLabel:a,menuAriaLabel:o=`Choose model and effort`,title:s,disabled:c=!1,compact:l=!1,side:u=`bottom`,menuZClass:d=$j,className:f=``}){let[p,m]=(0,I.useState)(!1),h=(0,I.useRef)(p),g=(0,I.useRef)(c),_=(0,I.useRef)(void 0),v=(0,I.useRef)(new Map),y=(0,I.useRef)(void 0),b=(0,I.useMemo)(()=>kR(e),[e]),x=(0,I.useMemo)(()=>e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n})))),[e]),S=l?CR:SR,C=c?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors hover:border-border hover:bg-panel-2 hover:text-fg`,w=NR(e,t),T=w&&t?.provider&&t.model&&t.effort?jR(t):void 0,E=n?.model||n?.effort?PR(e,n,`Pending profile`):void 0;h.current=p,g.current=c;function D(){h.current=!1,_.current=void 0,m(!1)}(0,I.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!h.current||g.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current?.(),D())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,I.useLayoutEffect)(()=>{!c||!p||(_.current?.(),D())},[c,p]),(0,I.useLayoutEffect)(()=>()=>_.current?.(),[]),(0,I.useLayoutEffect)(()=>{T===y.current&&(y.current=void 0)},[T]);function O(e){let t=jR(e);y.current!==t&&(y.current=t,r(e))}function k(t,n){if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(t.key))return;let r=FR(e,n,t.key);r&&(t.preventDefault(),t.stopPropagation(),v.current.get(jR(r))?.focus())}return(0,L.jsxs)(MI,{modal:!1,open:p,onOpenChange:e=>{_.current?.(),_.current=void 0,h.current=e,m(e),e&&(_.current=zR(D))},children:[(0,L.jsx)(NI,{asChild:!0,disabled:c,children:(0,L.jsxs)(`button`,{type:`button`,"aria-label":a,"aria-invalid":!w&&(t?.model||t?.effort)?!0:void 0,"aria-description":E?`Pending ${E}`:void 0,title:s,"data-profile-known":w?`true`:`false`,"data-profile-pending":E?`true`:void 0,className:`profile-grid-trigger group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-border/50 bg-transparent px-2 py-1 text-left text-muted outline-none data-[state=open]:border-border data-[state=open]:bg-panel-2 ${C} ${f} ${S}`,children:[(0,L.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 flex-1 truncate text-left ${S}`,children:PR(e,t,i)}),E&&(0,L.jsx)(Xm,{"aria-hidden":`true`,size:l?10:11,className:`shrink-0 animate-spin text-muted/65`}),(0,L.jsx)(_m,{"aria-hidden":`true`,size:l?11:13,className:`shrink-0 text-fg/65 transition-transform group-data-[state=open]:rotate-180`})]})}),(0,L.jsx)(PI,{children:(0,L.jsxs)(FI,{"aria-label":o,align:`start`,side:u,sideOffset:5,collisionPadding:8,onEscapeKeyDown:e=>e.stopPropagation(),className:`profile-grid-menu ${d} ${Qj} max-h-[min(360px,var(--radix-dropdown-menu-content-available-height))] max-w-[calc(100vw-1rem)] overflow-auto rounded-lg p-1.5 ${S}`,children:[e.map(t=>(0,L.jsxs)(II,{children:[t.label&&(0,L.jsx)(LI,{className:`px-1.5 pb-1 pt-1 text-left font-medium tracking-[0.07em] text-muted/55 first:pt-0.5`,children:t.label}),(0,L.jsx)(zI,{value:T,onValueChange:t=>{let n=MR(e,t);n&&O(n)},children:t.options.map(e=>(0,L.jsxs)(`div`,{"data-profile-grid-row":e.model,className:`grid w-max items-center gap-1 py-0.5`,style:{gridTemplateColumns:TR(b.length)},children:[(0,L.jsx)(`span`,{className:`profile-grid-model-label min-w-0 max-w-[9.5rem] truncate px-1.5 text-left text-muted ${S}`,title:e.label,children:e.label}),b.map(n=>{let r=n.find(t=>e.efforts.includes(t)),i=n.reduce((e,t)=>HR(t).length>HR(e).length?t:e);if(!r)return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`invisible cursor-default border border-transparent px-1 text-left font-medium ${S}`,children:HR(i)},i);let a={provider:t.id,model:e.model,effort:r},o=jR(a);return(0,L.jsx)(BI,{value:o,ref:e=>{e?v.current.set(o,e):v.current.delete(o)},onKeyDown:e=>k(e,a),onSelect:e=>{e.preventDefault(),O(a),_.current?.(),D()},"aria-label":`${e.label}, ${HR(r)} effort`,title:`${e.label} › ${HR(r)}`,className:wR,children:(0,L.jsxs)(`span`,{className:`grid`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 font-medium`,children:HR(r)}),(0,L.jsx)(`span`,{className:`col-start-1 row-start-1`,children:HR(r)})]})},r)})]},e.model))}),t!==e.at(-1)&&(0,L.jsx)(HI,{className:`my-1 h-px bg-border`})]},t.id)),x.length===0&&(0,L.jsx)(`div`,{className:`px-2 py-1.5 text-muted/60`,children:`No profiles available`})]})})]})}async function WR(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}if(!GR(e))throw Error(`the browser blocked clipboard access`)}function GR(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.opacity=`0`,document.body.append(t);let n=document.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;t.select(),t.setSelectionRange(0,e.length);let i=!1;try{i=document.execCommand(`copy`)}catch{i=!1}return t.remove(),r&&n&&(n.removeAllRanges(),n.addRange(r)),i}var KR={claude:`claude auth login`,codex:`codex login`},qR={claude:`Claude`,codex:`Codex`};function JR(e){let t=e.trim();return t===`/login`?`login`:t===`/logout`?`logout`:null}var YR=(0,I.lazy)(()=>ib(()=>import(`./TerminalPane-n1ZGMZW4.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([0,1])));function XR({backend:e,onClose:t,onAuthed:n}){let r=Ve(),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(null),c=(0,I.useRef)(!1),l=KR[e],u=qR[e],d=it({mutationFn:()=>Y.accountLoginStart({backend:e}),onSuccess:e=>{c.current=!1,s(e.attemptId)},onError:e=>Z(`Couldn't start the sign-in terminal: ${e.message.slice(0,80)} — use the command below instead`,{duration:7e3})}),f=nt({queryKey:[`accountLoginStatus`,o],queryFn:()=>Y.accountLoginStatus({attemptId:o}),enabled:!!o,refetchInterval:2e3});(0,I.useEffect)(()=>{if(!o||c.current)return;let t=f.data;if(!(!t||t.state===`running`||t.state===`unknown`)){if(c.current=!0,t.auth!==`signed-out`){r.setQueryData([`authStatus`],n=>n&&{...n,[e]:t.auth}),Z(`Signed in to ${u}`),n();return}Z(`${u} sign-in didn't complete — try again or use the command below`,{duration:7e3}),s(null)}},[o,f.data,e,u]);function p(){o&&!c.current&&Y.accountLoginCancel({attemptId:o}).catch(()=>{})}let m=(0,I.useRef)({attempt:null,settled:!1});m.current={attempt:o,settled:c.current},(0,I.useEffect)(()=>()=>{let{attempt:e,settled:t}=m.current;e&&!t&&Y.accountLoginCancel({attemptId:e}).catch(()=>{})},[]);async function h(){try{await WR(l),a(!0),window.setTimeout(()=>a(!1),1500)}catch{Z(`Couldn't copy — select the command and copy it manually`,{duration:6e3})}}let g=it({mutationFn:()=>Y.authStatus(),onSuccess:t=>{if(r.setQueryData([`authStatus`],t),t[e]===`signed-out`){Z(`Still signed out of ${u} — run the command, then retry`,{duration:6e3});return}n()},onError:()=>n()});return(0,L.jsx)(eL,{open:!0,onOpenChange:e=>{e||(p(),t())},children:(0,L.jsxs)(oL,{children:[(0,L.jsx)(cL,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,L.jsxs)(fL,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] ${o?`w-[680px]`:`w-[440px]`} max-w-[92vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,L.jsxs)(_L,{className:`mb-1 text-[14px] font-medium`,children:[`Signed out of `,u]}),o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`mb-3 text-[12.5px] leading-relaxed text-muted`,children:[`This terminal is running `,(0,L.jsx)(`code`,{className:`font-mono-keep text-fg/90`,children:l}),` — follow its prompts (it may open your browser). Frizz detects completion automatically.`]}),(0,L.jsx)(`div`,{className:`mb-4 h-[340px] overflow-hidden rounded-lg border border-border bg-[#0d0e10]`,children:(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-muted`,children:`Opening terminal…`}),children:(0,L.jsx)(YR,{slug:o})})}),(0,L.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>{p(),s(null)},className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel sign-in`})})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`Frizz can't start a `,u,` thread until you're signed in. Sign in here, or run the command in your own terminal and retry:`]}),(0,L.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-border bg-panel-2 px-3 py-2`,children:[(0,L.jsx)(`code`,{className:`flex-1 select-all font-mono-keep text-[12.5px] text-fg`,children:l}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,onClick:h,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel hover:text-fg`,children:i?(0,L.jsx)(gm,{size:14,strokeWidth:2,className:`text-green-400`}):(0,L.jsx)(Am,{size:14,strokeWidth:1.8})})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel`}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>g.mutate(),disabled:g.isPending,className:`flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[12.5px] text-fg/90 outline-none transition-colors hover:bg-panel-2 disabled:opacity-60`,children:[g.isPending&&(0,L.jsx)(Xm,{size:13,className:`animate-spin`}),`Retry`]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>d.mutate(),disabled:d.isPending,className:`flex items-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[d.isPending&&(0,L.jsx)(Xm,{size:13,className:`animate-spin`}),`Sign in here`]})]})]})]})]})})}function ZR({backend:e,onClose:t}){let n=Ve(),r=qR[e],i=it({mutationFn:()=>Y.accountLogout({backend:e}),onSuccess:i=>{n.setQueryData([`authStatus`],t=>t&&{...t,[e]:i.auth}),i.status===`done`?Z(`Signed out of ${r}`):i.status===`blocked`?Z(`Not signed out — ${i.activeThreads} active ${r} thread${i.activeThreads===1?``:`s`}. Let them finish (or complete them) first.`,{duration:7e3}):Z(`${r} sign-out failed: ${i.detail??`unknown error`}`,{duration:7e3}),t()},onError:e=>{Z(`${r} sign-out failed: ${e.message.slice(0,80)}`,{duration:7e3}),t()}});return(0,L.jsx)(eL,{open:!0,onOpenChange:e=>{!e&&!i.isPending&&t()},children:(0,L.jsxs)(oL,{children:[(0,L.jsx)(cL,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,L.jsxs)(fL,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] w-[420px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,L.jsxs)(_L,{className:`mb-1 text-[14px] font-medium`,children:[`Sign out of `,r,`?`]}),(0,L.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`New `,r,` threads will be blocked until you sign in again. Running `,r,` threads are left untouched — sign-out is refused while any are active.`]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:t,disabled:i.isPending,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-60`,children:`Cancel`}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>i.mutate(),disabled:i.isPending,className:`flex items-center gap-1.5 rounded-md bg-red-500/90 px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[i.isPending&&(0,L.jsx)(Xm,{size:13,className:`animate-spin`}),`Sign out`]})]})]})]})})}var QR=_u.options,$R={auto:`Auto`,default:`Default`,acceptEdits:`Accept edits`,plan:`Plan`,bypassPermissions:`Bypass`},ez={auto:`auto — safe actions auto-approved, risky ones prompt`,default:`default — prompt for every permission`,acceptEdits:`accept edits — file edits auto-approved`,plan:`plan — read-only planning, approval before changes`,bypassPermissions:`bypass — never prompt (dangerous)`};QR.filter(e=>e!==`plan`).map(e=>({value:e,label:$R[e],title:ez[e]}));var tz=[`auto`,`bypassPermissions`].map(e=>({value:e,label:$R[e],title:ez[e]})),nz=[{value:`fable`,label:`Fable`},{value:`opus`,label:`Opus`},{value:`sonnet`,label:`Sonnet`},{value:`haiku`,label:`Haiku`}];new Set([{slug:`gpt-6-astra`,displayName:`GPT-6 Astra`,defaultEffort:`low`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-sol`,displayName:`GPT-5.6 Sol`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-terra`,displayName:`GPT-5.6 Terra`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-luna`,displayName:`GPT-5.6 Luna`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`]},{slug:`gpt-5.5`,displayName:`GPT-5.5`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`]}].map(e=>e.slug));function rz(e){return e===`plan`?`auto`:e}var iz=[`low`,`medium`,`high`,`xhigh`,`max`],az=`ultracode`,oz=new Set([`fable`,`opus`,`sonnet`]);function sz(e){return e&&oz.has(e)?[...iz,az]:[...iz]}var cz={low:`Low`,medium:`Medium`,high:`High`,xhigh:`X-high`,max:`Max`,ultra:`Ultra`,ultracode:`Ultracode`};function lz(e){return cz[e]??e.charAt(0).toUpperCase()+e.slice(1)}function uz(e,t){let n=sz(e).map(e=>({value:e,label:lz(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function dz(e,t){let n=(e?.efforts??[]).map(e=>({value:e,label:lz(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function fz(e,t){return t.field===`backend`?{...e,backend:t.value}:t.field===`profile`?{...e,backend:t.backend,[t.backend]:{...e[t.backend],model:t.model,effort:t.effort}}:{...e,...t.field===`model`?{backend:t.backend}:{},[t.backend]:{...e[t.backend],[t.field]:t.value}}}function pz(e){return[{id:`claude`,label:`Claude Code`,options:nz.map(e=>({model:e.value,label:e.label,defaultEffort:`high`,efforts:sz(e.value)}))},{id:`codex`,label:`Codex`,options:e.map(e=>({model:e.slug,label:e.displayName,defaultEffort:e.defaultEffort,efforts:e.efforts}))}]}function mz(e,t){let n=e.backend,r=e[n],i=r.model??(n===`claude`?`opus`:t[0]?.slug??``),a=n===`codex`?t.find(e=>e.slug===i):void 0,o=n===`claude`?nz.some(e=>e.value===i):t.some(e=>e.slug===i),s=n===`claude`?`high`:a?.defaultEffort??``,c=r.effort??s,l=n===`claude`?uz(i,{withDefault:!1}):dz(a,{withDefault:!1}),u=l.some(e=>e.value===c);return{backend:n,model:i,effort:c,codexModel:a,modelAvailable:o,effortAvailable:u,effortOptions:c&&!u?[{value:c,label:`${c} (unavailable)`,title:`Saved reasoning level is not available for this model`},...l]:l}}function hz(){let e=Ve(),t=nt({queryKey:[`dispatchPreferencesGet`],queryFn:()=>Y.dispatchPreferencesGet()}),n=nt({queryKey:[`codexModels`],queryFn:()=>Y.codexModels()}),r=n.data??[],i=it({mutationFn:e=>Y.dispatchPreferenceSet(e),scope:{id:`dispatch-preferences`},onMutate:t=>{let n=e.getQueryData([`dispatchPreferencesGet`]);n&&e.setQueryData([`dispatchPreferencesGet`],fz(n,t))},onError:t=>{e.invalidateQueries({queryKey:[`dispatchPreferencesGet`]}),Z(`Could not save new-thread preference: ${t.message.slice(0,80)}`)}}),a=!!t.data&&!!n.data;return{resolved:(0,I.useMemo)(()=>a?mz(t.data,r):void 0,[a,t.data,r]),codexList:r,loadError:t.isError||n.isError,saveProfile:i.mutate}}var gz=`frizz-drafts:v1`,_z=80,vz=512*1024,yz=2*1024*1024,bz=new TextEncoder;function xz(e){return bz.encode(e).byteLength}function Sz(){return{version:1,entries:{}}}function Cz(e){if(!e)return Sz();try{let t=JSON.parse(e);if(!t||typeof t!=`object`||t.version!==1)return Sz();let n=t.entries;if(!n||typeof n!=`object`||Array.isArray(n))return Sz();let r={};for(let[e,t]of Object.entries(n))typeof t?.value!=`string`||typeof t?.touchedAt!=`number`||!Number.isFinite(t.touchedAt)||e.length>512||xz(t.value)>vz||(r[e]={value:t.value,touchedAt:t.touchedAt});return{version:1,entries:r}}catch{return Sz()}}function wz(e){let t=Object.entries(e.entries).filter(([,e])=>e.value&&xz(e.value)<=vz).sort((e,t)=>t[1].touchedAt-e[1].touchedAt),n={};for(let[e,r]of t){if(Object.keys(n).length>=_z)break;n[e]=r,xz(JSON.stringify({version:1,entries:n}))>yz&&delete n[e]}return{version:1,entries:n}}var Tz=new class{snapshot;listeners=new Set;storage;constructor(e=typeof sessionStorage>`u`?void 0:sessionStorage){this.storage=e;let t=null;try{t=e?.getItem(`frizz-drafts:v1`)??null}catch{}this.snapshot=wz(Cz(t))}getSnapshot=()=>this.snapshot;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));get(e){return this.snapshot.entries[e]?.value??``}set(e,t){let n={...this.snapshot.entries};t?n[e]={value:t,touchedAt:Date.now()}:delete n[e],this.commit({version:1,entries:n})}clear(e){this.snapshot.entries[e]&&this.commit({version:1,entries:Object.fromEntries(Object.entries(this.snapshot.entries).filter(([t])=>t!==e))})}commit(e){this.snapshot=e;try{this.storage?.setItem(gz,JSON.stringify(wz(e)))}catch{}for(let e of this.listeners)e()}};function Ez(e){return encodeURIComponent(e||`unresolved-project`)}var Dz={dispatch:e=>`dispatch:${Ez(e)}:new`,followUp:(e,t,n)=>`followup:${Ez(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}`,adopt:(e,t)=>`adopt:${Ez(e)}:${encodeURIComponent(t)}`,answer:(e,t,n,r,i)=>`answer:${Ez(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}:${encodeURIComponent(r)}:${i}`,interaction:(e,t,n,r,i,a,o)=>`interaction:${Ez(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n)}:${encodeURIComponent(r)}:${i}:${encodeURIComponent(a)}:${encodeURIComponent(o)}`,question:(e,t,n,r)=>`question:${Ez(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n)}:${encodeURIComponent(r)}`};function Oz(){return Zt(X).board?.projectDir}function kz(e){return Zt(X).board?.threads.find(t=>t.id===e)?.sessionId}function Az(e){let t=(0,I.useCallback)(()=>Tz.get(e),[e]);return[(0,I.useSyncExternalStore)(Tz.subscribe,t,t),(0,I.useCallback)(t=>Tz.set(e,t),[e]),(0,I.useCallback)(()=>Tz.clear(e),[e])]}function jz(e){let t=(0,I.useCallback)(()=>JSON.stringify(Object.fromEntries(e.map(e=>[e,Tz.get(e)]))),[e.join(`\0`)]),n=(0,I.useSyncExternalStore)(Tz.subscribe,t,t);return(0,I.useMemo)(()=>new Map(Object.entries(JSON.parse(n))),[n])}function Mz({autoFocus:e,onDispatched:t}){let{resolved:n,codexList:r,loadError:i,saveProfile:a}=hz(),o=yR(),s=Oz(),[c,l,u]=Az(Dz.dispatch(s)),d=Dz.dispatch(s),f=(0,I.useRef)(``),[p,m]=(0,I.useState)(null),h=nt({queryKey:[`authStatus`],queryFn:()=>Y.authStatus(),staleTime:3e4}),[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(null),b=(0,I.useRef)(null),x=it({mutationFn:e=>Y.dispatch(e),onMutate:()=>Z(`Starting thread…`,{spinner:!0,sticky:!0}),onSuccess:e=>{m(null),t?.(),Z(`Thread started`,{link:{label:`Open thread`,slug:e.slug}})},onError:(e,t)=>{Tz.get(d)||l(f.current||t.prompt),m(null);let n=/^AUTH_REQUIRED:(claude|codex)$/.exec(e.message);if(n){b.current=t,_(n[1]),Z(`Signed out of ${n[1]===`claude`?`Claude`:`Codex`}`,{duration:3e3});return}Z(`Dispatch failed: ${e.message.slice(0,80)}`)}});function S(e){f.current=c,u(),m(e.prompt),x.mutate(e)}function C(){if(!c.trim()||!n)return;let e=JR(c);if(e){u(),e===`login`?(b.current=null,_(n.backend)):y(n.backend);return}if(!n.modelAvailable){Z(`Saved model is unavailable — choose a model before starting the thread`);return}if(!n.effortAvailable){Z(`Saved reasoning level is unavailable for this model — choose another level`);return}let t={prompt:c.trim(),model:n.model,backend:n.backend,effort:n.effort};if(h.data?.[n.backend]===`signed-out`){b.current=t,_(n.backend);return}S(t)}let w=(0,I.useMemo)(()=>n?(0,L.jsx)(UR,{groups:pz(r),value:{provider:n.backend,model:n.model,effort:n.effort},onValueChange:e=>a({field:`profile`,backend:e.provider,model:e.model,effort:e.effort}),ariaLabel:`Model and effort`,title:n.modelAvailable&&n.effortAvailable?`Model and reasoning effort`:`Saved model or reasoning effort unavailable — choose a supported pair`,className:`max-w-[min(21rem,72vw)]`}):(0,L.jsx)(UR,{groups:[],value:void 0,onValueChange:()=>{},placeholder:i?`Profile unavailable`:`Profile loading…`,ariaLabel:`Model and effort loading`,disabled:!0}),[n,r,i,a]);return(0,L.jsxs)(`div`,{className:`w-full flex flex-col gap-3`,children:[(0,L.jsx)(gR,{surface:`newComposer`,autoFocus:e,value:c,onChange:l,onSubmit:C,placeholder:`Describe the task…`,minHeight:96,maxHeight:340,busy:x.isPending,footer:w,leftAction:o?(0,L.jsx)(bR,{}):void 0}),x.isError&&(0,L.jsx)(`span`,{className:`px-0.5 text-[11px] text-red-400 truncate`,children:x.error.message}),p&&(0,L.jsxs)(`div`,{"data-pending-dispatch":!0,role:`status`,className:`rounded-lg border border-border bg-panel-2 px-3 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted`,children:[(0,L.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-accent`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{children:`Starting thread…`})]}),(0,L.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed text-fg`,children:p})]}),g&&(0,L.jsx)(XR,{backend:g,onClose:()=>_(null),onAuthed:()=>{let e=b.current;b.current=null,_(null),e&&S(e)}}),v&&(0,L.jsx)(ZR,{backend:v,onClose:()=>y(null)})]})}function Nz({onClose:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null);return(0,I.useEffect)(()=>()=>{let e=n.current;window.setTimeout(()=>{e?.isConnected&&e.focus({preventScroll:!0})},0)},[]),(0,L.jsx)(eL,{open:!0,onOpenChange:t=>{t||e()},children:(0,L.jsxs)(oL,{children:[(0,L.jsx)(cL,{className:`fixed inset-0 z-50 bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,L.jsxs)(fL,{ref:t,"aria-modal":`true`,"aria-describedby":void 0,onEscapeKeyDown:VR,onCloseAutoFocus:e=>{e.preventDefault();let t=n.current;t?.isConnected&&t.focus({preventScroll:!0})},onOpenAutoFocus:e=>{e.preventDefault(),t.current?.querySelector(`textarea`)?.focus({preventScroll:!0})},className:`fixed left-1/2 top-1/2 z-50 w-[640px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none max-[700px]:top-[calc(env(safe-area-inset-top)+56px)] max-[700px]:w-[calc(100vw-24px)] max-[700px]:max-w-none max-[700px]:translate-y-0`,children:[(0,L.jsx)(_L,{className:`mb-1 text-[14px] font-medium`,children:`New thread`}),(0,L.jsx)(Mz,{autoFocus:!0,onDispatched:e})]})]})})}function Pz({children:e,onClose:t}){return(0,L.jsx)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center bg-black/30 backdrop-blur-md backdrop-saturate-150`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:e})}var Fz=`-mx-1.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/75 outline-none transition-colors hover:bg-elevated hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong disabled:opacity-55`,Iz={claude:`size-[11px] translate-y-px`,codex:`size-[10px]`},Lz={claude:{backend:`claude`,label:`Claude Code`},codex:{backend:`codex`,label:`OpenAI Codex`}};function Rz(e){return e===`claude`||e===`codex`?Lz[e]:void 0}function zz({backend:e,className:t}){let n=Rz(e);return n?(0,L.jsx)(`span`,{role:`img`,"aria-label":n.label,className:`inline-flex shrink-0 text-muted/65 ${Iz[n.backend]} ${t??``}`,children:n.backend===`codex`?(0,L.jsx)(Bz,{}):(0,L.jsx)(Vz,{})}):null}function Bz(){return(0,L.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,L.jsx)(`path`,{d:`M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z`})})}function Vz(){return(0,L.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,L.jsx)(`path`,{d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`})})}typeof window<`u`&&window.document&&window.document.createElement;function Hz(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function Uz(e,t=[]){let n=[];function r(t,r){let i=I.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=I.useMemo(()=>o,Object.values(o));return(0,L.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=I.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>I.createContext(e));return function(n){let r=n?.[e]||t;return I.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Wz(i,...t)]}function Wz(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Gz=`DismissableLayer`,Kz=`dismissableLayer.update`,qz=`dismissableLayer.pointerDownOutside`,Jz=`dismissableLayer.focusOutside`,Yz,Xz=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Zz=I.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=I.useContext(Xz),[d,f]=I.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=I.useState({}),h=TD(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=I.useRef(!1),C=tB(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:I.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=nB(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=UD(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return I.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),I.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Yz=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),rB(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Yz))}},[d,p,n,u]),I.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),rB())},[d,u]),I.useEffect(()=>{let e=()=>m({});return document.addEventListener(Kz,e),()=>document.removeEventListener(Kz,e)},[]),(0,L.jsx)(VD.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Hz(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Hz(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Hz(e.onPointerDownCapture,C.onPointerDownCapture)})});Zz.displayName=Gz;var Qz=`DismissableLayerBranch`,$z=I.forwardRef((e,t)=>{let n=I.useContext(Xz),r=I.useRef(null),i=TD(t,r);return I.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,L.jsx)(VD.div,{...e,ref:i})});$z.displayName=Qz;var eB=()=>!0;function tB(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=eB}=t,s=UD(e),c=I.useRef(!1),l=I.useRef(!1),u=I.useRef(new Map),d=I.useRef(()=>{});return I.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||iB(qz,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function nB(e,t=globalThis?.document){let n=UD(e),r=I.useRef(!1);return I.useEffect(()=>{let e=e=>{e.target&&!r.current&&iB(Jz,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function rB(){let e=new CustomEvent(Kz);document.dispatchEvent(e)}function iB(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?HD(i,a):i.dispatchEvent(a)}var aB=`focusScope.autoFocusOnMount`,oB=`focusScope.autoFocusOnUnmount`,sB={bubbles:!1,cancelable:!0},cB=`FocusScope`,lB=I.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=I.useState(null),l=UD(i),u=UD(a),d=I.useRef(null),f=TD(t,c),p=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:gB(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||gB(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&gB(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),I.useEffect(()=>{if(s){_B.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(aB,sB);s.addEventListener(aB,l),s.dispatchEvent(t),t.defaultPrevented||(uB(bB(fB(s)),{select:!0}),document.activeElement===e&&gB(s))}return()=>{s.removeEventListener(aB,l),setTimeout(()=>{let t=new CustomEvent(oB,sB);s.addEventListener(oB,u),s.dispatchEvent(t),t.defaultPrevented||gB(e??document.body,{select:!0}),s.removeEventListener(oB,u),_B.remove(p)},0)}}},[s,l,u,p]);let m=I.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=dB(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&gB(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&gB(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,L.jsx)(VD.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});lB.displayName=cB;function uB(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(gB(r,{select:t}),document.activeElement!==n)return}function dB(e){let t=fB(e);return[pB(t,e),pB(t.reverse(),e)]}function fB(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function pB(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):mB(r,{upTo:t})))return r}function mB(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function hB(e){return e instanceof HTMLInputElement&&`select`in e}function gB(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hB(e)&&t&&e.select()}}var _B=vB();function vB(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=yB(e,t),e.unshift(t)},remove(t){e=yB(e,t),e[0]?.resume()}}}function yB(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bB(e){return e.filter(e=>e.tagName!==`A`)}var xB=`Popper`,[SB,CB]=Uz(xB),[wB,TB]=SB(xB),EB=e=>{let{__scopePopper:t,children:n}=e,[r,i]=I.useState(null),[a,o]=I.useState(void 0);return(0,L.jsx)(wB,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};EB.displayName=xB;var DB=`PopperAnchor`,OB=I.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=TB(DB,n),o=I.useRef(null),s=a.onAnchorChange,c=TD(t,I.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=I.useRef(null);I.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&RB(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,L.jsx)(VD.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});OB.displayName=DB;var kB=`PopperContent`,[AB,jB]=SB(kB),MB=I.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:p=`optimized`,onPlaced:m,...h}=e,g=TB(kB,n),[_,v]=I.useState(null),y=TD(t,v),[b,x]=I.useState(null),S=EA(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(IB),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=mA({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>eA(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[gA({mainAxis:i+w,alignmentAxis:o}),c&&_A({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?vA():void 0,...k}),c&&yA({...k}),bA({...k,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`)}}),b&&SA({element:b,padding:s}),LB({arrowWidth:C,arrowHeight:w}),f&&xA({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;WD(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=RB(M),ne=UD(m);WD(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=I.useState();return WD(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,L.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,L.jsx)(AB,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,L.jsx)(VD.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});MB.displayName=kB;var NB=`PopperArrow`,PB={top:`bottom`,right:`left`,bottom:`top`,left:`right`},FB=I.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=jB(NB,n),a=PB[i.placedSide];return(0,L.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,L.jsx)(TA,{...r,ref:t,style:{...r.style,display:`block`}})})});FB.displayName=NB;function IB(e){return e!==null}var LB=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]=RB(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 RB(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var zB=EB,BB=OB,VB=MB,HB=FB;function UB(e,t){return I.useReducer((e,n)=>t[e][n]??e,e)}var WB=e=>{let{present:t,children:n}=e,r=GB(t),i=typeof n==`function`?n({present:r.isPresent}):I.Children.only(n),a=qB(r.ref,YB(i));return typeof n==`function`||r.isPresent?I.cloneElement(i,{ref:a}):null};WB.displayName=`Presence`;function GB(e){let[t,n]=I.useState(),r=I.useRef(null),i=I.useRef(e),a=I.useRef(`none`),o=I.useRef(void 0),[s,c]=UB(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return I.useEffect(()=>{s===`mounted`?(a.current=o.current??JB(r.current),o.current=void 0):a.current=`none`},[s]),WD(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=JB(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),WD(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=JB(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=JB(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:I.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=JB(t)}else r.current=null;n(e)},[])}}function KB(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function qB(...e){let t=I.useRef(e);return t.current=e,I.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=KB(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():KB(n[e],null)}}},[])}function JB(e){return e?.animationName||`none`}function YB(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var XB=`Popover`,[ZB,QB]=Uz(XB,[CB]),$B=CB(),[eV,tV]=ZB(XB),nV=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=$B(t),c=I.useRef(null),[l,u]=I.useState(!1),[d,f]=aj({prop:r,defaultProp:i??!1,onChange:a,caller:XB});return(0,L.jsx)(zB,{...s,children:(0,L.jsx)(eV,{scope:t,contentId:uO(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:I.useCallback(()=>u(!0),[]),onCustomAnchorRemove:I.useCallback(()=>u(!1),[]),modal:o,children:n})})};nV.displayName=XB;var rV=`PopoverAnchor`,iV=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tV(rV,n),a=$B(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return I.useEffect(()=>(o(),()=>s()),[o,s]),(0,L.jsx)(BB,{...a,...r,ref:t})});iV.displayName=rV;var aV=`PopoverTrigger`,oV=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tV(aV,n),a=$B(n),o=TD(t,i.triggerRef),s=(0,L.jsx)(VD.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":xV(i.open),...r,ref:o,onClick:Hz(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,L.jsx)(BB,{asChild:!0,...a,children:s})});oV.displayName=aV;var sV=`PopoverPortal`,[cV,lV]=ZB(sV,{forceMount:void 0}),uV=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=tV(sV,t);return(0,L.jsx)(cV,{scope:t,forceMount:n,children:(0,L.jsx)(WB,{present:n||a.open,children:(0,L.jsx)(XA,{asChild:!0,container:i,children:r})})})};uV.displayName=sV;var dV=`PopoverContent`,fV=I.forwardRef((e,t)=>{let n=lV(dV,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=tV(dV,e.__scopePopover);return(0,L.jsx)(WB,{present:r||a.open,children:a.modal?(0,L.jsx)(mV,{...i,ref:t}):(0,L.jsx)(hV,{...i,ref:t})})});fV.displayName=dV;var pV=OD(`PopoverContent.RemoveScroll`),mV=I.forwardRef((e,t)=>{let n=tV(dV,e.__scopePopover),r=I.useRef(null),i=TD(t,r),a=I.useRef(!1);return I.useEffect(()=>{let e=r.current;if(e)return oN(e)},[]),(0,L.jsx)(hP,{as:pV,allowPinchZoom:!0,children:(0,L.jsx)(gV,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hz(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Hz(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Hz(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),hV=I.forwardRef((e,t)=>{let n=tV(dV,e.__scopePopover),r=I.useRef(!1),i=I.useRef(!1);return(0,L.jsx)(gV,{...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()}})}),gV=I.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=tV(dV,n),p=$B(n);return pM(),(0,L.jsx)(lB,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(Zz,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,L.jsx)(VB,{"data-state":xV(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)`}})})})}),_V=`PopoverClose`,vV=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tV(_V,n);return(0,L.jsx)(VD.button,{type:`button`,...r,ref:t,onClick:Hz(e.onClick,()=>i.onOpenChange(!1))})});vV.displayName=_V;var yV=`PopoverArrow`,bV=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$B(n);return(0,L.jsx)(HB,{...i,...r,ref:t})});bV.displayName=yV;function xV(e){return e?`open`:`closed`}var SV=nV,CV=iV,wV=oV,TV=uV,EV=fV;function DV({modal:e=!1,...t}){return(0,L.jsx)(SV,{modal:e,...t})}var OV=wV,kV=CV;function AV({children:e,side:t=`top`,align:n=`center`,sideOffset:r=6,className:i=``,...a}){return(0,L.jsx)(TV,{children:(0,L.jsx)(EV,{side:t,align:n,sideOffset:r,avoidCollisions:!0,collisionPadding:12,onEscapeKeyDown:e=>e.stopPropagation(),className:`${Qj} ${nM} rounded-lg outline-none ${i}`,...a,children:e})})}var jV=3e4,MV=45e3;function NV(e,t){return t?AbortSignal.any([t,AbortSignal.timeout(e)]):AbortSignal.timeout(e)}var PV=`text-[9px]`,FV={claude:`text-fg/75! size-[14px]! translate-y-0!`,codex:`text-fg/75! size-[12.75px]! translate-y-0!`};function IV(){let e=nt({queryKey:[`quota`],queryFn:()=>Y.quota(),staleTime:1e4}),t=nt({queryKey:[`authStatus`],queryFn:()=>Y.authStatus(),staleTime:3e4});return[`claude`,`codex`].some(n=>LV(e.data?.[n],t.data?.[n],e.isLoading))}function LV(e,t,n){return t===`signed-out`||!e&&n?!1:!!e&&e.status===`ok`&&e.windows.length>0}function RV(){let e=Ve(),t=(0,I.useRef)(null),[n,r]=(0,I.useState)(!1),i=nt({queryKey:[`quota`],queryFn:({signal:e})=>Y.quota(void 0,{signal:NV(jV,e)}),refetchInterval:e=>{let t=e.state.data;return!t||t.claude.status!==`ok`||t.codex.status!==`ok`?15e3:3e4},staleTime:1e4,refetchOnWindowFocus:!0}),a=nt({queryKey:[`authStatus`],queryFn:({signal:e})=>Y.authStatus(void 0,{signal:NV(jV,e)}),refetchInterval:12e4,staleTime:3e4,refetchOnWindowFocus:!0}),o=n=>{if(t.current)return;r(!0);let i=Promise.all([Y.quota({force:n===`claude`},{signal:NV(MV)}).then(t=>e.setQueryData([`quota`],t)),e.refetchQueries({queryKey:[`authStatus`]})]).then(()=>{}).catch(()=>{}).finally(()=>{t.current=null,r(!1)});t.current=i};return(0,L.jsxs)(`div`,{"data-quota-bar":!0,className:`flex shrink-0 items-center gap-3 ${PV}`,children:[(0,L.jsx)(zV,{backend:`claude`,quota:i.data?.claude,auth:a.data?.claude,email:a.data?.emails?.claude,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`claude`)}),(0,L.jsx)(zV,{backend:`codex`,quota:i.data?.codex,auth:a.data?.codex,email:a.data?.emails?.codex,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`codex`)})]})}function zV({backend:e,quota:t,auth:n,email:r,loading:i,fetching:a,onRecheck:o}){let s=qR[e];if(!LV(t,n,i))return null;let c=BV(100-HV(t.windows).usedPercent);return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(DV,{onOpenChange:e=>{e&&o()},children:[(0,L.jsx)(OV,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,"aria-label":`${s} quota: ${c}% remaining`,className:`flex items-center gap-1.5 min-w-0 rounded outline-none transition-opacity hover:opacity-80 focus-visible:ring-1 focus-visible:ring-border-strong`,children:[(0,L.jsx)(zz,{backend:e,className:FV[e]}),(0,L.jsxs)(`span`,{className:`tabular-nums ${UV(c)}`,children:[c,`%`]})]})}),(0,L.jsxs)(AV,{side:`bottom`,align:`start`,className:`w-[min(15rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,children:[(0,L.jsxs)(`div`,{className:`mb-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,L.jsx)(zz,{backend:e}),(0,L.jsx)(`span`,{children:s}),t?.planType&&(0,L.jsxs)(`span`,{className:`text-muted/70`,children:[`· `,WV(t.planType),` plan`]}),a&&(0,L.jsx)(Xm,{size:11,className:`animate-spin text-muted/60`,"aria-label":`Rechecking`})]}),r&&(0,L.jsx)(`div`,{"data-quota-account":!0,className:`truncate text-muted/70 select-text`,title:r,children:r})]}),(0,L.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[t.windows.map(e=>{let t=BV(100-e.usedPercent),n=GV(e);return(0,L.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`span`,{className:`text-muted/80`,children:e.label}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,L.jsxs)(`span`,{className:UV(t),children:[t,`% left`]}),n&&(0,L.jsxs)(`span`,{className:`text-muted/55`,children:[`resets `,n]})]})]},e.key)}),t.detail&&(0,L.jsx)(`li`,{className:`pt-1 text-muted/55`,children:t.detail})]})]})]})})}function BV(e){return Math.max(0,Math.min(100,Math.round(e)))}var VV=25;function HV(e){return e.find(e=>e.key===`5h`)??e.reduce((e,t)=>t.usedPercent>e.usedPercent?t:e)}function UV(e){return e<=8?`text-red-400`:e<=VV?`text-accent`:`text-fg/70`}function WV(e){return e&&e[0].toUpperCase()+e.slice(1)}function GV(e){if(!e.resetsAt)return null;let t=e.resetsAt*1e3,n=new Date(t);if(Number.isNaN(n.getTime()))return null;let r=t-Date.now();if(r<=0)return null;if(r<24*36e5){let e=n.getHours(),t=n.getMinutes(),r=e>=12?`pm`:`am`;return e=e%12||12,t===0?`${e}${r}`:`${e}:${String(t).padStart(2,`0`)}${r}`}return n.toLocaleDateString(void 0,{weekday:`short`})}var KV=`frizz:supervisor-status-wake`,qV=`frizz:reload-after-update-restart`,JV=`frizz:update-restart-from-version`;function YV(e,t){return t.version===e?{kind:`previous-kept`}:{kind:`successor-failed`,version:t.version}}function XV(e){if(e.kind===`previous-kept`)return{summary:`Frizz kept running the previous version`,detail:`Frizz kept running the previous version, and your threads are unaffected.`};let t=e.version?`Frizz ${e.version}`:`The new version of Frizz`;return{summary:`${t} failed to start`,detail:`${t} came up but could not start its board, and the previous version is gone. Restart Frizz from the terminal (npx frizz) and check its log for the reason.`}}function ZV(e){return e?.artifactDigest??e?.version??null}function QV(e,t){if(e===null||t?.state!==`ready`)return!1;let n=ZV(t);return n!==null&&n!==e}var $V=3*6e4,eH={silentSince:null,silentForMs:0,stalled:!1};function tH(e,t,n=$V){if(!t.restarting||t.answered)return eH;let r=e.silentSince??t.at,i=Math.max(0,t.at-r);return{silentSince:r,silentForMs:i,stalled:i>=n}}function nH(e,t){return e.ackedAt!==null&&t.requestedAt>=e.ackedAt}function rH(e,t){return e.attempt&&!(nH(e.attempt,t)&&iH(e.attempt,t))?e:{state:t.state,message:t.message??null,attempt:null}}function iH(e,t){if(t.state!==`ready`)return!0;let n=t.artifactDigest??t.version??null;return e.build!=null&&n!==null&&n!==e.build}function aH(e,t){return t.state===`ready`&&e.attempt===null}function oH(e){return e!==null}function sH(e){return e?.updateRestart===!0&&e.updateAvailable!==!1}function cH(e){return e?.dev===!0}async function lH(e=fetch){try{let t=await e(`/_frizz/control/status`,{headers:{"cache-control":`no-store`}});if(!t.ok||!t.headers.get(`content-type`)?.includes(`application/json`))return null;let n=await t.json();return n.protocol===1&&(n.state===`ready`||n.state===`restarting`||n.state===`failed`)?n:null}catch{return null}}async function uH(e,t){let n=await t(e,{method:`POST`,headers:{"cache-control":`no-store`}}),r;try{r=await n.json()}catch{}if(!n.headers.get(`content-type`)?.includes(`application/json`)||!r||r.protocol!==1||r.state!==`ready`&&r.state!==`restarting`&&r.state!==`failed`)throw Error(`Frizz restart controls are unavailable for this server`);if(!n.ok)throw Error(r.message??`Restart request failed (${n.status})`);if(r.state===`failed`)throw Error(r.message??`Frizz did not become ready`);return r}function dH(e=fetch){return uH(`/_frizz/control/restart`,e)}function fH(e=fetch){return uH(`/_frizz/control/update-restart`,e)}var pH=8e3,mH=500,hH=[`supervisorStatus`];function gH(e,t){return e===`restarting`||t?mH:pH}var _H=rt({queryKey:hH,queryFn:async()=>{let e=Date.now(),t=await lH();return t?{...t,requestedAt:e}:null},refetchInterval:e=>gH(e.state.data?.state,X.controlPlaneRestartAttempt!==null),staleTime:e=>gH(e.state.data?.state,X.controlPlaneRestartAttempt!==null)});function vH(){return nt(_H)}var yH=null;function bH(e){yH||(yH=e,window.addEventListener(KV,()=>{e.refetchQueries({queryKey:hH,exact:!0})}))}function xH(e,t){let n=e=>{let t=e&&/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e);return t?[Number(t[1]),Number(t[2])]:null},r=n(e),i=n(t);return r!==null&&i!==null&&(r[0]!==i[0]||r[1]!==i[1])}var SH=`Install the latest version of Frizz. Your running threads will not be affected.`,CH=`A newer version of Frizz is available. Your running threads will not be affected.`,wH=`Restart Frizz. Your running threads will not be affected.`,TH=`fixed left-3 right-3 top-12 z-50 w-auto text-left font-sans sm:absolute sm:right-auto sm:-left-[17px] sm:top-[calc(100%+0.65rem)]`,EH=`absolute -top-[7px] left-4 h-3 w-3 rotate-45 border-l border-t bg-elevated`,DH=`sm:w-[min(23rem,calc(100vw-1.5rem))]`,OH=`sm:w-[min(34rem,calc(100vw-1.5rem))]`,kH=`rounded-xl bg-elevated p-3.5 shadow-xl shadow-black/45`;function AH({open:e,update:t,version:n,launcherVersion:r,updateVersion:i}){if(!e)return null;let a=t?`Update Frizz`:`Restart Frizz`,o=t?i:void 0;return(0,L.jsxs)(`div`,{id:`update-restart-popover`,role:`tooltip`,"aria-label":a,className:`${TH} ${DH} ${kH} border border-border-strong`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`${EH} border-border-strong`}),(0,L.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,L.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-fg/10 text-fg`,children:(0,L.jsx)(lh,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,L.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:a}),n&&(0,L.jsx)(`span`,{className:`font-mono text-[11px] leading-snug text-muted`,children:r?`Server ${o?`${n} → ${o}`:n}`:o?`${n} → ${o}`:n}),r&&(0,L.jsx)(`span`,{className:`font-mono text-[11px] leading-snug text-muted`,children:`Launcher ${r}`})]})]}),(0,L.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:t?o?CH:SH:wH})]})}var jH={kind:`previous-kept`};function MH({update:e,message:t,outcome:n=jH,onDismiss:r}){return(0,L.jsxs)(`div`,{role:`alert`,className:`${TH} ${OH} ${kH} border border-red-500/45`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`${EH} border-red-500/45`}),(0,L.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,L.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-red-500/15 text-red-300`,children:(0,L.jsx)(xh,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,L.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:e?`Update failed`:`Restart failed`}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:r,className:`-mr-1 ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong`,children:(0,L.jsx)(Ch,{"aria-hidden":`true`,size:14,strokeWidth:2.25})})]}),(0,L.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:XV(n).detail}),(0,L.jsx)(`pre`,{className:`relative mt-2.5 max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded-md border border-border bg-panel px-2.5 py-2 font-mono text-[11px] leading-relaxed text-fg/70`,children:t})]})}function NH({update:e,busy:t,version:n,updateVersion:r,onFocus:i,onBlur:a,onClick:o}){return(0,L.jsxs)(`button`,{type:`button`,"aria-describedby":`update-restart-popover`,"aria-label":e?`Update Frizz`:`Restart Frizz`,disabled:t,"aria-busy":t||void 0,className:`relative ${Fz}`,onFocus:i,onBlur:a,onClick:o,children:[(0,L.jsx)(lh,{size:14,"aria-hidden":`true`,className:t?`animate-spin`:void 0}),e&&!t&&xH(n,r)&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-[2px] top-[2px] h-[4px] w-[4px] rounded-full bg-accent`})]})}function PH(){let e=Zt(X),[t,n]=(0,I.useState)(!1),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(),[s,c]=(0,I.useState)(),l=(0,I.useRef)(null),u=(0,I.useRef)(null),d=vH().data??null,f=sH(d),p={version:d?.version,launcherVersion:d?.launcherVersion,updateVersion:d?.updateVersion};if(!oH(d))return null;let m=l.current!==null&&e.controlPlaneState===`failed`,h=m?e.controlPlaneMessage??`Frizz did not become ready`:void 0,g=a??h,_=g&&g!==s?g:void 0,v=!a&&m&&l.current?YV(l.current.version,{version:d?.version}):jH,y=async()=>{if(r)return;l.current={version:d?.version},n(!1),i(!0),o(void 0),c(void 0);let e=`${window.location.pathname}${window.location.search}${window.location.hash}`;f&&(X.controlPlaneState=`restarting`,X.controlPlaneMessage=null,X.controlPlaneRestartAttempt={startedAt:Date.now(),ackedAt:null,build:ZV(d)});try{if(f?await fH():await dH(),f){sessionStorage.setItem(qV,e),l.current.version?sessionStorage.setItem(JV,l.current.version):sessionStorage.removeItem(JV);let t=X.controlPlaneRestartAttempt;t&&(X.controlPlaneRestartAttempt={...t,ackedAt:Date.now()}),window.dispatchEvent(new Event(KV)),i(!1)}else window.location.replace(e)}catch(e){f&&(X.controlPlaneRestartAttempt=null,X.controlPlaneState=`ready`,X.controlPlaneMessage=null);let t=e.message.slice(0,140);i(!1),o(t),Z(`${f?`Update & Restart`:`Restart Frizz`} failed`)}};return(0,L.jsxs)(`div`,{ref:u,className:`relative`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,L.jsx)(NH,{update:f,busy:r,version:p.version,updateVersion:p.updateVersion,onFocus:()=>n(!0),onBlur:()=>n(!1),onClick:()=>void y()}),_&&(0,L.jsx)(MH,{update:f,message:_,outcome:v,onDismiss:()=>c(_)}),(0,L.jsx)(AH,{open:t&&!_,update:f,version:p.version,launcherVersion:p.launcherVersion,updateVersion:p.updateVersion})]})}function FH(){return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`})}function IH({text:e,title:t,className:n}){return(0,L.jsx)(`span`,{dir:`rtl`,className:`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${n??``}`,title:t,children:(0,L.jsx)(`span`,{dir:`ltr`,className:`[unicode-bidi:isolate]`,children:e})})}function LH(){let e=qC(),t=gW(e),n=IV(),r=e?.githubRepo??null,i=t.state===`verified`?t.label:t.state===`local`?t.name:null,a=t.state===`verified`?`Project: ${t.label}`:t.state===`local`?`Project: ${t.name}; local repository with no git remote`:t.state===`loading`?`Project identity loading`:`Project identity unavailable`;return(0,L.jsxs)(`div`,{"data-status-row":!0,className:`mb-2.5 flex min-w-0 items-center gap-3 text-[12px]`,children:[(0,L.jsx)(Ab,{to:`/`,title:`All projects`,"aria-label":`All projects`,className:`${Fz} -ml-px`,children:(0,L.jsx)(Wm,{size:14,"aria-hidden":`true`})}),(0,L.jsx)(FH,{}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Settings`,title:`Settings`,className:Fz,onClick:()=>X.showSettings=!0,children:(0,L.jsx)(ph,{size:14,"aria-hidden":`true`})}),(0,L.jsx)(PH,{}),n&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(FH,{}),(0,L.jsx)(RV,{})]}),(0,L.jsx)(`span`,{className:`ml-auto flex min-w-0 items-center`,"data-project-identity-state":t.state,"aria-label":a,"aria-busy":t.state===`loading`||void 0,children:i&&r?(0,L.jsx)(`a`,{href:`https://github.com/${r}`,target:`_blank`,rel:`noopener`,title:`Open ${i} on GitHub`,"aria-label":`Open ${i} on GitHub`,className:`block min-w-0 rounded-sm font-semibold text-fg/90 underline-offset-2 outline-none transition-colors hover:text-fg hover:underline focus-visible:ring-1 focus-visible:ring-border-strong`,children:(0,L.jsx)(IH,{text:i})}):i?(0,L.jsx)(IH,{text:i,title:i,className:`font-semibold text-fg/90`}):(0,L.jsx)(`span`,{className:`identity-placeholder w-24`,"aria-hidden":`true`})})]})}var RH=qt({at:{}}),zH=12e3,BH=new Map;function VH(e,t=Date.now()){RH.at[e]=t;let n=BH.get(e);n!==void 0&&clearTimeout(n),BH.set(e,setTimeout(()=>{BH.delete(e),delete RH.at[e]},zH))}function HH(e){let t=BH.get(e);t!==void 0&&(clearTimeout(t),BH.delete(e)),delete RH.at[e]}function UH(e,t,n=Date.now()){if(t===void 0||n-t>12e3)return!1;let r=e.lastActivityAt?Date.parse(e.lastActivityAt):NaN;return!(Number.isFinite(r)&&r>t)}function WH(){return Zt(RH).at}function GH(e,t,n=Date.now()){return t===void 0||!UH(e,t,n)?e:{...e,runtime:`running`,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1,lastUserAt:new Date(t).toISOString()}}function KH(e){let t=WH();return(0,I.useMemo)(()=>e.map(e=>GH(e,t[e.id])),[e,t])}var qH=0;function JH(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(qH+=1,`browser-${Date.now()}-${qH}`)}function YH({optimistic:e,request:t,success:n,failure:r}){e(),t().then(()=>n?.(),e=>r(e instanceof Error?e:Error(String(e))))}var XH=new Map;function ZH(e,t){let n=(XH.get(e)??Promise.resolve()).then(t,t);return XH.set(e,n.then(()=>{},()=>{})),n}var QH=[300,800,1800,3500],$H=12e4,eU=e=>new Promise(t=>{setTimeout(t,e)});async function tU(e,t,n=eU){for(let r=0;;r++){try{await e()}catch(e){if(r>=QH.length||!ff(e))throw e;t(),await n(QH[r]);continue}t();return}}function nU(e,t,n,r,i,a=$H){let o=new AbortController,s=setTimeout(()=>o.abort(Error(`Frizz did not answer this send`)),a);return Y.followUp({slug:e,sessionId:Gp(X.board,e)?.sessionId??``,message:t,deliveryId:n,freshProcess:r,interrupt:i},{signal:o.signal}).finally(()=>clearTimeout(s))}function rU(e,t,n,r,i){return tU(()=>nU(e,t,n,r,i),()=>VH(e))}function iU(e,t,n,r={}){let i=n.trim();if(!i)return!1;let a=JH();return YH({optimistic:()=>{r.onOptimistic?.(),dw(e,t,i,{scrollToBottom:r.scrollToBottom,deliveryId:a}),VH(t),Y.markRead({slug:t}).catch(()=>{})},request:()=>ZH(t,()=>rU(t,i,a,r.freshProcess,r.interrupt)),success:()=>r.onSuccess?.(),failure:n=>{fw(e,t,i,a),HH(t),r.onRollback?.(),Z(r.failureToast?.(n.message)??`Steer failed — ${n.message.slice(0,160)}`)}}),!0}function aU(e){let t=Ve(),[n,r]=(0,I.useState)(0);return{submit:(0,I.useCallback)((n,i={})=>iU(t,e,n,{...i,onOptimistic:()=>{r(e=>e+1),i.onOptimistic?.()},onSuccess:()=>{r(e=>Math.max(0,e-1)),i.onSuccess?.()},onRollback:()=>{r(e=>Math.max(0,e-1)),i.onRollback?.()}}),[t,e]),pending:n>0}}function oU(e,t){return new Promise(n=>{iU(e,t,`Continue exactly where you left off.`,{onSuccess:()=>{Z(`Retrying…`),n()},onRollback:()=>n(),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||n()})}function sU(e){let t=/^([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*)#(\d+)$/.exec(e.trim());return t?`https://github.com/${t[1]}/${t[2]}/pull/${t[3]}`:null}var cU=`Waiting for an external update.`;function lU(e){let t=new Set;return e.flatMap(e=>{if(e.kind!==`pr`)return[];let n=e.value.trim();return!n||t.has(n)?[]:(t.add(n),[{ref:n,url:sU(n)}])})}function uU(e){let t=(e.body??``).split(/\n\s*\n/).map(e=>e.trim()).find(Boolean);return t?pU(dU(t.replace(/\s*\n\s*/g,` `))):null}function dU(e){if(e.length<=fU)return e;let t=e.slice(0,fU),n=t.lastIndexOf(` `);return`${(n>fU/2?t.slice(0,n):t).replace(/[.,;:]$/,``)}…`}var fU=240;function pU(e){let t=(e.split(/\s/,1)[0]??``).replace(/[.,:;]+$/,``);return/[^a-zA-Z]/.test(t)||/[A-Z]/.test(t.slice(1))||mU.has(t)?e:e.charAt(0).toUpperCase()+e.slice(1)}var mU=new Set([`npm`,`npx`,`pnpm`,`nub`,`nubx`,`gh`,`git`,`node`,`bun`,`tsc`,`vite`,`curl`,`ssh`]);function hU(e){return e&&_U(e)||null}var gU=new Set([...rl,`shells`,`agents`,`timers`,`prs`,`for`,`title`]);function _U(e){return e.split(`
199
+ `+e.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1)))})}e.key===`Escape`&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.stopPropagation(),t.blur())}return(0,L.jsxs)(`div`,{className:`group relative rounded-xl border bg-bg transition-colors focus-within:border-accent ${v?`border-dashed border-accent`:`border-border`}`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`)&&(e.preventDefault(),y(!0))},onDragLeave:()=>y(!1),onDrop:e=>{e.preventDefault(),y(!1),O(e.dataTransfer.files)},children:[v&&(0,L.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-bg/80 text-[12px] text-muted`,children:`Drop file to attach`}),se&&(0,L.jsx)(`div`,{ref:le,"data-slash-menu":!0,className:`absolute bottom-full left-0 right-0 z-20 mb-1.5 max-h-56 overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg`,children:oe.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,"data-suggest-index":t,onMouseDown:e=>e.preventDefault(),onClick:()=>ue(e),onMouseEnter:()=>ne(t),className:`flex w-full items-baseline gap-2 px-3.5 py-1.5 text-left ${t===te?`bg-panel-2`:``}`,children:[(0,L.jsxs)(`span`,{className:`shrink-0 text-[12px] font-medium text-fg`,children:[`/`,e.name]}),e.description&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted`,children:e.description}),ce.length>0&&(0,L.jsxs)(`span`,{className:`ml-auto grid shrink-0 text-[10px]`,children:[ce.map(e=>(0,L.jsx)(`span`,{"aria-hidden":!0,className:`petite-caps invisible col-start-1 row-start-1`,children:e},e)),(0,L.jsx)(`span`,{className:`petite-caps col-start-1 row-start-1 text-right text-muted/70`,children:e.source?mR[e.source]:``})]})]},e.name))}),(0,L.jsxs)(`div`,{className:`relative`,children:[A&&(0,L.jsx)(`div`,{ref:g,"aria-hidden":!0,"data-composer-context-backdrop":!0,className:`pointer-events-none absolute inset-0 select-none overflow-hidden whitespace-pre-wrap [overflow-wrap:break-word] px-3.5 ${u?`py-2.5 pb-3`:`py-2.5 ${fe?`pr-[6.6875rem]`:`pr-20`}`} text-[13px] leading-relaxed text-transparent`,children:A}),(0,L.jsx)(`textarea`,{id:a,ref:h,onScroll:A?j:void 0,"data-surface":r,value:S,autoFocus:c,disabled:l,onChange:e=>E(e.target.value),onKeyDown:pe,onPaste:e=>{let t=[...e.clipboardData.items].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(Boolean);t.length&&(e.preventDefault(),O(t))},placeholder:i,rows:1,spellCheck:!1,style:{minHeight:o,maxHeight:s},className:`relative block w-full resize-none bg-transparent px-3.5 ${u?`py-2.5 pb-3`:`py-2.5 ${fe?dR:fR}`} text-[13px] leading-relaxed text-fg outline-none placeholder:text-muted scrollbar-none disabled:opacity-60`})]}),C.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pb-2 ${fe?`pr-[6.6875rem]`:`pr-20`}`,children:C.map((e,t)=>(0,L.jsx)(_R,{attachment:e,disabled:l,onRemove:()=>D(w.filter((e,n)=>n!==t))},`${e.path}-${t}`))}),u&&(0,L.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1 pl-1.5 pb-1.5 ${fe?`pr-[6.6875rem]`:`pr-20`}`,children:u}),fe&&(0,L.jsx)(`div`,{className:`absolute bottom-2 right-[43px] flex items-center`,children:fe}),(0,L.jsx)(`input`,{ref:_,type:`file`,multiple:!0,accept:Hc,className:`hidden`,onChange:e=>{O(e.target.files),e.target.value=``}}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>_.current?.click(),disabled:l||b,title:`Attach files`,"aria-label":`Attach files`,className:`absolute bottom-2 ${fe?lR:uR} flex h-7 w-7 items-center justify-center rounded-lg text-muted transition-[color,background-color] enabled:hover:bg-panel-2/70 enabled:hover:text-fg disabled:opacity-50`,children:b?(0,L.jsx)(Xm,{size:15,strokeWidth:2,className:`animate-spin`}):(0,L.jsx)(ih,{size:15,strokeWidth:2})}),(0,L.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:n,disabled:!de||l||b,title:`Send (Enter · ⌘⏎ sends now)`,"aria-label":`Send`,className:`absolute bottom-2 ${cR} flex h-7 w-7 items-center justify-center rounded-lg transition-all ${de&&!l&&!b?`bg-fg text-bg hover:opacity-90 active:scale-95`:`bg-panel-2 text-muted`}`,children:l?(0,L.jsx)(Xm,{size:14,strokeWidth:2.5,className:`animate-spin`}):(0,L.jsx)(fm,{size:14,strokeWidth:2.5})})]})}function _R({attachment:e,disabled:t,onRemove:n}){let[r,i]=(0,I.useState)(!1),a=Qf(e.path),o=(a.includes(`.`)?a.split(`.`).pop():``).toUpperCase();return(0,L.jsxs)(`div`,{className:`group/att relative h-11 w-11`,title:a,children:[e.kind===`image`&&!r?(0,L.jsx)(`img`,{src:YS(e.path),alt:a,onError:()=>i(!0),className:`h-11 w-11 rounded-md border border-border object-cover`}):(0,L.jsxs)(`div`,{className:`flex h-11 w-11 flex-col items-center justify-center gap-0.5 rounded-md border border-border bg-panel-2 px-1`,children:[(0,L.jsx)(Pm,{size:15,strokeWidth:2,className:`shrink-0 text-muted`}),o&&(0,L.jsx)(`span`,{className:`-mx-1 max-w-[calc(100%+0.5rem)] truncate text-[8px] font-medium leading-none text-muted/80`,children:o})]}),(0,L.jsx)(`button`,{type:`button`,onClick:n,disabled:t,title:`Remove ${a}`,"aria-label":`Remove ${a}`,className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-border bg-bg text-muted opacity-0 transition-opacity hover:text-fg focus-visible:opacity-100 group-hover/att:opacity-100 disabled:hidden`,children:(0,L.jsx)(Ch,{size:10,strokeWidth:2.5})})]})}function vR(){return nt({queryKey:[`githubStatus`],queryFn:()=>Y.githubStatus(),staleTime:3e4,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.data;return t?.inRepo&&t.authed?!1:6e4}})}function yR(){let e=vR();return!!(e.data?.inRepo&&e.data.authed)}function bR({className:e=``}){return yR()?(0,L.jsx)(`button`,{type:`button`,onClick:lp,onMouseDown:e=>e.preventDefault(),title:`Investigate this issue and make recommendations`,"aria-label":`Investigate this issue and make recommendations`,className:`flex h-7 w-7 items-center justify-center rounded-lg text-muted outline-none transition-[color,background-color,box-shadow] enabled:hover:bg-panel-2/70 enabled:hover:text-fg enabled:focus-visible:bg-panel-2/70 enabled:focus-visible:text-muted enabled:focus-visible:ring-1 enabled:focus-visible:ring-muted/80 enabled:focus-visible:ring-offset-1 enabled:focus-visible:ring-offset-bg enabled:active:bg-elevated enabled:active:text-muted disabled:bg-transparent disabled:text-muted/35 ${e}`,children:(0,L.jsx)(Hm,{size:15,strokeWidth:2})}):null}var xR=`prompt-control-type petite-caps`,SR=xR,CR=xR,wR=`profile-grid-cell relative flex h-6 cursor-pointer select-none items-center justify-start rounded border border-transparent px-1 text-left text-muted outline-none transition-colors ${SR} data-[highlighted]:border-border data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[highlighted]:outline data-[highlighted]:outline-1 data-[highlighted]:outline-offset-1 data-[highlighted]:outline-fg/55 data-[state=checked]:border-accent/70 data-[state=checked]:bg-accent/10 data-[state=checked]:font-medium data-[state=checked]:text-fg data-[state=checked]:ring-1 data-[state=checked]:ring-inset data-[state=checked]:ring-accent/90`;function TR(e){return`minmax(6rem, 7rem) repeat(${Math.max(0,e)}, auto)`}var ER=[`ultra`,`ultracode`],DR=[`low`,`medium`,`high`,`xhigh`,`max`,...ER];function OR(e){return[...new Set(e.flatMap(e=>e.options.flatMap(e=>e.efforts)))].sort((e,t)=>{let n=DR.indexOf(e),r=DR.indexOf(t);return n===-1&&r===-1?e.localeCompare(t):n===-1?1:r===-1?-1:n-r})}function kR(e){let t=[];for(let n of OR(e)){let e=ER.includes(n)?t.find(e=>ER.includes(e[0])):void 0;e?e.push(n):t.push([n])}return t}function AR(e){return e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n}))))}function jR(e){return JSON.stringify([e.provider,e.model,e.effort])}function MR(e,t){return AR(e).find(e=>jR(e)===t)}function NR(e,t){return!t?.model||!t.effort?!1:e.some(e=>(!t.provider||e.id===t.provider)&&e.options.some(e=>e.model===t.model&&e.efforts.includes(t.effort)))}function PR(e,t,n=`Profile unknown`){if(!t?.model&&!t?.effort)return n;let r=e.flatMap(e=>e.options).find(e=>e.model===t.model)?.label??t.model??`Model unknown`;return t.effort?`${r} › ${t.effort}`:r}function FR(e,t,n){let r=kR(e),i=e=>r.findIndex(t=>t.includes(e)),a=e.flatMap(e=>e.options.map(t=>({provider:e.id,option:t}))),o=a.findIndex(e=>e.provider===t.provider&&e.option.model===t.model);if(o===-1)return null;let s=a[o],c=s.option.efforts.indexOf(t.effort);if(c===-1)return null;if(n===`Home`||n===`End`||n===`ArrowLeft`||n===`ArrowRight`){let e=n===`Home`?0:n===`End`?s.option.efforts.length-1:c+(n===`ArrowLeft`?-1:1),t=s.option.efforts[e];return t?{provider:s.provider,model:s.option.model,effort:t}:null}let l=a[o+(n===`ArrowUp`?-1:1)];if(!l)return null;let u=i(t.effort),d=l.option.efforts.reduce((e,t)=>e?Math.abs(i(t)-u)<Math.abs(i(e)-u)?t:e:t,void 0);return d?{provider:l.provider,model:l.option.model,effort:d}:null}var IR,LR=!1;function RR(){LR||typeof window>`u`||(LR=!0,window.addEventListener(`keydown`,e=>{e.key!==`Escape`||!IR||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),BR())},{capture:!0}))}function zR(e){RR();let t={dismiss:e};return IR=t,()=>{IR===t&&(IR=void 0)}}function BR(){let e=IR;return e?(IR=void 0,e.dismiss(),!0):!1}function VR(e){BR()&&e.preventDefault(),e.stopPropagation()}function HR(e){return e===`xhigh`?`X-high`:e.charAt(0).toUpperCase()+e.slice(1)}function UR({groups:e,value:t,pending:n,onValueChange:r,placeholder:i,ariaLabel:a,menuAriaLabel:o=`Choose model and effort`,title:s,disabled:c=!1,compact:l=!1,side:u=`bottom`,menuZClass:d=$j,className:f=``}){let[p,m]=(0,I.useState)(!1),h=(0,I.useRef)(p),g=(0,I.useRef)(c),_=(0,I.useRef)(void 0),v=(0,I.useRef)(new Map),y=(0,I.useRef)(void 0),b=(0,I.useMemo)(()=>kR(e),[e]),x=(0,I.useMemo)(()=>e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n})))),[e]),S=l?CR:SR,C=c?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors hover:border-border hover:bg-panel-2 hover:text-fg`,w=NR(e,t),T=w&&t?.provider&&t.model&&t.effort?jR(t):void 0,E=n?.model||n?.effort?PR(e,n,`Pending profile`):void 0;h.current=p,g.current=c;function D(){h.current=!1,_.current=void 0,m(!1)}(0,I.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!h.current||g.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current?.(),D())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,I.useLayoutEffect)(()=>{!c||!p||(_.current?.(),D())},[c,p]),(0,I.useLayoutEffect)(()=>()=>_.current?.(),[]),(0,I.useLayoutEffect)(()=>{T===y.current&&(y.current=void 0)},[T]);function O(e){let t=jR(e);y.current!==t&&(y.current=t,r(e))}function k(t,n){if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(t.key))return;let r=FR(e,n,t.key);r&&(t.preventDefault(),t.stopPropagation(),v.current.get(jR(r))?.focus())}return(0,L.jsxs)(MI,{modal:!1,open:p,onOpenChange:e=>{_.current?.(),_.current=void 0,h.current=e,m(e),e&&(_.current=zR(D))},children:[(0,L.jsx)(NI,{asChild:!0,disabled:c,children:(0,L.jsxs)(`button`,{type:`button`,"aria-label":a,"aria-invalid":!w&&(t?.model||t?.effort)?!0:void 0,"aria-description":E?`Pending ${E}`:void 0,title:s,"data-profile-known":w?`true`:`false`,"data-profile-pending":E?`true`:void 0,className:`profile-grid-trigger group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-border/50 bg-transparent px-2 py-1 text-left text-muted outline-none data-[state=open]:border-border data-[state=open]:bg-panel-2 ${C} ${f} ${S}`,children:[(0,L.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 flex-1 truncate text-left ${S}`,children:PR(e,t,i)}),E&&(0,L.jsx)(Xm,{"aria-hidden":`true`,size:l?10:11,className:`shrink-0 animate-spin text-muted/65`}),(0,L.jsx)(_m,{"aria-hidden":`true`,size:l?11:13,className:`shrink-0 text-fg/65 transition-transform group-data-[state=open]:rotate-180`})]})}),(0,L.jsx)(PI,{children:(0,L.jsxs)(FI,{"aria-label":o,align:`start`,side:u,sideOffset:5,collisionPadding:8,onEscapeKeyDown:e=>e.stopPropagation(),className:`profile-grid-menu ${d} ${Qj} max-h-[min(360px,var(--radix-dropdown-menu-content-available-height))] max-w-[calc(100vw-1rem)] overflow-auto rounded-lg p-1.5 ${S}`,children:[e.map(t=>(0,L.jsxs)(II,{children:[t.label&&(0,L.jsx)(LI,{className:`px-1.5 pb-1 pt-1 text-left font-medium tracking-[0.07em] text-muted/55 first:pt-0.5`,children:t.label}),(0,L.jsx)(zI,{value:T,onValueChange:t=>{let n=MR(e,t);n&&O(n)},children:t.options.map(e=>(0,L.jsxs)(`div`,{"data-profile-grid-row":e.model,className:`grid w-max items-center gap-1 py-0.5`,style:{gridTemplateColumns:TR(b.length)},children:[(0,L.jsx)(`span`,{className:`profile-grid-model-label min-w-0 max-w-[9.5rem] truncate px-1.5 text-left text-muted ${S}`,title:e.label,children:e.label}),b.map(n=>{let r=n.find(t=>e.efforts.includes(t)),i=n.reduce((e,t)=>HR(t).length>HR(e).length?t:e);if(!r)return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`invisible cursor-default border border-transparent px-1 text-left font-medium ${S}`,children:HR(i)},i);let a={provider:t.id,model:e.model,effort:r},o=jR(a);return(0,L.jsx)(BI,{value:o,ref:e=>{e?v.current.set(o,e):v.current.delete(o)},onKeyDown:e=>k(e,a),onSelect:e=>{e.preventDefault(),O(a),_.current?.(),D()},"aria-label":`${e.label}, ${HR(r)} effort`,title:`${e.label} › ${HR(r)}`,className:wR,children:(0,L.jsxs)(`span`,{className:`grid`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 font-medium`,children:HR(r)}),(0,L.jsx)(`span`,{className:`col-start-1 row-start-1`,children:HR(r)})]})},r)})]},e.model))}),t!==e.at(-1)&&(0,L.jsx)(HI,{className:`my-1 h-px bg-border`})]},t.id)),x.length===0&&(0,L.jsx)(`div`,{className:`px-2 py-1.5 text-muted/60`,children:`No profiles available`})]})})]})}async function WR(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}if(!GR(e))throw Error(`the browser blocked clipboard access`)}function GR(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.opacity=`0`,document.body.append(t);let n=document.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;t.select(),t.setSelectionRange(0,e.length);let i=!1;try{i=document.execCommand(`copy`)}catch{i=!1}return t.remove(),r&&n&&(n.removeAllRanges(),n.addRange(r)),i}var KR={claude:`claude auth login`,codex:`codex login`},qR={claude:`Claude`,codex:`Codex`};function JR(e){let t=e.trim();return t===`/login`?`login`:t===`/logout`?`logout`:null}var YR=(0,I.lazy)(()=>ib(()=>import(`./TerminalPane-DuP4bhhj.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([0,1])));function XR({backend:e,onClose:t,onAuthed:n}){let r=Ve(),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(null),c=(0,I.useRef)(!1),l=KR[e],u=qR[e],d=it({mutationFn:()=>Y.accountLoginStart({backend:e}),onSuccess:e=>{c.current=!1,s(e.attemptId)},onError:e=>Z(`Couldn't start the sign-in terminal: ${e.message.slice(0,80)} — use the command below instead`,{duration:7e3})}),f=nt({queryKey:[`accountLoginStatus`,o],queryFn:()=>Y.accountLoginStatus({attemptId:o}),enabled:!!o,refetchInterval:2e3});(0,I.useEffect)(()=>{if(!o||c.current)return;let t=f.data;if(!(!t||t.state===`running`||t.state===`unknown`)){if(c.current=!0,t.auth!==`signed-out`){r.setQueryData([`authStatus`],n=>n&&{...n,[e]:t.auth}),Z(`Signed in to ${u}`),n();return}Z(`${u} sign-in didn't complete — try again or use the command below`,{duration:7e3}),s(null)}},[o,f.data,e,u]);function p(){o&&!c.current&&Y.accountLoginCancel({attemptId:o}).catch(()=>{})}let m=(0,I.useRef)({attempt:null,settled:!1});m.current={attempt:o,settled:c.current},(0,I.useEffect)(()=>()=>{let{attempt:e,settled:t}=m.current;e&&!t&&Y.accountLoginCancel({attemptId:e}).catch(()=>{})},[]);async function h(){try{await WR(l),a(!0),window.setTimeout(()=>a(!1),1500)}catch{Z(`Couldn't copy — select the command and copy it manually`,{duration:6e3})}}let g=it({mutationFn:()=>Y.authStatus(),onSuccess:t=>{if(r.setQueryData([`authStatus`],t),t[e]===`signed-out`){Z(`Still signed out of ${u} — run the command, then retry`,{duration:6e3});return}n()},onError:()=>n()});return(0,L.jsx)(eL,{open:!0,onOpenChange:e=>{e||(p(),t())},children:(0,L.jsxs)(oL,{children:[(0,L.jsx)(cL,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,L.jsxs)(fL,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] ${o?`w-[680px]`:`w-[440px]`} max-w-[92vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,L.jsxs)(_L,{className:`mb-1 text-[14px] font-medium`,children:[`Signed out of `,u]}),o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`mb-3 text-[12.5px] leading-relaxed text-muted`,children:[`This terminal is running `,(0,L.jsx)(`code`,{className:`font-mono-keep text-fg/90`,children:l}),` — follow its prompts (it may open your browser). Frizz detects completion automatically.`]}),(0,L.jsx)(`div`,{className:`mb-4 h-[340px] overflow-hidden rounded-lg border border-border bg-[#0d0e10]`,children:(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-muted`,children:`Opening terminal…`}),children:(0,L.jsx)(YR,{slug:o})})}),(0,L.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>{p(),s(null)},className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel sign-in`})})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`Frizz can't start a `,u,` thread until you're signed in. Sign in here, or run the command in your own terminal and retry:`]}),(0,L.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-border bg-panel-2 px-3 py-2`,children:[(0,L.jsx)(`code`,{className:`flex-1 select-all font-mono-keep text-[12.5px] text-fg`,children:l}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,onClick:h,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel hover:text-fg`,children:i?(0,L.jsx)(gm,{size:14,strokeWidth:2,className:`text-green-400`}):(0,L.jsx)(Am,{size:14,strokeWidth:1.8})})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel`}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>g.mutate(),disabled:g.isPending,className:`flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[12.5px] text-fg/90 outline-none transition-colors hover:bg-panel-2 disabled:opacity-60`,children:[g.isPending&&(0,L.jsx)(Xm,{size:13,className:`animate-spin`}),`Retry`]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>d.mutate(),disabled:d.isPending,className:`flex items-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[d.isPending&&(0,L.jsx)(Xm,{size:13,className:`animate-spin`}),`Sign in here`]})]})]})]})]})})}function ZR({backend:e,onClose:t}){let n=Ve(),r=qR[e],i=it({mutationFn:()=>Y.accountLogout({backend:e}),onSuccess:i=>{n.setQueryData([`authStatus`],t=>t&&{...t,[e]:i.auth}),i.status===`done`?Z(`Signed out of ${r}`):i.status===`blocked`?Z(`Not signed out — ${i.activeThreads} active ${r} thread${i.activeThreads===1?``:`s`}. Let them finish (or complete them) first.`,{duration:7e3}):Z(`${r} sign-out failed: ${i.detail??`unknown error`}`,{duration:7e3}),t()},onError:e=>{Z(`${r} sign-out failed: ${e.message.slice(0,80)}`,{duration:7e3}),t()}});return(0,L.jsx)(eL,{open:!0,onOpenChange:e=>{!e&&!i.isPending&&t()},children:(0,L.jsxs)(oL,{children:[(0,L.jsx)(cL,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,L.jsxs)(fL,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] w-[420px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,L.jsxs)(_L,{className:`mb-1 text-[14px] font-medium`,children:[`Sign out of `,r,`?`]}),(0,L.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`New `,r,` threads will be blocked until you sign in again. Running `,r,` threads are left untouched — sign-out is refused while any are active.`]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:t,disabled:i.isPending,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-60`,children:`Cancel`}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>i.mutate(),disabled:i.isPending,className:`flex items-center gap-1.5 rounded-md bg-red-500/90 px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[i.isPending&&(0,L.jsx)(Xm,{size:13,className:`animate-spin`}),`Sign out`]})]})]})]})})}var QR=_u.options,$R={auto:`Auto`,default:`Default`,acceptEdits:`Accept edits`,plan:`Plan`,bypassPermissions:`Bypass`},ez={auto:`auto — safe actions auto-approved, risky ones prompt`,default:`default — prompt for every permission`,acceptEdits:`accept edits — file edits auto-approved`,plan:`plan — read-only planning, approval before changes`,bypassPermissions:`bypass — never prompt (dangerous)`};QR.filter(e=>e!==`plan`).map(e=>({value:e,label:$R[e],title:ez[e]}));var tz=[`auto`,`bypassPermissions`].map(e=>({value:e,label:$R[e],title:ez[e]})),nz=[{value:`fable`,label:`Fable`},{value:`opus`,label:`Opus`},{value:`sonnet`,label:`Sonnet`},{value:`haiku`,label:`Haiku`}];new Set([{slug:`gpt-6-astra`,displayName:`GPT-6 Astra`,defaultEffort:`low`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-sol`,displayName:`GPT-5.6 Sol`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-terra`,displayName:`GPT-5.6 Terra`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-luna`,displayName:`GPT-5.6 Luna`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`]},{slug:`gpt-5.5`,displayName:`GPT-5.5`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`]}].map(e=>e.slug));function rz(e){return e===`plan`?`auto`:e}var iz=[`low`,`medium`,`high`,`xhigh`,`max`],az=`ultracode`,oz=new Set([`fable`,`opus`,`sonnet`]);function sz(e){return e&&oz.has(e)?[...iz,az]:[...iz]}var cz={low:`Low`,medium:`Medium`,high:`High`,xhigh:`X-high`,max:`Max`,ultra:`Ultra`,ultracode:`Ultracode`};function lz(e){return cz[e]??e.charAt(0).toUpperCase()+e.slice(1)}function uz(e,t){let n=sz(e).map(e=>({value:e,label:lz(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function dz(e,t){let n=(e?.efforts??[]).map(e=>({value:e,label:lz(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function fz(e,t){return t.field===`backend`?{...e,backend:t.value}:t.field===`profile`?{...e,backend:t.backend,[t.backend]:{...e[t.backend],model:t.model,effort:t.effort}}:{...e,...t.field===`model`?{backend:t.backend}:{},[t.backend]:{...e[t.backend],[t.field]:t.value}}}function pz(e){return[{id:`claude`,label:`Claude Code`,options:nz.map(e=>({model:e.value,label:e.label,defaultEffort:`high`,efforts:sz(e.value)}))},{id:`codex`,label:`Codex`,options:e.map(e=>({model:e.slug,label:e.displayName,defaultEffort:e.defaultEffort,efforts:e.efforts}))}]}function mz(e,t){let n=e.backend,r=e[n],i=r.model??(n===`claude`?`opus`:t[0]?.slug??``),a=n===`codex`?t.find(e=>e.slug===i):void 0,o=n===`claude`?nz.some(e=>e.value===i):t.some(e=>e.slug===i),s=n===`claude`?`high`:a?.defaultEffort??``,c=r.effort??s,l=n===`claude`?uz(i,{withDefault:!1}):dz(a,{withDefault:!1}),u=l.some(e=>e.value===c);return{backend:n,model:i,effort:c,codexModel:a,modelAvailable:o,effortAvailable:u,effortOptions:c&&!u?[{value:c,label:`${c} (unavailable)`,title:`Saved reasoning level is not available for this model`},...l]:l}}function hz(){let e=Ve(),t=nt({queryKey:[`dispatchPreferencesGet`],queryFn:()=>Y.dispatchPreferencesGet()}),n=nt({queryKey:[`codexModels`],queryFn:()=>Y.codexModels()}),r=n.data??[],i=it({mutationFn:e=>Y.dispatchPreferenceSet(e),scope:{id:`dispatch-preferences`},onMutate:t=>{let n=e.getQueryData([`dispatchPreferencesGet`]);n&&e.setQueryData([`dispatchPreferencesGet`],fz(n,t))},onError:t=>{e.invalidateQueries({queryKey:[`dispatchPreferencesGet`]}),Z(`Could not save new-thread preference: ${t.message.slice(0,80)}`)}}),a=!!t.data&&!!n.data;return{resolved:(0,I.useMemo)(()=>a?mz(t.data,r):void 0,[a,t.data,r]),codexList:r,loadError:t.isError||n.isError,saveProfile:i.mutate}}var gz=`frizz-drafts:v1`,_z=80,vz=512*1024,yz=2*1024*1024,bz=new TextEncoder;function xz(e){return bz.encode(e).byteLength}function Sz(){return{version:1,entries:{}}}function Cz(e){if(!e)return Sz();try{let t=JSON.parse(e);if(!t||typeof t!=`object`||t.version!==1)return Sz();let n=t.entries;if(!n||typeof n!=`object`||Array.isArray(n))return Sz();let r={};for(let[e,t]of Object.entries(n))typeof t?.value!=`string`||typeof t?.touchedAt!=`number`||!Number.isFinite(t.touchedAt)||e.length>512||xz(t.value)>vz||(r[e]={value:t.value,touchedAt:t.touchedAt});return{version:1,entries:r}}catch{return Sz()}}function wz(e){let t=Object.entries(e.entries).filter(([,e])=>e.value&&xz(e.value)<=vz).sort((e,t)=>t[1].touchedAt-e[1].touchedAt),n={};for(let[e,r]of t){if(Object.keys(n).length>=_z)break;n[e]=r,xz(JSON.stringify({version:1,entries:n}))>yz&&delete n[e]}return{version:1,entries:n}}var Tz=new class{snapshot;listeners=new Set;storage;constructor(e=typeof sessionStorage>`u`?void 0:sessionStorage){this.storage=e;let t=null;try{t=e?.getItem(`frizz-drafts:v1`)??null}catch{}this.snapshot=wz(Cz(t))}getSnapshot=()=>this.snapshot;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));get(e){return this.snapshot.entries[e]?.value??``}set(e,t){let n={...this.snapshot.entries};t?n[e]={value:t,touchedAt:Date.now()}:delete n[e],this.commit({version:1,entries:n})}clear(e){this.snapshot.entries[e]&&this.commit({version:1,entries:Object.fromEntries(Object.entries(this.snapshot.entries).filter(([t])=>t!==e))})}commit(e){this.snapshot=e;try{this.storage?.setItem(gz,JSON.stringify(wz(e)))}catch{}for(let e of this.listeners)e()}};function Ez(e){return encodeURIComponent(e||`unresolved-project`)}var Dz={dispatch:e=>`dispatch:${Ez(e)}:new`,followUp:(e,t,n)=>`followup:${Ez(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}`,adopt:(e,t)=>`adopt:${Ez(e)}:${encodeURIComponent(t)}`,answer:(e,t,n,r,i)=>`answer:${Ez(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}:${encodeURIComponent(r)}:${i}`,interaction:(e,t,n,r,i,a,o)=>`interaction:${Ez(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n)}:${encodeURIComponent(r)}:${i}:${encodeURIComponent(a)}:${encodeURIComponent(o)}`,question:(e,t,n,r)=>`question:${Ez(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n)}:${encodeURIComponent(r)}`};function Oz(){return Zt(X).board?.projectDir}function kz(e){return Zt(X).board?.threads.find(t=>t.id===e)?.sessionId}function Az(e){let t=(0,I.useCallback)(()=>Tz.get(e),[e]);return[(0,I.useSyncExternalStore)(Tz.subscribe,t,t),(0,I.useCallback)(t=>Tz.set(e,t),[e]),(0,I.useCallback)(()=>Tz.clear(e),[e])]}function jz(e){let t=(0,I.useCallback)(()=>JSON.stringify(Object.fromEntries(e.map(e=>[e,Tz.get(e)]))),[e.join(`\0`)]),n=(0,I.useSyncExternalStore)(Tz.subscribe,t,t);return(0,I.useMemo)(()=>new Map(Object.entries(JSON.parse(n))),[n])}function Mz({autoFocus:e,onDispatched:t}){let{resolved:n,codexList:r,loadError:i,saveProfile:a}=hz(),o=yR(),s=Oz(),[c,l,u]=Az(Dz.dispatch(s)),d=Dz.dispatch(s),f=(0,I.useRef)(``),[p,m]=(0,I.useState)(null),h=nt({queryKey:[`authStatus`],queryFn:()=>Y.authStatus(),staleTime:3e4}),[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(null),b=(0,I.useRef)(null),x=it({mutationFn:e=>Y.dispatch(e),onMutate:()=>Z(`Starting thread…`,{spinner:!0,sticky:!0}),onSuccess:e=>{m(null),t?.(),Z(`Thread started`,{link:{label:`Open thread`,slug:e.slug}})},onError:(e,t)=>{Tz.get(d)||l(f.current||t.prompt),m(null);let n=/^AUTH_REQUIRED:(claude|codex)$/.exec(e.message);if(n){b.current=t,_(n[1]),Z(`Signed out of ${n[1]===`claude`?`Claude`:`Codex`}`,{duration:3e3});return}Z(`Dispatch failed: ${e.message.slice(0,80)}`)}});function S(e){f.current=c,u(),m(e.prompt),x.mutate(e)}function C(){if(!c.trim()||!n)return;let e=JR(c);if(e){u(),e===`login`?(b.current=null,_(n.backend)):y(n.backend);return}if(!n.modelAvailable){Z(`Saved model is unavailable — choose a model before starting the thread`);return}if(!n.effortAvailable){Z(`Saved reasoning level is unavailable for this model — choose another level`);return}let t={prompt:c.trim(),model:n.model,backend:n.backend,effort:n.effort};if(h.data?.[n.backend]===`signed-out`){b.current=t,_(n.backend);return}S(t)}let w=(0,I.useMemo)(()=>n?(0,L.jsx)(UR,{groups:pz(r),value:{provider:n.backend,model:n.model,effort:n.effort},onValueChange:e=>a({field:`profile`,backend:e.provider,model:e.model,effort:e.effort}),ariaLabel:`Model and effort`,title:n.modelAvailable&&n.effortAvailable?`Model and reasoning effort`:`Saved model or reasoning effort unavailable — choose a supported pair`,className:`max-w-[min(21rem,72vw)]`}):(0,L.jsx)(UR,{groups:[],value:void 0,onValueChange:()=>{},placeholder:i?`Profile unavailable`:`Profile loading…`,ariaLabel:`Model and effort loading`,disabled:!0}),[n,r,i,a]);return(0,L.jsxs)(`div`,{className:`w-full flex flex-col gap-3`,children:[(0,L.jsx)(gR,{surface:`newComposer`,autoFocus:e,value:c,onChange:l,onSubmit:C,placeholder:`Describe the task…`,minHeight:96,maxHeight:340,busy:x.isPending,footer:w,leftAction:o?(0,L.jsx)(bR,{}):void 0}),x.isError&&(0,L.jsx)(`span`,{className:`px-0.5 text-[11px] text-red-400 truncate`,children:x.error.message}),p&&(0,L.jsxs)(`div`,{"data-pending-dispatch":!0,role:`status`,className:`rounded-lg border border-border bg-panel-2 px-3 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted`,children:[(0,L.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-accent`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{children:`Starting thread…`})]}),(0,L.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed text-fg`,children:p})]}),g&&(0,L.jsx)(XR,{backend:g,onClose:()=>_(null),onAuthed:()=>{let e=b.current;b.current=null,_(null),e&&S(e)}}),v&&(0,L.jsx)(ZR,{backend:v,onClose:()=>y(null)})]})}function Nz({onClose:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null);return(0,I.useEffect)(()=>()=>{let e=n.current;window.setTimeout(()=>{e?.isConnected&&e.focus({preventScroll:!0})},0)},[]),(0,L.jsx)(eL,{open:!0,onOpenChange:t=>{t||e()},children:(0,L.jsxs)(oL,{children:[(0,L.jsx)(cL,{className:`fixed inset-0 z-50 bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,L.jsxs)(fL,{ref:t,"aria-modal":`true`,"aria-describedby":void 0,onEscapeKeyDown:VR,onCloseAutoFocus:e=>{e.preventDefault();let t=n.current;t?.isConnected&&t.focus({preventScroll:!0})},onOpenAutoFocus:e=>{e.preventDefault(),t.current?.querySelector(`textarea`)?.focus({preventScroll:!0})},className:`fixed left-1/2 top-1/2 z-50 w-[640px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none max-[700px]:top-[calc(env(safe-area-inset-top)+56px)] max-[700px]:w-[calc(100vw-24px)] max-[700px]:max-w-none max-[700px]:translate-y-0`,children:[(0,L.jsx)(_L,{className:`mb-1 text-[14px] font-medium`,children:`New thread`}),(0,L.jsx)(Mz,{autoFocus:!0,onDispatched:e})]})]})})}function Pz({children:e,onClose:t}){return(0,L.jsx)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center bg-black/30 backdrop-blur-md backdrop-saturate-150`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:e})}var Fz=`-mx-1.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/75 outline-none transition-colors hover:bg-elevated hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong disabled:opacity-55`,Iz={claude:`size-[11px] translate-y-px`,codex:`size-[10px]`},Lz={claude:{backend:`claude`,label:`Claude Code`},codex:{backend:`codex`,label:`OpenAI Codex`}};function Rz(e){return e===`claude`||e===`codex`?Lz[e]:void 0}function zz({backend:e,className:t}){let n=Rz(e);return n?(0,L.jsx)(`span`,{role:`img`,"aria-label":n.label,className:`inline-flex shrink-0 text-muted/65 ${Iz[n.backend]} ${t??``}`,children:n.backend===`codex`?(0,L.jsx)(Bz,{}):(0,L.jsx)(Vz,{})}):null}function Bz(){return(0,L.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,L.jsx)(`path`,{d:`M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z`})})}function Vz(){return(0,L.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,L.jsx)(`path`,{d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`})})}typeof window<`u`&&window.document&&window.document.createElement;function Hz(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function Uz(e,t=[]){let n=[];function r(t,r){let i=I.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=I.useMemo(()=>o,Object.values(o));return(0,L.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=I.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>I.createContext(e));return function(n){let r=n?.[e]||t;return I.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Wz(i,...t)]}function Wz(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Gz=`DismissableLayer`,Kz=`dismissableLayer.update`,qz=`dismissableLayer.pointerDownOutside`,Jz=`dismissableLayer.focusOutside`,Yz,Xz=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Zz=I.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=I.useContext(Xz),[d,f]=I.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=I.useState({}),h=TD(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=I.useRef(!1),C=tB(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:I.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=nB(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=UD(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return I.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),I.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Yz=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),rB(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Yz))}},[d,p,n,u]),I.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),rB())},[d,u]),I.useEffect(()=>{let e=()=>m({});return document.addEventListener(Kz,e),()=>document.removeEventListener(Kz,e)},[]),(0,L.jsx)(VD.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Hz(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Hz(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Hz(e.onPointerDownCapture,C.onPointerDownCapture)})});Zz.displayName=Gz;var Qz=`DismissableLayerBranch`,$z=I.forwardRef((e,t)=>{let n=I.useContext(Xz),r=I.useRef(null),i=TD(t,r);return I.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,L.jsx)(VD.div,{...e,ref:i})});$z.displayName=Qz;var eB=()=>!0;function tB(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=eB}=t,s=UD(e),c=I.useRef(!1),l=I.useRef(!1),u=I.useRef(new Map),d=I.useRef(()=>{});return I.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||iB(qz,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function nB(e,t=globalThis?.document){let n=UD(e),r=I.useRef(!1);return I.useEffect(()=>{let e=e=>{e.target&&!r.current&&iB(Jz,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function rB(){let e=new CustomEvent(Kz);document.dispatchEvent(e)}function iB(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?HD(i,a):i.dispatchEvent(a)}var aB=`focusScope.autoFocusOnMount`,oB=`focusScope.autoFocusOnUnmount`,sB={bubbles:!1,cancelable:!0},cB=`FocusScope`,lB=I.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=I.useState(null),l=UD(i),u=UD(a),d=I.useRef(null),f=TD(t,c),p=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:gB(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||gB(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&gB(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),I.useEffect(()=>{if(s){_B.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(aB,sB);s.addEventListener(aB,l),s.dispatchEvent(t),t.defaultPrevented||(uB(bB(fB(s)),{select:!0}),document.activeElement===e&&gB(s))}return()=>{s.removeEventListener(aB,l),setTimeout(()=>{let t=new CustomEvent(oB,sB);s.addEventListener(oB,u),s.dispatchEvent(t),t.defaultPrevented||gB(e??document.body,{select:!0}),s.removeEventListener(oB,u),_B.remove(p)},0)}}},[s,l,u,p]);let m=I.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=dB(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&gB(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&gB(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,L.jsx)(VD.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});lB.displayName=cB;function uB(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(gB(r,{select:t}),document.activeElement!==n)return}function dB(e){let t=fB(e);return[pB(t,e),pB(t.reverse(),e)]}function fB(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function pB(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):mB(r,{upTo:t})))return r}function mB(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function hB(e){return e instanceof HTMLInputElement&&`select`in e}function gB(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hB(e)&&t&&e.select()}}var _B=vB();function vB(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=yB(e,t),e.unshift(t)},remove(t){e=yB(e,t),e[0]?.resume()}}}function yB(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bB(e){return e.filter(e=>e.tagName!==`A`)}var xB=`Popper`,[SB,CB]=Uz(xB),[wB,TB]=SB(xB),EB=e=>{let{__scopePopper:t,children:n}=e,[r,i]=I.useState(null),[a,o]=I.useState(void 0);return(0,L.jsx)(wB,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};EB.displayName=xB;var DB=`PopperAnchor`,OB=I.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=TB(DB,n),o=I.useRef(null),s=a.onAnchorChange,c=TD(t,I.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=I.useRef(null);I.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&RB(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,L.jsx)(VD.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});OB.displayName=DB;var kB=`PopperContent`,[AB,jB]=SB(kB),MB=I.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:p=`optimized`,onPlaced:m,...h}=e,g=TB(kB,n),[_,v]=I.useState(null),y=TD(t,v),[b,x]=I.useState(null),S=EA(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(IB),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=mA({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>eA(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[gA({mainAxis:i+w,alignmentAxis:o}),c&&_A({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?vA():void 0,...k}),c&&yA({...k}),bA({...k,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`)}}),b&&SA({element:b,padding:s}),LB({arrowWidth:C,arrowHeight:w}),f&&xA({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;WD(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=RB(M),ne=UD(m);WD(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=I.useState();return WD(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,L.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,L.jsx)(AB,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,L.jsx)(VD.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});MB.displayName=kB;var NB=`PopperArrow`,PB={top:`bottom`,right:`left`,bottom:`top`,left:`right`},FB=I.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=jB(NB,n),a=PB[i.placedSide];return(0,L.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,L.jsx)(TA,{...r,ref:t,style:{...r.style,display:`block`}})})});FB.displayName=NB;function IB(e){return e!==null}var LB=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]=RB(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 RB(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var zB=EB,BB=OB,VB=MB,HB=FB;function UB(e,t){return I.useReducer((e,n)=>t[e][n]??e,e)}var WB=e=>{let{present:t,children:n}=e,r=GB(t),i=typeof n==`function`?n({present:r.isPresent}):I.Children.only(n),a=qB(r.ref,YB(i));return typeof n==`function`||r.isPresent?I.cloneElement(i,{ref:a}):null};WB.displayName=`Presence`;function GB(e){let[t,n]=I.useState(),r=I.useRef(null),i=I.useRef(e),a=I.useRef(`none`),o=I.useRef(void 0),[s,c]=UB(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return I.useEffect(()=>{s===`mounted`?(a.current=o.current??JB(r.current),o.current=void 0):a.current=`none`},[s]),WD(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=JB(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),WD(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=JB(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=JB(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:I.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=JB(t)}else r.current=null;n(e)},[])}}function KB(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function qB(...e){let t=I.useRef(e);return t.current=e,I.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=KB(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():KB(n[e],null)}}},[])}function JB(e){return e?.animationName||`none`}function YB(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var XB=`Popover`,[ZB,QB]=Uz(XB,[CB]),$B=CB(),[eV,tV]=ZB(XB),nV=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=$B(t),c=I.useRef(null),[l,u]=I.useState(!1),[d,f]=aj({prop:r,defaultProp:i??!1,onChange:a,caller:XB});return(0,L.jsx)(zB,{...s,children:(0,L.jsx)(eV,{scope:t,contentId:uO(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:I.useCallback(()=>u(!0),[]),onCustomAnchorRemove:I.useCallback(()=>u(!1),[]),modal:o,children:n})})};nV.displayName=XB;var rV=`PopoverAnchor`,iV=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tV(rV,n),a=$B(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return I.useEffect(()=>(o(),()=>s()),[o,s]),(0,L.jsx)(BB,{...a,...r,ref:t})});iV.displayName=rV;var aV=`PopoverTrigger`,oV=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tV(aV,n),a=$B(n),o=TD(t,i.triggerRef),s=(0,L.jsx)(VD.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":xV(i.open),...r,ref:o,onClick:Hz(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,L.jsx)(BB,{asChild:!0,...a,children:s})});oV.displayName=aV;var sV=`PopoverPortal`,[cV,lV]=ZB(sV,{forceMount:void 0}),uV=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=tV(sV,t);return(0,L.jsx)(cV,{scope:t,forceMount:n,children:(0,L.jsx)(WB,{present:n||a.open,children:(0,L.jsx)(XA,{asChild:!0,container:i,children:r})})})};uV.displayName=sV;var dV=`PopoverContent`,fV=I.forwardRef((e,t)=>{let n=lV(dV,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=tV(dV,e.__scopePopover);return(0,L.jsx)(WB,{present:r||a.open,children:a.modal?(0,L.jsx)(mV,{...i,ref:t}):(0,L.jsx)(hV,{...i,ref:t})})});fV.displayName=dV;var pV=OD(`PopoverContent.RemoveScroll`),mV=I.forwardRef((e,t)=>{let n=tV(dV,e.__scopePopover),r=I.useRef(null),i=TD(t,r),a=I.useRef(!1);return I.useEffect(()=>{let e=r.current;if(e)return oN(e)},[]),(0,L.jsx)(hP,{as:pV,allowPinchZoom:!0,children:(0,L.jsx)(gV,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hz(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Hz(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Hz(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),hV=I.forwardRef((e,t)=>{let n=tV(dV,e.__scopePopover),r=I.useRef(!1),i=I.useRef(!1);return(0,L.jsx)(gV,{...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()}})}),gV=I.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=tV(dV,n),p=$B(n);return pM(),(0,L.jsx)(lB,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(Zz,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,L.jsx)(VB,{"data-state":xV(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)`}})})})}),_V=`PopoverClose`,vV=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tV(_V,n);return(0,L.jsx)(VD.button,{type:`button`,...r,ref:t,onClick:Hz(e.onClick,()=>i.onOpenChange(!1))})});vV.displayName=_V;var yV=`PopoverArrow`,bV=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$B(n);return(0,L.jsx)(HB,{...i,...r,ref:t})});bV.displayName=yV;function xV(e){return e?`open`:`closed`}var SV=nV,CV=iV,wV=oV,TV=uV,EV=fV;function DV({modal:e=!1,...t}){return(0,L.jsx)(SV,{modal:e,...t})}var OV=wV,kV=CV;function AV({children:e,side:t=`top`,align:n=`center`,sideOffset:r=6,className:i=``,...a}){return(0,L.jsx)(TV,{children:(0,L.jsx)(EV,{side:t,align:n,sideOffset:r,avoidCollisions:!0,collisionPadding:12,onEscapeKeyDown:e=>e.stopPropagation(),className:`${Qj} ${nM} rounded-lg outline-none ${i}`,...a,children:e})})}var jV=3e4,MV=45e3;function NV(e,t){return t?AbortSignal.any([t,AbortSignal.timeout(e)]):AbortSignal.timeout(e)}var PV=`text-[9px]`,FV={claude:`text-fg/75! size-[14px]! translate-y-0!`,codex:`text-fg/75! size-[12.75px]! translate-y-0!`};function IV(){let e=nt({queryKey:[`quota`],queryFn:()=>Y.quota(),staleTime:1e4}),t=nt({queryKey:[`authStatus`],queryFn:()=>Y.authStatus(),staleTime:3e4});return[`claude`,`codex`].some(n=>LV(e.data?.[n],t.data?.[n],e.isLoading))}function LV(e,t,n){return t===`signed-out`||!e&&n?!1:!!e&&e.status===`ok`&&e.windows.length>0}function RV(){let e=Ve(),t=(0,I.useRef)(null),[n,r]=(0,I.useState)(!1),i=nt({queryKey:[`quota`],queryFn:({signal:e})=>Y.quota(void 0,{signal:NV(jV,e)}),refetchInterval:e=>{let t=e.state.data;return!t||t.claude.status!==`ok`||t.codex.status!==`ok`?15e3:3e4},staleTime:1e4,refetchOnWindowFocus:!0}),a=nt({queryKey:[`authStatus`],queryFn:({signal:e})=>Y.authStatus(void 0,{signal:NV(jV,e)}),refetchInterval:12e4,staleTime:3e4,refetchOnWindowFocus:!0}),o=n=>{if(t.current)return;r(!0);let i=Promise.all([Y.quota({force:n===`claude`},{signal:NV(MV)}).then(t=>e.setQueryData([`quota`],t)),e.refetchQueries({queryKey:[`authStatus`]})]).then(()=>{}).catch(()=>{}).finally(()=>{t.current=null,r(!1)});t.current=i};return(0,L.jsxs)(`div`,{"data-quota-bar":!0,className:`flex shrink-0 items-center gap-3 ${PV}`,children:[(0,L.jsx)(zV,{backend:`claude`,quota:i.data?.claude,auth:a.data?.claude,email:a.data?.emails?.claude,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`claude`)}),(0,L.jsx)(zV,{backend:`codex`,quota:i.data?.codex,auth:a.data?.codex,email:a.data?.emails?.codex,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`codex`)})]})}function zV({backend:e,quota:t,auth:n,email:r,loading:i,fetching:a,onRecheck:o}){let s=qR[e];if(!LV(t,n,i))return null;let c=BV(100-HV(t.windows).usedPercent);return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(DV,{onOpenChange:e=>{e&&o()},children:[(0,L.jsx)(OV,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,"aria-label":`${s} quota: ${c}% remaining`,className:`flex items-center gap-1.5 min-w-0 rounded outline-none transition-opacity hover:opacity-80 focus-visible:ring-1 focus-visible:ring-border-strong`,children:[(0,L.jsx)(zz,{backend:e,className:FV[e]}),(0,L.jsxs)(`span`,{className:`tabular-nums ${UV(c)}`,children:[c,`%`]})]})}),(0,L.jsxs)(AV,{side:`bottom`,align:`start`,className:`w-[min(15rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,children:[(0,L.jsxs)(`div`,{className:`mb-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,L.jsx)(zz,{backend:e}),(0,L.jsx)(`span`,{children:s}),t?.planType&&(0,L.jsxs)(`span`,{className:`text-muted/70`,children:[`· `,WV(t.planType),` plan`]}),a&&(0,L.jsx)(Xm,{size:11,className:`animate-spin text-muted/60`,"aria-label":`Rechecking`})]}),r&&(0,L.jsx)(`div`,{"data-quota-account":!0,className:`truncate text-muted/70 select-text`,title:r,children:r})]}),(0,L.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[t.windows.map(e=>{let t=BV(100-e.usedPercent),n=GV(e);return(0,L.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`span`,{className:`text-muted/80`,children:e.label}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,L.jsxs)(`span`,{className:UV(t),children:[t,`% left`]}),n&&(0,L.jsxs)(`span`,{className:`text-muted/55`,children:[`resets `,n]})]})]},e.key)}),t.detail&&(0,L.jsx)(`li`,{className:`pt-1 text-muted/55`,children:t.detail})]})]})]})})}function BV(e){return Math.max(0,Math.min(100,Math.round(e)))}var VV=25;function HV(e){return e.find(e=>e.key===`5h`)??e.reduce((e,t)=>t.usedPercent>e.usedPercent?t:e)}function UV(e){return e<=8?`text-red-400`:e<=VV?`text-accent`:`text-fg/70`}function WV(e){return e&&e[0].toUpperCase()+e.slice(1)}function GV(e){if(!e.resetsAt)return null;let t=e.resetsAt*1e3,n=new Date(t);if(Number.isNaN(n.getTime()))return null;let r=t-Date.now();if(r<=0)return null;if(r<24*36e5){let e=n.getHours(),t=n.getMinutes(),r=e>=12?`pm`:`am`;return e=e%12||12,t===0?`${e}${r}`:`${e}:${String(t).padStart(2,`0`)}${r}`}return n.toLocaleDateString(void 0,{weekday:`short`})}var KV=`frizz:supervisor-status-wake`,qV=`frizz:reload-after-update-restart`,JV=`frizz:update-restart-from-version`;function YV(e,t){return t.version===e?{kind:`previous-kept`}:{kind:`successor-failed`,version:t.version}}function XV(e){if(e.kind===`previous-kept`)return{summary:`Frizz kept running the previous version`,detail:`Frizz kept running the previous version, and your threads are unaffected.`};let t=e.version?`Frizz ${e.version}`:`The new version of Frizz`;return{summary:`${t} failed to start`,detail:`${t} came up but could not start its board, and the previous version is gone. Restart Frizz from the terminal (npx frizz) and check its log for the reason.`}}function ZV(e){return e?.artifactDigest??e?.version??null}function QV(e,t){if(e===null||t?.state!==`ready`)return!1;let n=ZV(t);return n!==null&&n!==e}var $V=3*6e4,eH={silentSince:null,silentForMs:0,stalled:!1};function tH(e,t,n=$V){if(!t.restarting||t.answered)return eH;let r=e.silentSince??t.at,i=Math.max(0,t.at-r);return{silentSince:r,silentForMs:i,stalled:i>=n}}function nH(e,t){return e.ackedAt!==null&&t.requestedAt>=e.ackedAt}function rH(e,t){return e.attempt&&!(nH(e.attempt,t)&&iH(e.attempt,t))?e:{state:t.state,message:t.message??null,attempt:null}}function iH(e,t){if(t.state!==`ready`)return!0;let n=t.artifactDigest??t.version??null;return e.build!=null&&n!==null&&n!==e.build}function aH(e,t){return t.state===`ready`&&e.attempt===null}function oH(e){return e!==null}function sH(e){return e?.updateRestart===!0&&e.updateAvailable!==!1}function cH(e){return e?.dev===!0}async function lH(e=fetch){try{let t=await e(`/_frizz/control/status`,{headers:{"cache-control":`no-store`}});if(!t.ok||!t.headers.get(`content-type`)?.includes(`application/json`))return null;let n=await t.json();return n.protocol===1&&(n.state===`ready`||n.state===`restarting`||n.state===`failed`)?n:null}catch{return null}}async function uH(e,t){let n=await t(e,{method:`POST`,headers:{"cache-control":`no-store`}}),r;try{r=await n.json()}catch{}if(!n.headers.get(`content-type`)?.includes(`application/json`)||!r||r.protocol!==1||r.state!==`ready`&&r.state!==`restarting`&&r.state!==`failed`)throw Error(`Frizz restart controls are unavailable for this server`);if(!n.ok)throw Error(r.message??`Restart request failed (${n.status})`);if(r.state===`failed`)throw Error(r.message??`Frizz did not become ready`);return r}function dH(e=fetch){return uH(`/_frizz/control/restart`,e)}function fH(e=fetch){return uH(`/_frizz/control/update-restart`,e)}var pH=8e3,mH=500,hH=[`supervisorStatus`];function gH(e,t){return e===`restarting`||t?mH:pH}var _H=rt({queryKey:hH,queryFn:async()=>{let e=Date.now(),t=await lH();return t?{...t,requestedAt:e}:null},refetchInterval:e=>gH(e.state.data?.state,X.controlPlaneRestartAttempt!==null),staleTime:e=>gH(e.state.data?.state,X.controlPlaneRestartAttempt!==null)});function vH(){return nt(_H)}var yH=null;function bH(e){yH||(yH=e,window.addEventListener(KV,()=>{e.refetchQueries({queryKey:hH,exact:!0})}))}function xH(e,t){let n=e=>{let t=e&&/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e);return t?[Number(t[1]),Number(t[2])]:null},r=n(e),i=n(t);return r!==null&&i!==null&&(r[0]!==i[0]||r[1]!==i[1])}var SH=`Install the latest version of Frizz. Your running threads will not be affected.`,CH=`A newer version of Frizz is available. Your running threads will not be affected.`,wH=`Restart Frizz. Your running threads will not be affected.`,TH=`fixed left-3 right-3 top-12 z-50 w-auto text-left font-sans sm:absolute sm:right-auto sm:-left-[17px] sm:top-[calc(100%+0.65rem)]`,EH=`absolute -top-[7px] left-4 h-3 w-3 rotate-45 border-l border-t bg-elevated`,DH=`sm:w-[min(23rem,calc(100vw-1.5rem))]`,OH=`sm:w-[min(34rem,calc(100vw-1.5rem))]`,kH=`rounded-xl bg-elevated p-3.5 shadow-xl shadow-black/45`;function AH({open:e,update:t,version:n,updateVersion:r}){if(!e)return null;let i=t?`Update Frizz`:`Restart Frizz`,a=t?r:void 0;return(0,L.jsxs)(`div`,{id:`update-restart-popover`,role:`tooltip`,"aria-label":i,className:`${TH} ${DH} ${kH} border border-border-strong`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`${EH} border-border-strong`}),(0,L.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,L.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-fg/10 text-fg`,children:(0,L.jsx)(lh,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,L.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:i}),n&&(0,L.jsx)(`span`,{className:`font-mono text-[11px] leading-snug text-muted`,children:a?`${n} → ${a}`:n})]})]}),(0,L.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:t?a?CH:SH:wH})]})}var jH={kind:`previous-kept`};function MH({update:e,message:t,outcome:n=jH,onDismiss:r}){return(0,L.jsxs)(`div`,{role:`alert`,className:`${TH} ${OH} ${kH} border border-red-500/45`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`${EH} border-red-500/45`}),(0,L.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,L.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-red-500/15 text-red-300`,children:(0,L.jsx)(xh,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,L.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:e?`Update failed`:`Restart failed`}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:r,className:`-mr-1 ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong`,children:(0,L.jsx)(Ch,{"aria-hidden":`true`,size:14,strokeWidth:2.25})})]}),(0,L.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:XV(n).detail}),(0,L.jsx)(`pre`,{className:`relative mt-2.5 max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded-md border border-border bg-panel px-2.5 py-2 font-mono text-[11px] leading-relaxed text-fg/70`,children:t})]})}function NH({update:e,busy:t,version:n,updateVersion:r,onFocus:i,onBlur:a,onClick:o}){return(0,L.jsxs)(`button`,{type:`button`,"aria-describedby":`update-restart-popover`,"aria-label":e?`Update Frizz`:`Restart Frizz`,disabled:t,"aria-busy":t||void 0,className:`relative ${Fz}`,onFocus:i,onBlur:a,onClick:o,children:[(0,L.jsx)(lh,{size:14,"aria-hidden":`true`,className:t?`animate-spin`:void 0}),e&&!t&&xH(n,r)&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-[2px] top-[2px] h-[4px] w-[4px] rounded-full bg-accent`})]})}function PH(){let e=Zt(X),[t,n]=(0,I.useState)(!1),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(),[s,c]=(0,I.useState)(),l=(0,I.useRef)(null),u=(0,I.useRef)(null),d=vH().data??null,f=sH(d),p={version:d?.version,updateVersion:d?.updateVersion};if(!oH(d))return null;let m=l.current!==null&&e.controlPlaneState===`failed`,h=m?e.controlPlaneMessage??`Frizz did not become ready`:void 0,g=a??h,_=g&&g!==s?g:void 0,v=!a&&m&&l.current?YV(l.current.version,{version:d?.version}):jH,y=async()=>{if(r)return;l.current={version:d?.version},n(!1),i(!0),o(void 0),c(void 0);let e=`${window.location.pathname}${window.location.search}${window.location.hash}`;f&&(X.controlPlaneState=`restarting`,X.controlPlaneMessage=null,X.controlPlaneRestartAttempt={startedAt:Date.now(),ackedAt:null,build:ZV(d)});try{if(f?await fH():await dH(),f){sessionStorage.setItem(qV,e),l.current.version?sessionStorage.setItem(JV,l.current.version):sessionStorage.removeItem(JV);let t=X.controlPlaneRestartAttempt;t&&(X.controlPlaneRestartAttempt={...t,ackedAt:Date.now()}),window.dispatchEvent(new Event(KV)),i(!1)}else window.location.replace(e)}catch(e){f&&(X.controlPlaneRestartAttempt=null,X.controlPlaneState=`ready`,X.controlPlaneMessage=null);let t=e.message.slice(0,140);i(!1),o(t),Z(`${f?`Update & Restart`:`Restart Frizz`} failed`)}};return(0,L.jsxs)(`div`,{ref:u,className:`relative`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,L.jsx)(NH,{update:f,busy:r,version:p.version,updateVersion:p.updateVersion,onFocus:()=>n(!0),onBlur:()=>n(!1),onClick:()=>void y()}),_&&(0,L.jsx)(MH,{update:f,message:_,outcome:v,onDismiss:()=>c(_)}),(0,L.jsx)(AH,{open:t&&!_,update:f,version:p.version,updateVersion:p.updateVersion})]})}function FH(){return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`})}function IH({text:e,title:t,className:n}){return(0,L.jsx)(`span`,{dir:`rtl`,className:`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${n??``}`,title:t,children:(0,L.jsx)(`span`,{dir:`ltr`,className:`[unicode-bidi:isolate]`,children:e})})}function LH(){let e=qC(),t=gW(e),n=IV(),r=e?.githubRepo??null,i=t.state===`verified`?t.label:t.state===`local`?t.name:null,a=t.state===`verified`?`Project: ${t.label}`:t.state===`local`?`Project: ${t.name}; local repository with no git remote`:t.state===`loading`?`Project identity loading`:`Project identity unavailable`;return(0,L.jsxs)(`div`,{"data-status-row":!0,className:`mb-2.5 flex min-w-0 items-center gap-3 text-[12px]`,children:[(0,L.jsx)(Ab,{to:`/`,title:`All projects`,"aria-label":`All projects`,className:`${Fz} -ml-px`,children:(0,L.jsx)(Wm,{size:14,"aria-hidden":`true`})}),(0,L.jsx)(FH,{}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Settings`,title:`Settings`,className:Fz,onClick:()=>X.showSettings=!0,children:(0,L.jsx)(ph,{size:14,"aria-hidden":`true`})}),(0,L.jsx)(PH,{}),n&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(FH,{}),(0,L.jsx)(RV,{})]}),(0,L.jsx)(`span`,{className:`ml-auto flex min-w-0 items-center`,"data-project-identity-state":t.state,"aria-label":a,"aria-busy":t.state===`loading`||void 0,children:i&&r?(0,L.jsx)(`a`,{href:`https://github.com/${r}`,target:`_blank`,rel:`noopener`,title:`Open ${i} on GitHub`,"aria-label":`Open ${i} on GitHub`,className:`block min-w-0 rounded-sm font-semibold text-fg/90 underline-offset-2 outline-none transition-colors hover:text-fg hover:underline focus-visible:ring-1 focus-visible:ring-border-strong`,children:(0,L.jsx)(IH,{text:i})}):i?(0,L.jsx)(IH,{text:i,title:i,className:`font-semibold text-fg/90`}):(0,L.jsx)(`span`,{className:`identity-placeholder w-24`,"aria-hidden":`true`})})]})}var RH=qt({at:{}}),zH=12e3,BH=new Map;function VH(e,t=Date.now()){RH.at[e]=t;let n=BH.get(e);n!==void 0&&clearTimeout(n),BH.set(e,setTimeout(()=>{BH.delete(e),delete RH.at[e]},zH))}function HH(e){let t=BH.get(e);t!==void 0&&(clearTimeout(t),BH.delete(e)),delete RH.at[e]}function UH(e,t,n=Date.now()){if(t===void 0||n-t>12e3)return!1;let r=e.lastActivityAt?Date.parse(e.lastActivityAt):NaN;return!(Number.isFinite(r)&&r>t)}function WH(){return Zt(RH).at}function GH(e,t,n=Date.now()){return t===void 0||!UH(e,t,n)?e:{...e,runtime:`running`,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1,lastUserAt:new Date(t).toISOString()}}function KH(e){let t=WH();return(0,I.useMemo)(()=>e.map(e=>GH(e,t[e.id])),[e,t])}var qH=0;function JH(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(qH+=1,`browser-${Date.now()}-${qH}`)}function YH({optimistic:e,request:t,success:n,failure:r}){e(),t().then(()=>n?.(),e=>r(e instanceof Error?e:Error(String(e))))}var XH=new Map;function ZH(e,t){let n=(XH.get(e)??Promise.resolve()).then(t,t);return XH.set(e,n.then(()=>{},()=>{})),n}var QH=[300,800,1800,3500],$H=12e4,eU=e=>new Promise(t=>{setTimeout(t,e)});async function tU(e,t,n=eU){for(let r=0;;r++){try{await e()}catch(e){if(r>=QH.length||!ff(e))throw e;t(),await n(QH[r]);continue}t();return}}function nU(e,t,n,r,i,a=$H){let o=new AbortController,s=setTimeout(()=>o.abort(Error(`Frizz did not answer this send`)),a);return Y.followUp({slug:e,sessionId:Gp(X.board,e)?.sessionId??``,message:t,deliveryId:n,freshProcess:r,interrupt:i},{signal:o.signal}).finally(()=>clearTimeout(s))}function rU(e,t,n,r,i){return tU(()=>nU(e,t,n,r,i),()=>VH(e))}function iU(e,t,n,r={}){let i=n.trim();if(!i)return!1;let a=JH();return YH({optimistic:()=>{r.onOptimistic?.(),dw(e,t,i,{scrollToBottom:r.scrollToBottom,deliveryId:a}),VH(t),Y.markRead({slug:t}).catch(()=>{})},request:()=>ZH(t,()=>rU(t,i,a,r.freshProcess,r.interrupt)),success:()=>r.onSuccess?.(),failure:n=>{fw(e,t,i,a),HH(t),r.onRollback?.(),Z(r.failureToast?.(n.message)??`Steer failed — ${n.message.slice(0,160)}`)}}),!0}function aU(e){let t=Ve(),[n,r]=(0,I.useState)(0);return{submit:(0,I.useCallback)((n,i={})=>iU(t,e,n,{...i,onOptimistic:()=>{r(e=>e+1),i.onOptimistic?.()},onSuccess:()=>{r(e=>Math.max(0,e-1)),i.onSuccess?.()},onRollback:()=>{r(e=>Math.max(0,e-1)),i.onRollback?.()}}),[t,e]),pending:n>0}}function oU(e,t){return new Promise(n=>{iU(e,t,`Continue exactly where you left off.`,{onSuccess:()=>{Z(`Retrying…`),n()},onRollback:()=>n(),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||n()})}function sU(e){let t=/^([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*)#(\d+)$/.exec(e.trim());return t?`https://github.com/${t[1]}/${t[2]}/pull/${t[3]}`:null}var cU=`Waiting for an external update.`;function lU(e){let t=new Set;return e.flatMap(e=>{if(e.kind!==`pr`)return[];let n=e.value.trim();return!n||t.has(n)?[]:(t.add(n),[{ref:n,url:sU(n)}])})}function uU(e){let t=(e.body??``).split(/\n\s*\n/).map(e=>e.trim()).find(Boolean);return t?pU(dU(t.replace(/\s*\n\s*/g,` `))):null}function dU(e){if(e.length<=fU)return e;let t=e.slice(0,fU),n=t.lastIndexOf(` `);return`${(n>fU/2?t.slice(0,n):t).replace(/[.,;:]$/,``)}…`}var fU=240;function pU(e){let t=(e.split(/\s/,1)[0]??``).replace(/[.,:;]+$/,``);return/[^a-zA-Z]/.test(t)||/[A-Z]/.test(t.slice(1))||mU.has(t)?e:e.charAt(0).toUpperCase()+e.slice(1)}var mU=new Set([`npm`,`npx`,`pnpm`,`nub`,`nubx`,`gh`,`git`,`node`,`bun`,`tsc`,`vite`,`curl`,`ssh`]);function hU(e){return e&&_U(e)||null}var gU=new Set([...rl,`shells`,`agents`,`timers`,`prs`,`for`,`title`]);function _U(e){return e.split(`
200
200
  `).filter(e=>{let t=/^\s*([a-z][a-z-]*):/i.exec(e)?.[1]?.toLowerCase();return!(t&&gU.has(t))}).join(`
201
201
  `).trim()}function vU(e){let t=t=>e.filter(e=>e.kind===t&&e.value.trim()).length,n=[...lU(e).map(e=>e.ref),yU(t(`shell`),`background shell`,`background shells`),yU(t(`agent`),`sub-agent`,`sub-agents`),yU(t(`timer`),`timer`,`timers`)].filter(e=>e!==null);return n.length>0?`waiting on ${bU(n)}`:null}function yU(e,t,n){return e<=0?null:e===1?`a ${t}`:`${e} ${n}`}function bU(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function xU(e){let t=e.find(e=>e.kind===`pr`);return t?`PR ${t.value}`:null}var SU=qt({at:{}}),CU=12e3,wU=new Map;function TU(e,t=Date.now()){SU.at[e]=t;let n=wU.get(e);n!==void 0&&clearTimeout(n),wU.set(e,setTimeout(()=>{wU.delete(e),delete SU.at[e]},CU))}function EU(e){let t=wU.get(e);t!==void 0&&(clearTimeout(t),wU.delete(e)),delete SU.at[e]}function DU(){return Zt(SU).at}function OU(e,t,n=Date.now()){return t===void 0||n-t>12e3||e.state===`archived`?e:{...e,state:`archived`,archived:!0,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1}}function kU(e){let t=DU();return(0,I.useMemo)(()=>e.map(e=>OU(e,t[e.id])),[e,t])}var AU=.5;function jU(e,t,n=!1){let r=e.map(e=>({id:e.id,height:Math.max(0,e.bottom-e.top),visible:Math.min(e.bottom,t)-Math.max(e.top,0)})).filter(e=>e.visible>0);if(!r.length)return null;if(n)return r[r.length-1].id;let i=t*AU,a=r[0];for(let e of r)if(e.visible>a.visible&&(a=e),e.visible>=Math.min(i,e.height)&&e.visible>=a.visible)return e.id;return a.id}function MU(e,t,n,r){return!e||e.top<=r&&e.bottom>r?!0:Math.abs(t-n)>1}function NU(e,t,n,r,i=8){return n<e+i?n-e-i:r>t-i?r-t+i:0}var PU=`flex h-[19px] w-[19px] items-center justify-center rounded text-muted opacity-70 outline-none transition-[color,opacity] hover:bg-panel-2 hover:text-fg hover:opacity-100`,FU=`sticky top-0 self-start h-screen w-[clamp(272px,34vw,680px)] shrink-0 flex flex-col justify-center max-[800px]:static max-[800px]:h-auto max-[800px]:w-full max-[800px]:justify-start max-[800px]:pt-16`;function IU(){let e=Zt(X),t=kU(KH(YC(qC()?.threads??[]))),n=oE(t,Zt(yT).queueOrder),r=IT(zT(t)),i=e.sidebarCollapsed,a=n.active,o=n.snoozed,s=n.inactive,c=(0,I.useRef)(null),[l,u]=(0,I.useState)(null),d=(0,I.useRef)(null),f=(0,I.useCallback)(()=>{let e=[...document.querySelectorAll(`[data-queue-card][data-queue-leaving="false"]`)].map(e=>{let t=e.dataset.queueCard;if(!t)return null;let{top:n,bottom:r}=(e.querySelector(`[data-queue-card-root]`)??e).getBoundingClientRect();return{id:t,top:n,bottom:r}}).filter(e=>e!==null),t=d.current;if(t)if(MU(e.find(e=>e.id===t.id),window.scrollY,t.landedY,40))d.current=null;else{u(t.id);return}let n=Math.max(0,document.documentElement.scrollHeight-window.innerHeight),r=n>0&&window.scrollY>=n-1,i=jU(e,window.innerHeight,r);u(e=>e===i?e:i)},[]);(0,I.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(f)};t(),document.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,t);let n=document.getElementById(`workpane`),r=n?new ResizeObserver(t):null,i=n?new MutationObserver(t):null;return n&&r?.observe(n),n&&i?.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-queue-card`,`data-queue-leaving`,`style`,`class`]}),()=>{cancelAnimationFrame(e),document.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,t),r?.disconnect(),i?.disconnect()}},[f,e.view,e.drawers.length]),(0,I.useLayoutEffect)(()=>{let e=c.current;if(!e||!l||window.matchMedia(`(max-width: 800px)`).matches)return;let t=e.querySelector(`[data-sidebar-item="${CSS.escape(l)}"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=NU(n.top,n.bottom,r.top,r.bottom);Math.abs(i)>.5&&(e.scrollTop+=i)},[l]);let p=(0,I.useCallback)(e=>{d.current={id:e,landedY:sp(e)??window.scrollY},u(e)},[]);return(0,L.jsx)(`aside`,{className:FU,children:(0,L.jsxs)(`div`,{className:`flex max-h-[calc(100vh-32px)] min-h-0 min-w-0 w-full flex-col max-[800px]:max-h-none`,children:[(0,L.jsxs)(`div`,{className:`mb-5 shrink-0 px-0.5`,children:[(0,L.jsx)(LH,{}),(0,L.jsx)(Mz,{})]}),(0,L.jsxs)(`div`,{ref:c,"data-sidebar-rail":!0,className:`min-h-0 min-w-0 overflow-y-auto overflow-x-hidden max-[800px]:overflow-y-visible`,children:[n.pinned.length>0&&(0,L.jsxs)(`section`,{"aria-label":`Pinned`,children:[n.pinned.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(WU,{t:e,active:l===e.id,onQueueNavigate:p}),(0,L.jsx)(YU,{t:e})]},e.id)),a.length>0&&(0,L.jsx)(`hr`,{className:`my-3 border-border/50`})]}),a.length>0?(()=>{let{running:e,rested:t}=aE(a),n=e=>t=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(WU,{t,active:l===t.id,onQueueNavigate:p,restedAge:e}),(0,L.jsx)(YU,{t})]},t.id);return(0,L.jsxs)(L.Fragment,{children:[t.map(n(!0)),e.length>0&&t.length>0&&(0,L.jsx)(`hr`,{className:`my-3 border-border/50`}),e.map(n(!1))]})})():n.pinned.length===0?(0,L.jsx)(`div`,{className:`py-1 pl-5 pr-1.5 text-[11.5px] text-muted/50`,children:`No open threads`}):null,o.length>0&&(0,L.jsxs)(`section`,{"aria-label":`Snoozed`,children:[(0,L.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,L.jsx)(LU,{label:`Snoozed`,count:o.length,collapsed:i.snoozed,onToggle:()=>X.sidebarCollapsed.snoozed=!X.sidebarCollapsed.snoozed}),!i.snoozed&&o.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(WU,{t:e,active:l===e.id,onQueueNavigate:p}),(0,L.jsx)(YU,{t:e})]},e.id))]}),s.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,L.jsx)(LU,{label:`Done`,count:s.length,collapsed:i.inactive,onToggle:()=>X.sidebarCollapsed.inactive=!X.sidebarCollapsed.inactive}),!i.inactive&&(0,L.jsx)(BU,{threads:s,railRef:c,activeId:l,onQueueNavigate:p})]}),r.length>0&&(0,L.jsxs)(`section`,{"aria-label":`External`,children:[(0,L.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,L.jsx)(LU,{label:`External`,count:r.length,collapsed:i.external,onToggle:()=>X.sidebarCollapsed.external=!X.sidebarCollapsed.external}),!i.external&&r.map(e=>(0,L.jsx)(WU,{t:e,active:l===e.id,onQueueNavigate:p,restedAge:!0},e.id))]})]})]})})}function LU({label:e,count:t,collapsed:n,onToggle:r}){let i=(0,L.jsxs)(L.Fragment,{children:[r?(0,L.jsx)(ym,{size:11,className:`transition-transform ${n?``:`rotate-90`}`}):(0,L.jsx)(`span`,{className:`w-[11px] shrink-0`,"aria-hidden":!0}),(0,L.jsx)(`span`,{children:e}),(0,L.jsx)(`span`,{className:`ml-1.5 tabular-nums text-muted/60`,children:t})]}),a=`flex w-full items-center gap-1 px-1.5 py-1 text-[11px] uppercase tracking-wide text-muted/70`;return r?(0,L.jsx)(`button`,{onClick:r,className:`${a} transition-colors hover:text-fg`,children:i}):(0,L.jsx)(`div`,{className:a,children:i})}var RU=27,zU=8;function BU({threads:e,railRef:t,activeId:n,onQueueNavigate:r}){let i=(0,I.useRef)(null),[a,o]=(0,I.useState)(0),s=Yw({count:e.length,getScrollElement:()=>t.current,getItemKey:t=>e[t]?.id??t,estimateSize:()=>RU,overscan:zU,scrollMargin:a});return(0,I.useLayoutEffect)(()=>{let e=t.current,n=i.current;if(!e||!n)return;let r=()=>{let t=n.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;o(e=>Math.abs(e-t)<.5?e:t)};r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()}),(0,L.jsx)(`div`,{ref:i,"data-done-band":!0,className:`relative w-full`,style:{height:s.getTotalSize()},children:s.getVirtualItems().map(t=>{let i=e[t.index];return i?(0,L.jsxs)(`div`,{ref:s.measureElement,"data-index":t.index,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${t.start-a}px)`},children:[(0,L.jsx)(WU,{t:i,active:n===i.id,onQueueNavigate:r}),(0,L.jsx)(YU,{t:i})]},i.id):null})})}var VU=16,HU=12;function UU({title:e,children:t}){let n=e.trimEnd(),r=n.lastIndexOf(` `)+1,i=n.length-r<=VU?r:n.length-HU;return i>=n.length?(0,L.jsxs)(L.Fragment,{children:[e,t]}):(0,L.jsxs)(L.Fragment,{children:[n.slice(0,i),(0,L.jsxs)(`span`,{className:`whitespace-nowrap`,children:[n.slice(i),t]})]})}var WU=(0,I.memo)(function({t:e,legacy:t,active:n=!1,onQueueNavigate:r,restedAge:i=!1}){let a=!t&&e.foreign===!0,o=!t&&KT(e),s=!t&&eE(e)===`archived`,c=o||s,l=!t&&AT(e),u=!t&&tE(e),d=!t&&BT(e);return(0,L.jsxs)(`div`,{"data-sidebar-item":e.id,className:`group relative flex min-w-0 items-start rounded-md transition-[color,opacity] after:pointer-events-none after:absolute after:inset-0 after:rounded-md after:bg-white/[0.04] after:opacity-0 after:transition-opacity hover:after:opacity-100 ${t?`opacity-80`:c?`opacity-65 hover:opacity-90 focus-within:opacity-90`:``}`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,"data-sidebar-marker-rail":!0,className:`pointer-events-none absolute inset-y-0 left-0 w-5`,children:n&&(0,L.jsx)(`span`,{"data-sidebar-scroll-marker":!0,className:`absolute inset-y-0 left-1 w-[2px] rounded-full bg-accent`})}),(0,L.jsxs)(`button`,{onClick:()=>{if(e.needsYou&&Tp(e.id)){r?.(e.id);return}bp(e.id)},"aria-current":n?`location`:void 0,className:`min-w-0 flex-1 flex items-start gap-2 pb-1 pl-5 pr-1.5 pt-1 text-left`,children:[(0,L.jsx)(`span`,{className:`w-4 h-[19px] shrink-0 flex items-center justify-center`,children:(0,L.jsx)(eW,{t:e,legacy:t})}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 flex flex-col`,children:(0,L.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-3`,children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-[13px] leading-[19px] ${l?`text-fg/50`:c?`text-fg/75`:`text-fg/90`}`,children:(0,L.jsxs)(UU,{title:CT(e),children:[!t&&(0,L.jsx)(zz,{backend:e.backend,className:`ml-1`}),a&&(0,L.jsx)(`span`,{className:`petite-caps ml-1.5 inline-block rounded border border-border/60 px-1 align-[2px] text-[9.5px] leading-[14px] text-muted/55`,title:`Read-only — running in an external terminal`,children:`terminal`}),t&&(0,L.jsx)(XU,{status:e.archived?`archived`:e.status})]})}),i&&(0,L.jsx)(GU,{t:e,yieldsToRetry:!0}),d&&!i&&(0,L.jsx)(qU,{})]})})]}),t&&(0,L.jsx)(`div`,{className:`absolute right-1 top-1 hidden group-hover:flex items-stretch rounded-md bg-panel shadow-sm shadow-black/30`,children:(0,L.jsx)(JI,{slug:e.id,size:`sm`})}),!t&&(0,L.jsxs)(`div`,{className:`absolute right-1.5 top-1 hidden items-center gap-0.5 bg-bg group-hover:flex group-focus-within:flex before:pointer-events-none before:absolute before:inset-y-0 before:right-full before:w-3 before:bg-linear-to-r before:from-transparent before:to-bg`,children:[!a&&!d&&(0,L.jsx)(JU,{t:e,className:`-mr-0.5`}),(0,L.jsx)(aM,{slug:e.id,size:12,className:PU}),u&&(0,L.jsx)(KU,{slug:e.id}),!a&&d&&(0,L.jsx)(JU,{t:e})]})]})});function GU({t:e,yieldsToRetry:t}){let n=TE(),r=PT(e),i=fE(r,n);return!r||!i?null:(0,L.jsx)(`time`,{dateTime:r,"data-rail-rested-age":!0,title:lE(r,n)??void 0,"aria-label":`Rested ${lE(r,n)??i}`,className:`shrink-0 tabular-nums text-[10.5px] leading-[19px] text-muted/55 ${t?`transition-opacity group-hover:opacity-0 group-focus-within:opacity-0`:``}`,children:i})}function KU({slug:e}){let t=Ve(),[n,r]=(0,I.useState)(!1);return(0,L.jsx)(iM,{label:`Retry — resume this session where it left off`,children:(0,L.jsx)(`button`,{"data-sidebar-retry":e,"aria-label":`Retry exited session`,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:n=>{n.stopPropagation(),r(!0),oU(t,e).finally(()=>r(!1))},className:`${PU} disabled:opacity-50`,children:n?(0,L.jsx)(Xm,{size:13,className:`animate-spin`}):(0,L.jsx)(dh,{size:13})})})}function qU(){return(0,L.jsx)(`span`,{"aria-hidden":!0,"data-rail-pin-mark":!0,className:`-ml-1 flex h-[19px] w-[19px] shrink-0 items-center justify-center self-start text-muted opacity-55 transition-opacity group-hover:opacity-0 group-focus-within:opacity-0`,children:(0,L.jsx)(oh,{size:12,fill:`currentColor`})})}function JU({t:e,className:t=``}){let n=BT(e),[r,i]=(0,I.useState)(!1);return(0,L.jsx)(iM,{label:n?`Unpin — return this thread to the rail's bands`:`Pin — keep this thread at the very top`,children:(0,L.jsx)(`button`,{"data-sidebar-pin":e.id,"aria-label":n?`Unpin thread`:`Pin thread`,disabled:r,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),i(!0),Y.setThreadPinned({slug:e.id,sessionId:e.sessionId??``,pinned:!n}).catch(e=>Z(`${n?`Unpin`:`Pin`} failed: ${String(e instanceof Error?e.message:e).slice(0,80)}`)).finally(()=>i(!1))},className:`${PU} disabled:opacity-50 ${t}`,children:n?(0,L.jsx)(ah,{size:12,fill:`currentColor`}):(0,L.jsx)(oh,{size:12})})})}function YU({t:e}){let t=sD(e.subAgents??[],`rail`);return t.length===0?null:(0,L.jsx)(`div`,{className:`flex flex-col`,children:t.map(t=>(0,L.jsx)(uD,{kind:`AGENT`,label:t.label,state:t.state,density:`rail`,depth:t.depth,startedAt:t.startedAt,parentSlug:e.id,onOpen:()=>vp(e.id,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}),onDismiss:sM(e.id,t),title:t.subagentType?`[${t.subagentType}] ${t.label}`:t.label},t.id))})}function XU({status:e}){let t=e===`archived`?`Done`:e;return(0,L.jsx)(`span`,{className:`petite-caps ml-1.5 inline-block rounded border px-1 align-[2px] leading-[14px] text-[9.5px] ${ST[e]??`text-muted border-border`}`,children:t})}function ZU(e,t,n=null){return[[t,vU(e.lastFence?.kind===`awaiting`?e.lastFence.hints:[]),n].filter(e=>!!e).join(` — `),QU(e)].filter(e=>!!e).join(`
202
202
 
@@ -310,7 +310,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
310
310
  `).length>6?(0,L.jsxs)(`details`,{className:`rounded-md border border-border/70 bg-panel/60`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[11px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/50`,children:`Request message`}),(0,L.jsx)(`div`,{className:`max-h-52 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})]}):(0,L.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})}function XQ({url:e}){let t=kQ(e,location.href);return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[11px] font-medium text-fg`,children:`Open this page to continue`}),(0,L.jsx)(`code`,{className:`mt-1.5 block max-h-24 overflow-auto break-all rounded-md border border-border bg-bg/40 px-2.5 py-2 font-mono-keep text-[10.5px] text-fg/80`,children:e}),t?(0,L.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-border bg-panel px-2.5 py-1.5 text-[11px] font-medium text-fg hover:bg-panel-2`,children:[(0,L.jsx)(Mm,{"aria-hidden":`true`,size:12}),`Open page`]}):(0,L.jsx)(`div`,{role:`alert`,className:`mt-1.5 break-words text-[11px] text-red-300`,children:`This request did not provide a safe http(s) URL.`})]})}function ZQ({record:e}){return(0,L.jsxs)(`details`,{className:`mt-3 border-t border-border/50 pt-2 text-[10.5px] text-muted/70`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer w-fit outline-none hover:text-muted focus-visible:ring-1 focus-visible:ring-fg/50`,children:`Request details`}),(0,L.jsxs)(`dl`,{className:`mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[(0,L.jsx)(`dt`,{children:`Provider`}),(0,L.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:SQ(e.provider.kind)}),e.provider.name&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Reported name`}),(0,L.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.name})]}),e.provider.version&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Reported version`}),(0,L.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.version})]}),(0,L.jsx)(`dt`,{children:`Source`}),(0,L.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:CQ(e.source.kind)}),e.source.label&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Reported source`}),(0,L.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.source.label})]}),(0,L.jsx)(`dt`,{children:`Scope`}),(0,L.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:`This thread · this request`}),e.expiresAt&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Expires`}),(0,L.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.expiresAt})]})]})]})}function QQ({instanceId:e,fields:t,draft:n,setValue:r,errors:i,autoFocus:a}){let o=t.findIndex(e=>!e.secret);return(0,L.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:`Requested information`}),(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:t.map((t,s)=>(0,L.jsx)($Q,{instanceId:e,field:t,value:n[t.id],setValue:e=>r(t.id,e),error:i[t.id],autoFocus:a&&s===o},t.id))})]})}function $Q({instanceId:e,field:t,value:n,setValue:r,error:i,autoFocus:a}){let o=`${e}-${t.id}`,s=t.description?`${o}-description`:void 0,c=i?`${o}-error`:void 0,l=[s,c].filter(Boolean).join(` `)||void 0,u=(0,L.jsxs)(L.Fragment,{children:[t.label,t.required&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`ml-0.5 text-accent`,children:`*`})]}),d=`mt-1 w-full min-w-0 rounded-md border border-border bg-bg/45 px-2.5 py-2 text-[12px] text-fg outline-none focus:border-accent focus:ring-1 focus:ring-accent/40`,f;if(t.secret)f=(0,L.jsx)(`div`,{className:`mt-1 text-[11px] text-amber-100/70`,children:`Use the secure fallback below.`});else if(t.input===`multiline`)f=(0,L.jsx)(`textarea`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,rows:4,className:`${d} resize-y`});else if(t.input===`text`){let e=t.format===`email`?`email`:t.format===`uri`?`url`:t.format===`date`?`date`:`text`;f=(0,L.jsx)(`input`,{id:o,name:t.id,type:e,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,placeholder:t.format===`date-time`?`2026-07-13T12:00:00Z`:void 0,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d})}else if(t.input===`number`||t.input===`integer`)f=(0,L.jsx)(`input`,{id:o,name:t.id,type:`number`,step:t.input===`integer`?1:`any`,min:t.minimum,max:t.maximum,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d});else if(t.input===`boolean`)f=(0,L.jsxs)(`label`,{htmlFor:o,className:`mt-1 flex cursor-pointer items-center gap-2 rounded-md border border-border bg-bg/30 px-2.5 py-2 text-[12px] text-fg/85`,children:[(0,L.jsx)(`input`,{id:o,name:t.id,type:`checkbox`,checked:n===!0,onChange:e=>r(e.target.checked),"aria-describedby":l,autoFocus:a,className:`accent-[var(--color-accent)]`}),(0,L.jsx)(`span`,{children:u})]});else if(t.input===`select`)f=(0,L.jsxs)(`select`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d,children:[(0,L.jsx)(`option`,{value:``,children:`Choose an option…`}),t.options.map((e,t)=>(0,L.jsx)(`option`,{value:String(t),children:e.label},t))]});else if(t.input===`multi-select`){let e=Array.isArray(n)?n:[];f=(0,L.jsxs)(`fieldset`,{id:o,"aria-describedby":l,className:`mt-1 rounded-md border border-border bg-bg/30 px-2.5 py-2`,children:[(0,L.jsx)(`legend`,{className:`px-1 text-[11px] font-medium text-fg/85`,children:u}),(0,L.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.options.map((n,i)=>{let o=String(i);return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[12px] text-fg/85`,children:[(0,L.jsx)(`input`,{type:`checkbox`,name:t.id,value:o,checked:e.includes(o),onChange:t=>r(t.target.checked?[...e,o]:e.filter(e=>e!==o)),autoFocus:a&&i===0,className:`mt-0.5 accent-[var(--color-accent)]`}),(0,L.jsx)(`span`,{children:n.label})]},o)})})]})}return(0,L.jsxs)(`div`,{className:`min-w-0`,children:[t.secret?(0,L.jsx)(`div`,{className:`text-[11px] font-medium text-fg/85`,children:u}):t.input!==`boolean`&&t.input!==`multi-select`?(0,L.jsx)(`label`,{htmlFor:o,className:`block text-[11px] font-medium text-fg/85`,children:u}):null,t.description&&(0,L.jsx)(`div`,{id:s,className:`mt-0.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-muted`,children:t.description}),f,i&&(0,L.jsx)(`div`,{id:c,role:`alert`,className:`mt-1 text-[10.5px] text-red-300`,children:i})]})}function e$(e){let t=e,n=``;do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return`${n}.`}function t$(e,t){let n=t.description?.trim(),r=n&&!n.includes(`
311
311
  `)?n:void 0,i=[r?void 0:n,t.preview?.trim()].filter(Boolean).join(`
312
312
 
313
- `)||void 0;return{line:`${e$(e)} ${t.label}${r?` — ${r}`:``}`,...i?{body:i}:{}}}var n$=`root`;function r$(e,t,n){return`${e}/${t}.${n}`}function i$(e){let t=e.options??[],n=t.findIndex(e=>e.recommended),r=t.map((e,t)=>t$(t,e));return{question:{kind:e.kind,danger:e.danger===!0,contextMd:e.question,options:r.map(e=>e.line),recommendedIdx:n===-1?null:n,...r.some(e=>e.body)?{optionBodies:r.map(e=>e.body)}:{}},optionLabels:t.map(e=>e.label)}}function a$(e,t){return!t||e.kind===`multi`?null:t.chosen}function o$(e,t){let n=[],r=(e,i,a)=>{let{question:o,optionLabels:s}=i$(e);n.push({path:i,spec:e,question:o,optionLabels:s,depth:a});let c=a$(e,t.get(i));c!==null&&(e.options?.[c]?.followUps??[]).forEach((e,t)=>r(e,r$(i,c,t),a+1))};return r(e,n$,1),n}function s$(e,t){return t?t.text.trim()?!0:e.kind===`multi`?(t.chosenSet??[]).length>0:t.chosen!==null:!1}function c$(e,t){if(!s$(e.spec,t.get(`root`)))return;let n=(r,i)=>{let a=t.get(i),o=(r.options??[]).map(e=>e.label),s=a$(r,a),c=r.kind===`multi`?(a?.chosenSet??[]).slice().sort((e,t)=>e-t).flatMap(e=>o[e]===void 0?[]:[o[e]]):s===null?[]:[o[s]].filter(e=>e!==void 0),l=r.kind===`multi`||s===null?a?.text.trim():void 0,u=s===null?[]:(r.options?.[s]?.followUps??[]).map((e,t)=>n(e,r$(i,s,t)));return{questionId:e.id,question:r.question,chosen:c,...l?{text:l}:{},...u.length>0?{followUps:u}:{}}};return n(e.spec,n$)}function l$(e){let t=e instanceof Error?e.message:`The answer could not be sent.`;return t.length>240?`${t.slice(0,239)}…`:t}var u$=(e,t)=>`${e}|${t}`,d$=(0,I.createContext)(null);function f$(e){let t=e?.id,n=e?.questions??[],r=Oz(),[i,a]=(0,I.useState)(()=>new Map),[o,s]=(0,I.useState)(),c=(0,I.useContext)(A0),l=jz((0,I.useMemo)(()=>t?n.flatMap(e=>g$(e).map(n=>Dz.question(r,t,e.id,n))):[],[r,t,n])),u=(e,n)=>{let a=i.get(u$(e.id,n));return{chosen:a?.chosen??null,chosenSet:a?.chosenSet??[],text:(t?l.get(Dz.question(r,t,e.id,n)):void 0)??``}},d=e=>new Map(g$(e).map(t=>[t,u(e,t)])),f=n.flatMap(e=>{let t=c$(e,d(e));return t?[t]:[]}),p=it({mutationFn:async e=>Y.answerQuestions({slug:t,answers:e}),onSuccess:e=>{for(let i of e.answered){a(e=>{let t=new Map(e);for(let e of[...t.keys()])e.startsWith(`${i}|`)&&t.delete(e);return t});let e=n.find(e=>e.id===i);if(e&&t)for(let n of g$(e))Tz.set(Dz.question(r,t,e.id,n),``)}},onError:e=>{c?.cancel(),s(l$(e))}}),m=it({mutationFn:async e=>Y.dismissQuestions({slug:t,ids:[e]}),onError:e=>s(l$(e))});return{slug:t,answerFor:u,answersOf:d,onChip:(e,t,n,r)=>{a(i=>{let a=new Map(i),o=u$(e.id,t),s=a.get(o)??{chosen:null,chosenSet:[]};if(n){let e=s.chosenSet.includes(r)?s.chosenSet.filter(e=>e!==r):[...s.chosenSet,r];a.set(o,{...s,chosenSet:e})}else a.set(o,{...s,chosen:s.chosen===r?null:r});return a})},onText:(e,n,i,o)=>{t&&(Tz.set(Dz.question(r,t,e.id,n),o),i||a(t=>{let r=u$(e.id,n),i=t.get(r);return!i||i.chosen===null?t:new Map(t).set(r,{...i,chosen:null})}))},dismiss:e=>m.mutate(e),dismissing:m.isPending,submit:()=>{!t||f.length===0||p.isPending||(s(void 0),c?.dismiss(),p.mutate(f))},staged:f.length,sending:p.isPending,error:o}}function p$({thread:e,children:t}){let n=f$(e);return(0,L.jsx)(d$.Provider,{value:n,children:t})}function m$({q:e,answering:t}){let n=(0,I.useContext)(d$),r=t??n;if(!r||!r.slug)return null;let i=o$(e.spec,r.answersOf(e)),a=t=>(0,L.jsx)(oX,{question:t.question,label:t.depth>1?`Follow-up`:void 0,aside:t.depth===1&&!e.spec.danger?(0,L.jsx)(`button`,{type:`button`,"data-dismiss-question":!0,"aria-label":`Dismiss this question`,title:`Dismiss — the worker decides it itself`,disabled:r.dismissing,onClick:()=>r.dismiss(e.id),className:`card-icon-offset -mx-2 -my-1 flex rounded-md p-1 text-muted/70 outline-none transition-colors hover:bg-elevated hover:text-fg disabled:opacity-40`,children:(0,L.jsx)(Ch,{size:16})}):void 0,interactive:{answer:r.answerFor(e,t.path),onChip:n=>r.onChip(e,t.path,t.spec.kind===`multi`,n),onText:n=>r.onText(e,t.path,t.spec.kind===`multi`,n),onSubmit:r.submit}},t.path),o=i.slice(1);return(0,L.jsxs)(`article`,{"data-question-id":e.id,className:`flex min-w-0 flex-col gap-2`,children:[a(i[0]),o.length>0&&(0,L.jsx)(`div`,{className:`ml-3 flex flex-col gap-2 border-l border-border pl-3`,children:o.map(e=>(0,L.jsx)(`div`,{className:e.depth>2?`ml-3 border-l border-border pl-3`:void 0,children:a(e)},e.path))})]})}function h$({thread:e,questions:t,inFlight:n=null,showSend:r=!1,className:i=``}){let a=e?.id,o=t??e?.questions??[],s=(0,I.useContext)(d$),c=f$(s?void 0:e),l=s??c;return!a||o.length===0&&!r?!a||!n?.length?null:(0,L.jsx)(`section`,{"data-answers-in-flight":!0,"aria-label":`Your answer, on its way to the worker`,className:`flex min-w-0 flex-col items-end ${i}`,children:(0,L.jsx)(JY,{answers:n,queued:!0})}):(0,L.jsxs)(`section`,{"data-registered-questions":!0,"aria-label":o.length>0?`${o.length} question${o.length===1?``:`s`} waiting for an answer`:`Send the answers above`,className:`flex min-w-0 flex-col gap-3 ${i}`,children:[o.map(e=>(0,L.jsx)(m$,{q:e,answering:l},e.id)),l.error&&(0,L.jsx)(`div`,{role:`alert`,className:`break-words text-[11px] leading-snug text-red-300`,children:l.error}),l.sending&&(0,L.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[11px] leading-snug text-muted`,children:`Sending…`}),(0,L.jsx)(`div`,{className:`flex justify-start`,children:(0,L.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:l.staged===0||l.sending,onClick:l.submit,onMouseDown:e=>e.preventDefault(),className:`rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:`Send answers`})})]})}function g$(e){let t=[],n=(e,r)=>{t.push(r),e.options?.forEach((e,t)=>{e.followUps?.forEach((e,i)=>n(e,`${r}/${t}.${i}`))})};return n(e.spec,n$),t}function _$(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function v$(e,t={}){let n=(e.subAgents??[]).filter(e=>Xc(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:_$(e),a=[n>0?`${n} sub-agent${n===1?``:`s`}`:null,r>0?`${r} background shell${r===1?``:`s`}`:null,i>0?`${i} PR watcher${i===1?``:`s`}`:null].filter(e=>e!==null);return a.length===0?`0 background shells`:a.length===1?a[0]:`${a.slice(0,-1).join(`, `)} and ${a[a.length-1]}`}function y$(e){return(e.subAgents??[]).some(e=>Xc(e)&&e.state===`running`)}function b$(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function x$(e){return y$(e)||b$(e)>0}function S$(e,t){return ul(t)??(C$(e)?`Background shells running`:`Awaiting`)}function C$(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!y$(e)&&_$(e)===0&&w$(e).length===0}function w$(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}var T$={id:``,subAgents:[],bgShells:[],watches:[]},E$=[];function D$(e,t){let n=new Set((e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).map(e=>e.target));return lU(t).filter(e=>!n.has(e.ref))}function O$({watch:e}){return(0,I.useEffect)(()=>{e.url&&jf([e.ref])},[e.url,e.ref]),e.url?(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,"data-gh-ref":e.ref,className:`${BJ} text-[12px]`,children:e.ref}):(0,L.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.ref})}var k$={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function A$(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:k$[e.merge]}var j$=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function M$({tone:e}){return(0,L.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${j$}`})}function N$(){return(0,L.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 16 16`,width:12,height:12,fill:`none`,stroke:`currentColor`,overflow:`visible`,className:j$,style:{color:UE.fgAttention},children:[(0,L.jsx)(`circle`,{cx:`8`,cy:`8`,r:`4`,fill:`currentColor`,stroke:`none`}),(0,L.jsxs)(`g`,{strokeWidth:`2`,className:`origin-center motion-safe:animate-spin`,children:[(0,L.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`,opacity:`0.25`}),(0,L.jsx)(`path`,{d:`M15 8A7 7 0 0 1 8 15`})]})]})}function P$({status:e}){return e?e.state===`merged`?(0,L.jsx)(Rm,{size:12,className:j$,style:{color:UE.fgDone}}):e.state===`closed`?(0,L.jsx)(zm,{size:12,className:j$,style:{color:UE.fgDanger}}):e.checks===`failing`?(0,L.jsx)(Om,{size:12,className:j$,style:{color:UE.fgDanger}}):e.checks===`passing`?(0,L.jsx)(Cm,{size:12,className:j$,style:{color:UE.fgSuccess}}):e.gated>0&&e.running===0?(0,L.jsx)(Sm,{size:12,className:j$,style:{color:UE.fgAttention}}):e.checks===`running`?(0,L.jsx)(N$,{}):(0,L.jsx)(wm,{size:12,className:`${j$} text-muted/60`}):(0,L.jsx)(wm,{size:12,className:`${j$} text-muted/60`})}function F$(e){return[e.failed>0?`${e.failed} failing`:null,e.gated>0?`${e.gated} awaiting approval`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null,e.skipped>0?`${e.skipped} skipped`:null].filter(e=>e!==null).join(`, `)}function I$(e){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let t=F$(e),n=A$(e);return[t||`No checks`,n].filter(e=>e!==null).join(` · `)}var L$=`group relative col-span-4 grid grid-cols-subgrid items-baseline rounded-sm text-[12px] leading-5`,R$=`group relative col-span-4 flex items-baseline rounded-sm text-[12px] leading-5`,z$=`ml-1.5 min-w-0 truncate font-medium text-fg/90`,B$=`ml-3 min-w-0 truncate text-right text-muted/70`,V$=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function H$(){return(0,L.jsx)(ym,{size:13,"aria-hidden":!0,className:`${j$} ml-[3px] -mr-[4px] text-muted/35 transition-colors group-hover:text-muted/70`})}function U$({mark:e,name:t,status:n,onOpen:r,onPrewarm:i,href:a,ghRef:o,title:s,testKind:c,testId:l,indent:u}){let d=u!==void 0,f=d?`${z$} flex-1`:z$,p=a?(0,L.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer noopener`,title:s,"data-gh-ref":o,onMouseDown:e=>e.stopPropagation(),className:`${f} ${V$} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,L.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),title:s,className:`${f} ${V$} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,L.jsx)(`span`,{className:f,title:s,children:t}),m=!!(a||r);return(0,L.jsxs)(`div`,{"data-wait-row":l,"data-wait-kind":c,onMouseEnter:i,onFocus:i,style:d?{paddingLeft:u}:void 0,className:`${d?R$:L$} ${m?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,L.jsx)(`span`,{className:`flex shrink-0`,children:e}),p,(0,L.jsx)(`span`,{"data-wait-status":!0,className:B$,children:n}),m?(0,L.jsx)(H$,{}):(0,L.jsx)(`span`,{})]})}function W$({watch:e}){let t=e.github,n=sU(e.target);return(0,I.useEffect)(()=>{n&&jf([e.target])},[n,e.target]),(0,L.jsx)(U$,{testKind:`github`,testId:e.target,mark:(0,L.jsx)(P$,{status:t}),name:e.target,href:n??void 0,ghRef:n?e.target:void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:(0,L.jsxs)(L.Fragment,{children:[I$(t),t&&t.failing.length>0&&n&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,onMouseDown:e=>e.stopPropagation(),className:`relative underline underline-offset-2 text-[#f85149]/85 decoration-[#f85149]/30 hover:decoration-[#f85149]`,children:`view failures`})]})]})})}function G$(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function K$(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function q$({watch:e,thread:t,slug:n,now:r}){let i=G$(t,e.target);if(i)return(0,L.jsx)(J$,{shell:i,slug:n,now:r,testId:e.target});let a=RE(e.createdAt,r);return(0,L.jsx)(U$,{testKind:`shell`,testId:e.target,mark:(0,L.jsx)(vh,{size:12,className:`${j$} text-shell`}),name:e.target,title:e.target,status:a?`running · ${a}`:`running`})}function J$({shell:e,slug:t,now:n,testId:r}){let i=RE(e.startedAt,n),a=e.id&&!e.outputUnavailable;return(0,L.jsx)(U$,{testKind:`shell`,testId:r??e.id??e.label,mark:(0,L.jsx)(vh,{size:12,className:`${j$} text-shell`}),name:e.label,onOpen:a?()=>yp(t,e.id,{label:e.label,startedAt:e.startedAt}):void 0,title:a?`Read this shell's output — running for ${i}`:e.label,status:i?`running · ${i}`:`running`})}function Y$({watch:e,now:t}){let n=Date.parse(e.timer?.fireAt??``),r=Number.isFinite(n)?n>t?`fires in ${IE(n-t)}`:`firing…`:`armed`;return(0,L.jsx)(U$,{testKind:`timer`,testId:e.target,mark:(0,L.jsx)(km,{size:12,className:`${j$} text-muted/60`}),name:e.timer?.prompt||e.target,title:e.timer?.fireAt?`One-off timer, set for ${e.timer.fireAt}`:e.target,status:r})}function X$(e){return(e.subAgents??[]).filter(e=>Xc(e)&&e.state===`running`)}function Z$({agent:e,slug:t,now:n}){let r=RE(e.startedAt,n),i=e.subagentType?.replace(/^frizz:/,``);return(0,L.jsx)(U$,{testKind:`agent`,testId:e.id??e.label,mark:(0,L.jsx)(M$,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>vp(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent — working for ${r}`:e.label,status:[i,r].filter(Boolean).join(` · `)})}function Q$(e,t,n){let r=new Set(n.map(e=>e.target)),i=[];for(let n of t){if(n.kind!==`shell`)continue;let t=n.value.trim();if(!t||r.has(t))continue;let a=G$(e,t);!a||a.state!==`running`||(r.add(t),i.push({id:`shell:${e.id}:${t}`,kind:`shell`,target:t,state:`armed`,createdAt:a.startedAt}))}return i}function $$(e,t={}){let n=Date.parse(t.notAfter??``),r=e=>!Number.isFinite(n)||!e||!(Date.parse(e)>n),i=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`&&r(e.createdAt)),a=K$(e).filter(t=>r(G$(e,t.target)?.startedAt??t.createdAt));return{prs:i,shells:[...a,...Q$(e,t.hints??[],a)],agents:X$(e).filter(e=>r(e.startedAt)),timers:w$(e).filter(e=>r(e.createdAt))}}function e1(e,t={}){let n=$$(e,t);return n.prs.length+n.shells.length+n.agents.length+n.timers.length>0}function t1(e,t,n={}){let{prs:r,shells:i,agents:a,timers:o}=$$(e,n);return[{head:`Sub-agents`,rows:a.map(n=>(0,L.jsx)(Z$,{agent:n,slug:e.id,now:t},n.id??n.label))},{head:`Background shells`,rows:i.map(n=>(0,L.jsx)(q$,{watch:n,thread:e,slug:e.id,now:t},n.id))},{head:`Pull requests`,rows:r.map(e=>(0,L.jsx)(W$,{watch:e},e.id))},{head:`Timers`,rows:o.map(e=>(0,L.jsx)(Y$,{watch:e,now:t},e.id))}].filter(e=>e.rows.length>0)}function n1({group:e,first:t}){let n=`col-span-4 text-[10.5px] uppercase tracking-wide text-muted/45 ${t?``:`mt-2.5`}`;return e.onToggle?(0,L.jsxs)(`button`,{type:`button`,onClick:e.onToggle,"aria-expanded":!e.collapsed,onMouseDown:e=>e.stopPropagation(),className:`${n} flex items-baseline rounded-sm text-left transition-colors hover:text-muted/80`,children:[(0,L.jsx)(`span`,{children:e.head}),e.count!==void 0&&(0,L.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.count}),(0,L.jsx)(ym,{size:10,"aria-hidden":!0,className:`${j$} ml-[5px] transition-transform ${e.collapsed?``:`rotate-90`}`})]}):(0,L.jsx)(`div`,{className:n,children:e.head})}function r1({groups:e,divider:t}){return e.length===0?null:(0,L.jsxs)(L.Fragment,{children:[t&&(0,L.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),(0,L.jsx)(`div`,{className:`mt-3 grid grid-cols-[auto_1fr_fit-content(50%)_auto] gap-y-px`,children:e.map((e,t)=>(0,L.jsxs)(I.Fragment,{children:[(0,L.jsx)(n1,{group:e,first:t===0}),!e.collapsed&&e.rows]},e.head))})]})}function i1(e){return e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}var a1=`Hides card until new activity is detected`;function o1({thread:e,onSnooze:t,onSnoozeFailed:n}){let[r,i]=(0,I.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{i(!0),t?.(),Y.snoozeAwaitingBackground({slug:e.id,sessionId:e.sessionId??``}).then(()=>Z(`Snoozed until the background work returns`)).catch(e=>{n?.(),Z(`Couldn’t snooze: ${e.message.slice(0,80)}`),i(!1)})},disabled:r,onMouseDown:e=>e.preventDefault(),title:a1,className:`disabled:opacity-45 ${VJ}`,children:[(0,L.jsx)(Um,{size:12,className:CX}),`Snooze`]}),(0,L.jsx)(`span`,{className:zJ,children:a1})]})}function s1({thread:e,fence:t,onSnooze:n,onSnoozeFailed:r,notAfter:i}){let a=e??T$,o=t??(e?.lastFence?.kind===`awaiting`?e.lastFence:void 0),s=o?.hints??E$,c=y$(a),l=hU(o?.body),u=XK(l??``),d=t1(a,TE(),{hints:s,notAfter:i}),f=D$(a,s),p=i===void 0&&e!==void 0&&i1(e)&&aZ(e).snooze;return(0,L.jsxs)(IJ,{"data-awaiting-background":!0,icon:C$(a)?vh:Um,label:(0,L.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:S$(a,s)}),aside:f.length===1?(0,L.jsx)(O$,{watch:f[0]}):void 0,className:p?`pb-0`:``,children:[l?(0,L.jsx)(Yq,{className:`md-body ${OJ}`,html:u}):d.length===0&&!x$(a)?(0,L.jsx)(`p`,{className:LJ,children:cU}):null,f.length>1&&(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:f.map(e=>(0,L.jsx)(O$,{watch:e},e.ref))}),d.length===0&&x$(a)&&(0,L.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:c?(0,L.jsxs)(L.Fragment,{children:[`It’s awaiting the results from `,v$(a,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,L.jsxs)(L.Fragment,{children:[v$(a,{watchers:!1}),` `,b$(a)===1?`is`:`are`,` still running. It resumes on its own when`,` `,b$(a)===1?`it finishes`:`one of them finishes`,`.`]})}),(0,L.jsx)(r1,{groups:d,divider:!!l}),p?(0,L.jsx)(`div`,{"data-awaiting-snooze":!0,className:`-mx-4 mt-3 flex flex-wrap items-center gap-x-2.5 gap-y-2 border-t border-border bg-fg/[0.03] px-4 py-2.5 ${jJ}`,children:(0,L.jsx)(o1,{thread:e,onSnooze:n,onSnoozeFailed:r})}):null]})}function c1(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.kind!==`event`||n.boundary!==`rest`)){for(let r=t-1;r>=0;r--){let t=e[r];if(t.role===`assistant`&&t.kind!==`event`&&t.kind!==`reasoning`)return{index:r,at:n.at}}return{index:-1,at:n.at}}}}function l1(e,t=Date.now()){return e!==void 0&&GT(e,t)!==void 0}function u1(){let[e,t]=(0,I.useState)(()=>Date.now());return(0,I.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function d1({thread:e}){let t=u1(),[n,r]=(0,I.useState)(!1),i=GT(e,t);if(!i)return null;let a=Date.parse(i),o=cT(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await Y.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),Z(`Snooze cleared`)}catch(e){Z((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,L.jsxs)(IJ,{"data-snooze-card":!0,icon:Um,label:`Snoozed`,children:[(0,L.jsx)(`div`,{"data-snooze-countdown":!0,title:new Date(a).toLocaleString(),className:`text-[22px] font-semibold leading-8 tracking-tight text-fg tabular-nums`,children:BE(a-t)}),(0,L.jsx)(`p`,{className:LJ,children:s?(0,L.jsxs)(L.Fragment,{children:[`Resumes `,o,` and sends: “`,fT(s),`”`]}):(0,L.jsxs)(L.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,L.jsx)(RJ,{children:(0,L.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${VJ} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}function f1({at:e,fallbackAt:t,className:n=``}){let r=TE(),i=sE(e,t),a=cE(i,r);return!a||!i?null:(0,L.jsx)(`time`,{dateTime:i,className:n,children:a})}var p1=1500;function m1(e,t){let n=0,r;function i(){r!==void 0&&(t.clearTimeout(r),r=void 0)}return{begin(){let a=++n;return e(!0),i(),r=t.setTimeout(()=>{a===n&&e(!1),r=void 0},p1),a},fail(t){t===n&&(i(),e(!1))},dispose(){n++,i()}}}var h1=`Could not copy terminal command`,g1={attach:`Attach command copied`,resume:`Resume command copied`},_1={attach:`Copy command to attach to this thread's live terminal`,resume:`Copy command to resume this thread in a new terminal`},v1=e=>[`terminalCommand`,e];function y1(e){return Y.threadTerminalCommand({slug:e}).then(e=>{if(!e.command)throw Error(e.reason??`No verified provider session is available to resume`);return{command:e.command,mode:e.mode===`attach`?`attach`:`resume`}})}async function b1(e){let t=y1(e);if(typeof ClipboardItem<`u`&&navigator.clipboard?.write)return await navigator.clipboard.write([new ClipboardItem({"text/plain":t.then(({command:e})=>new Blob([e],{type:`text/plain`}))})]),(await t).mode;let{command:n,mode:r}=await t;return await WR(n),r}function x1(e){let t=it({mutationFn:()=>b1(e)});return e=>t.mutate(void 0,{onSuccess:t=>{e?.onSuccess?.(),Z(g1[t])},onError:t=>{e?.onError?.(),Z(t instanceof Error?`${h1}: ${t.message}`:h1,{duration:7e3})}})}function S1({slug:e}){let[t,n]=(0,I.useState)(!1),r=(0,I.useRef)(null);r.current||=m1(n,{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let i=Ve(),a=x1(e);(0,I.useEffect)(()=>()=>r.current?.dispose(),[]);function o(){i.prefetchQuery({queryKey:v1(e),queryFn:()=>y1(e),staleTime:15e3})}function s(){let t=i.getQueryData(v1(e));if(t){WR(t.command).then(()=>{r.current?.begin(),Z(g1[t.mode])},()=>Z(h1,{duration:7e3}));return}a({onSuccess:()=>r.current?.begin()})}let c=i.getQueryData(v1(e)),l=t?c?g1[c.mode]:`Terminal command copied`:c?_1[c.mode]:`Copy terminal command`;return(0,L.jsx)(iM,{label:l,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":l,title:l,onClick:s,onPointerEnter:o,onFocus:o,className:xD,children:t?(0,L.jsx)(gm,{size:14,strokeWidth:2.2,className:`text-fg`}):(0,L.jsx)(vh,{size:14,strokeWidth:1.8})})})}function C1(e){let t=Math.max(e.scrollHeight-e.clientHeight,0),n=t-e.scrollTop,r=e.scrollHeight!==e.previousScrollHeight,i=r&&!e.readerMoved?e.following||n<=1:n<=4;return!i||!r||t<=0||n<=1?{following:i,scrollTop:null}:{following:i,scrollTop:t}}function w1(e){let t=e.scrollTop>640?!0:e.armed,n=t&&e.readerMoved&&e.scrollTop<=480&&e.hasEarlier&&!e.loading;return{armed:n?!1:t,shouldLoad:n}}function T1(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function E1(e,t,n){let r=[],i=new Map,a=null;return e.forEach((e,o)=>{if(e.queued||t(e))return;let s=e.sourceId??T1(e),c=i.get(s)??0;i.set(s,c+1),r.push({key:c===0?s:`${s}:${c}`,message:e,messageIndex:o,gap:a===null?0:n(a,e)}),a=e}),r}function D1(e,t,n){let r=e[t];if(!r||r.kind!==`event`||r.boundary!==`rest`)return!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(!(t.queued||n(t)))return!!t.boundary||t.wake===!0}return!0}function O1(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!D1(n,r,t))}var k1=new Set([`agent`,`follow up`,`interrupt`,`send message`,`spawn agent`,`wait for agents`]),A1=new Set([`poll process`,`wait`]);function j1(e){return(e.split(`__`).pop()||e).replaceAll(`_`,` `).trim()}function M1(e){return j1(e).toLowerCase()}function N1(e){return e.prompt!==void 0||e.agentId!==void 0||e.sendTo!==void 0||e.sendBody!==void 0||e.backgroundState!==void 0&&!I1(e)||F1(e)||P1(e)||k1.has(M1(e.name))}function P1(e){return e.ask!==void 0&&e.ask.length>0&&e.status!==void 0&&e.status!==`pending`}function F1(e){return e.outputImage!==void 0||e.sentImages!==void 0&&e.sentImages.length>0}function I1(e){return e.backgroundState===`unknown`&&A1.has(M1(e.name))}function L1(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(e.parts&&e.parts.length>0){let t=[];for(let n of e.parts)if(n.kind===`text`){if(n.text.trim())return null}else t.push(...n.tools);return t.length>0&&t.every(e=>!N1(e))?t:null}return e.text.trim()||e.tools.length===0?null:e.tools.every(e=>!N1(e))?e.tools:null}function R1(e){return e.role!==`assistant`||e.kind||e.queued||e.text.trim()||e.tools.length>0?!1:!e.parts?.some(e=>e.kind===`text`?e.text.trim().length>0:e.tools.length>0)}function z1(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(!e.parts?.length)return B1(e.tools);for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`text`){if(n.text.trim())return null;continue}if(n.tools.length!==0)return B1(n.tools)}return null}function B1(e){let t=[];for(let n=e.length-1;n>=0&&!N1(e[n]);n--)t.unshift(e[n]);return t.length>0?t:null}function V1(e){if(e.role!==`assistant`||e.kind||e.queued)return null;let t=[],n=e=>{for(let n of e){if(N1(n))return!0;t.push(n)}return!1};if(!e.parts?.length)return e.text.trim()?null:n(e.tools)&&t.length>0?t:null;for(let r of e.parts){if(r.kind===`text`){if(!r.text.trim())continue;return t.length>0?t:null}if(n(r.tools))return t.length>0?t:null}return null}function H1(e,t){return U1(e,new Set(t))}function U1(e,t){if(!e.parts?.length)return{...e,tools:e.tools.filter(e=>!t.has(e))};let n=e.parts.map(e=>e.kind===`text`?e:{kind:`tools`,tools:e.tools.filter(e=>!t.has(e))}).filter(e=>e.kind===`text`||e.tools.length>0);return{...e,tools:n.flatMap(e=>e.kind===`tools`?e.tools:[]),parts:n}}function W1(e,t,n){let r=[...e.tools,...t],i=e.parts?.map(e=>e.kind===`text`?e:{...e,tools:[...e.tools]})??[],a=-1;for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.kind===`text`){if(t.text.trim())break;continue}if(t.tools.length>0){a=e;break}}let o=i[a];return o?.kind===`tools`?i[a]={kind:`tools`,tools:[...o.tools,...t]}:i.push({kind:`tools`,tools:t}),{...e,at:n??e.at,tools:r,parts:i}}function G1(e){let t=[],n=null;return e.forEach((e,r)=>{if(R1(e))return;if(e.queued){t.push({message:e,messageIndex:r});return}let i=L1(e);if(i&&n){n.message=W1(n.message,i,e.at);return}let a=n?V1(e):null,o=a?H1(e,a):e;a&&n&&(n.message=W1(n.message,a,e.at));let s={message:o,messageIndex:r};t.push(s),z1(o)?(s.runStartedAt=o.at,n=s):n=null}),t}function K1(e){return e.status===`completed`||e.status===`failed`||e.status===`cancelled`}function q1(e){let t=J1(e);return t?.tools.some(e=>!K1(e))?t.tools.at(-1):void 0}function J1(e){let t=Y1(e);if(!t)return;let n=z1(t.message);return n?{tools:n,at:t.message.at}:void 0}function Y1(e){for(let t=e.length-1;t>=0;t--)if(!e[t].message.queued)return e[t]}function X1(e){let t=Y1(e);if(t)return z1(t.message)?t.runStartedAt??t.message.at:t.message.at}function Z1(e){return e.runStartedAt??e.message.at}function Q1(e){let t=z1(e);return t?U1(e,new Set(t)):e}function $1(e){let t;for(let n=e.length-1;n>=0;n--){let r=e[n].message;if(!r.queued){z1(r)&&(t=r);break}}if(!t)return[...e];let n=[];for(let r of e){let e=r.message===t?Q1(r.message):r.message;R1(e)||n.push(e===r.message?r:{...r,message:e})}return n}function e0(e){return e.detail?.trim()||void 0}var t0={add:`Adding`,analyze:`Analyzing`,apply:`Applying`,audit:`Auditing`,benchmark:`Benchmarking`,build:`Building`,bump:`Bumping`,capture:`Capturing`,check:`Checking`,clean:`Cleaning`,collect:`Collecting`,commit:`Committing`,compare:`Comparing`,confirm:`Confirming`,copy:`Copying`,count:`Counting`,create:`Creating`,debug:`Debugging`,delete:`Deleting`,diff:`Diffing`,disable:`Disabling`,dispatch:`Dispatching`,drive:`Driving`,dump:`Dumping`,edit:`Editing`,enable:`Enabling`,extract:`Extracting`,fetch:`Fetching`,find:`Finding`,fix:`Fixing`,format:`Formatting`,generate:`Generating`,grep:`Grepping`,inspect:`Inspecting`,install:`Installing`,kill:`Killing`,launch:`Launching`,lint:`Linting`,list:`Listing`,load:`Loading`,measure:`Measuring`,merge:`Merging`,migrate:`Migrating`,move:`Moving`,open:`Opening`,parse:`Parsing`,patch:`Patching`,poll:`Polling`,print:`Printing`,probe:`Probing`,profile:`Profiling`,publish:`Publishing`,pull:`Pulling`,push:`Pushing`,query:`Querying`,read:`Reading`,rebase:`Rebasing`,refactor:`Refactoring`,regenerate:`Regenerating`,remove:`Removing`,rename:`Renaming`,render:`Rendering`,reproduce:`Reproducing`,restart:`Restarting`,revert:`Reverting`,review:`Reviewing`,run:`Running`,save:`Saving`,scan:`Scanning`,search:`Searching`,seed:`Seeding`,spawn:`Spawning`,start:`Starting`,stop:`Stopping`,summarize:`Summarizing`,sync:`Syncing`,tag:`Tagging`,test:`Testing`,trace:`Tracing`,typecheck:`Typechecking`,update:`Updating`,validate:`Validating`,verify:`Verifying`,wait:`Waiting`,watch:`Watching`,write:`Writing`};function n0(e,t){let n=e?.trim();if(!n)return t;let r=n.indexOf(` `),i=(r===-1?n:n.slice(0,r)).replace(/[.:]$/,``);if(/ing$/i.test(i))return i.charAt(0).toUpperCase()+i.slice(1)+(r===-1?``:n.slice(r));let a=t0[i.toLowerCase()];return a?a+(r===-1?``:n.slice(r)):n.charAt(0).toUpperCase()+n.slice(1)}function r0(e,t,n){let r=t?.trim().replace(/[\\/]+$/,``);if(!r||!qf(r))return e;let i=tp(r);return i?rp(e.replace(i,``),n?.trim().replace(/[\\/]+$/,``)||/^([A-Za-z]:[\\/]Users[\\/][^\\/]+|\/(?:Users|home)\/[^/]+)(?=[\\/]|$)/.exec(r)?.[1]):e}function i0(e,t,n=Vf().home){return r0(a0(e),t,n)}function a0(e){let t=M1(e.name),n=e0(e),r=n?` ${n}`:``;return t===`bash`||t===`exec`||t===`run command`?n0(e.desc,n?`Running ${n}`:`Running a command`):t===`read`||t===`view image`?`Reading${r||` a file`}`:t===`grep`||t===`search`||t===`search query`||t===`find`?n?`Searching for ${n}`:`Searching`:t===`glob`||t===`find files`?n?`Finding ${n}`:`Finding files`:t===`edit`||t===`write`||t===`apply patch`?n?`Editing ${n}`:`Editing files`:t===`todos`||t===`update plan`?`Updating the plan`:t===`screenshot`||t===`snapshot`?n?`Capturing ${n}`:`Capturing the page`:t===`navigate`?n?`Navigating to ${n}`:`Navigating`:t===`evaluate`?`Evaluating the page`:t===`pages`?`Listing pages`:t===`new page`?`Opening a new page`:t===`close page`?`Closing the page`:t===`select page`?`Selecting a page`:t===`console`||t===`console message`?`Reading the console`:t===`network`||t===`network request`?`Inspecting network traffic`:t===`press key`?n?`Pressing ${n}`:`Pressing a key`:t===`fill form`?`Filling the form`:t===`dialog`?`Handling a dialog`:t===`upload`?n?`Uploading ${n}`:`Uploading a file`:t===`wait for`||t===`wait`?n?`Waiting for ${n}`:`Waiting`:t===`resize`?`Resizing the page`:t===`ask`?`Preparing a question`:t===`web`||t===`web search`?n?`Searching for ${n}`:`Searching the web`:`Using ${j1(e.name)||`a tool`}`}var o0=new Set([`edit`,`multiedit`,`write`,`apply patch`]);function s0(e){let t=new Set;for(let n of e){for(let e of n.edits??(n.edit?[n.edit]:[]))e.file.trim()&&t.add(e.file.trim());if(n.edit||n.edits?.length)continue;let e=n.detail?.trim();e&&o0.has(M1(n.name))&&t.add(e)}return t.size}function c0(e,t=0){let n=`Ran ${e} tool ${e===1?`call`:`calls`}`;return t===0?n:`${n}, edited ${t} file${t===1?``:`s`}`}function l0(e){return e>0?`${c0(e)}. Thinking…`:`Thinking…`}function u0(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function d0(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function f0(e,t){let n=u0(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function p0({directive:e,icon:t,title:n,meta:r,children:i}){return(0,L.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${kJ} border border-border bg-panel-2/75 p-4`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,L.jsx)(`div`,{className:`max-w-[calc(100%-1.5rem)] shrink-0 break-words text-[12px] font-medium leading-4 text-fg`,children:n}),r&&(0,L.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function m0({children:e,mono:t=!1}){return(0,L.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function h0({directive:e}){let t=e.attrs,n=u0(t,`display_name`)??u0(t,`skill_name`)??`Artifact template`,r=u0(t,`artifact_kind`),i=u0(t,`skill_name`),a=u0(t,`skill_directory`),[o,s]=(0,I.useState)(!!a);return(0,L.jsxs)(p0,{directive:e,icon:(0,L.jsx)(Jm,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,L.jsx)(m0,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,L.jsx)(`img`,{src:YS(`${a}/assets/preview.png`),alt:`${n} template preview`,loading:`lazy`,onError:()=>s(!1),className:`ml-6 mt-2 max-h-44 max-w-[calc(100%-1.5rem)] rounded-md border border-border object-contain`})]})}function g0({directive:e}){let t=e.attrs,n=u0(t,`file`),r=d0(t,`start`),i=d0(t,`end`)??r,a=d0(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,L.jsxs)(p0,{directive:e,icon:(0,L.jsx)($m,{size:15}),title:u0(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[u0(t,`body`)&&(0,L.jsx)(m0,{children:u0(t,`body`)}),n?(0,L.jsx)(`button`,{type:`button`,className:`local-file-action ml-6 mt-1 max-w-[calc(100%-1.5rem)] break-all text-left font-mono-keep text-[11px] leading-4 text-accent underline decoration-dotted underline-offset-2`,"data-local-path":n,title:o,children:o}):(0,L.jsx)(m0,{mono:!0,children:o})]})}var _0={"git-stage":[rh,`Changes staged`],"git-commit":[Lm,`Commit created`],"git-create-branch":[Im,`Branch created`],"git-push":[Sh,`Branch pushed`],"git-create-pr":[Vm,`Pull request created`]};function v0({directive:e}){let[t,n]=_0[e.name],r=u0(e.attrs,`branch`),i=f0(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,L.jsx)(p0,{directive:e,icon:(0,L.jsx)(t,{size:15}),title:i?(0,L.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,L.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function y0({directive:e}){let t=u0(e.attrs,`threadId`),n=u0(e.attrs,`pendingWorktreeId`);return(0,L.jsx)(p0,{directive:e,icon:(0,L.jsx)(nh,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,L.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function b0({directive:e}){let t=u0(e.attrs,`reason`);return(0,L.jsx)(p0,{directive:e,icon:(0,L.jsx)(um,{size:15}),title:`Archive suggested`,meta:t})}function x0(e){if(typeof e!=`string`||!e)return;let t=e.match(/(?:^|;)INTERVAL=(\d+)(?:;|$)/)?.[1];return/(?:^|;)FREQ=HOURLY(?:;|$)/.test(e)?`Every ${t??`1`} hour${t===`1`||t===void 0?``:`s`}`:/(?:^|;)FREQ=WEEKLY(?:;|$)/.test(e)?`Weekly schedule`:`Custom schedule`}function S0({directive:e}){let t=e.attrs,n=u0(t,`mode`),r=u0(t,`name`)??`Automation`,i=x0(t.rrule),a=[r,n,u0(t,`status`),i].filter(Boolean).join(` · `);return(0,L.jsx)(p0,{directive:e,icon:(0,L.jsx)(hm,{size:15}),title:`Automation suggested`,meta:a,children:u0(t,`prompt`)&&(0,L.jsx)(m0,{children:u0(t,`prompt`)})})}function C0({directive:e}){return e.name===`artifact-template`?(0,L.jsx)(h0,{directive:e}):e.name===`code-comment`?(0,L.jsx)(g0,{directive:e}):e.name.startsWith(`git-`)?(0,L.jsx)(v0,{directive:e}):e.name===`created-thread`?(0,L.jsx)(y0,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,L.jsx)(b0,{directive:e}):(0,L.jsx)(S0,{directive:e})}var w0;function T0(){return w0??=ib(async()=>{let{default:e}=await import(`./mermaid.core-kc8D7Mjc.js`);return{default:e}},__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`dark`,themeVariables:{background:`#181b20`,primaryColor:`#181b20`,primaryTextColor:`#e6e7e9`,primaryBorderColor:`#33363c`,lineColor:`#8b8f96`,secondaryColor:`#26282d`,tertiaryColor:`#0d0e10`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}),e)),w0}function E0({source:e}){let t=(0,I.useId)(),[n,r]=(0,I.useState)({}),i=Fq(n.html??``);return(0,I.useEffect)(()=>{let n=!0;if(r({}),e.length>5e4)return r({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{n=!1};let i=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}`;return T0().then(t=>t.render(i,e)).then(({svg:e})=>{n&&r({html:e})}).catch(e=>{if(!n)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;r({error:t.slice(0,240)})}).finally(()=>document.getElementById(`d${i}`)?.remove()),()=>{n=!1}},[t,e]),n.error?(0,L.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${kJ} border border-border bg-panel-2/75 p-4`,children:[(0,L.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,L.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:n.error}),(0,L.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap rounded-md bg-bg p-2 font-mono-keep text-[11px] text-muted`,children:e})]}):n.html?(0,L.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${kJ} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:i}):(0,L.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${kJ} bg-panel-2`})}var D0=(0,I.createContext)(null),O0=(0,I.createContext)(null);function k0(){let e=(0,I.useContext)(D0),t=(0,I.useContext)(O0);return e??t}var A0=(0,I.createContext)(null);function j0(e){return e.status===`pending`&&e.backgroundState===`background`}function M0(e){let t=[];for(let n of e)for(let e of n.tools)j0(e)&&n.at&&t.push({label:e.desc??e.detail??e.command??`Background command`,startedAt:n.at,state:`running`,...e.shellId?{launchId:e.shellId}:{},...e.command?{command:e.command}:{}});return t}function N0(e){return e.map(e=>{if(!e.tools.some(j0))return e;let t=e.tools.filter(e=>!j0(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!j0(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}function P0({slug:e,onStatusApplied:t,onClose:n,virtualized:r=!1,showReturnToQueue:i=!1}){let a=Gp(qC(),e);return(0,L.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,L.jsx)(K0,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:i}),(0,L.jsx)(F0,{slug:e,virtualized:r}),a&&(0,L.jsx)(MZ,{thread:a,sticky:!0,safeArea:!0,onArchived:t})]})}function F0({slug:e,virtualized:t}){let n=qC(),r=Gp(n,e),i=r?.runtime===`running`||r?.runtime===`spawning`,a=x1(e),o=sw(e,{poll:i}),s=Ve(),c=(0,I.useRef)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(null),p=(0,I.useMemo)(()=>o.data?.messages??[],[o.data]),m=(0,I.useMemo)(()=>M0(p),[p]),h=(0,I.useMemo)(()=>N0(p),[p]),g=(0,I.useMemo)(()=>o2(h),[h]),_=(0,I.useMemo)(()=>i?c1(h):void 0,[i,h]),v=_&&_.index>=0?_.index:g,y=(0,I.useMemo)(()=>G1(h),[h]),b=i?J1(y):void 0,x=i?q1(y):void 0,S=x?i0(x,n?.projectDir):void 0,C=i?X1(y):void 0,w=i1(r),T=(0,I.useMemo)(()=>{let e=i?$1(y):y;return O1(e,s2(e,v,w))},[y,i,v,w]),E=i,D=(0,I.useMemo)(()=>oY(p),[p]),O=(0,I.useMemo)(()=>tY(p,r?.answersInFlight),[p,r?.answersInFlight]),k=(0,I.useMemo)(()=>yX(p),[p]),A={thread:r,showWorking:E,registeredDone:DJ(r,g>=0?h[g]?.text:void 0),restedCard:HJ(r,g>=0?h[g]?.text:void 0),errorVisible:WJ(h,r?.providerError)},{answeringForMessage:j}=nX(e,p),M=(0,I.useMemo)(()=>pY(p,r?.questions??[]),[p,r?.questions]),N=(0,I.useMemo)(()=>xY(p,r?.questions??[]),[p,r?.questions]),P=Xl(r?.spawnedAt),ee=(0,I.useRef)(null),[F,te]=(0,I.useState)(null),ne=o.data?.messages.length??0,re=!o.isLoading;(0,I.useEffect)(()=>{if(t)return;let e=ee.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=4&&(e.scrollTop=e.scrollHeight)},[ne,i,t]);let ie=(0,I.useCallback)(async()=>{if(c.current)return;let t=s.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){c.current=!0,u(!0),f(null);try{let t=await Y.threadTranscriptEarlier({slug:e,cursor:n}),i=s.getQueryData([`transcript`,e]);if(!i?.transcriptKey||i.transcriptKey!==r||t.transcriptKey!==r){await o.refetch(),Z(`Transcript changed while loading history; refreshed the current session`);return}s.setQueryData([`transcript`,e],Mx(i,t))}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;f(t)}finally{c.current=!1,u(!1)}}},[o,s,e]);return(0,L.jsx)(D0.Provider,{value:e,children:(0,L.jsx)(p$,{thread:r,children:(0,L.jsxs)(`div`,{"data-drawer-scroll-ready":o.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,L.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,L.jsx)(`div`,{ref:ee,"data-drawer-transcript-scroll":!0,"data-virtualized-transcript-scroll":t||void 0,tabIndex:t?0:void 0,role:t?`region`:void 0,"aria-label":t?`Thread conversation`:void 0,"aria-busy":t&&l?!0:void 0,className:`relative min-h-0 flex-1 overflow-y-auto pb-3 outline-none [overflow-anchor:none] focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:t&&ne>0?(0,L.jsx)(W0,{slug:e,transcriptRef:ee,transcriptKey:o.data?.transcriptKey,messages:h,paired:D,inFlightAnswers:O,answeringForMessage:j,placement:N,fencesLive:P,thread:r,running:i,copyTerminalCommand:a,transportFallback:o.transportFallback,isFetching:o.isFetching,refresh:()=>void o.refetch(),retryLiveUpdates:o.retryLiveUpdates,hasEarlier:o.data?.hasEarlier===!0,beforeCursor:o.data?.beforeCursor,loadingEarlier:l,earlierError:d,loadEarlier:()=>void ie(),jumpOverlay:F}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(HQ,{thread:r,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,L.jsx)(h$,{thread:r,inFlight:O,className:`px-6 pt-5`}),o.transportFallback&&(0,L.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`mx-6 mt-3 flex flex-wrap items-center gap-2.5 rounded-xl border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:o.transportFallback.kind===`payload-too-large`?`Live payload ${o.transportFallback.actualBytes} bytes; socket limit ${o.transportFallback.maxBytes} bytes`:`Transcript read budget reached (${o.transportFallback.scope}); retry after about ${o.transportFallback.retryAfterMs}ms`,children:[(0,L.jsx)(xh,{size:13,className:`shrink-0 text-muted`}),(0,L.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,o.transportFallback.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,L.jsx)(`button`,{type:`button`,disabled:o.isFetching,onClick:()=>void o.refetch(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:o.isFetching?`Refreshing…`:`Refresh once`}),(0,L.jsx)(`button`,{type:`button`,onClick:o.retryLiveUpdates,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]}),(0,L.jsx)(`div`,{"data-transcript-column":!0,className:`flex min-h-full flex-col px-6 py-5`,children:ne===0?(0,L.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:o.isPending?(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(d4,{}),` Loading…`]}):i?(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(d4,{}),` Session starting…`]}):TX(r)?(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,L.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>Y.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`}):(0,L.jsxs)(L.Fragment,{children:[d2(T.map(e=>e.message),(e,t)=>{let n=T[t].messageIndex;return(0,L.jsx)(K2,{m:e,answering:P?j(e):void 0,showSendButton:!0,paired:D[n],staleAwaiting:v>=0&&n<v,restingCardShown:n===g&&w,restedAt:_&&n===_.index?_.at??``:void 0,shadowedBy:M.get(n),placed:N.placed.get(n),thread:r},t)},e=>!!e.queued),re&&V0(A)!==null&&(0,L.jsx)(SY,{h:H0(A,T.map(e=>e.message))}),re&&(0,L.jsx)(U0,{state:A,slug:e,retryText:k>=0?p[k]?.text:void 0,onTerminal:a,liveRuntimeStart:C,liveActivityLabel:S,liveToolRun:b}),r?.permPolicy?(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(r4,{policy:r.permPolicy,denies:r.permDenies})}):null,p.some(e=>e.queued)&&(0,L.jsx)(SY,{}),(0,L.jsx)(`div`,{className:`flex flex-col gap-3.5`,children:p.map((e,t)=>e.queued?(0,L.jsx)(K2,{m:e,paired:D[t]},`q${t}`):null)})]})})]})}),(0,L.jsx)(`div`,{ref:te,"data-transcript-overlay":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-end p-4 [&>*]:pointer-events-auto`})]}),(0,L.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel`,children:(0,L.jsx)(XX,{slug:e,onTerminal:a,ops:(0,L.jsx)(i4,{slug:e,transcriptShells:m,className:`px-1 pt-1.5`})})})]})})})}var I0=700,L0=250,R0=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function z0(e){return e?.pendingInteraction===!0}function B0(e){return z0(e)?void 0:e?.pendingAsk}function V0({thread:e,showWorking:t,registeredDone:n,restedCard:r,errorVisible:i}){return e?.providerError?.retrying?`provider-error`:e?.providerFault&&!e.foreign?`provider-fault`:e?.limitPause&&!e.foreign?`limit-pause`:B0(e)?`pending-ask`:e?.runtime===`perm-prompt`&&!z0(e)?`perm-prompt`:t?`working`:e?.providerError?i?null:`provider-error`:l1(e)?`snooze`:i1(e)?`resting`:n?`registered-done`:r?`rested`:null}function H0(e,t){return V0(e)===`working`?u2(t):14}function U0({state:e,slug:t,retryText:n,onTerminal:r,liveRuntimeStart:i,liveActivityLabel:a,liveToolRun:o}){let s=e.thread;switch(V0(e)){case`provider-fault`:return(0,L.jsx)(e4,{slug:t,sessionId:s.sessionId,fault:s.providerFault,retryText:n});case`provider-error`:return(0,L.jsx)(GJ,{error:s.providerError});case`limit-pause`:return(0,L.jsx)(t4,{slug:t,sessionId:s.sessionId,pause:s.limitPause});case`pending-ask`:return(0,L.jsx)(a4,{ask:B0(s),onTerminal:r});case`perm-prompt`:return(0,L.jsx)(n4,{onTerminal:r});case`working`:return(0,L.jsx)(f4,{since:s?.lastUserAt,startedAt:i,activityLabel:a,run:o});case`snooze`:return(0,L.jsx)(d1,{thread:s});case`resting`:return(0,L.jsx)(s1,{thread:s});case`registered-done`:return(0,L.jsx)($2,{fenceKind:`done`,body:s.lastFence.body,hints:[]});case`rested`:return(0,L.jsx)(UJ,{thread:s});default:return null}}function W0({slug:e,transcriptRef:t,transcriptKey:n,messages:r,paired:i,inFlightAnswers:a,answeringForMessage:o,placement:s,fencesLive:c,thread:l,running:u,copyTerminalCommand:d,transportFallback:f,isFetching:p,refresh:m,retryLiveUpdates:h,hasEarlier:g,beforeCursor:_,loadingEarlier:v,earlierError:y,loadEarlier:b,jumpOverlay:x}){let S=JC(),C=(0,I.useMemo)(()=>G1(r),[r]),w=u?J1(C):void 0,T=u?q1(C):void 0,E=T?i0(T,S):void 0,D=u?X1(C):void 0,O=(0,I.useMemo)(()=>o2(r),[r]),k=(0,I.useMemo)(()=>u?c1(r):void 0,[u,r]),A=k&&k.index>=0?k.index:O,j=i1(l),M=(0,I.useMemo)(()=>{let e=u?$1(C):C;return O1(e,s2(e,A,j))},[C,u,A,j]),N=u,P=(0,I.useMemo)(()=>E1(M.map(e=>e.message),s2(M,A,j),i2).map(e=>{let t=M[e.messageIndex];return{...e,messageIndex:t.messageIndex,stampAt:Z1(t)}}),[M,A,j]),ee=(0,I.useMemo)(()=>yX(r),[r]),F=DJ(l,O>=0?r[O]?.text:void 0),te=HJ(l,O>=0?r[O]?.text:void 0),ne=WJ(r,l?.providerError),re={thread:l,showWorking:N,registeredDone:F,restedCard:te,errorVisible:ne},ie=V0(re)!==null,ae=(0,I.useMemo)(()=>H0({thread:l,showWorking:N,registeredDone:F,restedCard:te,errorVisible:ne},M.map(e=>e.message)),[M,N,l,F,te,ne]),oe=(0,I.useMemo)(()=>{let e=[],t=new Map,n=r.length-1,i=(l?.questions??[]).filter(e=>!s.placedIds.has(e.id));for(let[a,o]of uY(r,i,{atRest:!u})){if(a>=n){e.push(...o);continue}let r=-1;for(let e=0;e<P.length&&!(P[e].messageIndex>a);e++)r=e;let i=t.get(r);i?i.push(...o):t.set(r,[...o])}return{byRow:t,tail:e}},[P,r,s.placedIds,u,l?.questions]),se=(0,I.useMemo)(()=>pY(r,l?.questions??[]),[r,l?.questions]),ce=(0,I.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];f&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(g||v||y)&&e.push({key:`earlier-history:${_??`complete`}`,kind:`earlier-history`});let t=oe.byRow.get(-1);t&&e.push({key:`questions:head`,kind:`questions`,questions:t}),P.forEach((t,n)=>{e.push({...t,kind:`message`});let r=oe.byRow.get(n);r&&e.push({key:`questions:${t.key}`,kind:`questions`,questions:r})}),e.push({key:`interactions`,kind:`interactions`}),ie&&e.push({key:`runtime-status`,kind:`runtime-status`});let n=ie||P.length>0?14:0;return r.forEach((t,r)=>{if(!t.queued)return;let i=`queued:${t.deliveryId??t.sourceId??r}`;e.push({key:i,kind:`queued`,message:t,messageIndex:r,gap:n}),n=14}),e},[_,y,g,ie,v,P,r,oe,f]),le=Yw({count:ce.length,getScrollElement:()=>t.current,getItemKey:e=>ce[e]?.key??e,estimateSize:e=>{let t=ce[e];return t?t.kind===`head-anchor`||t.kind===`interactions`?1:t.kind===`earlier-history`?42:t.kind===`transport-fallback`?76:t.kind===`runtime-status`?54:t.kind===`questions`?220:t.kind===`message`?108+t.gap:82+t.gap:80},overscan:8,paddingStart:20,paddingEnd:20,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:4,scrollToFn:(e,{adjustments:t,behavior:n},r)=>{let i=r.scrollElement;i&&i.scrollTo({top:t===void 0?e:i.scrollTop+t,behavior:n})}}),[ue,de]=(0,I.useState)(!0),fe=(0,I.useRef)(!0),pe=(0,I.useRef)(-1),me=(0,I.useRef)(0),he=(0,I.useRef)(null),ge=(0,I.useRef)(!1),_e=(0,I.useRef)(!1),ve=(0,I.useRef)(!0),ye=(0,I.useRef)(null),be=(0,I.useRef)(void 0),xe=(0,I.useRef)(null),Se=(0,I.useRef)(void 0),Ce=(0,I.useRef)(0),we=(0,I.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(ye.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}b()},[b,t]),Te=(0,I.useCallback)((e,n)=>{let r=t.current;if(!r)return;let i=Array.from(r.querySelectorAll(`[data-transcript-source-id]`)).find(t=>t.dataset.transcriptSourceId===e);i&&(r.scrollTop+=i.getBoundingClientRect().top-n)},[t]);(0,I.useLayoutEffect)(()=>{if(!n||ce.length===0||be.current===n)return;be.current=n,ge.current=!1,_e.current=!1,ve.current=!0;let t=_D(e)?.candidates.map(e=>({candidate:e,index:ce.findIndex(t=>t.kind===`message`&&t.message.sourceId===e.sourceId)})).find(e=>e.index>=0),r=requestAnimationFrame(()=>{if(!t){le.scrollToEnd({behavior:`instant`}),de(!0),ge.current=!0;return}le.scrollToIndex(t.index,{align:`start`,behavior:`instant`}),fe.current=!1,de(!1),ge.current=!0;let e=performance.now()+L0;Ce.current=e;let n=()=>{performance.now()>=e||performance.now()<me.current||(Te(t.candidate.sourceId,t.candidate.screenTop),r=requestAnimationFrame(n))};n()});return()=>cancelAnimationFrame(r)},[Te,ce.length,e,n,le]),(0,I.useLayoutEffect)(()=>{let e=ye.current,n=t.current;if(!e||!n||v)return;let r=()=>{let t=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!t)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=r-e.viewportTop};r();let i=0,a=requestAnimationFrame(()=>{r(),i=requestAnimationFrame(()=>{r(),ye.current===e&&(ye.current=null)})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(i)}},[v,P.length,t]);let Ee=(0,I.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),De=(0,I.useCallback)(e=>{let n=t.current;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),Oe=P[0]?.key;(0,I.useLayoutEffect)(()=>{let e=Se.current;if(Se.current=Oe,e===void 0||e===Oe||!ge.current||fe.current||ye.current)return;let t=xe.current;if(!t)return;De(t);let n=()=>{if(performance.now()<me.current)return;let e=xe.current;e&&De(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[De,Oe]);let ke=(0,I.useCallback)(()=>{let e=t.current;if(!e||ye.current||performance.now()<Ce.current)return;let n=C1({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:pe.current,following:fe.current,readerMoved:performance.now()<me.current});if(fe.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),pe.current=e.scrollHeight,de(e=>e===n.following?e:n.following),R0&&!n.following&&performance.now()>=me.current){let t=xe.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey);if(t&&n){let r=Math.round(n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.viewportTop);Math.abs(r)>2&&console.warn(`[frizz] transcript moved ${r}px under a still reader — row=${t.rowKey}`)}}xe.current=Ee()??xe.current},[Ee,t]);(0,I.useLayoutEffect)(ke),(0,I.useEffect)(()=>{let e=he.current;if(!e)return;let t=new ResizeObserver(ke);return t.observe(e),()=>t.disconnect()},[ke]),(0,I.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{ke();let t=w1({armed:ve.current,scrollTop:e.scrollTop,readerMoved:ge.current&&_e.current,hasEarlier:g,loading:v});ve.current=t.armed,t.shouldLoad&&we()},r=()=>{_e.current=!0,me.current=performance.now()+I0,requestAnimationFrame(n)},i=t=>{[`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)&&(e.scrollTop<=480&&(ve.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(ve.current=!0),r()},o=()=>{e.scrollTop<=480&&(ve.current=!0),r()};e.addEventListener(`scroll`,n,{passive:!0}),e.addEventListener(`wheel`,a,{passive:!0}),e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`pointerdown`,r,{passive:!0}),e.addEventListener(`keydown`,i);let s=requestAnimationFrame(n);return()=>{cancelAnimationFrame(s),e.removeEventListener(`scroll`,n),e.removeEventListener(`wheel`,a),e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,o),e.removeEventListener(`pointerdown`,r),e.removeEventListener(`keydown`,i)}},[g,v,we,ke,t]);let Ae=le.getVirtualItems(),je=le.getTotalSize();return(0,L.jsxs)(`div`,{ref:he,"data-virtualized-transcript":!0,"data-virtual-row-count":Ae.length,className:`relative w-full`,style:{height:je},children:[Ae.map(t=>{let n=ce[t.index];return n?(0,L.jsx)(`div`,{ref:le.measureElement,"data-index":t.index,"data-transcript-row-key":n.key,"data-transcript-source-id":n.kind===`message`?n.message.sourceId:void 0,className:`absolute left-0 top-0 w-full hover:z-[1]`,style:{transform:`translateY(${t.start}px)`},children:n.kind===`head-anchor`?null:n.kind===`interactions`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(HQ,{thread:l,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,L.jsx)(h$,{thread:l,questions:oe.tail,inFlight:a,showSend:s.placedIds.size>0,className:`px-6 pt-5`})]}):n.kind===`questions`?(0,L.jsx)(h$,{thread:l,questions:n.questions,className:`px-6 pt-5`}):n.kind===`transport-fallback`?f?(0,L.jsx)(`div`,{className:`px-6 pt-3`,children:(0,L.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${kJ} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:f.kind===`payload-too-large`?`Live payload ${f.actualBytes} bytes; socket limit ${f.maxBytes} bytes`:`Transcript read budget reached (${f.scope}); retry after about ${f.retryAfterMs}ms`,children:[(0,L.jsx)(xh,{size:13,className:`shrink-0 text-muted`}),(0,L.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,f.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,L.jsx)(`button`,{type:`button`,disabled:p,onClick:m,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:p?`Refreshing…`:`Refresh once`}),(0,L.jsx)(`button`,{type:`button`,onClick:h,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]})}):null:n.kind===`earlier-history`?(0,L.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:y?(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,L.jsx)(`span`,{children:y}),(0,L.jsx)(`button`,{type:`button`,onClick:we,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):v?(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Xm,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,L.jsx)(`button`,{type:`button`,onClick:we,className:`rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:`Load earlier messages`})}):n.kind===`message`?(0,L.jsx)($Z,{at:n.stampAt,host:SX(n.message,i[n.messageIndex]),gap:n.gap,children:(0,L.jsx)(K2,{m:n.message,answering:c?o(n.message):void 0,showSendButton:!0,paired:i[n.messageIndex],staleAwaiting:A>=0&&n.messageIndex<A,restingCardShown:n.messageIndex===O&&j,restedAt:k&&n.messageIndex===k.index?k.at??``:void 0,shadowedBy:se.get(n.messageIndex),placed:s.placed.get(n.messageIndex),thread:l})}):n.kind===`runtime-status`?(0,L.jsxs)(`div`,{className:`px-6`,style:{paddingTop:ae},children:[(0,L.jsx)(U0,{state:re,slug:e,retryText:ee>=0?r[ee]?.text:void 0,onTerminal:d,liveRuntimeStart:D,liveActivityLabel:E,liveToolRun:w}),l?.permPolicy?(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(r4,{policy:l.permPolicy,denies:l.permDenies})}):null]}):(0,L.jsx)($Z,{at:n.message.at,host:SX(n.message,i[n.messageIndex]),gap:n.gap,children:(0,L.jsx)(K2,{m:n.message,paired:i[n.messageIndex]})})},n.key):null}),(0,L.jsx)(G0,{overlay:x,hidden:ue,onJump:()=>le.scrollToEnd({behavior:`smooth`})})]})}function G0({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,ot.createPortal)((0,L.jsxs)(`button`,{type:`button`,"data-jump-to-latest":!0,onClick:n,className:`flex items-center gap-1.5 rounded-full border border-border-strong bg-elevated px-3 py-1.5 text-[11px] font-medium text-fg shadow-lg shadow-black/30 hover:bg-panel-2`,children:[(0,L.jsx)(dm,{size:12}),`Jump to latest`]}),e)}function K0({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1}){let i=Gp(qC(),e),a=it({mutationFn:()=>Y.markComplete({slug:e})}),o=it({mutationFn:t=>Y.renameThread({slug:e,title:t})}),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(``),d=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!s)return;let e=requestAnimationFrame(()=>{d.current?.focus(),d.current?.select()});return()=>cancelAnimationFrame(e)},[s]),(0,I.useEffect)(()=>{c(!1),u(``)},[e]);let f=LK(nt({queryKey:[`threadBody`,e],queryFn:()=>Y.threadBody({slug:e})}).data?.markdown??``).trim().length>0;if(!i)return null;let p=i.kind===`session`&&i.foreign!==!0,m=i.foreign===!0,h=i.kind===`session`&&!m,g=CT(i);function _(){c(!1),u(``)}function v(){let e=EX(l,g);if(c(!1),!e){u(``);return}o.mutate(e,{onSuccess:()=>{u(``),Z(`Thread renamed`)},onError:t=>{u(e),c(!0),Z(t instanceof Error?t.message:`Could not rename thread`)}})}return(0,L.jsxs)(`header`,{"data-thread-header":!0,className:kX,children:[(0,L.jsx)(`div`,{className:AX,children:(0,L.jsxs)(`div`,{className:`min-w-0 leading-tight`,children:[(0,L.jsxs)(`div`,{className:`group/thread-title flex min-w-0 items-center gap-2`,children:[s?(0,L.jsx)(`input`,{ref:d,"aria-label":`Thread title`,value:l,maxLength:200,onChange:e=>u(e.target.value),onBlur:v,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),v()):e.key===`Escape`&&(e.preventDefault(),_())},className:`min-w-0 flex-1 rounded-md border border-border bg-elevated px-1.5 py-1 font-semibold text-[15px] text-fg outline-none focus:border-accent`}):h?(0,L.jsx)(`button`,{type:`button`,title:`Edit title`,"aria-label":`Edit thread title: ${g}`,disabled:o.isPending,onClick:()=>{u(DX(g,i.id)),c(!0)},className:`min-w-0 max-w-full shrink truncate rounded px-0.5 -mx-0.5 font-semibold text-[15px] text-left outline-none transition-colors hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-40`,children:g}):(0,L.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px]`,title:g,children:g}),(0,L.jsx)(LZ,{thread:i,hidden:s})]}),(0,L.jsx)(f1,{at:PT(i),fallbackAt:i.spawnedAt,className:`mt-0.5 block truncate text-[11px] leading-tight text-muted/75`})]})}),(0,L.jsxs)(`div`,{className:jX,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[p&&(0,L.jsx)(S1,{slug:e}),(0,L.jsx)(nZ,{thread:i,collapse:r,onDoc:f?()=>_p(`doc`,i.id):void 0,onDone:()=>a.mutate(void 0,{onSuccess:t}),doneBusy:a.isPending,onStatusApplied:t}),n&&(0,L.jsx)(aM,{slug:e})]}),n&&(0,L.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:n,className:`ml-0.5 shrink-0 rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,L.jsx)(Ch,{size:15})})]})]})}function q0(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||HZ(e))return null;if(e.parts&&e.parts.length>0){for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`tools`?n.tools.length>0:n.text.trim())return n.kind===`tools`?n.tools:null}return null}return(e.tools?.length??0)>0&&!e.text.trim()?e.tools:null}function J0(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||HZ(e))return null;if(e.parts&&e.parts.length>0){for(let t of e.parts)if(t.kind===`tools`?t.tools.length>0:t.text.trim())return t.kind===`tools`?t.tools:null;return null}return(e.tools?.length??0)>0?e.tools:null}function Y0(e){return q0(e)!==null}function X0(e){return J0(e)!==null}function Z0(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function Q0(e){return Z0(e)||Y0(e)}function $0(e){return Z0(e)||X0(e)}function e2(e){if(Z0(e))return!0;let t=q0(e);return t!==null&&!N1(t[t.length-1])}function t2(e){if(Z0(e))return!0;let t=J0(e);return t!==null&&!N1(t[0])}function n2(e){let t=q0(e);return t!==null&&F1(t[t.length-1])}function r2(e){let t=J0(e);return t!==null&&F1(t[0])}function i2(e,t){let n=n2(e)||r2(t),r=!n&&Q0(e)&&$0(t)&&!(e2(e)&&t2(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function a2(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.every(n=>n.kind===`tools`?n.tools.length===0:c2(e,n.text,t)):(e.tools?.length??0)===0&&c2(e,e.text,t)}function o2(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function s2(e,t,n=!1){let r=new WeakSet;if(t>=0)for(let n of e)n.messageIndex<t&&r.add(n.message);if(t>=0&&n)for(let n of e)n.messageIndex===t&&r.add(n.message);return e=>a2(e,r.has(e))}function c2(e,t,n){return!e.fenceRefused&&!n?!t.trim():EJ(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`)}function l2(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.some(n=>n.kind===`text`&&!c2(e,n.text,t)):typeof e.text==`string`&&!c2(e,e.text,t)}function u2(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.queued||a2(n)))return n2(n)?22:Q0(n)&&!e2(n)?6:14+(n.role===`user`?3:0)}return 0}function d2(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||a2(e)||(i!==null&&r.push((0,L.jsx)(SY,{h:i2(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function f2(e){let t=[];for(let n of e){if(n.kind===`text`){if(!n.text.trim())continue;t.push(n);continue}if(n.tools.length===0)continue;let e=t[t.length-1];e&&e.kind===`tools`?t[t.length-1]={kind:`tools`,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function p2(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{n>0&&r.push((0,L.jsx)(SY,{h:typeof t==`number`?t:t(n)},`vs${n}`)),r.push(e)}),r}var m2={head:!1,tail:!1};function h2(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function g2(e){return{head:F1(e[0]),tail:F1(e[e.length-1])}}function _2(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.edit){let r=!!(n.input||n.output||n.status||n.exitCode!==void 0);e&&e.edits&&!r&&!e.input&&!e.output&&!e.status&&e.edits[0].file===n.edit.file?e.edits.push(n.edit):t.push({name:n.name,detail:n.detail,edits:[n.edit],input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}else n.command?t.push({name:n.name,detail:n.detail,command:n.command,desc:n.desc,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):n.outputImage?t.push({name:n.name,detail:n.detail,outputImage:n.outputImage,output:n.output??n.read,status:n.status,durationMs:n.durationMs,count:1}):n.read?t.push({name:n.name,detail:n.detail,read:n.read,status:n.status,durationMs:n.durationMs,count:1}):n.prompt||n.agentId?t.push({name:n.name,detail:n.detail,prompt:n.prompt,input:n.input,subagentType:n.subagentType,agentId:n.agentId,agentStatus:n.agentStatus,agentElapsedMs:n.agentElapsedMs,output:n.output,status:n.status,durationMs:n.durationMs,count:1}):n.sendTo!==void 0||n.sendBody!==void 0?t.push({name:n.name,detail:n.detail,sendTo:n.sendTo,sendSummary:n.sendSummary,sendBody:n.sendBody,sendType:n.sendType,sendDispatchId:n.sendDispatchId,sendTargetLabel:n.sendTargetLabel,status:n.status,durationMs:n.durationMs,count:1}):n.todos?t.push({name:n.name,detail:n.detail,todos:n.todos,input:n.input,status:n.status,durationMs:n.durationMs,count:1}):P1(n)?t.push({name:n.name,detail:n.detail,ask:n.ask,askAnswers:n.askAnswers,status:n.status,durationMs:n.durationMs,count:1}):n.sentImages||n.sentFiles?t.push({name:n.name,detail:n.detail,sentImages:n.sentImages,sentFiles:n.sentFiles,caption:n.caption,status:n.status,durationMs:n.durationMs,count:1}):n.input||n.output?t.push({name:n.name,detail:n.detail,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):e&&!e.edits&&!e.command&&!e.input&&!e.output&&!e.read&&!e.prompt&&!e.outputImage&&!e.sentImages&&!e.sentFiles&&e.sendTo===void 0&&e.sendBody===void 0&&e.name===n.name&&e.detail===n.detail&&e.status===n.status&&e.backgroundState===n.backgroundState&&e.exitCode===n.exitCode&&e.cwd===n.cwd&&e.sessionId===n.sessionId&&e.durationMs===n.durationMs?e.count++:t.push({name:n.name,detail:n.detail,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}return t}function v2(e){return e.split(`__`).pop()||e}function y2(e){let t=X.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function b2({tools:e,at:t}){let[n,r]=(0,I.useState)(!1),i=(0,I.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=c0(a,s0(e));return(0,L.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${a} tool ${a===1?`call`:`calls`}: ${o}`,className:`group flex w-full min-w-0 items-baseline gap-1.5 rounded py-0.5 text-left outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 ${eQ}`,children:[(0,L.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,L.jsx)(ym,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:nQ(n)})]}),n&&(0,L.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:p2(e.map((e,n)=>(0,L.jsx)(S2,{t:e,startedAt:t},n)),6)}),!n&&(0,L.jsx)(`div`,{id:i,hidden:!0})]})}function x2({tools:e,at:t}){let n=[];for(let t of e){let e=N1(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,L.jsx)(`div`,{className:`flex flex-col`,children:p2(n.map((e,n)=>e.exceptional?(0,L.jsx)(`div`,{className:`flex flex-col`,children:p2(e.tools.map((e,n)=>(0,L.jsx)(S2,{t:e,startedAt:t},n)),h2(e.tools.map(e=>g2([e])),6))},`exceptions-${n}`):(0,L.jsx)(b2,{tools:e.tools,at:t},`activity-${n}`)),h2(n.map(e=>g2(e.tools)),6))})}function S2({t:e,startedAt:t}){let n=(0,I.useContext)(D0),r=qC(),i=NE(e,(n?Gp(r,n):void 0)?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,L.jsx)(Mq,{edits:e.edits,meta:(0,L.jsx)(D2,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,L.jsx)(F2,{command:e.command,desc:e.desc??e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t}):e.outputImage?(0,L.jsx)(M2,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,L.jsx)(L2,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,L.jsx)(z2,{detail:e.detail,prompt:e.prompt,input:e.input,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs,output:e.output}):e.sendTo!==void 0||e.sendBody!==void 0?(0,L.jsx)(V2,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs,at:t}):e.sentImages||e.sentFiles?(0,L.jsx)(N2,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,L.jsx)(nJ,{todos:e.todos,note:e.input,meta:(0,L.jsx)(D2,{status:e.status,durationMs:e.durationMs})}):P1(e)?(0,L.jsx)(C2,{ask:e.ask??[],askAnswers:e.askAnswers}):e.input||e.output?(0,L.jsx)(F2,{name:e.name,command:e.input??``,desc:e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,inputLabel:`input`,startedAt:t}):(0,L.jsx)(j2,{name:e.name,detail:e.detail,count:e.count,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,cwd:e.cwd,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t})}function C2({ask:e,askAnswers:t}){return(0,L.jsx)(`div`,{"data-settled-ask":!0,className:`flex flex-col gap-1.5`,children:e.map((e,n)=>{let r=RQ(e,t?.[n]);return(0,L.jsx)(oX,{question:r.question,settled:{chosenIdxs:r.chosenIdxs,text:r.text}},n)})})}function w2({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,L.jsxs)(`span`,{className:`petite-caps frizz-tool-header-caps flex shrink-0 items-center gap-1 whitespace-nowrap text-[11.5px] leading-none ${e}`,title:i,"aria-label":i,children:[t,(0,L.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function T2(e,t,n){let[r,i]=(0,I.useState)(()=>Date.now()),a=AE(e,t),o=jE(e,t,n,r);return(0,I.useEffect)(()=>{if(!a||o)return;let e=n?Date.parse(n):NaN;if(!Number.isFinite(e))return;let t=setTimeout(()=>i(Date.now()),Math.max(kE-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function E2({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=T2(e,t,r),a=n===`running`?(0,L.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,L.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`tool-quiet`,title:ZE}):OE(e,t)||i?(0,L.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,L.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:a}):null}function D2({status:e,backgroundState:t,liveBackgroundState:n,exitCode:r,durationMs:i}){if(!e&&i===void 0)return null;let[a,o]=n===`running`?[`running`,`background running`]:n===`stale`?[`stale`,`background stale`]:e===`pending`?t===`unknown`?[`unknown`,`background / unknown`]:[`running`,t===`background`?`background running`:`running`]:e===`failed`?r===void 0?[`failed`,`failed`]:[`exit ${r}`,`exit ${r}`]:e===`cancelled`?[`cancelled`,`cancelled`]:e===`completed`?[`done`,`done`]:[void 0,void 0],s=i===void 0?void 0:PE(i),c=[o,s].filter(Boolean).join(` · `);return(0,L.jsx)(w2,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-amber-400`:`text-muted/55`,title:c,label:a,duration:s})}function O2(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,I.useState)(()=>Date.now());return(0,I.useEffect)(()=>{if(!i)return;let e=()=>o(Date.now()),t,n=setTimeout(()=>{e(),t=setInterval(e,1e3)},1e3-Date.now()%1e3);return()=>{clearTimeout(n),t&&clearInterval(t)}},[i,t]),i?Math.max(a-r,0):n}function k2(e,t,n){let r=t&&t!==X.board?.projectDir?`in ${y2(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function A2(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function j2({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=k2(t,s,c),f=d?y2(d):void 0,p=t&&A2(t)?t:void 0;return(0,L.jsx)(`div`,{className:`frizz-bash`,title:d,children:(0,L.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(E2,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,L.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:v2(e)}),f&&(p?(0,L.jsx)(`span`,{className:`min-w-0 truncate`,onClick:e=>e.stopPropagation(),children:(0,L.jsx)(jq,{path:p,className:`text-[11.5px] text-muted`,children:f})}):(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:f}))]}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(D2,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,L.jsxs)(`span`,{className:`tabular-nums text-[11px] text-muted/45`,children:[`×`,n]})]})]})})}function M2({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let o=t?y2(t):void 0,s=(0,L.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:v2(e)}),o&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:t,children:o})]}),(0,L.jsx)(`span`,{className:`flex shrink-0 items-center gap-2`,children:(0,L.jsx)(D2,{status:i,durationMs:a})})]});return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(J2,{path:n,hideCaption:!0,altText:o?`${v2(e)}: ${o}`:v2(e),header:s}),r&&(0,L.jsx)(`pre`,{className:`frizz-bash frizz-bash-body frizz-bash-output-body mt-1.5`,children:r})]})}function N2({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,I.useState)(!0),s=(0,I.useId)(),c=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,L.jsxs)(`div`,{className:`frizz-bash`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":s,"aria-expanded":a,"aria-label":`${a?`Collapse`:`Expand`} files sent to you${c?`: ${c}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Sent to you`}),c&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:c})]}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(D2,{status:r,durationMs:i}),(0,L.jsx)(ym,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${a?`rotate-90`:``}`})]})]}),(0,L.jsx)(`div`,{id:s,hidden:!a,children:a&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[e.map((e,t)=>(0,L.jsx)(J2,{path:e,hideCaption:!0,altText:n??`delivered image`},`i${t}`)),t.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,L.jsx)(Y2,{path:e},`f${t}`))}),n&&(0,L.jsx)(`div`,{className:`max-w-[65%] text-[12px] leading-snug text-muted`,children:n})]})})]})}var P2=16;function F2({command:e,desc:t,output:n,name:r=`Bash`,status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,sessionId:c,durationMs:l,inputLabel:u,startedAt:d}){let[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),v=(0,I.useId)(),y=O2(i,d,l),b=(0,I.useMemo)(()=>e.split(`
313
+ `)||void 0;return{line:`${e$(e)} ${t.label}${r?` — ${r}`:``}`,...i?{body:i}:{}}}var n$=`root`;function r$(e,t,n){return`${e}/${t}.${n}`}function i$(e){let t=e.options??[],n=t.findIndex(e=>e.recommended),r=t.map((e,t)=>t$(t,e));return{question:{kind:e.kind,danger:e.danger===!0,contextMd:e.question,options:r.map(e=>e.line),recommendedIdx:n===-1?null:n,...r.some(e=>e.body)?{optionBodies:r.map(e=>e.body)}:{}},optionLabels:t.map(e=>e.label)}}function a$(e,t){return!t||e.kind===`multi`?null:t.chosen}function o$(e,t){let n=[],r=(e,i,a)=>{let{question:o,optionLabels:s}=i$(e);n.push({path:i,spec:e,question:o,optionLabels:s,depth:a});let c=a$(e,t.get(i));c!==null&&(e.options?.[c]?.followUps??[]).forEach((e,t)=>r(e,r$(i,c,t),a+1))};return r(e,n$,1),n}function s$(e,t){return t?t.text.trim()?!0:e.kind===`multi`?(t.chosenSet??[]).length>0:t.chosen!==null:!1}function c$(e,t){if(!s$(e.spec,t.get(`root`)))return;let n=(r,i)=>{let a=t.get(i),o=(r.options??[]).map(e=>e.label),s=a$(r,a),c=r.kind===`multi`?(a?.chosenSet??[]).slice().sort((e,t)=>e-t).flatMap(e=>o[e]===void 0?[]:[o[e]]):s===null?[]:[o[s]].filter(e=>e!==void 0),l=r.kind===`multi`||s===null?a?.text.trim():void 0,u=s===null?[]:(r.options?.[s]?.followUps??[]).map((e,t)=>n(e,r$(i,s,t)));return{questionId:e.id,question:r.question,chosen:c,...l?{text:l}:{},...u.length>0?{followUps:u}:{}}};return n(e.spec,n$)}function l$(e){let t=e instanceof Error?e.message:`The answer could not be sent.`;return t.length>240?`${t.slice(0,239)}…`:t}var u$=(e,t)=>`${e}|${t}`,d$=(0,I.createContext)(null);function f$(e){let t=e?.id,n=e?.questions??[],r=Oz(),[i,a]=(0,I.useState)(()=>new Map),[o,s]=(0,I.useState)(),c=(0,I.useContext)(A0),l=jz((0,I.useMemo)(()=>t?n.flatMap(e=>g$(e).map(n=>Dz.question(r,t,e.id,n))):[],[r,t,n])),u=(e,n)=>{let a=i.get(u$(e.id,n));return{chosen:a?.chosen??null,chosenSet:a?.chosenSet??[],text:(t?l.get(Dz.question(r,t,e.id,n)):void 0)??``}},d=e=>new Map(g$(e).map(t=>[t,u(e,t)])),f=n.flatMap(e=>{let t=c$(e,d(e));return t?[t]:[]}),p=it({mutationFn:async e=>Y.answerQuestions({slug:t,answers:e}),onSuccess:e=>{for(let i of e.answered){a(e=>{let t=new Map(e);for(let e of[...t.keys()])e.startsWith(`${i}|`)&&t.delete(e);return t});let e=n.find(e=>e.id===i);if(e&&t)for(let n of g$(e))Tz.set(Dz.question(r,t,e.id,n),``)}},onError:e=>{c?.cancel(),s(l$(e))}}),m=it({mutationFn:async e=>Y.dismissQuestions({slug:t,ids:[e]}),onError:e=>s(l$(e))});return{slug:t,answerFor:u,answersOf:d,onChip:(e,t,n,r)=>{a(i=>{let a=new Map(i),o=u$(e.id,t),s=a.get(o)??{chosen:null,chosenSet:[]};if(n){let e=s.chosenSet.includes(r)?s.chosenSet.filter(e=>e!==r):[...s.chosenSet,r];a.set(o,{...s,chosenSet:e})}else a.set(o,{...s,chosen:s.chosen===r?null:r});return a})},onText:(e,n,i,o)=>{t&&(Tz.set(Dz.question(r,t,e.id,n),o),i||a(t=>{let r=u$(e.id,n),i=t.get(r);return!i||i.chosen===null?t:new Map(t).set(r,{...i,chosen:null})}))},dismiss:e=>m.mutate(e),dismissing:m.isPending,submit:()=>{!t||f.length===0||p.isPending||(s(void 0),c?.dismiss(),p.mutate(f))},staged:f.length,sending:p.isPending,error:o}}function p$({thread:e,children:t}){let n=f$(e);return(0,L.jsx)(d$.Provider,{value:n,children:t})}function m$({q:e,answering:t}){let n=(0,I.useContext)(d$),r=t??n;if(!r||!r.slug)return null;let i=o$(e.spec,r.answersOf(e)),a=t=>(0,L.jsx)(oX,{question:t.question,label:t.depth>1?`Follow-up`:void 0,aside:t.depth===1&&!e.spec.danger?(0,L.jsx)(`button`,{type:`button`,"data-dismiss-question":!0,"aria-label":`Dismiss this question`,title:`Dismiss — the worker decides it itself`,disabled:r.dismissing,onClick:()=>r.dismiss(e.id),className:`card-icon-offset -mx-2 -my-1 flex rounded-md p-1 text-muted/70 outline-none transition-colors hover:bg-elevated hover:text-fg disabled:opacity-40`,children:(0,L.jsx)(Ch,{size:16})}):void 0,interactive:{answer:r.answerFor(e,t.path),onChip:n=>r.onChip(e,t.path,t.spec.kind===`multi`,n),onText:n=>r.onText(e,t.path,t.spec.kind===`multi`,n),onSubmit:r.submit}},t.path),o=i.slice(1);return(0,L.jsxs)(`article`,{"data-question-id":e.id,className:`flex min-w-0 flex-col gap-2`,children:[a(i[0]),o.length>0&&(0,L.jsx)(`div`,{className:`ml-3 flex flex-col gap-2 border-l border-border pl-3`,children:o.map(e=>(0,L.jsx)(`div`,{className:e.depth>2?`ml-3 border-l border-border pl-3`:void 0,children:a(e)},e.path))})]})}function h$({thread:e,questions:t,inFlight:n=null,showSend:r=!1,className:i=``}){let a=e?.id,o=t??e?.questions??[],s=(0,I.useContext)(d$),c=f$(s?void 0:e),l=s??c;return!a||o.length===0&&!r?!a||!n?.length?null:(0,L.jsx)(`section`,{"data-answers-in-flight":!0,"aria-label":`Your answer, on its way to the worker`,className:`flex min-w-0 flex-col items-end ${i}`,children:(0,L.jsx)(JY,{answers:n,queued:!0})}):(0,L.jsxs)(`section`,{"data-registered-questions":!0,"aria-label":o.length>0?`${o.length} question${o.length===1?``:`s`} waiting for an answer`:`Send the answers above`,className:`flex min-w-0 flex-col gap-3 ${i}`,children:[o.map(e=>(0,L.jsx)(m$,{q:e,answering:l},e.id)),l.error&&(0,L.jsx)(`div`,{role:`alert`,className:`break-words text-[11px] leading-snug text-red-300`,children:l.error}),l.sending&&(0,L.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[11px] leading-snug text-muted`,children:`Sending…`}),(0,L.jsx)(`div`,{className:`flex justify-start`,children:(0,L.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:l.staged===0||l.sending,onClick:l.submit,onMouseDown:e=>e.preventDefault(),className:`rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:`Send answers`})})]})}function g$(e){let t=[],n=(e,r)=>{t.push(r),e.options?.forEach((e,t)=>{e.followUps?.forEach((e,i)=>n(e,`${r}/${t}.${i}`))})};return n(e.spec,n$),t}function _$(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function v$(e,t={}){let n=(e.subAgents??[]).filter(e=>Xc(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:_$(e),a=[n>0?`${n} sub-agent${n===1?``:`s`}`:null,r>0?`${r} background shell${r===1?``:`s`}`:null,i>0?`${i} PR watcher${i===1?``:`s`}`:null].filter(e=>e!==null);return a.length===0?`0 background shells`:a.length===1?a[0]:`${a.slice(0,-1).join(`, `)} and ${a[a.length-1]}`}function y$(e){return(e.subAgents??[]).some(e=>Xc(e)&&e.state===`running`)}function b$(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function x$(e){return y$(e)||b$(e)>0}function S$(e,t){return ul(t)??(C$(e)?`Background shells running`:`Awaiting`)}function C$(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!y$(e)&&_$(e)===0&&w$(e).length===0}function w$(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}var T$={id:``,subAgents:[],bgShells:[],watches:[]},E$=[];function D$(e,t){let n=new Set((e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).map(e=>e.target));return lU(t).filter(e=>!n.has(e.ref))}function O$({watch:e}){return(0,I.useEffect)(()=>{e.url&&jf([e.ref])},[e.url,e.ref]),e.url?(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,"data-gh-ref":e.ref,className:`${BJ} text-[12px]`,children:e.ref}):(0,L.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.ref})}var k$={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function A$(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:k$[e.merge]}var j$=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function M$({tone:e}){return(0,L.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${j$}`})}function N$(){return(0,L.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 16 16`,width:12,height:12,fill:`none`,stroke:`currentColor`,overflow:`visible`,className:j$,style:{color:UE.fgAttention},children:[(0,L.jsx)(`circle`,{cx:`8`,cy:`8`,r:`4`,fill:`currentColor`,stroke:`none`}),(0,L.jsxs)(`g`,{strokeWidth:`2`,className:`origin-center motion-safe:animate-spin`,children:[(0,L.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`,opacity:`0.25`}),(0,L.jsx)(`path`,{d:`M15 8A7 7 0 0 1 8 15`})]})]})}function P$({status:e}){return e?e.state===`merged`?(0,L.jsx)(Rm,{size:12,className:j$,style:{color:UE.fgDone}}):e.state===`closed`?(0,L.jsx)(zm,{size:12,className:j$,style:{color:UE.fgDanger}}):e.checks===`failing`?(0,L.jsx)(Om,{size:12,className:j$,style:{color:UE.fgDanger}}):e.checks===`passing`?(0,L.jsx)(Cm,{size:12,className:j$,style:{color:UE.fgSuccess}}):e.gated>0&&e.running===0?(0,L.jsx)(Sm,{size:12,className:j$,style:{color:UE.fgAttention}}):e.checks===`running`?(0,L.jsx)(N$,{}):(0,L.jsx)(wm,{size:12,className:`${j$} text-muted/60`}):(0,L.jsx)(wm,{size:12,className:`${j$} text-muted/60`})}function F$(e){return[e.failed>0?`${e.failed} failing`:null,e.gated>0?`${e.gated} awaiting approval`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null,e.skipped>0?`${e.skipped} skipped`:null].filter(e=>e!==null).join(`, `)}function I$(e){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let t=F$(e),n=A$(e);return[t||`No checks`,n].filter(e=>e!==null).join(` · `)}var L$=`group relative col-span-4 grid grid-cols-subgrid items-baseline rounded-sm text-[12px] leading-5`,R$=`group relative col-span-4 flex items-baseline rounded-sm text-[12px] leading-5`,z$=`ml-1.5 min-w-0 truncate font-medium text-fg/90`,B$=`ml-3 min-w-0 truncate text-right text-muted/70`,V$=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function H$(){return(0,L.jsx)(ym,{size:13,"aria-hidden":!0,className:`${j$} ml-[3px] -mr-[4px] text-muted/35 transition-colors group-hover:text-muted/70`})}function U$({mark:e,name:t,status:n,onOpen:r,onPrewarm:i,href:a,ghRef:o,title:s,testKind:c,testId:l,indent:u}){let d=u!==void 0,f=d?`${z$} flex-1`:z$,p=a?(0,L.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer noopener`,title:s,"data-gh-ref":o,onMouseDown:e=>e.stopPropagation(),className:`${f} ${V$} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,L.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),title:s,className:`${f} ${V$} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,L.jsx)(`span`,{className:f,title:s,children:t}),m=!!(a||r);return(0,L.jsxs)(`div`,{"data-wait-row":l,"data-wait-kind":c,onMouseEnter:i,onFocus:i,style:d?{paddingLeft:u}:void 0,className:`${d?R$:L$} ${m?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,L.jsx)(`span`,{className:`flex shrink-0`,children:e}),p,(0,L.jsx)(`span`,{"data-wait-status":!0,className:B$,children:n}),m?(0,L.jsx)(H$,{}):(0,L.jsx)(`span`,{})]})}function W$({watch:e}){let t=e.github,n=sU(e.target);return(0,I.useEffect)(()=>{n&&jf([e.target])},[n,e.target]),(0,L.jsx)(U$,{testKind:`github`,testId:e.target,mark:(0,L.jsx)(P$,{status:t}),name:e.target,href:n??void 0,ghRef:n?e.target:void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:(0,L.jsxs)(L.Fragment,{children:[I$(t),t&&t.failing.length>0&&n&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,onMouseDown:e=>e.stopPropagation(),className:`relative underline underline-offset-2 text-[#f85149]/85 decoration-[#f85149]/30 hover:decoration-[#f85149]`,children:`view failures`})]})]})})}function G$(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function K$(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function q$({watch:e,thread:t,slug:n,now:r}){let i=G$(t,e.target);if(i)return(0,L.jsx)(J$,{shell:i,slug:n,now:r,testId:e.target});let a=RE(e.createdAt,r);return(0,L.jsx)(U$,{testKind:`shell`,testId:e.target,mark:(0,L.jsx)(vh,{size:12,className:`${j$} text-shell`}),name:e.target,title:e.target,status:a?`running · ${a}`:`running`})}function J$({shell:e,slug:t,now:n,testId:r}){let i=RE(e.startedAt,n),a=e.id&&!e.outputUnavailable;return(0,L.jsx)(U$,{testKind:`shell`,testId:r??e.id??e.label,mark:(0,L.jsx)(vh,{size:12,className:`${j$} text-shell`}),name:e.label,onOpen:a?()=>yp(t,e.id,{label:e.label,startedAt:e.startedAt}):void 0,title:a?`Read this shell's output — running for ${i}`:e.label,status:i?`running · ${i}`:`running`})}function Y$({watch:e,now:t}){let n=Date.parse(e.timer?.fireAt??``),r=Number.isFinite(n)?n>t?`fires in ${IE(n-t)}`:`firing…`:`armed`;return(0,L.jsx)(U$,{testKind:`timer`,testId:e.target,mark:(0,L.jsx)(km,{size:12,className:`${j$} text-muted/60`}),name:e.timer?.prompt||e.target,title:e.timer?.fireAt?`One-off timer, set for ${e.timer.fireAt}`:e.target,status:r})}function X$(e){return(e.subAgents??[]).filter(e=>Xc(e)&&e.state===`running`)}function Z$({agent:e,slug:t,now:n}){let r=RE(e.startedAt,n),i=e.subagentType?.replace(/^frizz:/,``);return(0,L.jsx)(U$,{testKind:`agent`,testId:e.id??e.label,mark:(0,L.jsx)(M$,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>vp(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent — working for ${r}`:e.label,status:[i,r].filter(Boolean).join(` · `)})}function Q$(e,t,n){let r=new Set(n.map(e=>e.target)),i=[];for(let n of t){if(n.kind!==`shell`)continue;let t=n.value.trim();if(!t||r.has(t))continue;let a=G$(e,t);!a||a.state!==`running`||(r.add(t),i.push({id:`shell:${e.id}:${t}`,kind:`shell`,target:t,state:`armed`,createdAt:a.startedAt}))}return i}function $$(e,t={}){let n=Date.parse(t.notAfter??``),r=e=>!Number.isFinite(n)||!e||!(Date.parse(e)>n),i=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`&&r(e.createdAt)),a=K$(e).filter(t=>r(G$(e,t.target)?.startedAt??t.createdAt));return{prs:i,shells:[...a,...Q$(e,t.hints??[],a)],agents:X$(e).filter(e=>r(e.startedAt)),timers:w$(e).filter(e=>r(e.createdAt))}}function e1(e,t={}){let n=$$(e,t);return n.prs.length+n.shells.length+n.agents.length+n.timers.length>0}function t1(e,t,n={}){let{prs:r,shells:i,agents:a,timers:o}=$$(e,n);return[{head:`Sub-agents`,rows:a.map(n=>(0,L.jsx)(Z$,{agent:n,slug:e.id,now:t},n.id??n.label))},{head:`Background shells`,rows:i.map(n=>(0,L.jsx)(q$,{watch:n,thread:e,slug:e.id,now:t},n.id))},{head:`Pull requests`,rows:r.map(e=>(0,L.jsx)(W$,{watch:e},e.id))},{head:`Timers`,rows:o.map(e=>(0,L.jsx)(Y$,{watch:e,now:t},e.id))}].filter(e=>e.rows.length>0)}function n1({group:e,first:t}){let n=`col-span-4 text-[10.5px] uppercase tracking-wide text-muted/45 ${t?``:`mt-2.5`}`;return e.onToggle?(0,L.jsxs)(`button`,{type:`button`,onClick:e.onToggle,"aria-expanded":!e.collapsed,onMouseDown:e=>e.stopPropagation(),className:`${n} flex items-baseline rounded-sm text-left transition-colors hover:text-muted/80`,children:[(0,L.jsx)(`span`,{children:e.head}),e.count!==void 0&&(0,L.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.count}),(0,L.jsx)(ym,{size:10,"aria-hidden":!0,className:`${j$} ml-[5px] transition-transform ${e.collapsed?``:`rotate-90`}`})]}):(0,L.jsx)(`div`,{className:n,children:e.head})}function r1({groups:e,divider:t}){return e.length===0?null:(0,L.jsxs)(L.Fragment,{children:[t&&(0,L.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),(0,L.jsx)(`div`,{className:`mt-3 grid grid-cols-[auto_1fr_fit-content(50%)_auto] gap-y-px`,children:e.map((e,t)=>(0,L.jsxs)(I.Fragment,{children:[(0,L.jsx)(n1,{group:e,first:t===0}),!e.collapsed&&e.rows]},e.head))})]})}function i1(e){return e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}var a1=`Hides card until new activity is detected`;function o1({thread:e,onSnooze:t,onSnoozeFailed:n}){let[r,i]=(0,I.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{i(!0),t?.(),Y.snoozeAwaitingBackground({slug:e.id,sessionId:e.sessionId??``}).then(()=>Z(`Snoozed until the background work returns`)).catch(e=>{n?.(),Z(`Couldn’t snooze: ${e.message.slice(0,80)}`),i(!1)})},disabled:r,onMouseDown:e=>e.preventDefault(),title:a1,className:`disabled:opacity-45 ${VJ}`,children:[(0,L.jsx)(Um,{size:12,className:CX}),`Snooze`]}),(0,L.jsx)(`span`,{className:zJ,children:a1})]})}function s1({thread:e,fence:t,onSnooze:n,onSnoozeFailed:r,notAfter:i}){let a=e??T$,o=t??(e?.lastFence?.kind===`awaiting`?e.lastFence:void 0),s=o?.hints??E$,c=y$(a),l=hU(o?.body),u=XK(l??``),d=t1(a,TE(),{hints:s,notAfter:i}),f=D$(a,s),p=i===void 0&&e!==void 0&&i1(e)&&aZ(e).snooze;return(0,L.jsxs)(IJ,{"data-awaiting-background":!0,icon:C$(a)?vh:Um,label:(0,L.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:S$(a,s)}),aside:f.length===1?(0,L.jsx)(O$,{watch:f[0]}):void 0,className:p?`pb-0`:``,children:[l?(0,L.jsx)(Yq,{className:`md-body ${OJ}`,html:u}):d.length===0&&!x$(a)?(0,L.jsx)(`p`,{className:LJ,children:cU}):null,f.length>1&&(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:f.map(e=>(0,L.jsx)(O$,{watch:e},e.ref))}),d.length===0&&x$(a)&&(0,L.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:c?(0,L.jsxs)(L.Fragment,{children:[`It’s awaiting the results from `,v$(a,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,L.jsxs)(L.Fragment,{children:[v$(a,{watchers:!1}),` `,b$(a)===1?`is`:`are`,` still running. It resumes on its own when`,` `,b$(a)===1?`it finishes`:`one of them finishes`,`.`]})}),(0,L.jsx)(r1,{groups:d,divider:!!l}),p?(0,L.jsx)(`div`,{"data-awaiting-snooze":!0,className:`-mx-4 mt-3 flex flex-wrap items-center gap-x-2.5 gap-y-2 border-t border-border bg-fg/[0.03] px-4 py-2.5 ${jJ}`,children:(0,L.jsx)(o1,{thread:e,onSnooze:n,onSnoozeFailed:r})}):null]})}function c1(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.kind!==`event`||n.boundary!==`rest`)){for(let r=t-1;r>=0;r--){let t=e[r];if(t.role===`assistant`&&t.kind!==`event`&&t.kind!==`reasoning`)return{index:r,at:n.at}}return{index:-1,at:n.at}}}}function l1(e,t=Date.now()){return e!==void 0&&GT(e,t)!==void 0}function u1(){let[e,t]=(0,I.useState)(()=>Date.now());return(0,I.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function d1({thread:e}){let t=u1(),[n,r]=(0,I.useState)(!1),i=GT(e,t);if(!i)return null;let a=Date.parse(i),o=cT(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await Y.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),Z(`Snooze cleared`)}catch(e){Z((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,L.jsxs)(IJ,{"data-snooze-card":!0,icon:Um,label:`Snoozed`,children:[(0,L.jsx)(`div`,{"data-snooze-countdown":!0,title:new Date(a).toLocaleString(),className:`text-[22px] font-semibold leading-8 tracking-tight text-fg tabular-nums`,children:BE(a-t)}),(0,L.jsx)(`p`,{className:LJ,children:s?(0,L.jsxs)(L.Fragment,{children:[`Resumes `,o,` and sends: “`,fT(s),`”`]}):(0,L.jsxs)(L.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,L.jsx)(RJ,{children:(0,L.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${VJ} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}function f1({at:e,fallbackAt:t,className:n=``}){let r=TE(),i=sE(e,t),a=cE(i,r);return!a||!i?null:(0,L.jsx)(`time`,{dateTime:i,className:n,children:a})}var p1=1500;function m1(e,t){let n=0,r;function i(){r!==void 0&&(t.clearTimeout(r),r=void 0)}return{begin(){let a=++n;return e(!0),i(),r=t.setTimeout(()=>{a===n&&e(!1),r=void 0},p1),a},fail(t){t===n&&(i(),e(!1))},dispose(){n++,i()}}}var h1=`Could not copy terminal command`,g1={attach:`Attach command copied`,resume:`Resume command copied`},_1={attach:`Copy command to attach to this thread's live terminal`,resume:`Copy command to resume this thread in a new terminal`},v1=e=>[`terminalCommand`,e];function y1(e){return Y.threadTerminalCommand({slug:e}).then(e=>{if(!e.command)throw Error(e.reason??`No verified provider session is available to resume`);return{command:e.command,mode:e.mode===`attach`?`attach`:`resume`}})}async function b1(e){let t=y1(e);if(typeof ClipboardItem<`u`&&navigator.clipboard?.write)return await navigator.clipboard.write([new ClipboardItem({"text/plain":t.then(({command:e})=>new Blob([e],{type:`text/plain`}))})]),(await t).mode;let{command:n,mode:r}=await t;return await WR(n),r}function x1(e){let t=it({mutationFn:()=>b1(e)});return e=>t.mutate(void 0,{onSuccess:t=>{e?.onSuccess?.(),Z(g1[t])},onError:t=>{e?.onError?.(),Z(t instanceof Error?`${h1}: ${t.message}`:h1,{duration:7e3})}})}function S1({slug:e}){let[t,n]=(0,I.useState)(!1),r=(0,I.useRef)(null);r.current||=m1(n,{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let i=Ve(),a=x1(e);(0,I.useEffect)(()=>()=>r.current?.dispose(),[]);function o(){i.prefetchQuery({queryKey:v1(e),queryFn:()=>y1(e),staleTime:15e3})}function s(){let t=i.getQueryData(v1(e));if(t){WR(t.command).then(()=>{r.current?.begin(),Z(g1[t.mode])},()=>Z(h1,{duration:7e3}));return}a({onSuccess:()=>r.current?.begin()})}let c=i.getQueryData(v1(e)),l=t?c?g1[c.mode]:`Terminal command copied`:c?_1[c.mode]:`Copy terminal command`;return(0,L.jsx)(iM,{label:l,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":l,title:l,onClick:s,onPointerEnter:o,onFocus:o,className:xD,children:t?(0,L.jsx)(gm,{size:14,strokeWidth:2.2,className:`text-fg`}):(0,L.jsx)(vh,{size:14,strokeWidth:1.8})})})}function C1(e){let t=Math.max(e.scrollHeight-e.clientHeight,0),n=t-e.scrollTop,r=e.scrollHeight!==e.previousScrollHeight,i=r&&!e.readerMoved?e.following||n<=1:n<=4;return!i||!r||t<=0||n<=1?{following:i,scrollTop:null}:{following:i,scrollTop:t}}function w1(e){let t=e.scrollTop>640?!0:e.armed,n=t&&e.readerMoved&&e.scrollTop<=480&&e.hasEarlier&&!e.loading;return{armed:n?!1:t,shouldLoad:n}}function T1(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function E1(e,t,n){let r=[],i=new Map,a=null;return e.forEach((e,o)=>{if(e.queued||t(e))return;let s=e.sourceId??T1(e),c=i.get(s)??0;i.set(s,c+1),r.push({key:c===0?s:`${s}:${c}`,message:e,messageIndex:o,gap:a===null?0:n(a,e)}),a=e}),r}function D1(e,t,n){let r=e[t];if(!r||r.kind!==`event`||r.boundary!==`rest`)return!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(!(t.queued||n(t)))return!!t.boundary||t.wake===!0}return!0}function O1(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!D1(n,r,t))}var k1=new Set([`agent`,`follow up`,`interrupt`,`send message`,`spawn agent`,`wait for agents`]),A1=new Set([`poll process`,`wait`]);function j1(e){return(e.split(`__`).pop()||e).replaceAll(`_`,` `).trim()}function M1(e){return j1(e).toLowerCase()}function N1(e){return e.prompt!==void 0||e.agentId!==void 0||e.sendTo!==void 0||e.sendBody!==void 0||e.backgroundState!==void 0&&!I1(e)||F1(e)||P1(e)||k1.has(M1(e.name))}function P1(e){return e.ask!==void 0&&e.ask.length>0&&e.status!==void 0&&e.status!==`pending`}function F1(e){return e.outputImage!==void 0||e.sentImages!==void 0&&e.sentImages.length>0}function I1(e){return e.backgroundState===`unknown`&&A1.has(M1(e.name))}function L1(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(e.parts&&e.parts.length>0){let t=[];for(let n of e.parts)if(n.kind===`text`){if(n.text.trim())return null}else t.push(...n.tools);return t.length>0&&t.every(e=>!N1(e))?t:null}return e.text.trim()||e.tools.length===0?null:e.tools.every(e=>!N1(e))?e.tools:null}function R1(e){return e.role!==`assistant`||e.kind||e.queued||e.text.trim()||e.tools.length>0?!1:!e.parts?.some(e=>e.kind===`text`?e.text.trim().length>0:e.tools.length>0)}function z1(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(!e.parts?.length)return B1(e.tools);for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`text`){if(n.text.trim())return null;continue}if(n.tools.length!==0)return B1(n.tools)}return null}function B1(e){let t=[];for(let n=e.length-1;n>=0&&!N1(e[n]);n--)t.unshift(e[n]);return t.length>0?t:null}function V1(e){if(e.role!==`assistant`||e.kind||e.queued)return null;let t=[],n=e=>{for(let n of e){if(N1(n))return!0;t.push(n)}return!1};if(!e.parts?.length)return e.text.trim()?null:n(e.tools)&&t.length>0?t:null;for(let r of e.parts){if(r.kind===`text`){if(!r.text.trim())continue;return t.length>0?t:null}if(n(r.tools))return t.length>0?t:null}return null}function H1(e,t){return U1(e,new Set(t))}function U1(e,t){if(!e.parts?.length)return{...e,tools:e.tools.filter(e=>!t.has(e))};let n=e.parts.map(e=>e.kind===`text`?e:{kind:`tools`,tools:e.tools.filter(e=>!t.has(e))}).filter(e=>e.kind===`text`||e.tools.length>0);return{...e,tools:n.flatMap(e=>e.kind===`tools`?e.tools:[]),parts:n}}function W1(e,t,n){let r=[...e.tools,...t],i=e.parts?.map(e=>e.kind===`text`?e:{...e,tools:[...e.tools]})??[],a=-1;for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.kind===`text`){if(t.text.trim())break;continue}if(t.tools.length>0){a=e;break}}let o=i[a];return o?.kind===`tools`?i[a]={kind:`tools`,tools:[...o.tools,...t]}:i.push({kind:`tools`,tools:t}),{...e,at:n??e.at,tools:r,parts:i}}function G1(e){let t=[],n=null;return e.forEach((e,r)=>{if(R1(e))return;if(e.queued){t.push({message:e,messageIndex:r});return}let i=L1(e);if(i&&n){n.message=W1(n.message,i,e.at);return}let a=n?V1(e):null,o=a?H1(e,a):e;a&&n&&(n.message=W1(n.message,a,e.at));let s={message:o,messageIndex:r};t.push(s),z1(o)?(s.runStartedAt=o.at,n=s):n=null}),t}function K1(e){return e.status===`completed`||e.status===`failed`||e.status===`cancelled`}function q1(e){let t=J1(e);return t?.tools.some(e=>!K1(e))?t.tools.at(-1):void 0}function J1(e){let t=Y1(e);if(!t)return;let n=z1(t.message);return n?{tools:n,at:t.message.at}:void 0}function Y1(e){for(let t=e.length-1;t>=0;t--)if(!e[t].message.queued)return e[t]}function X1(e){let t=Y1(e);if(t)return z1(t.message)?t.runStartedAt??t.message.at:t.message.at}function Z1(e){return e.runStartedAt??e.message.at}function Q1(e){let t=z1(e);return t?U1(e,new Set(t)):e}function $1(e){let t;for(let n=e.length-1;n>=0;n--){let r=e[n].message;if(!r.queued){z1(r)&&(t=r);break}}if(!t)return[...e];let n=[];for(let r of e){let e=r.message===t?Q1(r.message):r.message;R1(e)||n.push(e===r.message?r:{...r,message:e})}return n}function e0(e){return e.detail?.trim()||void 0}var t0={add:`Adding`,analyze:`Analyzing`,apply:`Applying`,audit:`Auditing`,benchmark:`Benchmarking`,build:`Building`,bump:`Bumping`,capture:`Capturing`,check:`Checking`,clean:`Cleaning`,collect:`Collecting`,commit:`Committing`,compare:`Comparing`,confirm:`Confirming`,copy:`Copying`,count:`Counting`,create:`Creating`,debug:`Debugging`,delete:`Deleting`,diff:`Diffing`,disable:`Disabling`,dispatch:`Dispatching`,drive:`Driving`,dump:`Dumping`,edit:`Editing`,enable:`Enabling`,extract:`Extracting`,fetch:`Fetching`,find:`Finding`,fix:`Fixing`,format:`Formatting`,generate:`Generating`,grep:`Grepping`,inspect:`Inspecting`,install:`Installing`,kill:`Killing`,launch:`Launching`,lint:`Linting`,list:`Listing`,load:`Loading`,measure:`Measuring`,merge:`Merging`,migrate:`Migrating`,move:`Moving`,open:`Opening`,parse:`Parsing`,patch:`Patching`,poll:`Polling`,print:`Printing`,probe:`Probing`,profile:`Profiling`,publish:`Publishing`,pull:`Pulling`,push:`Pushing`,query:`Querying`,read:`Reading`,rebase:`Rebasing`,refactor:`Refactoring`,regenerate:`Regenerating`,remove:`Removing`,rename:`Renaming`,render:`Rendering`,reproduce:`Reproducing`,restart:`Restarting`,revert:`Reverting`,review:`Reviewing`,run:`Running`,save:`Saving`,scan:`Scanning`,search:`Searching`,seed:`Seeding`,spawn:`Spawning`,start:`Starting`,stop:`Stopping`,summarize:`Summarizing`,sync:`Syncing`,tag:`Tagging`,test:`Testing`,trace:`Tracing`,typecheck:`Typechecking`,update:`Updating`,validate:`Validating`,verify:`Verifying`,wait:`Waiting`,watch:`Watching`,write:`Writing`};function n0(e,t){let n=e?.trim();if(!n)return t;let r=n.indexOf(` `),i=(r===-1?n:n.slice(0,r)).replace(/[.:]$/,``);if(/ing$/i.test(i))return i.charAt(0).toUpperCase()+i.slice(1)+(r===-1?``:n.slice(r));let a=t0[i.toLowerCase()];return a?a+(r===-1?``:n.slice(r)):n.charAt(0).toUpperCase()+n.slice(1)}function r0(e,t,n){let r=t?.trim().replace(/[\\/]+$/,``);if(!r||!qf(r))return e;let i=tp(r);return i?rp(e.replace(i,``),n?.trim().replace(/[\\/]+$/,``)||/^([A-Za-z]:[\\/]Users[\\/][^\\/]+|\/(?:Users|home)\/[^/]+)(?=[\\/]|$)/.exec(r)?.[1]):e}function i0(e,t,n=Vf().home){return r0(a0(e),t,n)}function a0(e){let t=M1(e.name),n=e0(e),r=n?` ${n}`:``;return t===`bash`||t===`exec`||t===`run command`?n0(e.desc,n?`Running ${n}`:`Running a command`):t===`read`||t===`view image`?`Reading${r||` a file`}`:t===`grep`||t===`search`||t===`search query`||t===`find`?n?`Searching for ${n}`:`Searching`:t===`glob`||t===`find files`?n?`Finding ${n}`:`Finding files`:t===`edit`||t===`write`||t===`apply patch`?n?`Editing ${n}`:`Editing files`:t===`todos`||t===`update plan`?`Updating the plan`:t===`screenshot`||t===`snapshot`?n?`Capturing ${n}`:`Capturing the page`:t===`navigate`?n?`Navigating to ${n}`:`Navigating`:t===`evaluate`?`Evaluating the page`:t===`pages`?`Listing pages`:t===`new page`?`Opening a new page`:t===`close page`?`Closing the page`:t===`select page`?`Selecting a page`:t===`console`||t===`console message`?`Reading the console`:t===`network`||t===`network request`?`Inspecting network traffic`:t===`press key`?n?`Pressing ${n}`:`Pressing a key`:t===`fill form`?`Filling the form`:t===`dialog`?`Handling a dialog`:t===`upload`?n?`Uploading ${n}`:`Uploading a file`:t===`wait for`||t===`wait`?n?`Waiting for ${n}`:`Waiting`:t===`resize`?`Resizing the page`:t===`ask`?`Preparing a question`:t===`web`||t===`web search`?n?`Searching for ${n}`:`Searching the web`:`Using ${j1(e.name)||`a tool`}`}var o0=new Set([`edit`,`multiedit`,`write`,`apply patch`]);function s0(e){let t=new Set;for(let n of e){for(let e of n.edits??(n.edit?[n.edit]:[]))e.file.trim()&&t.add(e.file.trim());if(n.edit||n.edits?.length)continue;let e=n.detail?.trim();e&&o0.has(M1(n.name))&&t.add(e)}return t.size}function c0(e,t=0){let n=`Ran ${e} tool ${e===1?`call`:`calls`}`;return t===0?n:`${n}, edited ${t} file${t===1?``:`s`}`}function l0(e){return e>0?`${c0(e)}. Thinking…`:`Thinking…`}function u0(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function d0(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function f0(e,t){let n=u0(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function p0({directive:e,icon:t,title:n,meta:r,children:i}){return(0,L.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${kJ} border border-border bg-panel-2/75 p-4`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,L.jsx)(`div`,{className:`max-w-[calc(100%-1.5rem)] shrink-0 break-words text-[12px] font-medium leading-4 text-fg`,children:n}),r&&(0,L.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function m0({children:e,mono:t=!1}){return(0,L.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function h0({directive:e}){let t=e.attrs,n=u0(t,`display_name`)??u0(t,`skill_name`)??`Artifact template`,r=u0(t,`artifact_kind`),i=u0(t,`skill_name`),a=u0(t,`skill_directory`),[o,s]=(0,I.useState)(!!a);return(0,L.jsxs)(p0,{directive:e,icon:(0,L.jsx)(Jm,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,L.jsx)(m0,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,L.jsx)(`img`,{src:YS(`${a}/assets/preview.png`),alt:`${n} template preview`,loading:`lazy`,onError:()=>s(!1),className:`ml-6 mt-2 max-h-44 max-w-[calc(100%-1.5rem)] rounded-md border border-border object-contain`})]})}function g0({directive:e}){let t=e.attrs,n=u0(t,`file`),r=d0(t,`start`),i=d0(t,`end`)??r,a=d0(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,L.jsxs)(p0,{directive:e,icon:(0,L.jsx)($m,{size:15}),title:u0(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[u0(t,`body`)&&(0,L.jsx)(m0,{children:u0(t,`body`)}),n?(0,L.jsx)(`button`,{type:`button`,className:`local-file-action ml-6 mt-1 max-w-[calc(100%-1.5rem)] break-all text-left font-mono-keep text-[11px] leading-4 text-accent underline decoration-dotted underline-offset-2`,"data-local-path":n,title:o,children:o}):(0,L.jsx)(m0,{mono:!0,children:o})]})}var _0={"git-stage":[rh,`Changes staged`],"git-commit":[Lm,`Commit created`],"git-create-branch":[Im,`Branch created`],"git-push":[Sh,`Branch pushed`],"git-create-pr":[Vm,`Pull request created`]};function v0({directive:e}){let[t,n]=_0[e.name],r=u0(e.attrs,`branch`),i=f0(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,L.jsx)(p0,{directive:e,icon:(0,L.jsx)(t,{size:15}),title:i?(0,L.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,L.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function y0({directive:e}){let t=u0(e.attrs,`threadId`),n=u0(e.attrs,`pendingWorktreeId`);return(0,L.jsx)(p0,{directive:e,icon:(0,L.jsx)(nh,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,L.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function b0({directive:e}){let t=u0(e.attrs,`reason`);return(0,L.jsx)(p0,{directive:e,icon:(0,L.jsx)(um,{size:15}),title:`Archive suggested`,meta:t})}function x0(e){if(typeof e!=`string`||!e)return;let t=e.match(/(?:^|;)INTERVAL=(\d+)(?:;|$)/)?.[1];return/(?:^|;)FREQ=HOURLY(?:;|$)/.test(e)?`Every ${t??`1`} hour${t===`1`||t===void 0?``:`s`}`:/(?:^|;)FREQ=WEEKLY(?:;|$)/.test(e)?`Weekly schedule`:`Custom schedule`}function S0({directive:e}){let t=e.attrs,n=u0(t,`mode`),r=u0(t,`name`)??`Automation`,i=x0(t.rrule),a=[r,n,u0(t,`status`),i].filter(Boolean).join(` · `);return(0,L.jsx)(p0,{directive:e,icon:(0,L.jsx)(hm,{size:15}),title:`Automation suggested`,meta:a,children:u0(t,`prompt`)&&(0,L.jsx)(m0,{children:u0(t,`prompt`)})})}function C0({directive:e}){return e.name===`artifact-template`?(0,L.jsx)(h0,{directive:e}):e.name===`code-comment`?(0,L.jsx)(g0,{directive:e}):e.name.startsWith(`git-`)?(0,L.jsx)(v0,{directive:e}):e.name===`created-thread`?(0,L.jsx)(y0,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,L.jsx)(b0,{directive:e}):(0,L.jsx)(S0,{directive:e})}var w0;function T0(){return w0??=ib(async()=>{let{default:e}=await import(`./mermaid.core-Bo-3lWY-.js`);return{default:e}},__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`dark`,themeVariables:{background:`#181b20`,primaryColor:`#181b20`,primaryTextColor:`#e6e7e9`,primaryBorderColor:`#33363c`,lineColor:`#8b8f96`,secondaryColor:`#26282d`,tertiaryColor:`#0d0e10`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}),e)),w0}function E0({source:e}){let t=(0,I.useId)(),[n,r]=(0,I.useState)({}),i=Fq(n.html??``);return(0,I.useEffect)(()=>{let n=!0;if(r({}),e.length>5e4)return r({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{n=!1};let i=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}`;return T0().then(t=>t.render(i,e)).then(({svg:e})=>{n&&r({html:e})}).catch(e=>{if(!n)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;r({error:t.slice(0,240)})}).finally(()=>document.getElementById(`d${i}`)?.remove()),()=>{n=!1}},[t,e]),n.error?(0,L.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${kJ} border border-border bg-panel-2/75 p-4`,children:[(0,L.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,L.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:n.error}),(0,L.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap rounded-md bg-bg p-2 font-mono-keep text-[11px] text-muted`,children:e})]}):n.html?(0,L.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${kJ} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:i}):(0,L.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${kJ} bg-panel-2`})}var D0=(0,I.createContext)(null),O0=(0,I.createContext)(null);function k0(){let e=(0,I.useContext)(D0),t=(0,I.useContext)(O0);return e??t}var A0=(0,I.createContext)(null);function j0(e){return e.status===`pending`&&e.backgroundState===`background`}function M0(e){let t=[];for(let n of e)for(let e of n.tools)j0(e)&&n.at&&t.push({label:e.desc??e.detail??e.command??`Background command`,startedAt:n.at,state:`running`,...e.shellId?{launchId:e.shellId}:{},...e.command?{command:e.command}:{}});return t}function N0(e){return e.map(e=>{if(!e.tools.some(j0))return e;let t=e.tools.filter(e=>!j0(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!j0(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}function P0({slug:e,onStatusApplied:t,onClose:n,virtualized:r=!1,showReturnToQueue:i=!1}){let a=Gp(qC(),e);return(0,L.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,L.jsx)(K0,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:i}),(0,L.jsx)(F0,{slug:e,virtualized:r}),a&&(0,L.jsx)(MZ,{thread:a,sticky:!0,safeArea:!0,onArchived:t})]})}function F0({slug:e,virtualized:t}){let n=qC(),r=Gp(n,e),i=r?.runtime===`running`||r?.runtime===`spawning`,a=x1(e),o=sw(e,{poll:i}),s=Ve(),c=(0,I.useRef)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(null),p=(0,I.useMemo)(()=>o.data?.messages??[],[o.data]),m=(0,I.useMemo)(()=>M0(p),[p]),h=(0,I.useMemo)(()=>N0(p),[p]),g=(0,I.useMemo)(()=>o2(h),[h]),_=(0,I.useMemo)(()=>i?c1(h):void 0,[i,h]),v=_&&_.index>=0?_.index:g,y=(0,I.useMemo)(()=>G1(h),[h]),b=i?J1(y):void 0,x=i?q1(y):void 0,S=x?i0(x,n?.projectDir):void 0,C=i?X1(y):void 0,w=i1(r),T=(0,I.useMemo)(()=>{let e=i?$1(y):y;return O1(e,s2(e,v,w))},[y,i,v,w]),E=i,D=(0,I.useMemo)(()=>oY(p),[p]),O=(0,I.useMemo)(()=>tY(p,r?.answersInFlight),[p,r?.answersInFlight]),k=(0,I.useMemo)(()=>yX(p),[p]),A={thread:r,showWorking:E,registeredDone:DJ(r,g>=0?h[g]?.text:void 0),restedCard:HJ(r,g>=0?h[g]?.text:void 0),errorVisible:WJ(h,r?.providerError)},{answeringForMessage:j}=nX(e,p),M=(0,I.useMemo)(()=>pY(p,r?.questions??[]),[p,r?.questions]),N=(0,I.useMemo)(()=>xY(p,r?.questions??[]),[p,r?.questions]),P=Xl(r?.spawnedAt),ee=(0,I.useRef)(null),[F,te]=(0,I.useState)(null),ne=o.data?.messages.length??0,re=!o.isLoading;(0,I.useEffect)(()=>{if(t)return;let e=ee.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=4&&(e.scrollTop=e.scrollHeight)},[ne,i,t]);let ie=(0,I.useCallback)(async()=>{if(c.current)return;let t=s.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){c.current=!0,u(!0),f(null);try{let t=await Y.threadTranscriptEarlier({slug:e,cursor:n}),i=s.getQueryData([`transcript`,e]);if(!i?.transcriptKey||i.transcriptKey!==r||t.transcriptKey!==r){await o.refetch(),Z(`Transcript changed while loading history; refreshed the current session`);return}s.setQueryData([`transcript`,e],Mx(i,t))}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;f(t)}finally{c.current=!1,u(!1)}}},[o,s,e]);return(0,L.jsx)(D0.Provider,{value:e,children:(0,L.jsx)(p$,{thread:r,children:(0,L.jsxs)(`div`,{"data-drawer-scroll-ready":o.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,L.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,L.jsx)(`div`,{ref:ee,"data-drawer-transcript-scroll":!0,"data-virtualized-transcript-scroll":t||void 0,tabIndex:t?0:void 0,role:t?`region`:void 0,"aria-label":t?`Thread conversation`:void 0,"aria-busy":t&&l?!0:void 0,className:`relative min-h-0 flex-1 overflow-y-auto pb-3 outline-none [overflow-anchor:none] focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:t&&ne>0?(0,L.jsx)(W0,{slug:e,transcriptRef:ee,transcriptKey:o.data?.transcriptKey,messages:h,paired:D,inFlightAnswers:O,answeringForMessage:j,placement:N,fencesLive:P,thread:r,running:i,copyTerminalCommand:a,transportFallback:o.transportFallback,isFetching:o.isFetching,refresh:()=>void o.refetch(),retryLiveUpdates:o.retryLiveUpdates,hasEarlier:o.data?.hasEarlier===!0,beforeCursor:o.data?.beforeCursor,loadingEarlier:l,earlierError:d,loadEarlier:()=>void ie(),jumpOverlay:F}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(HQ,{thread:r,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,L.jsx)(h$,{thread:r,inFlight:O,className:`px-6 pt-5`}),o.transportFallback&&(0,L.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`mx-6 mt-3 flex flex-wrap items-center gap-2.5 rounded-xl border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:o.transportFallback.kind===`payload-too-large`?`Live payload ${o.transportFallback.actualBytes} bytes; socket limit ${o.transportFallback.maxBytes} bytes`:`Transcript read budget reached (${o.transportFallback.scope}); retry after about ${o.transportFallback.retryAfterMs}ms`,children:[(0,L.jsx)(xh,{size:13,className:`shrink-0 text-muted`}),(0,L.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,o.transportFallback.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,L.jsx)(`button`,{type:`button`,disabled:o.isFetching,onClick:()=>void o.refetch(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:o.isFetching?`Refreshing…`:`Refresh once`}),(0,L.jsx)(`button`,{type:`button`,onClick:o.retryLiveUpdates,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]}),(0,L.jsx)(`div`,{"data-transcript-column":!0,className:`flex min-h-full flex-col px-6 py-5`,children:ne===0?(0,L.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:o.isPending?(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(d4,{}),` Loading…`]}):i?(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(d4,{}),` Session starting…`]}):TX(r)?(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,L.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>Y.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`}):(0,L.jsxs)(L.Fragment,{children:[d2(T.map(e=>e.message),(e,t)=>{let n=T[t].messageIndex;return(0,L.jsx)(K2,{m:e,answering:P?j(e):void 0,showSendButton:!0,paired:D[n],staleAwaiting:v>=0&&n<v,restingCardShown:n===g&&w,restedAt:_&&n===_.index?_.at??``:void 0,shadowedBy:M.get(n),placed:N.placed.get(n),thread:r},t)},e=>!!e.queued),re&&V0(A)!==null&&(0,L.jsx)(SY,{h:H0(A,T.map(e=>e.message))}),re&&(0,L.jsx)(U0,{state:A,slug:e,retryText:k>=0?p[k]?.text:void 0,onTerminal:a,liveRuntimeStart:C,liveActivityLabel:S,liveToolRun:b}),r?.permPolicy?(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(r4,{policy:r.permPolicy,denies:r.permDenies})}):null,p.some(e=>e.queued)&&(0,L.jsx)(SY,{}),(0,L.jsx)(`div`,{className:`flex flex-col gap-3.5`,children:p.map((e,t)=>e.queued?(0,L.jsx)(K2,{m:e,paired:D[t]},`q${t}`):null)})]})})]})}),(0,L.jsx)(`div`,{ref:te,"data-transcript-overlay":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-end p-4 [&>*]:pointer-events-auto`})]}),(0,L.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel`,children:(0,L.jsx)(XX,{slug:e,onTerminal:a,ops:(0,L.jsx)(i4,{slug:e,transcriptShells:m,className:`px-1 pt-1.5`})})})]})})})}var I0=700,L0=250,R0=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function z0(e){return e?.pendingInteraction===!0}function B0(e){return z0(e)?void 0:e?.pendingAsk}function V0({thread:e,showWorking:t,registeredDone:n,restedCard:r,errorVisible:i}){return e?.providerError?.retrying?`provider-error`:e?.providerFault&&!e.foreign?`provider-fault`:e?.limitPause&&!e.foreign?`limit-pause`:B0(e)?`pending-ask`:e?.runtime===`perm-prompt`&&!z0(e)?`perm-prompt`:t?`working`:e?.providerError?i?null:`provider-error`:l1(e)?`snooze`:i1(e)?`resting`:n?`registered-done`:r?`rested`:null}function H0(e,t){return V0(e)===`working`?u2(t):14}function U0({state:e,slug:t,retryText:n,onTerminal:r,liveRuntimeStart:i,liveActivityLabel:a,liveToolRun:o}){let s=e.thread;switch(V0(e)){case`provider-fault`:return(0,L.jsx)(e4,{slug:t,sessionId:s.sessionId,fault:s.providerFault,retryText:n});case`provider-error`:return(0,L.jsx)(GJ,{error:s.providerError});case`limit-pause`:return(0,L.jsx)(t4,{slug:t,sessionId:s.sessionId,pause:s.limitPause});case`pending-ask`:return(0,L.jsx)(a4,{ask:B0(s),onTerminal:r});case`perm-prompt`:return(0,L.jsx)(n4,{onTerminal:r});case`working`:return(0,L.jsx)(f4,{since:s?.lastUserAt,startedAt:i,activityLabel:a,run:o});case`snooze`:return(0,L.jsx)(d1,{thread:s});case`resting`:return(0,L.jsx)(s1,{thread:s});case`registered-done`:return(0,L.jsx)($2,{fenceKind:`done`,body:s.lastFence.body,hints:[]});case`rested`:return(0,L.jsx)(UJ,{thread:s});default:return null}}function W0({slug:e,transcriptRef:t,transcriptKey:n,messages:r,paired:i,inFlightAnswers:a,answeringForMessage:o,placement:s,fencesLive:c,thread:l,running:u,copyTerminalCommand:d,transportFallback:f,isFetching:p,refresh:m,retryLiveUpdates:h,hasEarlier:g,beforeCursor:_,loadingEarlier:v,earlierError:y,loadEarlier:b,jumpOverlay:x}){let S=JC(),C=(0,I.useMemo)(()=>G1(r),[r]),w=u?J1(C):void 0,T=u?q1(C):void 0,E=T?i0(T,S):void 0,D=u?X1(C):void 0,O=(0,I.useMemo)(()=>o2(r),[r]),k=(0,I.useMemo)(()=>u?c1(r):void 0,[u,r]),A=k&&k.index>=0?k.index:O,j=i1(l),M=(0,I.useMemo)(()=>{let e=u?$1(C):C;return O1(e,s2(e,A,j))},[C,u,A,j]),N=u,P=(0,I.useMemo)(()=>E1(M.map(e=>e.message),s2(M,A,j),i2).map(e=>{let t=M[e.messageIndex];return{...e,messageIndex:t.messageIndex,stampAt:Z1(t)}}),[M,A,j]),ee=(0,I.useMemo)(()=>yX(r),[r]),F=DJ(l,O>=0?r[O]?.text:void 0),te=HJ(l,O>=0?r[O]?.text:void 0),ne=WJ(r,l?.providerError),re={thread:l,showWorking:N,registeredDone:F,restedCard:te,errorVisible:ne},ie=V0(re)!==null,ae=(0,I.useMemo)(()=>H0({thread:l,showWorking:N,registeredDone:F,restedCard:te,errorVisible:ne},M.map(e=>e.message)),[M,N,l,F,te,ne]),oe=(0,I.useMemo)(()=>{let e=[],t=new Map,n=r.length-1,i=(l?.questions??[]).filter(e=>!s.placedIds.has(e.id));for(let[a,o]of uY(r,i,{atRest:!u})){if(a>=n){e.push(...o);continue}let r=-1;for(let e=0;e<P.length&&!(P[e].messageIndex>a);e++)r=e;let i=t.get(r);i?i.push(...o):t.set(r,[...o])}return{byRow:t,tail:e}},[P,r,s.placedIds,u,l?.questions]),se=(0,I.useMemo)(()=>pY(r,l?.questions??[]),[r,l?.questions]),ce=(0,I.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];f&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(g||v||y)&&e.push({key:`earlier-history:${_??`complete`}`,kind:`earlier-history`});let t=oe.byRow.get(-1);t&&e.push({key:`questions:head`,kind:`questions`,questions:t}),P.forEach((t,n)=>{e.push({...t,kind:`message`});let r=oe.byRow.get(n);r&&e.push({key:`questions:${t.key}`,kind:`questions`,questions:r})}),e.push({key:`interactions`,kind:`interactions`}),ie&&e.push({key:`runtime-status`,kind:`runtime-status`});let n=ie||P.length>0?14:0;return r.forEach((t,r)=>{if(!t.queued)return;let i=`queued:${t.deliveryId??t.sourceId??r}`;e.push({key:i,kind:`queued`,message:t,messageIndex:r,gap:n}),n=14}),e},[_,y,g,ie,v,P,r,oe,f]),le=Yw({count:ce.length,getScrollElement:()=>t.current,getItemKey:e=>ce[e]?.key??e,estimateSize:e=>{let t=ce[e];return t?t.kind===`head-anchor`||t.kind===`interactions`?1:t.kind===`earlier-history`?42:t.kind===`transport-fallback`?76:t.kind===`runtime-status`?54:t.kind===`questions`?220:t.kind===`message`?108+t.gap:82+t.gap:80},overscan:8,paddingStart:20,paddingEnd:20,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:4,scrollToFn:(e,{adjustments:t,behavior:n},r)=>{let i=r.scrollElement;i&&i.scrollTo({top:t===void 0?e:i.scrollTop+t,behavior:n})}}),[ue,de]=(0,I.useState)(!0),fe=(0,I.useRef)(!0),pe=(0,I.useRef)(-1),me=(0,I.useRef)(0),he=(0,I.useRef)(null),ge=(0,I.useRef)(!1),_e=(0,I.useRef)(!1),ve=(0,I.useRef)(!0),ye=(0,I.useRef)(null),be=(0,I.useRef)(void 0),xe=(0,I.useRef)(null),Se=(0,I.useRef)(void 0),Ce=(0,I.useRef)(0),we=(0,I.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(ye.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}b()},[b,t]),Te=(0,I.useCallback)((e,n)=>{let r=t.current;if(!r)return;let i=Array.from(r.querySelectorAll(`[data-transcript-source-id]`)).find(t=>t.dataset.transcriptSourceId===e);i&&(r.scrollTop+=i.getBoundingClientRect().top-n)},[t]);(0,I.useLayoutEffect)(()=>{if(!n||ce.length===0||be.current===n)return;be.current=n,ge.current=!1,_e.current=!1,ve.current=!0;let t=_D(e)?.candidates.map(e=>({candidate:e,index:ce.findIndex(t=>t.kind===`message`&&t.message.sourceId===e.sourceId)})).find(e=>e.index>=0),r=requestAnimationFrame(()=>{if(!t){le.scrollToEnd({behavior:`instant`}),de(!0),ge.current=!0;return}le.scrollToIndex(t.index,{align:`start`,behavior:`instant`}),fe.current=!1,de(!1),ge.current=!0;let e=performance.now()+L0;Ce.current=e;let n=()=>{performance.now()>=e||performance.now()<me.current||(Te(t.candidate.sourceId,t.candidate.screenTop),r=requestAnimationFrame(n))};n()});return()=>cancelAnimationFrame(r)},[Te,ce.length,e,n,le]),(0,I.useLayoutEffect)(()=>{let e=ye.current,n=t.current;if(!e||!n||v)return;let r=()=>{let t=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!t)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=r-e.viewportTop};r();let i=0,a=requestAnimationFrame(()=>{r(),i=requestAnimationFrame(()=>{r(),ye.current===e&&(ye.current=null)})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(i)}},[v,P.length,t]);let Ee=(0,I.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),De=(0,I.useCallback)(e=>{let n=t.current;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),Oe=P[0]?.key;(0,I.useLayoutEffect)(()=>{let e=Se.current;if(Se.current=Oe,e===void 0||e===Oe||!ge.current||fe.current||ye.current)return;let t=xe.current;if(!t)return;De(t);let n=()=>{if(performance.now()<me.current)return;let e=xe.current;e&&De(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[De,Oe]);let ke=(0,I.useCallback)(()=>{let e=t.current;if(!e||ye.current||performance.now()<Ce.current)return;let n=C1({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:pe.current,following:fe.current,readerMoved:performance.now()<me.current});if(fe.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),pe.current=e.scrollHeight,de(e=>e===n.following?e:n.following),R0&&!n.following&&performance.now()>=me.current){let t=xe.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey);if(t&&n){let r=Math.round(n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.viewportTop);Math.abs(r)>2&&console.warn(`[frizz] transcript moved ${r}px under a still reader — row=${t.rowKey}`)}}xe.current=Ee()??xe.current},[Ee,t]);(0,I.useLayoutEffect)(ke),(0,I.useEffect)(()=>{let e=he.current;if(!e)return;let t=new ResizeObserver(ke);return t.observe(e),()=>t.disconnect()},[ke]),(0,I.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{ke();let t=w1({armed:ve.current,scrollTop:e.scrollTop,readerMoved:ge.current&&_e.current,hasEarlier:g,loading:v});ve.current=t.armed,t.shouldLoad&&we()},r=()=>{_e.current=!0,me.current=performance.now()+I0,requestAnimationFrame(n)},i=t=>{[`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)&&(e.scrollTop<=480&&(ve.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(ve.current=!0),r()},o=()=>{e.scrollTop<=480&&(ve.current=!0),r()};e.addEventListener(`scroll`,n,{passive:!0}),e.addEventListener(`wheel`,a,{passive:!0}),e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`pointerdown`,r,{passive:!0}),e.addEventListener(`keydown`,i);let s=requestAnimationFrame(n);return()=>{cancelAnimationFrame(s),e.removeEventListener(`scroll`,n),e.removeEventListener(`wheel`,a),e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,o),e.removeEventListener(`pointerdown`,r),e.removeEventListener(`keydown`,i)}},[g,v,we,ke,t]);let Ae=le.getVirtualItems(),je=le.getTotalSize();return(0,L.jsxs)(`div`,{ref:he,"data-virtualized-transcript":!0,"data-virtual-row-count":Ae.length,className:`relative w-full`,style:{height:je},children:[Ae.map(t=>{let n=ce[t.index];return n?(0,L.jsx)(`div`,{ref:le.measureElement,"data-index":t.index,"data-transcript-row-key":n.key,"data-transcript-source-id":n.kind===`message`?n.message.sourceId:void 0,className:`absolute left-0 top-0 w-full hover:z-[1]`,style:{transform:`translateY(${t.start}px)`},children:n.kind===`head-anchor`?null:n.kind===`interactions`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(HQ,{thread:l,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,L.jsx)(h$,{thread:l,questions:oe.tail,inFlight:a,showSend:s.placedIds.size>0,className:`px-6 pt-5`})]}):n.kind===`questions`?(0,L.jsx)(h$,{thread:l,questions:n.questions,className:`px-6 pt-5`}):n.kind===`transport-fallback`?f?(0,L.jsx)(`div`,{className:`px-6 pt-3`,children:(0,L.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${kJ} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:f.kind===`payload-too-large`?`Live payload ${f.actualBytes} bytes; socket limit ${f.maxBytes} bytes`:`Transcript read budget reached (${f.scope}); retry after about ${f.retryAfterMs}ms`,children:[(0,L.jsx)(xh,{size:13,className:`shrink-0 text-muted`}),(0,L.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,f.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,L.jsx)(`button`,{type:`button`,disabled:p,onClick:m,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:p?`Refreshing…`:`Refresh once`}),(0,L.jsx)(`button`,{type:`button`,onClick:h,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]})}):null:n.kind===`earlier-history`?(0,L.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:y?(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,L.jsx)(`span`,{children:y}),(0,L.jsx)(`button`,{type:`button`,onClick:we,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):v?(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Xm,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,L.jsx)(`button`,{type:`button`,onClick:we,className:`rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:`Load earlier messages`})}):n.kind===`message`?(0,L.jsx)($Z,{at:n.stampAt,host:SX(n.message,i[n.messageIndex]),gap:n.gap,children:(0,L.jsx)(K2,{m:n.message,answering:c?o(n.message):void 0,showSendButton:!0,paired:i[n.messageIndex],staleAwaiting:A>=0&&n.messageIndex<A,restingCardShown:n.messageIndex===O&&j,restedAt:k&&n.messageIndex===k.index?k.at??``:void 0,shadowedBy:se.get(n.messageIndex),placed:s.placed.get(n.messageIndex),thread:l})}):n.kind===`runtime-status`?(0,L.jsxs)(`div`,{className:`px-6`,style:{paddingTop:ae},children:[(0,L.jsx)(U0,{state:re,slug:e,retryText:ee>=0?r[ee]?.text:void 0,onTerminal:d,liveRuntimeStart:D,liveActivityLabel:E,liveToolRun:w}),l?.permPolicy?(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(r4,{policy:l.permPolicy,denies:l.permDenies})}):null]}):(0,L.jsx)($Z,{at:n.message.at,host:SX(n.message,i[n.messageIndex]),gap:n.gap,children:(0,L.jsx)(K2,{m:n.message,paired:i[n.messageIndex]})})},n.key):null}),(0,L.jsx)(G0,{overlay:x,hidden:ue,onJump:()=>le.scrollToEnd({behavior:`smooth`})})]})}function G0({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,ot.createPortal)((0,L.jsxs)(`button`,{type:`button`,"data-jump-to-latest":!0,onClick:n,className:`flex items-center gap-1.5 rounded-full border border-border-strong bg-elevated px-3 py-1.5 text-[11px] font-medium text-fg shadow-lg shadow-black/30 hover:bg-panel-2`,children:[(0,L.jsx)(dm,{size:12}),`Jump to latest`]}),e)}function K0({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1}){let i=Gp(qC(),e),a=it({mutationFn:()=>Y.markComplete({slug:e})}),o=it({mutationFn:t=>Y.renameThread({slug:e,title:t})}),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(``),d=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!s)return;let e=requestAnimationFrame(()=>{d.current?.focus(),d.current?.select()});return()=>cancelAnimationFrame(e)},[s]),(0,I.useEffect)(()=>{c(!1),u(``)},[e]);let f=LK(nt({queryKey:[`threadBody`,e],queryFn:()=>Y.threadBody({slug:e})}).data?.markdown??``).trim().length>0;if(!i)return null;let p=i.kind===`session`&&i.foreign!==!0,m=i.foreign===!0,h=i.kind===`session`&&!m,g=CT(i);function _(){c(!1),u(``)}function v(){let e=EX(l,g);if(c(!1),!e){u(``);return}o.mutate(e,{onSuccess:()=>{u(``),Z(`Thread renamed`)},onError:t=>{u(e),c(!0),Z(t instanceof Error?t.message:`Could not rename thread`)}})}return(0,L.jsxs)(`header`,{"data-thread-header":!0,className:kX,children:[(0,L.jsx)(`div`,{className:AX,children:(0,L.jsxs)(`div`,{className:`min-w-0 leading-tight`,children:[(0,L.jsxs)(`div`,{className:`group/thread-title flex min-w-0 items-center gap-2`,children:[s?(0,L.jsx)(`input`,{ref:d,"aria-label":`Thread title`,value:l,maxLength:200,onChange:e=>u(e.target.value),onBlur:v,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),v()):e.key===`Escape`&&(e.preventDefault(),_())},className:`min-w-0 flex-1 rounded-md border border-border bg-elevated px-1.5 py-1 font-semibold text-[15px] text-fg outline-none focus:border-accent`}):h?(0,L.jsx)(`button`,{type:`button`,title:`Edit title`,"aria-label":`Edit thread title: ${g}`,disabled:o.isPending,onClick:()=>{u(DX(g,i.id)),c(!0)},className:`min-w-0 max-w-full shrink truncate rounded px-0.5 -mx-0.5 font-semibold text-[15px] text-left outline-none transition-colors hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-40`,children:g}):(0,L.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px]`,title:g,children:g}),(0,L.jsx)(LZ,{thread:i,hidden:s})]}),(0,L.jsx)(f1,{at:PT(i),fallbackAt:i.spawnedAt,className:`mt-0.5 block truncate text-[11px] leading-tight text-muted/75`})]})}),(0,L.jsxs)(`div`,{className:jX,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[p&&(0,L.jsx)(S1,{slug:e}),(0,L.jsx)(nZ,{thread:i,collapse:r,onDoc:f?()=>_p(`doc`,i.id):void 0,onDone:()=>a.mutate(void 0,{onSuccess:t}),doneBusy:a.isPending,onStatusApplied:t}),n&&(0,L.jsx)(aM,{slug:e})]}),n&&(0,L.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:n,className:`ml-0.5 shrink-0 rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,L.jsx)(Ch,{size:15})})]})]})}function q0(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||HZ(e))return null;if(e.parts&&e.parts.length>0){for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`tools`?n.tools.length>0:n.text.trim())return n.kind===`tools`?n.tools:null}return null}return(e.tools?.length??0)>0&&!e.text.trim()?e.tools:null}function J0(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||HZ(e))return null;if(e.parts&&e.parts.length>0){for(let t of e.parts)if(t.kind===`tools`?t.tools.length>0:t.text.trim())return t.kind===`tools`?t.tools:null;return null}return(e.tools?.length??0)>0?e.tools:null}function Y0(e){return q0(e)!==null}function X0(e){return J0(e)!==null}function Z0(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function Q0(e){return Z0(e)||Y0(e)}function $0(e){return Z0(e)||X0(e)}function e2(e){if(Z0(e))return!0;let t=q0(e);return t!==null&&!N1(t[t.length-1])}function t2(e){if(Z0(e))return!0;let t=J0(e);return t!==null&&!N1(t[0])}function n2(e){let t=q0(e);return t!==null&&F1(t[t.length-1])}function r2(e){let t=J0(e);return t!==null&&F1(t[0])}function i2(e,t){let n=n2(e)||r2(t),r=!n&&Q0(e)&&$0(t)&&!(e2(e)&&t2(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function a2(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.every(n=>n.kind===`tools`?n.tools.length===0:c2(e,n.text,t)):(e.tools?.length??0)===0&&c2(e,e.text,t)}function o2(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function s2(e,t,n=!1){let r=new WeakSet;if(t>=0)for(let n of e)n.messageIndex<t&&r.add(n.message);if(t>=0&&n)for(let n of e)n.messageIndex===t&&r.add(n.message);return e=>a2(e,r.has(e))}function c2(e,t,n){return!e.fenceRefused&&!n?!t.trim():EJ(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`)}function l2(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.some(n=>n.kind===`text`&&!c2(e,n.text,t)):typeof e.text==`string`&&!c2(e,e.text,t)}function u2(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.queued||a2(n)))return n2(n)?22:Q0(n)&&!e2(n)?6:14+(n.role===`user`?3:0)}return 0}function d2(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||a2(e)||(i!==null&&r.push((0,L.jsx)(SY,{h:i2(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function f2(e){let t=[];for(let n of e){if(n.kind===`text`){if(!n.text.trim())continue;t.push(n);continue}if(n.tools.length===0)continue;let e=t[t.length-1];e&&e.kind===`tools`?t[t.length-1]={kind:`tools`,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function p2(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{n>0&&r.push((0,L.jsx)(SY,{h:typeof t==`number`?t:t(n)},`vs${n}`)),r.push(e)}),r}var m2={head:!1,tail:!1};function h2(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function g2(e){return{head:F1(e[0]),tail:F1(e[e.length-1])}}function _2(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.edit){let r=!!(n.input||n.output||n.status||n.exitCode!==void 0);e&&e.edits&&!r&&!e.input&&!e.output&&!e.status&&e.edits[0].file===n.edit.file?e.edits.push(n.edit):t.push({name:n.name,detail:n.detail,edits:[n.edit],input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}else n.command?t.push({name:n.name,detail:n.detail,command:n.command,desc:n.desc,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):n.outputImage?t.push({name:n.name,detail:n.detail,outputImage:n.outputImage,output:n.output??n.read,status:n.status,durationMs:n.durationMs,count:1}):n.read?t.push({name:n.name,detail:n.detail,read:n.read,status:n.status,durationMs:n.durationMs,count:1}):n.prompt||n.agentId?t.push({name:n.name,detail:n.detail,prompt:n.prompt,input:n.input,subagentType:n.subagentType,agentId:n.agentId,agentStatus:n.agentStatus,agentElapsedMs:n.agentElapsedMs,output:n.output,status:n.status,durationMs:n.durationMs,count:1}):n.sendTo!==void 0||n.sendBody!==void 0?t.push({name:n.name,detail:n.detail,sendTo:n.sendTo,sendSummary:n.sendSummary,sendBody:n.sendBody,sendType:n.sendType,sendDispatchId:n.sendDispatchId,sendTargetLabel:n.sendTargetLabel,status:n.status,durationMs:n.durationMs,count:1}):n.todos?t.push({name:n.name,detail:n.detail,todos:n.todos,input:n.input,status:n.status,durationMs:n.durationMs,count:1}):P1(n)?t.push({name:n.name,detail:n.detail,ask:n.ask,askAnswers:n.askAnswers,status:n.status,durationMs:n.durationMs,count:1}):n.sentImages||n.sentFiles?t.push({name:n.name,detail:n.detail,sentImages:n.sentImages,sentFiles:n.sentFiles,caption:n.caption,status:n.status,durationMs:n.durationMs,count:1}):n.input||n.output?t.push({name:n.name,detail:n.detail,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):e&&!e.edits&&!e.command&&!e.input&&!e.output&&!e.read&&!e.prompt&&!e.outputImage&&!e.sentImages&&!e.sentFiles&&e.sendTo===void 0&&e.sendBody===void 0&&e.name===n.name&&e.detail===n.detail&&e.status===n.status&&e.backgroundState===n.backgroundState&&e.exitCode===n.exitCode&&e.cwd===n.cwd&&e.sessionId===n.sessionId&&e.durationMs===n.durationMs?e.count++:t.push({name:n.name,detail:n.detail,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}return t}function v2(e){return e.split(`__`).pop()||e}function y2(e){let t=X.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function b2({tools:e,at:t}){let[n,r]=(0,I.useState)(!1),i=(0,I.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=c0(a,s0(e));return(0,L.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${a} tool ${a===1?`call`:`calls`}: ${o}`,className:`group flex w-full min-w-0 items-baseline gap-1.5 rounded py-0.5 text-left outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 ${eQ}`,children:[(0,L.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,L.jsx)(ym,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:nQ(n)})]}),n&&(0,L.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:p2(e.map((e,n)=>(0,L.jsx)(S2,{t:e,startedAt:t},n)),6)}),!n&&(0,L.jsx)(`div`,{id:i,hidden:!0})]})}function x2({tools:e,at:t}){let n=[];for(let t of e){let e=N1(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,L.jsx)(`div`,{className:`flex flex-col`,children:p2(n.map((e,n)=>e.exceptional?(0,L.jsx)(`div`,{className:`flex flex-col`,children:p2(e.tools.map((e,n)=>(0,L.jsx)(S2,{t:e,startedAt:t},n)),h2(e.tools.map(e=>g2([e])),6))},`exceptions-${n}`):(0,L.jsx)(b2,{tools:e.tools,at:t},`activity-${n}`)),h2(n.map(e=>g2(e.tools)),6))})}function S2({t:e,startedAt:t}){let n=(0,I.useContext)(D0),r=qC(),i=NE(e,(n?Gp(r,n):void 0)?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,L.jsx)(Mq,{edits:e.edits,meta:(0,L.jsx)(D2,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,L.jsx)(F2,{command:e.command,desc:e.desc??e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t}):e.outputImage?(0,L.jsx)(M2,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,L.jsx)(L2,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,L.jsx)(z2,{detail:e.detail,prompt:e.prompt,input:e.input,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs,output:e.output}):e.sendTo!==void 0||e.sendBody!==void 0?(0,L.jsx)(V2,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs,at:t}):e.sentImages||e.sentFiles?(0,L.jsx)(N2,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,L.jsx)(nJ,{todos:e.todos,note:e.input,meta:(0,L.jsx)(D2,{status:e.status,durationMs:e.durationMs})}):P1(e)?(0,L.jsx)(C2,{ask:e.ask??[],askAnswers:e.askAnswers}):e.input||e.output?(0,L.jsx)(F2,{name:e.name,command:e.input??``,desc:e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,inputLabel:`input`,startedAt:t}):(0,L.jsx)(j2,{name:e.name,detail:e.detail,count:e.count,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,cwd:e.cwd,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t})}function C2({ask:e,askAnswers:t}){return(0,L.jsx)(`div`,{"data-settled-ask":!0,className:`flex flex-col gap-1.5`,children:e.map((e,n)=>{let r=RQ(e,t?.[n]);return(0,L.jsx)(oX,{question:r.question,settled:{chosenIdxs:r.chosenIdxs,text:r.text}},n)})})}function w2({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,L.jsxs)(`span`,{className:`petite-caps frizz-tool-header-caps flex shrink-0 items-center gap-1 whitespace-nowrap text-[11.5px] leading-none ${e}`,title:i,"aria-label":i,children:[t,(0,L.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function T2(e,t,n){let[r,i]=(0,I.useState)(()=>Date.now()),a=AE(e,t),o=jE(e,t,n,r);return(0,I.useEffect)(()=>{if(!a||o)return;let e=n?Date.parse(n):NaN;if(!Number.isFinite(e))return;let t=setTimeout(()=>i(Date.now()),Math.max(kE-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function E2({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=T2(e,t,r),a=n===`running`?(0,L.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,L.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`tool-quiet`,title:ZE}):OE(e,t)||i?(0,L.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,L.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:a}):null}function D2({status:e,backgroundState:t,liveBackgroundState:n,exitCode:r,durationMs:i}){if(!e&&i===void 0)return null;let[a,o]=n===`running`?[`running`,`background running`]:n===`stale`?[`stale`,`background stale`]:e===`pending`?t===`unknown`?[`unknown`,`background / unknown`]:[`running`,t===`background`?`background running`:`running`]:e===`failed`?r===void 0?[`failed`,`failed`]:[`exit ${r}`,`exit ${r}`]:e===`cancelled`?[`cancelled`,`cancelled`]:e===`completed`?[`done`,`done`]:[void 0,void 0],s=i===void 0?void 0:PE(i),c=[o,s].filter(Boolean).join(` · `);return(0,L.jsx)(w2,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-amber-400`:`text-muted/55`,title:c,label:a,duration:s})}function O2(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,I.useState)(()=>Date.now());return(0,I.useEffect)(()=>{if(!i)return;let e=()=>o(Date.now()),t,n=setTimeout(()=>{e(),t=setInterval(e,1e3)},1e3-Date.now()%1e3);return()=>{clearTimeout(n),t&&clearInterval(t)}},[i,t]),i?Math.max(a-r,0):n}function k2(e,t,n){let r=t&&t!==X.board?.projectDir?`in ${y2(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function A2(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function j2({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=k2(t,s,c),f=d?y2(d):void 0,p=t&&A2(t)?t:void 0;return(0,L.jsx)(`div`,{className:`frizz-bash`,title:d,children:(0,L.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(E2,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,L.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:v2(e)}),f&&(p?(0,L.jsx)(`span`,{className:`min-w-0 truncate`,onClick:e=>e.stopPropagation(),children:(0,L.jsx)(jq,{path:p,className:`text-[11.5px] text-muted`,children:f})}):(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:f}))]}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(D2,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,L.jsxs)(`span`,{className:`tabular-nums text-[11px] text-muted/45`,children:[`×`,n]})]})]})})}function M2({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let o=t?y2(t):void 0,s=(0,L.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:v2(e)}),o&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:t,children:o})]}),(0,L.jsx)(`span`,{className:`flex shrink-0 items-center gap-2`,children:(0,L.jsx)(D2,{status:i,durationMs:a})})]});return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(J2,{path:n,hideCaption:!0,altText:o?`${v2(e)}: ${o}`:v2(e),header:s}),r&&(0,L.jsx)(`pre`,{className:`frizz-bash frizz-bash-body frizz-bash-output-body mt-1.5`,children:r})]})}function N2({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,I.useState)(!0),s=(0,I.useId)(),c=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,L.jsxs)(`div`,{className:`frizz-bash`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":s,"aria-expanded":a,"aria-label":`${a?`Collapse`:`Expand`} files sent to you${c?`: ${c}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Sent to you`}),c&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:c})]}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(D2,{status:r,durationMs:i}),(0,L.jsx)(ym,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${a?`rotate-90`:``}`})]})]}),(0,L.jsx)(`div`,{id:s,hidden:!a,children:a&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[e.map((e,t)=>(0,L.jsx)(J2,{path:e,hideCaption:!0,altText:n??`delivered image`},`i${t}`)),t.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,L.jsx)(Y2,{path:e},`f${t}`))}),n&&(0,L.jsx)(`div`,{className:`max-w-[65%] text-[12px] leading-snug text-muted`,children:n})]})})]})}var P2=16;function F2({command:e,desc:t,output:n,name:r=`Bash`,status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,sessionId:c,durationMs:l,inputLabel:u,startedAt:d}){let[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),v=(0,I.useId)(),y=O2(i,d,l),b=(0,I.useMemo)(()=>e.split(`
314
314
  `).length,[e]),x=b>P2,S=(0,I.useMemo)(()=>n?n.split(`
315
315
  `).length:0,[n]),C=S>P2,w=k2(t,void 0,c),T=!!(e||n);return(0,L.jsxs)(`div`,{className:`frizz-bash`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>T&&p(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":T?v:void 0,"aria-expanded":T?f:void 0,"aria-label":`${T?`${f?`Collapse`:`Expand`} `:``}${v2(r)}${w?`: ${w}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(E2,{status:i,backgroundState:a,liveBackgroundState:o,startedAt:d}),(0,L.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:v2(r)}),(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:w,children:w??``})]}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(D2,{status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,durationMs:y}),T&&(0,L.jsx)(ym,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${f?`rotate-90`:``}`})]})]}),T&&(0,L.jsxs)(`div`,{id:v,hidden:!f,children:[f&&e&&(0,L.jsxs)(L.Fragment,{children:[u&&(0,L.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:u}),(0,L.jsx)(Xq,{text:e,language:u?`plaintext`:`bash`,className:`frizz-bash-body${u?` frizz-bash-output-body`:``}${x&&!m?` frizz-bash-clamp`:``}`}),x&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:m?`Collapse`:`Show all ${b} lines`})]}),f&&n&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`output`}),(0,L.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body${C&&!g?` frizz-bash-clamp`:``}`,children:n}),C&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>_(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:g?`Collapse`:`Show all ${S} lines`})]})]})]})}var I2=16;function L2({detail:e,read:t,status:n,durationMs:r}){let[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(!1),c=(0,I.useId)(),l=(0,I.useMemo)(()=>t.split(`
316
316
  `).length,[t]),u=l>I2,d=e?y2(e):void 0,f=e&&A2(e)?e:void 0;return(0,L.jsxs)(`div`,{className:`frizz-bash`,children:[(0,L.jsxs)(Aq,{className:`frizz-bash-header`,controls:c,expanded:i,label:`${i?`Collapse`:`Expand`} Read${e?`: ${e}`:``}`,onToggle:()=>a(e=>!e),meta:(0,L.jsx)(D2,{status:n,durationMs:r}),children:[(0,L.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Read`}),d&&(f?(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,L.jsx)(jq,{path:f,className:`text-[11.5px] text-muted`,children:d})}):(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:d}))]}),(0,L.jsx)(`div`,{id:c,hidden:!i,children:i&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xq,{text:t,language:DS(e),className:`frizz-bash-body${u&&!o?` frizz-bash-clamp`:``}`}),u&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:o?`Collapse`:`Show all ${l} lines`})]})})]})}var R2=16;function z2({detail:e,prompt:t,input:n,subagentType:r,agentId:i,agentStatus:a,agentElapsedMs:o,status:s,durationMs:c,output:l}){let[u,d]=(0,I.useState)(!1),[f,p]=(0,I.useState)(!1),m=(0,I.useId)(),h=t??n,g=(0,I.useMemo)(()=>h?h.split(`