@jait/gateway 0.1.533 → 0.1.534

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 (56) hide show
  1. package/package.json +1 -1
  2. package/web-dist/assets/{_basePickBy-DnCTBRP5.js → _basePickBy-nRzIaxP2.js} +1 -1
  3. package/web-dist/assets/{_baseUniq-CoptRluT.js → _baseUniq-BeHwEWiO.js} +1 -1
  4. package/web-dist/assets/{arc-BqmABdis.js → arc-XnPnBf_F.js} +1 -1
  5. package/web-dist/assets/{architectureDiagram-2XIMDMQ5-BnxgHiHD.js → architectureDiagram-2XIMDMQ5-D7Cs9zUf.js} +1 -1
  6. package/web-dist/assets/{blockDiagram-WCTKOSBZ-oZSw42CW.js → blockDiagram-WCTKOSBZ-Bz8AeP4b.js} +1 -1
  7. package/web-dist/assets/{c4Diagram-IC4MRINW-BOzaNXK7.js → c4Diagram-IC4MRINW-CBzV98Qe.js} +1 -1
  8. package/web-dist/assets/channel-qZANQpCS.js +1 -0
  9. package/web-dist/assets/{chunk-4BX2VUAB-DlMd-J39.js → chunk-4BX2VUAB-DSGXfl7B.js} +1 -1
  10. package/web-dist/assets/{chunk-55IACEB6-Ei7ux0wC.js → chunk-55IACEB6-DtZlQmKR.js} +1 -1
  11. package/web-dist/assets/{chunk-FMBD7UC4-CFcFIaMh.js → chunk-FMBD7UC4-D7KjCGqt.js} +1 -1
  12. package/web-dist/assets/{chunk-JSJVCQXG-fgfHD2jD.js → chunk-JSJVCQXG-D96624tq.js} +1 -1
  13. package/web-dist/assets/{chunk-KX2RTZJC-CZgOcR_R.js → chunk-KX2RTZJC-BUgvm4qV.js} +1 -1
  14. package/web-dist/assets/{chunk-NQ4KR5QH-Cd-ebLnA.js → chunk-NQ4KR5QH-xjcjinUQ.js} +1 -1
  15. package/web-dist/assets/{chunk-QZHKN3VN-D7tEh00f.js → chunk-QZHKN3VN-uo6uE3Gy.js} +1 -1
  16. package/web-dist/assets/{chunk-WL4C6EOR-BqzA-COI.js → chunk-WL4C6EOR-eS5ISPNI.js} +1 -1
  17. package/web-dist/assets/classDiagram-VBA2DB6C-JNVtn0w7.js +1 -0
  18. package/web-dist/assets/classDiagram-v2-RAHNMMFH-JNVtn0w7.js +1 -0
  19. package/web-dist/assets/clone-DBthyWDQ.js +1 -0
  20. package/web-dist/assets/{cose-bilkent-S5V4N54A-qyQOdIdo.js → cose-bilkent-S5V4N54A-06j-dUkk.js} +1 -1
  21. package/web-dist/assets/{dagre-KLK3FWXG-NZhPNhMW.js → dagre-KLK3FWXG-3ki_LOOM.js} +1 -1
  22. package/web-dist/assets/{diagram-E7M64L7V-13slynO_.js → diagram-E7M64L7V-DvxYS4vM.js} +1 -1
  23. package/web-dist/assets/{diagram-IFDJBPK2-_kmWclxF.js → diagram-IFDJBPK2-21O6kr93.js} +1 -1
  24. package/web-dist/assets/{diagram-P4PSJMXO-Cgem35Ym.js → diagram-P4PSJMXO-Cbsyt6Gs.js} +1 -1
  25. package/web-dist/assets/{erDiagram-INFDFZHY-CUBKFJ6q.js → erDiagram-INFDFZHY-Bee1DAgo.js} +1 -1
  26. package/web-dist/assets/{flowDiagram-PKNHOUZH-DxA4mpTS.js → flowDiagram-PKNHOUZH-CglkA6AQ.js} +1 -1
  27. package/web-dist/assets/{ganttDiagram-A5KZAMGK-DN864NFf.js → ganttDiagram-A5KZAMGK-Cu1B0De9.js} +1 -1
  28. package/web-dist/assets/{gitGraphDiagram-K3NZZRJ6-KV4gJGNe.js → gitGraphDiagram-K3NZZRJ6-HKy0H0y9.js} +1 -1
  29. package/web-dist/assets/{graph-3MEHcZ9V.js → graph-CgAkUTqY.js} +1 -1
  30. package/web-dist/assets/{index-YCk3k0sX.js → index-BDg20qR7.js} +1 -1
  31. package/web-dist/assets/{index-XnY1AlSL.js → index-DcZqwsWW.js} +1 -1
  32. package/web-dist/assets/{index-sT1dAdlx.js → index-oelCKh3N.js} +5 -5
  33. package/web-dist/assets/{infoDiagram-LFFYTUFH-C-5588N4.js → infoDiagram-LFFYTUFH-SIXp09w7.js} +1 -1
  34. package/web-dist/assets/{ishikawaDiagram-PHBUUO56-CGBkxSvB.js → ishikawaDiagram-PHBUUO56-C8ot5FTh.js} +1 -1
  35. package/web-dist/assets/{journeyDiagram-4ABVD52K-BJQ73CEY.js → journeyDiagram-4ABVD52K-CgVCGXlc.js} +1 -1
  36. package/web-dist/assets/{kanban-definition-K7BYSVSG-Crarbala.js → kanban-definition-K7BYSVSG-Be9BBTIb.js} +1 -1
  37. package/web-dist/assets/{layout-BdbaMK9D.js → layout-BKLpXmG5.js} +1 -1
  38. package/web-dist/assets/{linear-CsJh77hQ.js → linear-B4dVqiUd.js} +1 -1
  39. package/web-dist/assets/{mindmap-definition-YRQLILUH-CiODXVD6.js → mindmap-definition-YRQLILUH-Dk0nd2_l.js} +1 -1
  40. package/web-dist/assets/{pieDiagram-SKSYHLDU-Bx9yjqXE.js → pieDiagram-SKSYHLDU-C9S12F53.js} +1 -1
  41. package/web-dist/assets/{quadrantDiagram-337W2JSQ-D4Q_28kp.js → quadrantDiagram-337W2JSQ-Dh3vbLvN.js} +1 -1
  42. package/web-dist/assets/{requirementDiagram-Z7DCOOCP-D4kOlANe.js → requirementDiagram-Z7DCOOCP-C3TgXeOA.js} +1 -1
  43. package/web-dist/assets/{sankeyDiagram-WA2Y5GQK-BfBuHxxg.js → sankeyDiagram-WA2Y5GQK-CYFw-fgv.js} +1 -1
  44. package/web-dist/assets/{sequenceDiagram-2WXFIKYE-CQVRIihX.js → sequenceDiagram-2WXFIKYE-Vx0NgNh6.js} +1 -1
  45. package/web-dist/assets/{stateDiagram-RAJIS63D-DR35Qjwc.js → stateDiagram-RAJIS63D-vVKVdyAg.js} +1 -1
  46. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-Bn1EqFCn.js +1 -0
  47. package/web-dist/assets/{timeline-definition-YZTLITO2-5TpIUxnL.js → timeline-definition-YZTLITO2-C7zuY5DX.js} +1 -1
  48. package/web-dist/assets/{treemap-KZPCXAKY-B1-okpH2.js → treemap-KZPCXAKY-BV-FQax3.js} +1 -1
  49. package/web-dist/assets/{vennDiagram-LZ73GAT5-mn4mC3uT.js → vennDiagram-LZ73GAT5-C16ci4of.js} +1 -1
  50. package/web-dist/assets/{xychartDiagram-JWTSCODW-3NzJEq_p.js → xychartDiagram-JWTSCODW-BGjJmP2y.js} +1 -1
  51. package/web-dist/index.html +1 -1
  52. package/web-dist/assets/channel-BKDHjBwN.js +0 -1
  53. package/web-dist/assets/classDiagram-VBA2DB6C-DRd91lBt.js +0 -1
  54. package/web-dist/assets/classDiagram-v2-RAHNMMFH-DRd91lBt.js +0 -1
  55. package/web-dist/assets/clone-CwQPpGdV.js +0 -1
  56. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-D_Azcqlt.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-DA-rfuFy.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./angular-ts-BrjP3tb8.js","./scss-D5BDwBP9.js","./astro-HNnZUWAn.js","./json-Cp-IABpG.js","./typescript-BPQ3VLAy.js","./postcss-CXtECtnM.js","./tsx-COt5Ahok.js","./blade-BjGOyj-B.js","./html-derivative-DlHx6ybY.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./sql-BLtJtn59.js","./coffee-Ch7k5sss.js","./cpp-CofmeUqb.js","./regexp-CDVJQ6XC.js","./glsl-DplSGwfg.js","./c-BIGW1oBm.js","./graphql-ChdNCCLP.js","./jsx-g9-lgVsj.js","./haml-D5jkg6IW.js","./handlebars-BpdQsYii.js","./yaml-Buea-lGh.js","./http-jrhK8wxY.js","./shellscript-Yzrsuije.js","./hurl-irOxFIW8.js","./csv-fuZLfV_i.js","./jinja-f2NsQr07.js","./jison-wvAkD_A8.js","./julia-CxzCAyBv.js","./python-B6aJPvgy.js","./r-Dspwwk_N.js","./marko-DjSrsDqO.js","./less-B1dDrJ26.js","./mdc-DTYItulj.js","./markdown-Cvjx9yec.js","./php-R6g_5hLQ.js","./pug-DKIMFp6K.js","./svelte-Cy7k_4gC.js","./ts-tags-DQrlYJgV.js","./vue-D2xRrEX4.js","./vue-html-AaS7Mt5G.js","./vue-vine-BoDAl6tE.js","./stylus-BEDo0Tqx.js","./dagre-KLK3FWXG-NZhPNhMW.js","./graph-3MEHcZ9V.js","./_baseUniq-CoptRluT.js","./layout-BdbaMK9D.js","./_basePickBy-DnCTBRP5.js","./clone-CwQPpGdV.js","./cose-bilkent-S5V4N54A-qyQOdIdo.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-BOzaNXK7.js","./chunk-JSJVCQXG-fgfHD2jD.js","./flowDiagram-PKNHOUZH-DxA4mpTS.js","./chunk-FMBD7UC4-CFcFIaMh.js","./chunk-55IACEB6-Ei7ux0wC.js","./chunk-KX2RTZJC-CZgOcR_R.js","./channel-BKDHjBwN.js","./erDiagram-INFDFZHY-CUBKFJ6q.js","./gitGraphDiagram-K3NZZRJ6-KV4gJGNe.js","./chunk-4BX2VUAB-DlMd-J39.js","./chunk-QZHKN3VN-D7tEh00f.js","./treemap-KZPCXAKY-B1-okpH2.js","./ganttDiagram-A5KZAMGK-DN864NFf.js","./linear-CsJh77hQ.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-C-5588N4.js","./pieDiagram-SKSYHLDU-Bx9yjqXE.js","./arc-BqmABdis.js","./quadrantDiagram-337W2JSQ-D4Q_28kp.js","./xychartDiagram-JWTSCODW-3NzJEq_p.js","./requirementDiagram-Z7DCOOCP-D4kOlANe.js","./sequenceDiagram-2WXFIKYE-CQVRIihX.js","./classDiagram-VBA2DB6C-DRd91lBt.js","./chunk-WL4C6EOR-BqzA-COI.js","./classDiagram-v2-RAHNMMFH-DRd91lBt.js","./stateDiagram-RAJIS63D-DR35Qjwc.js","./chunk-NQ4KR5QH-Cd-ebLnA.js","./stateDiagram-v2-FVOUBMTO-D_Azcqlt.js","./journeyDiagram-4ABVD52K-BJQ73CEY.js","./timeline-definition-YZTLITO2-5TpIUxnL.js","./mindmap-definition-YRQLILUH-CiODXVD6.js","./kanban-definition-K7BYSVSG-Crarbala.js","./diagram-P4PSJMXO-Cgem35Ym.js","./diagram-IFDJBPK2-_kmWclxF.js","./blockDiagram-WCTKOSBZ-oZSw42CW.js","./architectureDiagram-2XIMDMQ5-BnxgHiHD.js","./diagram-E7M64L7V-13slynO_.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-DA-rfuFy.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./angular-ts-BrjP3tb8.js","./scss-D5BDwBP9.js","./astro-HNnZUWAn.js","./json-Cp-IABpG.js","./typescript-BPQ3VLAy.js","./postcss-CXtECtnM.js","./tsx-COt5Ahok.js","./blade-BjGOyj-B.js","./html-derivative-DlHx6ybY.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./sql-BLtJtn59.js","./coffee-Ch7k5sss.js","./cpp-CofmeUqb.js","./regexp-CDVJQ6XC.js","./glsl-DplSGwfg.js","./c-BIGW1oBm.js","./graphql-ChdNCCLP.js","./jsx-g9-lgVsj.js","./haml-D5jkg6IW.js","./handlebars-BpdQsYii.js","./yaml-Buea-lGh.js","./http-jrhK8wxY.js","./shellscript-Yzrsuije.js","./hurl-irOxFIW8.js","./csv-fuZLfV_i.js","./jinja-f2NsQr07.js","./jison-wvAkD_A8.js","./julia-CxzCAyBv.js","./python-B6aJPvgy.js","./r-Dspwwk_N.js","./marko-DjSrsDqO.js","./less-B1dDrJ26.js","./mdc-DTYItulj.js","./markdown-Cvjx9yec.js","./php-R6g_5hLQ.js","./pug-DKIMFp6K.js","./svelte-Cy7k_4gC.js","./ts-tags-DQrlYJgV.js","./vue-D2xRrEX4.js","./vue-html-AaS7Mt5G.js","./vue-vine-BoDAl6tE.js","./stylus-BEDo0Tqx.js","./dagre-KLK3FWXG-3ki_LOOM.js","./graph-CgAkUTqY.js","./_baseUniq-BeHwEWiO.js","./layout-BKLpXmG5.js","./_basePickBy-nRzIaxP2.js","./clone-DBthyWDQ.js","./cose-bilkent-S5V4N54A-06j-dUkk.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-CBzV98Qe.js","./chunk-JSJVCQXG-D96624tq.js","./flowDiagram-PKNHOUZH-CglkA6AQ.js","./chunk-FMBD7UC4-D7KjCGqt.js","./chunk-55IACEB6-DtZlQmKR.js","./chunk-KX2RTZJC-BUgvm4qV.js","./channel-qZANQpCS.js","./erDiagram-INFDFZHY-Bee1DAgo.js","./gitGraphDiagram-K3NZZRJ6-HKy0H0y9.js","./chunk-4BX2VUAB-DSGXfl7B.js","./chunk-QZHKN3VN-uo6uE3Gy.js","./treemap-KZPCXAKY-BV-FQax3.js","./ganttDiagram-A5KZAMGK-Cu1B0De9.js","./linear-B4dVqiUd.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-SIXp09w7.js","./pieDiagram-SKSYHLDU-C9S12F53.js","./arc-XnPnBf_F.js","./quadrantDiagram-337W2JSQ-Dh3vbLvN.js","./xychartDiagram-JWTSCODW-BGjJmP2y.js","./requirementDiagram-Z7DCOOCP-C3TgXeOA.js","./sequenceDiagram-2WXFIKYE-Vx0NgNh6.js","./classDiagram-VBA2DB6C-JNVtn0w7.js","./chunk-WL4C6EOR-eS5ISPNI.js","./classDiagram-v2-RAHNMMFH-JNVtn0w7.js","./stateDiagram-RAJIS63D-vVKVdyAg.js","./chunk-NQ4KR5QH-xjcjinUQ.js","./stateDiagram-v2-FVOUBMTO-Bn1EqFCn.js","./journeyDiagram-4ABVD52K-CgVCGXlc.js","./timeline-definition-YZTLITO2-C7zuY5DX.js","./mindmap-definition-YRQLILUH-Dk0nd2_l.js","./kanban-definition-K7BYSVSG-Be9BBTIb.js","./diagram-P4PSJMXO-Cbsyt6Gs.js","./diagram-IFDJBPK2-21O6kr93.js","./blockDiagram-WCTKOSBZ-Bz8AeP4b.js","./architectureDiagram-2XIMDMQ5-D7Cs9zUf.js","./diagram-E7M64L7V-DvxYS4vM.js"])))=>i.map(i=>d[i]);
2
2
  var dpe=Object.defineProperty;var hpe=(e,n,r)=>n in e?dpe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Xe=(e,n,r)=>hpe(e,typeof n!="symbol"?n+"":n,r);function fpe(e,n){for(var r=0;r<n.length;r++){const i=n[r];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=r(s);fetch(s.href,a)}})();function F0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i_t(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if(typeof n=="function"){var r=function i(){return this instanceof i?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};r.prototype=n.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}),r}var A6={exports:{}},Lv={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -959,7 +959,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
959
959
  monaco.config({ paths: { vs: '...' } })
960
960
 
961
961
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
962
- `},_F=aDe(uDe)(rte),dDe={config:lDe},hDe=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return function(s){return r.reduceRight(function(a,o){return o(a)},s)}};function ite(e,n){return Object.keys(n).forEach(function(r){n[r]instanceof Object&&e[r]&&Object.assign(n[r],ite(e[r],n[r]))}),xF(xF({},e),n)}var fDe={type:"cancelation",msg:"operation is manually canceled"};function mE(e){var n=!1,r=new Promise(function(i,s){e.then(function(a){return n?s(fDe):i(a)}),e.catch(s)});return r.cancel=function(){return n=!0},r}var pDe=["monaco"],mDe=iDe.create({config:sDe,isInitialized:!1,resolve:null,reject:null,monaco:null}),ste=z$e(mDe,2),bS=ste[0],B4=ste[1];function gDe(e){var n=dDe.config(e),r=n.monaco,i=I$e(n,pDe);B4(function(s){return{config:ite(s.config,i),monaco:r}})}function yDe(){var e=bS(function(n){var r=n.monaco,i=n.isInitialized,s=n.resolve;return{monaco:r,isInitialized:i,resolve:s}});if(!e.isInitialized){if(B4({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),mE(gE);if(window.monaco&&window.monaco.editor)return ate(window.monaco),e.resolve(window.monaco),mE(gE);hDe(xDe,bDe)(_De)}return mE(gE)}function xDe(e){return document.body.appendChild(e)}function vDe(e){var n=document.createElement("script");return e&&(n.src=e),n}function bDe(e){var n=bS(function(i){var s=i.config,a=i.reject;return{config:s,reject:a}}),r=vDe("".concat(n.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=n.reject,r}function _De(){var e=bS(function(r){var i=r.config,s=r.resolve,a=r.reject;return{config:i,resolve:s,reject:a}}),n=window.require;n.config(e.config),n(["vs/editor/editor.main"],function(r){var i=r.m||r;ate(i),e.resolve(i)},function(r){e.reject(r)})}function ate(e){bS().monaco||B4({monaco:e})}function wDe(){return bS(function(e){var n=e.monaco;return n})}var gE=new Promise(function(e,n){return B4({resolve:e,reject:n})}),z4={config:gDe,init:yDe,__getMonacoInstance:wDe};const ote=Object.freeze(JSON.parse('{"colors":{"actionBar.toggledBackground":"#383a49","activityBarBadge.background":"#007ACC","checkbox.border":"#6B6B6B","editor.background":"#1E1E1E","editor.foreground":"#D4D4D4","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","input.placeholderForeground":"#A6A6A6","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#252526","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","ports.iconRunningProcessForeground":"#369432","sideBarSectionHeader.background":"#0000","sideBarSectionHeader.border":"#ccc3","sideBarTitle.foreground":"#BBBBBB","statusBarItem.remoteBackground":"#16825D","statusBarItem.remoteForeground":"#FFF","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedForeground":"#ffffffa0","terminal.inactiveSelectionBackground":"#3A3D41","widget.border":"#303031"},"displayName":"Dark Plus","name":"dark-plus","semanticHighlighting":true,"semanticTokenColors":{"customLiteral":"#DCDCAA","newOperator":"#C586C0","numberLiteral":"#b5cea8","stringLiteral":"#ce9178"},"tokenColors":[{"scope":["meta.embedded","source.groovy.embedded","string meta.image.inline.markdown","variable.legacy.builtin.python"],"settings":{"foreground":"#D4D4D4"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#6A9955"}},{"scope":"constant.language","settings":{"foreground":"#569cd6"}},{"scope":["constant.numeric","variable.other.enummember","keyword.operator.plus.exponent","keyword.operator.minus.exponent"],"settings":{"foreground":"#b5cea8"}},{"scope":"constant.regexp","settings":{"foreground":"#646695"}},{"scope":"entity.name.tag","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.tag.css","entity.name.tag.less"],"settings":{"foreground":"#d7ba7d"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#9cdcfe"}},{"scope":["entity.other.attribute-name.class.css","source.css entity.other.attribute-name.class","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.parent.less","source.css entity.other.attribute-name.pseudo-class","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.scss"],"settings":{"foreground":"#d7ba7d"}},{"scope":"invalid","settings":{"foreground":"#f44747"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.strikethrough","settings":{"fontStyle":"strikethrough"}},{"scope":"markup.inserted","settings":{"foreground":"#b5cea8"}},{"scope":"markup.deleted","settings":{"foreground":"#ce9178"}},{"scope":"markup.changed","settings":{"foreground":"#569cd6"}},{"scope":"punctuation.definition.quote.begin.markdown","settings":{"foreground":"#6A9955"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#6796e6"}},{"scope":"markup.inline.raw","settings":{"foreground":"#ce9178"}},{"scope":"punctuation.definition.tag","settings":{"foreground":"#808080"}},{"scope":["meta.preprocessor","entity.name.function.preprocessor"],"settings":{"foreground":"#569cd6"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#ce9178"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#b5cea8"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#9cdcfe"}},{"scope":"meta.diff.header","settings":{"foreground":"#569cd6"}},{"scope":"storage","settings":{"foreground":"#569cd6"}},{"scope":"storage.type","settings":{"foreground":"#569cd6"}},{"scope":["storage.modifier","keyword.operator.noexcept"],"settings":{"foreground":"#569cd6"}},{"scope":["string","meta.embedded.assembly"],"settings":{"foreground":"#ce9178"}},{"scope":"string.tag","settings":{"foreground":"#ce9178"}},{"scope":"string.value","settings":{"foreground":"#ce9178"}},{"scope":"string.regexp","settings":{"foreground":"#d16969"}},{"scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#569cd6"}},{"scope":["meta.template.expression"],"settings":{"foreground":"#d4d4d4"}},{"scope":["support.type.vendored.property-name","support.type.property-name","source.css variable","source.coffee.embedded"],"settings":{"foreground":"#9cdcfe"}},{"scope":"keyword","settings":{"foreground":"#569cd6"}},{"scope":"keyword.control","settings":{"foreground":"#569cd6"}},{"scope":"keyword.operator","settings":{"foreground":"#d4d4d4"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.alignof","keyword.operator.typeid","keyword.operator.alignas","keyword.operator.instanceof","keyword.operator.logical.python","keyword.operator.wordlike"],"settings":{"foreground":"#569cd6"}},{"scope":"keyword.other.unit","settings":{"foreground":"#b5cea8"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#569cd6"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#9cdcfe"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#b5cea8"}},{"scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#d4d4d4"}},{"scope":"variable.language","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.function","support.function","support.constant.handlebars","source.powershell variable.other.member","entity.name.operator.custom-literal"],"settings":{"foreground":"#DCDCAA"}},{"scope":["support.class","support.type","entity.name.type","entity.name.namespace","entity.other.attribute","entity.name.scope-resolution","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#4EC9B0"}},{"scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class","punctuation.separator.namespace.ruby"],"settings":{"foreground":"#4EC9B0"}},{"scope":["keyword.control","source.cpp keyword.operator.new","keyword.operator.delete","keyword.other.using","keyword.other.directive.using","keyword.other.operator","entity.name.operator"],"settings":{"foreground":"#C586C0"}},{"scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable","constant.other.placeholder"],"settings":{"foreground":"#9CDCFE"}},{"scope":["variable.other.constant","variable.other.enummember"],"settings":{"foreground":"#4FC1FF"}},{"scope":["meta.object-literal.key"],"settings":{"foreground":"#9CDCFE"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#CE9178"}},{"scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#CE9178"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#DCDCAA"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#d7ba7d"}},{"scope":["constant.character","constant.other.option"],"settings":{"foreground":"#569cd6"}},{"scope":"constant.character.escape","settings":{"foreground":"#d7ba7d"}},{"scope":"entity.name.label","settings":{"foreground":"#C8C8C8"}}],"type":"dark"}')),SDe=Object.freeze(Object.defineProperty({__proto__:null,default:ote},Symbol.toStringTag,{value:"Module"})),kDe=["editor theme","vscode theme","monaco theme","workbench colors"],yE=new Set,Qw="dark-plus",wF=new WeakSet,SF=ote,CDe={"editor.background":"#0B0C0E","editorGutter.background":"#0B0C0E","editorStickyScroll.background":"#0B0C0E","editorStickyScrollGutter.background":"#0B0C0E","minimap.background":"#0B0C0E","editor.lineHighlightBackground":"#151922","editorWidget.background":"#16181D","editorHoverWidget.background":"#16181D","editorWidget.border":"#363B44","editorHoverWidget.border":"#363B44","editorGroupHeader.tabsBackground":"#0B0C0E"},jDe={base:"vs-dark",inherit:!1,rules:[...cte(SF.tokenColors??[]),...MDe()],colors:{...ute(SF.colors??{}),...CDe}};function NDe(){return kDe}function lte(e){var n,r;(r=(n=e==null?void 0:e.editor)==null?void 0:n.defineTheme)==null||r.call(n,Qw,jDe)}function TDe(e){!e||typeof e!="object"||wF.has(e)||(wF.add(e),Promise.all([nt(()=>import("./index-YCk3k0sX.js"),[],import.meta.url),nt(()=>import("./index-XnY1AlSL.js"),[],import.meta.url)]).then(async([{shikiToMonaco:n},{createHighlighter:r}])=>{var l,u,d;const i=e.languages,s=new Set(((l=i==null?void 0:i.getLanguages)==null?void 0:l.call(i).map(h=>h.id))??[]);for(const h of["javascript","typescript","json","css","html","markdown","python","yaml","diff"])s.has(h)||((u=i==null?void 0:i.register)==null||u.call(i,{id:h}),s.add(h));const a=await r({themes:["dark-plus"],langs:["javascript","typescript","jsx","tsx","json","css","html","markdown","python","yaml","diff"]});n(a,e),lte(e);const o=e.editor;typeof document<"u"&&document.documentElement.dataset.monacoTheme===Qw&&((d=o==null?void 0:o.setTheme)==null||d.call(o,Qw))}).catch(n=>{console.error("Failed to initialize Shiki Monaco Dark Plus theme:",n)}))}function EDe(e){var o;const n=ADe(e.text),r=ute(n.colors??{}),i=LDe(n,r),s=((o=n.name)==null?void 0:o.trim())||e.sourceLabel.trim()||"Imported Theme",a=`jait-vscode-${HDe(s)}-${e.id}`;return{id:e.id,name:s,sourceLabel:e.sourceLabel,importedAt:e.importedAt??new Date().toISOString(),colorMode:i,monacoThemeName:a,monacoThemeData:{base:i==="dark"?"vs-dark":"vs",inherit:!0,rules:cte(n.tokenColors??[]),colors:r},cssVariables:PDe(r),rawColors:r,hasInclude:typeof n.include=="string"&&n.include.trim().length>0}}function ADe(e){const n=FDe(zDe(e)),r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Theme file must contain a JSON object.");return r}function ODe(e,n){var r;!n||!((r=e==null?void 0:e.editor)!=null&&r.defineTheme)||e.editor.defineTheme(n.monacoThemeName,n.monacoThemeData)}function RDe(e){if(typeof document>"u")return;const n=document.documentElement;n.classList.toggle("dark",e.colorMode==="dark"),n.dataset.monacoTheme=e.monacoThemeName;for(const r of yE)n.style.removeProperty(r);if(yE.clear(),!!e.theme)for(const[r,i]of Object.entries(e.theme.cssVariables))n.style.setProperty(r,i),yE.add(r)}function cte(e){var r;const n=[];for(const i of e){const s=i.settings??{},a=$De(i.scope);if(a.length===0)continue;const o=CF(s.foreground),l=CF(s.background),u=((r=s.fontStyle)==null?void 0:r.trim())||void 0;for(const d of a)n.push({token:d,foreground:o,background:l,fontStyle:u})}return n}function MDe(){return[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"F44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"comment",foreground:"6A9955"},{token:"constant",foreground:"569CD6"},{token:"number",foreground:"B5CEA8"},{token:"regexp",foreground:"D16969"},{token:"string",foreground:"CE9178"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.operator",foreground:"D4D4D4"},{token:"keyword.operator.new",foreground:"C586C0"},{token:"operator",foreground:"D4D4D4"},{token:"type",foreground:"4EC9B0"},{token:"type.identifier",foreground:"4EC9B0"},{token:"class",foreground:"4EC9B0"},{token:"interface",foreground:"4EC9B0"},{token:"enum",foreground:"4EC9B0"},{token:"namespace",foreground:"4EC9B0"},{token:"identifier",foreground:"9CDCFE"},{token:"identifier.function",foreground:"DCDCAA"},{token:"function",foreground:"DCDCAA"},{token:"member",foreground:"DCDCAA"},{token:"method",foreground:"DCDCAA"},{token:"property",foreground:"9CDCFE"},{token:"variable",foreground:"9CDCFE"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"parameter",foreground:"9CDCFE"},{token:"delimiter",foreground:"D4D4D4"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"}]}function PDe(e){const n={},r=si(e,["editor.background","sideBar.background","panel.background"]),i=si(e,["editor.foreground","foreground"]),s=si(e,["sideBar.background","panel.background","editorWidget.background"]),a=si(e,["panel.background","tab.inactiveBackground","editorGroupHeader.tabsBackground"]),o=si(e,["list.hoverBackground","tab.activeBackground","editor.lineHighlightBackground"]),l=si(e,["button.background","focusBorder","textLink.foreground"]),u=si(e,["widget.border","panel.border","sideBar.border","contrastBorder"]);Ei(n,"--background",r),Ei(n,"--foreground",i),Ei(n,"--card",s),Ei(n,"--card-foreground",si(e,["sideBar.foreground","foreground"])??i),Ei(n,"--popover",si(e,["editorWidget.background","panel.background"])??s),Ei(n,"--popover-foreground",si(e,["editorWidget.foreground","foreground"])??i),Ei(n,"--primary",l),Ei(n,"--primary-foreground",kF(l)),Ei(n,"--secondary",si(e,["tab.inactiveBackground","panel.background"])??a),Ei(n,"--secondary-foreground",si(e,["tab.inactiveForeground","foreground"])??i),Ei(n,"--muted",a),Ei(n,"--muted-foreground",si(e,["descriptionForeground","input.placeholderForeground","disabledForeground"])),Ei(n,"--accent",o),Ei(n,"--accent-foreground",si(e,["list.activeSelectionForeground","foreground"])??i),Ei(n,"--destructive",si(e,["inputValidation.errorBackground","errorForeground","list.errorForeground"])),Ei(n,"--destructive-foreground",kF(si(e,["inputValidation.errorBackground","errorForeground"]))),Ei(n,"--border",u),Ei(n,"--input",si(e,["input.background","editorWidget.background","dropdown.background"])??u),Ei(n,"--ring",si(e,["focusBorder","button.background","textLink.foreground"])??l),Ei(n,"--scrollbar-track",si(e,["editor.background","sideBar.background","panel.background"])??r),Ei(n,"--scrollbar-thumb",si(e,["scrollbarSlider.background","scrollbar.shadow"])),Ei(n,"--scrollbar-thumb-hover",si(e,["scrollbarSlider.hoverBackground","scrollbarSlider.activeBackground","scrollbarSlider.background"])),Ei(n,"--toast-bg",si(e,["notifications.background","editorWidget.background","panel.background"])??s,!0),Ei(n,"--toast-border",si(e,["notifications.border","widget.border","panel.border"])??u,!0),Ei(n,"--toast-success-accent",si(e,["testing.iconPassed","terminal.ansiGreen"])),Ei(n,"--toast-info-accent",si(e,["textLink.foreground","focusBorder"])??l),Ei(n,"--toast-warning-accent",si(e,["editorWarning.foreground","terminal.ansiYellow"])),Ei(n,"--toast-error-accent",si(e,["editorError.foreground","terminal.ansiRed"]));const d=si(e,["editorGroupHeader.tabsBackground","tab.inactiveBackground","sideBar.background"]);d&&(n["--tab-bg"]=d);const h=si(e,["activityBarBadge.background","button.background","focusBorder"]),f=si(e,["textLink.foreground","terminal.ansiBlue"]),m=si(e,["editorWarning.foreground","terminal.ansiYellow"]),x=si(e,["terminal.ansiMagenta","badge.background"]);return h&&(n["--ctx-system"]=h),f&&(n["--ctx-history"]=f),m&&(n["--ctx-tool-results"]=m),x&&(n["--ctx-tools"]=x),n}function Ei(e,n,r,i=!1){if(!r)return;const s=DDe(r,i);s&&(e[n]=s)}function kF(e){const n=O9(e);return n?(.2126*n.r+.7152*n.g+.0722*n.b)/255>.55?"0 0% 7%":"0 0% 100%":null}function LDe(e,n){if(e.type==="light"||e.type==="hc-light")return"light";if(e.type==="dark"||e.type==="hc-dark")return"dark";const r=O9(n["editor.background"]??n["sideBar.background"]??"");return r&&(.2126*r.r+.7152*r.g+.0722*r.b)/255>.55?"light":"dark"}function ute(e){const n={};for(const[r,i]of Object.entries(e))typeof i=="string"&&i.trim()&&(n[r]=i.trim());return n}function $De(e){return Array.isArray(e)?e.flatMap(n=>n.split(",")).map(n=>n.trim()).filter(Boolean):typeof e!="string"?[]:e.split(",").map(n=>n.trim()).filter(Boolean)}function CF(e){if(!e)return;const n=e.trim();if(n.startsWith("#"))return dte(n).slice(1)}function si(e,n){for(const r of n){const i=e[r];if(typeof i=="string"&&i.trim())return i.trim()}return null}function DDe(e,n=!1){const r=O9(e);if(!r)return null;const i=r.r/255,s=r.g/255,a=r.b/255,o=Math.max(i,s,a),l=Math.min(i,s,a),u=o-l,d=(o+l)/2;let h=0;u!==0&&(o===i?h=(s-a)/u%6:o===s?h=(a-i)/u+2:h=(i-s)/u+4,h*=60),h<0&&(h+=360);const f=u===0?0:u/(1-Math.abs(2*d-1)),m=`${Math.round(h)} ${Math.round(f*100)}% ${Math.round(d*100)}%`;return n&&r.a<1?`${m} / ${Number(r.a.toFixed(3))}`:m}function O9(e){if(!e)return null;const n=e.trim();if(!n)return null;if(n.startsWith("#"))return IDe(n);const r=n.match(/^rgba?\(([^)]+)\)$/i);if(!r)return null;const i=r[1].split(",").map(u=>u.trim());if(i.length<3)return null;const s=xE(i[0]),a=xE(i[1]),o=xE(i[2]),l=i[3]==null?1:BDe(i[3]);return s==null||a==null||o==null||l==null?null:{r:s,g:a,b:o,a:l}}function IDe(e){const n=dte(e).slice(1);return n.length===6?{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16),a:1}:n.length===8?{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16),a:Number.parseInt(n.slice(6,8),16)/255}:null}function xE(e){if(e.endsWith("%")){const r=Number.parseFloat(e.slice(0,-1));return Number.isFinite(r)?jF(Math.round(r/100*255)):null}const n=Number.parseFloat(e);return Number.isFinite(n)?jF(Math.round(n)):null}function BDe(e){const n=Number.parseFloat(e);return Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function jF(e){return Math.max(0,Math.min(255,e))}function dte(e){const n=e.trim().slice(1);return n.length===3||n.length===4?`#${n.split("").map(r=>`${r}${r}`).join("").toLowerCase()}`:`#${n.toLowerCase()}`}function zDe(e){let n="",r=!1,i=!1,s=!1,a=!1;for(let o=0;o<e.length;o+=1){const l=e[o],u=e[o+1];if(i){l===`
962
+ `},_F=aDe(uDe)(rte),dDe={config:lDe},hDe=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return function(s){return r.reduceRight(function(a,o){return o(a)},s)}};function ite(e,n){return Object.keys(n).forEach(function(r){n[r]instanceof Object&&e[r]&&Object.assign(n[r],ite(e[r],n[r]))}),xF(xF({},e),n)}var fDe={type:"cancelation",msg:"operation is manually canceled"};function mE(e){var n=!1,r=new Promise(function(i,s){e.then(function(a){return n?s(fDe):i(a)}),e.catch(s)});return r.cancel=function(){return n=!0},r}var pDe=["monaco"],mDe=iDe.create({config:sDe,isInitialized:!1,resolve:null,reject:null,monaco:null}),ste=z$e(mDe,2),bS=ste[0],B4=ste[1];function gDe(e){var n=dDe.config(e),r=n.monaco,i=I$e(n,pDe);B4(function(s){return{config:ite(s.config,i),monaco:r}})}function yDe(){var e=bS(function(n){var r=n.monaco,i=n.isInitialized,s=n.resolve;return{monaco:r,isInitialized:i,resolve:s}});if(!e.isInitialized){if(B4({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),mE(gE);if(window.monaco&&window.monaco.editor)return ate(window.monaco),e.resolve(window.monaco),mE(gE);hDe(xDe,bDe)(_De)}return mE(gE)}function xDe(e){return document.body.appendChild(e)}function vDe(e){var n=document.createElement("script");return e&&(n.src=e),n}function bDe(e){var n=bS(function(i){var s=i.config,a=i.reject;return{config:s,reject:a}}),r=vDe("".concat(n.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=n.reject,r}function _De(){var e=bS(function(r){var i=r.config,s=r.resolve,a=r.reject;return{config:i,resolve:s,reject:a}}),n=window.require;n.config(e.config),n(["vs/editor/editor.main"],function(r){var i=r.m||r;ate(i),e.resolve(i)},function(r){e.reject(r)})}function ate(e){bS().monaco||B4({monaco:e})}function wDe(){return bS(function(e){var n=e.monaco;return n})}var gE=new Promise(function(e,n){return B4({resolve:e,reject:n})}),z4={config:gDe,init:yDe,__getMonacoInstance:wDe};const ote=Object.freeze(JSON.parse('{"colors":{"actionBar.toggledBackground":"#383a49","activityBarBadge.background":"#007ACC","checkbox.border":"#6B6B6B","editor.background":"#1E1E1E","editor.foreground":"#D4D4D4","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","input.placeholderForeground":"#A6A6A6","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#252526","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","ports.iconRunningProcessForeground":"#369432","sideBarSectionHeader.background":"#0000","sideBarSectionHeader.border":"#ccc3","sideBarTitle.foreground":"#BBBBBB","statusBarItem.remoteBackground":"#16825D","statusBarItem.remoteForeground":"#FFF","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedForeground":"#ffffffa0","terminal.inactiveSelectionBackground":"#3A3D41","widget.border":"#303031"},"displayName":"Dark Plus","name":"dark-plus","semanticHighlighting":true,"semanticTokenColors":{"customLiteral":"#DCDCAA","newOperator":"#C586C0","numberLiteral":"#b5cea8","stringLiteral":"#ce9178"},"tokenColors":[{"scope":["meta.embedded","source.groovy.embedded","string meta.image.inline.markdown","variable.legacy.builtin.python"],"settings":{"foreground":"#D4D4D4"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#6A9955"}},{"scope":"constant.language","settings":{"foreground":"#569cd6"}},{"scope":["constant.numeric","variable.other.enummember","keyword.operator.plus.exponent","keyword.operator.minus.exponent"],"settings":{"foreground":"#b5cea8"}},{"scope":"constant.regexp","settings":{"foreground":"#646695"}},{"scope":"entity.name.tag","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.tag.css","entity.name.tag.less"],"settings":{"foreground":"#d7ba7d"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#9cdcfe"}},{"scope":["entity.other.attribute-name.class.css","source.css entity.other.attribute-name.class","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.parent.less","source.css entity.other.attribute-name.pseudo-class","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.scss"],"settings":{"foreground":"#d7ba7d"}},{"scope":"invalid","settings":{"foreground":"#f44747"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.strikethrough","settings":{"fontStyle":"strikethrough"}},{"scope":"markup.inserted","settings":{"foreground":"#b5cea8"}},{"scope":"markup.deleted","settings":{"foreground":"#ce9178"}},{"scope":"markup.changed","settings":{"foreground":"#569cd6"}},{"scope":"punctuation.definition.quote.begin.markdown","settings":{"foreground":"#6A9955"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#6796e6"}},{"scope":"markup.inline.raw","settings":{"foreground":"#ce9178"}},{"scope":"punctuation.definition.tag","settings":{"foreground":"#808080"}},{"scope":["meta.preprocessor","entity.name.function.preprocessor"],"settings":{"foreground":"#569cd6"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#ce9178"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#b5cea8"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#9cdcfe"}},{"scope":"meta.diff.header","settings":{"foreground":"#569cd6"}},{"scope":"storage","settings":{"foreground":"#569cd6"}},{"scope":"storage.type","settings":{"foreground":"#569cd6"}},{"scope":["storage.modifier","keyword.operator.noexcept"],"settings":{"foreground":"#569cd6"}},{"scope":["string","meta.embedded.assembly"],"settings":{"foreground":"#ce9178"}},{"scope":"string.tag","settings":{"foreground":"#ce9178"}},{"scope":"string.value","settings":{"foreground":"#ce9178"}},{"scope":"string.regexp","settings":{"foreground":"#d16969"}},{"scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#569cd6"}},{"scope":["meta.template.expression"],"settings":{"foreground":"#d4d4d4"}},{"scope":["support.type.vendored.property-name","support.type.property-name","source.css variable","source.coffee.embedded"],"settings":{"foreground":"#9cdcfe"}},{"scope":"keyword","settings":{"foreground":"#569cd6"}},{"scope":"keyword.control","settings":{"foreground":"#569cd6"}},{"scope":"keyword.operator","settings":{"foreground":"#d4d4d4"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.alignof","keyword.operator.typeid","keyword.operator.alignas","keyword.operator.instanceof","keyword.operator.logical.python","keyword.operator.wordlike"],"settings":{"foreground":"#569cd6"}},{"scope":"keyword.other.unit","settings":{"foreground":"#b5cea8"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#569cd6"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#9cdcfe"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#b5cea8"}},{"scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#d4d4d4"}},{"scope":"variable.language","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.function","support.function","support.constant.handlebars","source.powershell variable.other.member","entity.name.operator.custom-literal"],"settings":{"foreground":"#DCDCAA"}},{"scope":["support.class","support.type","entity.name.type","entity.name.namespace","entity.other.attribute","entity.name.scope-resolution","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#4EC9B0"}},{"scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class","punctuation.separator.namespace.ruby"],"settings":{"foreground":"#4EC9B0"}},{"scope":["keyword.control","source.cpp keyword.operator.new","keyword.operator.delete","keyword.other.using","keyword.other.directive.using","keyword.other.operator","entity.name.operator"],"settings":{"foreground":"#C586C0"}},{"scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable","constant.other.placeholder"],"settings":{"foreground":"#9CDCFE"}},{"scope":["variable.other.constant","variable.other.enummember"],"settings":{"foreground":"#4FC1FF"}},{"scope":["meta.object-literal.key"],"settings":{"foreground":"#9CDCFE"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#CE9178"}},{"scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#CE9178"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#DCDCAA"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#d7ba7d"}},{"scope":["constant.character","constant.other.option"],"settings":{"foreground":"#569cd6"}},{"scope":"constant.character.escape","settings":{"foreground":"#d7ba7d"}},{"scope":"entity.name.label","settings":{"foreground":"#C8C8C8"}}],"type":"dark"}')),SDe=Object.freeze(Object.defineProperty({__proto__:null,default:ote},Symbol.toStringTag,{value:"Module"})),kDe=["editor theme","vscode theme","monaco theme","workbench colors"],yE=new Set,Qw="dark-plus",wF=new WeakSet,SF=ote,CDe={"editor.background":"#0B0C0E","editorGutter.background":"#0B0C0E","editorStickyScroll.background":"#0B0C0E","editorStickyScrollGutter.background":"#0B0C0E","minimap.background":"#0B0C0E","editor.lineHighlightBackground":"#151922","editorWidget.background":"#16181D","editorHoverWidget.background":"#16181D","editorWidget.border":"#363B44","editorHoverWidget.border":"#363B44","editorGroupHeader.tabsBackground":"#0B0C0E"},jDe={base:"vs-dark",inherit:!1,rules:[...cte(SF.tokenColors??[]),...MDe()],colors:{...ute(SF.colors??{}),...CDe}};function NDe(){return kDe}function lte(e){var n,r;(r=(n=e==null?void 0:e.editor)==null?void 0:n.defineTheme)==null||r.call(n,Qw,jDe)}function TDe(e){!e||typeof e!="object"||wF.has(e)||(wF.add(e),Promise.all([nt(()=>import("./index-BDg20qR7.js"),[],import.meta.url),nt(()=>import("./index-DcZqwsWW.js"),[],import.meta.url)]).then(async([{shikiToMonaco:n},{createHighlighter:r}])=>{var l,u,d;const i=e.languages,s=new Set(((l=i==null?void 0:i.getLanguages)==null?void 0:l.call(i).map(h=>h.id))??[]);for(const h of["javascript","typescript","json","css","html","markdown","python","yaml","diff"])s.has(h)||((u=i==null?void 0:i.register)==null||u.call(i,{id:h}),s.add(h));const a=await r({themes:["dark-plus"],langs:["javascript","typescript","jsx","tsx","json","css","html","markdown","python","yaml","diff"]});n(a,e),lte(e);const o=e.editor;typeof document<"u"&&document.documentElement.dataset.monacoTheme===Qw&&((d=o==null?void 0:o.setTheme)==null||d.call(o,Qw))}).catch(n=>{console.error("Failed to initialize Shiki Monaco Dark Plus theme:",n)}))}function EDe(e){var o;const n=ADe(e.text),r=ute(n.colors??{}),i=LDe(n,r),s=((o=n.name)==null?void 0:o.trim())||e.sourceLabel.trim()||"Imported Theme",a=`jait-vscode-${HDe(s)}-${e.id}`;return{id:e.id,name:s,sourceLabel:e.sourceLabel,importedAt:e.importedAt??new Date().toISOString(),colorMode:i,monacoThemeName:a,monacoThemeData:{base:i==="dark"?"vs-dark":"vs",inherit:!0,rules:cte(n.tokenColors??[]),colors:r},cssVariables:PDe(r),rawColors:r,hasInclude:typeof n.include=="string"&&n.include.trim().length>0}}function ADe(e){const n=FDe(zDe(e)),r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Theme file must contain a JSON object.");return r}function ODe(e,n){var r;!n||!((r=e==null?void 0:e.editor)!=null&&r.defineTheme)||e.editor.defineTheme(n.monacoThemeName,n.monacoThemeData)}function RDe(e){if(typeof document>"u")return;const n=document.documentElement;n.classList.toggle("dark",e.colorMode==="dark"),n.dataset.monacoTheme=e.monacoThemeName;for(const r of yE)n.style.removeProperty(r);if(yE.clear(),!!e.theme)for(const[r,i]of Object.entries(e.theme.cssVariables))n.style.setProperty(r,i),yE.add(r)}function cte(e){var r;const n=[];for(const i of e){const s=i.settings??{},a=$De(i.scope);if(a.length===0)continue;const o=CF(s.foreground),l=CF(s.background),u=((r=s.fontStyle)==null?void 0:r.trim())||void 0;for(const d of a)n.push({token:d,foreground:o,background:l,fontStyle:u})}return n}function MDe(){return[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"F44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"comment",foreground:"6A9955"},{token:"constant",foreground:"569CD6"},{token:"number",foreground:"B5CEA8"},{token:"regexp",foreground:"D16969"},{token:"string",foreground:"CE9178"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.operator",foreground:"D4D4D4"},{token:"keyword.operator.new",foreground:"C586C0"},{token:"operator",foreground:"D4D4D4"},{token:"type",foreground:"4EC9B0"},{token:"type.identifier",foreground:"4EC9B0"},{token:"class",foreground:"4EC9B0"},{token:"interface",foreground:"4EC9B0"},{token:"enum",foreground:"4EC9B0"},{token:"namespace",foreground:"4EC9B0"},{token:"identifier",foreground:"9CDCFE"},{token:"identifier.function",foreground:"DCDCAA"},{token:"function",foreground:"DCDCAA"},{token:"member",foreground:"DCDCAA"},{token:"method",foreground:"DCDCAA"},{token:"property",foreground:"9CDCFE"},{token:"variable",foreground:"9CDCFE"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"parameter",foreground:"9CDCFE"},{token:"delimiter",foreground:"D4D4D4"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"}]}function PDe(e){const n={},r=si(e,["editor.background","sideBar.background","panel.background"]),i=si(e,["editor.foreground","foreground"]),s=si(e,["sideBar.background","panel.background","editorWidget.background"]),a=si(e,["panel.background","tab.inactiveBackground","editorGroupHeader.tabsBackground"]),o=si(e,["list.hoverBackground","tab.activeBackground","editor.lineHighlightBackground"]),l=si(e,["button.background","focusBorder","textLink.foreground"]),u=si(e,["widget.border","panel.border","sideBar.border","contrastBorder"]);Ei(n,"--background",r),Ei(n,"--foreground",i),Ei(n,"--card",s),Ei(n,"--card-foreground",si(e,["sideBar.foreground","foreground"])??i),Ei(n,"--popover",si(e,["editorWidget.background","panel.background"])??s),Ei(n,"--popover-foreground",si(e,["editorWidget.foreground","foreground"])??i),Ei(n,"--primary",l),Ei(n,"--primary-foreground",kF(l)),Ei(n,"--secondary",si(e,["tab.inactiveBackground","panel.background"])??a),Ei(n,"--secondary-foreground",si(e,["tab.inactiveForeground","foreground"])??i),Ei(n,"--muted",a),Ei(n,"--muted-foreground",si(e,["descriptionForeground","input.placeholderForeground","disabledForeground"])),Ei(n,"--accent",o),Ei(n,"--accent-foreground",si(e,["list.activeSelectionForeground","foreground"])??i),Ei(n,"--destructive",si(e,["inputValidation.errorBackground","errorForeground","list.errorForeground"])),Ei(n,"--destructive-foreground",kF(si(e,["inputValidation.errorBackground","errorForeground"]))),Ei(n,"--border",u),Ei(n,"--input",si(e,["input.background","editorWidget.background","dropdown.background"])??u),Ei(n,"--ring",si(e,["focusBorder","button.background","textLink.foreground"])??l),Ei(n,"--scrollbar-track",si(e,["editor.background","sideBar.background","panel.background"])??r),Ei(n,"--scrollbar-thumb",si(e,["scrollbarSlider.background","scrollbar.shadow"])),Ei(n,"--scrollbar-thumb-hover",si(e,["scrollbarSlider.hoverBackground","scrollbarSlider.activeBackground","scrollbarSlider.background"])),Ei(n,"--toast-bg",si(e,["notifications.background","editorWidget.background","panel.background"])??s,!0),Ei(n,"--toast-border",si(e,["notifications.border","widget.border","panel.border"])??u,!0),Ei(n,"--toast-success-accent",si(e,["testing.iconPassed","terminal.ansiGreen"])),Ei(n,"--toast-info-accent",si(e,["textLink.foreground","focusBorder"])??l),Ei(n,"--toast-warning-accent",si(e,["editorWarning.foreground","terminal.ansiYellow"])),Ei(n,"--toast-error-accent",si(e,["editorError.foreground","terminal.ansiRed"]));const d=si(e,["editorGroupHeader.tabsBackground","tab.inactiveBackground","sideBar.background"]);d&&(n["--tab-bg"]=d);const h=si(e,["activityBarBadge.background","button.background","focusBorder"]),f=si(e,["textLink.foreground","terminal.ansiBlue"]),m=si(e,["editorWarning.foreground","terminal.ansiYellow"]),x=si(e,["terminal.ansiMagenta","badge.background"]);return h&&(n["--ctx-system"]=h),f&&(n["--ctx-history"]=f),m&&(n["--ctx-tool-results"]=m),x&&(n["--ctx-tools"]=x),n}function Ei(e,n,r,i=!1){if(!r)return;const s=DDe(r,i);s&&(e[n]=s)}function kF(e){const n=O9(e);return n?(.2126*n.r+.7152*n.g+.0722*n.b)/255>.55?"0 0% 7%":"0 0% 100%":null}function LDe(e,n){if(e.type==="light"||e.type==="hc-light")return"light";if(e.type==="dark"||e.type==="hc-dark")return"dark";const r=O9(n["editor.background"]??n["sideBar.background"]??"");return r&&(.2126*r.r+.7152*r.g+.0722*r.b)/255>.55?"light":"dark"}function ute(e){const n={};for(const[r,i]of Object.entries(e))typeof i=="string"&&i.trim()&&(n[r]=i.trim());return n}function $De(e){return Array.isArray(e)?e.flatMap(n=>n.split(",")).map(n=>n.trim()).filter(Boolean):typeof e!="string"?[]:e.split(",").map(n=>n.trim()).filter(Boolean)}function CF(e){if(!e)return;const n=e.trim();if(n.startsWith("#"))return dte(n).slice(1)}function si(e,n){for(const r of n){const i=e[r];if(typeof i=="string"&&i.trim())return i.trim()}return null}function DDe(e,n=!1){const r=O9(e);if(!r)return null;const i=r.r/255,s=r.g/255,a=r.b/255,o=Math.max(i,s,a),l=Math.min(i,s,a),u=o-l,d=(o+l)/2;let h=0;u!==0&&(o===i?h=(s-a)/u%6:o===s?h=(a-i)/u+2:h=(i-s)/u+4,h*=60),h<0&&(h+=360);const f=u===0?0:u/(1-Math.abs(2*d-1)),m=`${Math.round(h)} ${Math.round(f*100)}% ${Math.round(d*100)}%`;return n&&r.a<1?`${m} / ${Number(r.a.toFixed(3))}`:m}function O9(e){if(!e)return null;const n=e.trim();if(!n)return null;if(n.startsWith("#"))return IDe(n);const r=n.match(/^rgba?\(([^)]+)\)$/i);if(!r)return null;const i=r[1].split(",").map(u=>u.trim());if(i.length<3)return null;const s=xE(i[0]),a=xE(i[1]),o=xE(i[2]),l=i[3]==null?1:BDe(i[3]);return s==null||a==null||o==null||l==null?null:{r:s,g:a,b:o,a:l}}function IDe(e){const n=dte(e).slice(1);return n.length===6?{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16),a:1}:n.length===8?{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16),a:Number.parseInt(n.slice(6,8),16)/255}:null}function xE(e){if(e.endsWith("%")){const r=Number.parseFloat(e.slice(0,-1));return Number.isFinite(r)?jF(Math.round(r/100*255)):null}const n=Number.parseFloat(e);return Number.isFinite(n)?jF(Math.round(n)):null}function BDe(e){const n=Number.parseFloat(e);return Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function jF(e){return Math.max(0,Math.min(255,e))}function dte(e){const n=e.trim().slice(1);return n.length===3||n.length===4?`#${n.split("").map(r=>`${r}${r}`).join("").toLowerCase()}`:`#${n.toLowerCase()}`}function zDe(e){let n="",r=!1,i=!1,s=!1,a=!1;for(let o=0;o<e.length;o+=1){const l=e[o],u=e[o+1];if(i){l===`
963
963
  `&&(i=!1,n+=l);continue}if(s){l==="*"&&u==="/"&&(s=!1,o+=1);continue}if(r){n+=l,a?a=!1:l==="\\"?a=!0:l==='"'&&(r=!1);continue}if(l==='"'){r=!0,n+=l;continue}if(l==="/"&&u==="/"){i=!0,o+=1;continue}if(l==="/"&&u==="*"){s=!0,o+=1;continue}n+=l}return n}function FDe(e){return e.replace(/,\s*([}\]])/g,"$1")}function HDe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"theme"}function NF(){if(typeof document>"u")return"vs";const e=document.documentElement;return e.dataset.monacoTheme??(e.classList.contains("dark")?Qw:"vs")}function _S(){const[e,n]=y.useState(NF);return y.useEffect(()=>{if(typeof document>"u")return;const r=document.documentElement,i=()=>n(NF());i();const s=new MutationObserver(i);return s.observe(r,{attributes:!0,attributeFilter:["class","data-monaco-theme"]}),()=>s.disconnect()},[]),e}const R9="jait:vscode-theme-store",_3=new Set;let bd=fte(),TF=!1;function hte(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function fte(){const e=hte();if(!e)return{importedThemes:[],activeThemeId:null};let n=null;try{n=e.getItem(R9)}catch{return{importedThemes:[],activeThemeId:null}}if(!n)return{importedThemes:[],activeThemeId:null};try{const r=JSON.parse(n),i=Array.isArray(r.importedThemes)?r.importedThemes.filter(a=>!!(a&&typeof a.id=="string"&&typeof a.monacoThemeName=="string")):[],s=typeof r.activeThemeId=="string"?r.activeThemeId:null;return{importedThemes:i,activeThemeId:i.some(a=>a.id===s)?s:null}}catch{return{importedThemes:[],activeThemeId:null}}}function M9(e){bd=e;const n=hte();if(n)try{n.setItem(R9,JSON.stringify(e))}catch{}for(const r of _3)r()}function WDe(e){return!TF&&typeof window<"u"&&(TF=!0,window.addEventListener("storage",n=>{if(n.key===R9){bd=fte();for(const r of _3)r()}})),_3.add(e),()=>_3.delete(e)}function EF(){return bd}function pte(){const e=y.useSyncExternalStore(WDe,EF,EF);return{...e,activeTheme:e.importedThemes.find(n=>n.id===e.activeThemeId)??null}}function mte(){return bd.importedThemes.find(e=>e.id===bd.activeThemeId)??null}function UDe(e,n){const r=`${Date.now().toString(36)}-${GDe(e+n)}`,i=EDe({id:r,sourceLabel:e,text:n});return M9({importedThemes:[...bd.importedThemes.filter(s=>s.id!==r),i],activeThemeId:r}),i}function M5(e){M9({...bd,activeThemeId:e&&bd.importedThemes.some(n=>n.id===e)?e:null})}function VDe(e){M9({importedThemes:bd.importedThemes.filter(n=>n.id!==e),activeThemeId:bd.activeThemeId===e?null:bd.activeThemeId})}function qDe(e){lte(e);const n=mte();n?ODe(e,n):TDe(e)}function Yl(e,n){var r,i;qDe(e),n&&((i=(r=e==null?void 0:e.editor)==null?void 0:r.setTheme)==null||i.call(r,n))}function GDe(e){let n=0;for(let r=0;r<e.length;r+=1)n=(n<<5)-n+e.charCodeAt(r)|0;return Math.abs(n).toString(36)}function Hy(e,n){return Math.max(1,e||n||1)}function e2({original:e,modified:n,language:r,modelKey:i,className:s,editorClassName:a,renderSideBySide:o=!1,emptyMessage:l="Files are identical.",options:u}){const d=y.useRef(null),h=y.useRef(null),f=y.useRef(null),m=y.useRef(null),x=y.useRef({original:null,modified:null}),[v,_]=y.useState(!1),[w,S]=y.useState([]),[C,j]=y.useState(0),T=_S(),E=y.useRef(T);y.useEffect(()=>{E.current=T},[T]);const N=y.useMemo(()=>`inmemory://jait-diff/${encodeURIComponent(i??`${r}:${e.length}:${n.length}`)}`,[r,i,n.length,e.length]),R=y.useMemo(()=>({readOnly:!0,renderSideBySide:o,minimap:{enabled:!1},"semanticHighlighting.enabled":!0,fontSize:13,automaticLayout:!0,scrollBeyondLastLine:!1,renderOverviewRuler:!0,ignoreTrimWhitespace:!1,...u}),[u,o]),$=y.useCallback(()=>{var I;const z=h.current;if(!z)return;const U=((I=z.getLineChanges)==null?void 0:I.call(z))??[];S(U.map(O=>({originalStartLineNumber:O.originalStartLineNumber,originalEndLineNumber:O.originalEndLineNumber,modifiedStartLineNumber:O.modifiedStartLineNumber,modifiedEndLineNumber:O.modifiedEndLineNumber})))},[]);y.useEffect(()=>{let z=!1;const U=z4.init();return U.then(I=>{if(z||!d.current)return;f.current=I,Yl(I,E.current);const O=I.editor.createDiffEditor(d.current,{automaticLayout:!0,...R});h.current=O,m.current=O.onDidUpdateDiff(()=>$()),_(!0),$()}).catch(I=>{!z&&(I==null?void 0:I.type)!=="cancelation"&&console.error("Monaco initialization: error:",I)}),()=>{var D,M,L,B,q,H;z=!0,(D=m.current)==null||D.dispose(),m.current=null;const I=h.current,O=x.current;try{I==null||I.setModel(null)}catch{}(M=I==null?void 0:I.dispose)==null||M.call(I),(B=(L=O.original)==null?void 0:L.dispose)==null||B.call(L),(H=(q=O.modified)==null?void 0:q.dispose)==null||H.call(q),x.current={original:null,modified:null},h.current=null,f.current=null,_(!1),U.cancel()}},[$]),y.useEffect(()=>{j(0)},[e,n,r]),y.useEffect(()=>{var B,q;const z=h.current,U=f.current;if(!v||!z||!U)return;const I=x.current,O=U.Uri.parse(`${N}.original`),D=U.Uri.parse(`${N}.modified`);(B=U.editor.getModel(O))==null||B.dispose(),(q=U.editor.getModel(D))==null||q.dispose();const M=U.editor.createModel(e,r,O),L=U.editor.createModel(n,r,D);return z.setModel({original:M,modified:L}),x.current={original:M,modified:L},$(),()=>{var H,F,X,V;try{z.setModel(null)}catch{}(F=(H=I.original)==null?void 0:H.dispose)==null||F.call(H),(V=(X=I.modified)==null?void 0:X.dispose)==null||V.call(X),M.dispose(),L.dispose(),(x.current.original===M||x.current.modified===L)&&(x.current={original:null,modified:null})}},[v,r,N,n,e,$]),y.useEffect(()=>{const z=f.current;z&&Yl(z,T)},[T]),y.useEffect(()=>{var z,U;(U=(z=h.current)==null?void 0:z.updateOptions)==null||U.call(z,R)},[R]),y.useEffect(()=>{w.length!==0&&j(z=>Math.min(z,w.length-1))},[w]),y.useEffect(()=>{const z=h.current;if(!z||w.length===0)return;const U=w[C];if(!U)return;const I=z.getModifiedEditor(),O=z.getOriginalEditor();try{U.modifiedStartLineNumber>0||U.modifiedEndLineNumber>0?I.revealLineInCenter(Hy(U.modifiedStartLineNumber,U.modifiedEndLineNumber)):O.revealLineInCenter(Hy(U.originalStartLineNumber,U.originalEndLineNumber))}catch{}},[C,w]),y.useEffect(()=>{const z=h.current,U=f.current;if(!z||!U||w.length===0)return;const I=w[C];if(!I)return;const O=[];(I.originalStartLineNumber>0||I.originalEndLineNumber>0)&&O.push({editor:z.getOriginalEditor(),range:new U.Range(Hy(I.originalStartLineNumber,I.originalEndLineNumber),1,Hy(I.originalEndLineNumber,I.originalStartLineNumber),1)}),(I.modifiedStartLineNumber>0||I.modifiedEndLineNumber>0)&&O.push({editor:z.getModifiedEditor(),range:new U.Range(Hy(I.modifiedStartLineNumber,I.modifiedEndLineNumber),1,Hy(I.modifiedEndLineNumber,I.modifiedStartLineNumber),1)});const D=O.map(({editor:M,range:L})=>M.deltaDecorations([],[{range:L,options:{isWholeLine:!0,className:"diff-change-active"}}]));return()=>{var M;for(let L=0;L<O.length;L++)try{(M=O[L])==null||M.editor.deltaDecorations(D[L]??[],[])}catch{}}},[C,w]);const G=y.useCallback(()=>{j(z=>Math.max(z-1,0))},[]),W=y.useCallback(()=>{j(z=>Math.min(z+1,w.length-1))},[w.length]);return c.jsxs("div",{className:je("relative min-h-0",s),children:[c.jsx("div",{className:je("h-full min-h-0",a),children:c.jsx("div",{ref:d,className:"h-full min-h-0"})}),!v&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-muted-foreground",children:"Loading diff..."}),w.length>1&&c.jsxs("div",{className:"absolute right-3 top-1/2 z-10 flex -translate-y-1/2 flex-col gap-1.5",children:[c.jsx(ye,{size:"sm",variant:"secondary",className:"h-9 w-9 rounded-full border bg-background/90 p-0 shadow-lg backdrop-blur-sm hover:bg-background",onClick:G,disabled:C===0,title:"Previous change",children:c.jsx(nM,{className:"h-5 w-5"})}),c.jsxs("span",{className:"text-center font-medium tabular-nums text-2xs text-muted-foreground",children:[C+1,"/",w.length]}),c.jsx(ye,{size:"sm",variant:"secondary",className:"h-9 w-9 rounded-full border bg-background/90 p-0 shadow-lg backdrop-blur-sm hover:bg-background",onClick:W,disabled:C===w.length-1,title:"Next change",children:c.jsx(fl,{className:"h-5 w-5"})})]}),w.length===0&&e===n&&v&&c.jsx("div",{className:"pointer-events-none absolute inset-x-3 bottom-3 rounded-md border bg-background/90 px-3 py-2 text-center text-xs text-muted-foreground shadow-sm",children:l}),c.jsx("style",{children:`
964
964
  .diff-change-active { outline: 1px solid rgba(99, 102, 241, 0.5); outline-offset: -1px; }
965
965
  `})]})}var KDe={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},vE=KDe,YDe={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},XDe=YDe;function JDe({children:e}){return Ht.createElement("div",{style:XDe.container},e)}var ZDe=JDe,QDe=ZDe;function eIe({width:e,height:n,isEditorReady:r,loading:i,_ref:s,className:a,wrapperProps:o}){return Ht.createElement("section",{style:{...vE.wrapper,width:e,height:n},...o},!r&&Ht.createElement(QDe,null,i),Ht.createElement("div",{ref:s,style:{...vE.fullWidth,...!r&&vE.hide},className:a}))}var tIe=eIe,gte=y.memo(tIe);function nIe(e){y.useEffect(e,[])}var yte=nIe;function rIe(e,n,r=!0){let i=y.useRef(!0);y.useEffect(i.current||!r?()=>{i.current=!1}:e,n)}var wc=rIe;function y_(){}function cx(e,n,r,i){return iIe(e,i)||sIe(e,n,r,i)}function iIe(e,n){return e.editor.getModel(xte(e,n))}function sIe(e,n,r,i){return e.editor.createModel(n,r,i?xte(e,i):void 0)}function xte(e,n){return e.Uri.parse(n)}function aIe({original:e,modified:n,language:r,originalLanguage:i,modifiedLanguage:s,originalModelPath:a,modifiedModelPath:o,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:u=!1,theme:d="light",loading:h="Loading...",options:f={},height:m="100%",width:x="100%",className:v,wrapperProps:_={},beforeMount:w=y_,onMount:S=y_}){let[C,j]=y.useState(!1),[T,E]=y.useState(!0),N=y.useRef(null),R=y.useRef(null),$=y.useRef(null),G=y.useRef(S),W=y.useRef(w),z=y.useRef(!1);yte(()=>{let D=z4.init();return D.then(M=>(R.current=M)&&E(!1)).catch(M=>(M==null?void 0:M.type)!=="cancelation"&&console.error("Monaco initialization: error:",M)),()=>N.current?O():D.cancel()}),wc(()=>{if(N.current&&R.current){let D=N.current.getOriginalEditor(),M=cx(R.current,e||"",i||r||"text",a||"");M!==D.getModel()&&D.setModel(M)}},[a],C),wc(()=>{if(N.current&&R.current){let D=N.current.getModifiedEditor(),M=cx(R.current,n||"",s||r||"text",o||"");M!==D.getModel()&&D.setModel(M)}},[o],C),wc(()=>{let D=N.current.getModifiedEditor();D.getOption(R.current.editor.EditorOption.readOnly)?D.setValue(n||""):n!==D.getValue()&&(D.executeEdits("",[{range:D.getModel().getFullModelRange(),text:n||"",forceMoveMarkers:!0}]),D.pushUndoStop())},[n],C),wc(()=>{var D,M;(M=(D=N.current)==null?void 0:D.getModel())==null||M.original.setValue(e||"")},[e],C),wc(()=>{let{original:D,modified:M}=N.current.getModel();R.current.editor.setModelLanguage(D,i||r||"text"),R.current.editor.setModelLanguage(M,s||r||"text")},[r,i,s],C),wc(()=>{var D;(D=R.current)==null||D.editor.setTheme(d)},[d],C),wc(()=>{var D;(D=N.current)==null||D.updateOptions(f)},[f],C);let U=y.useCallback(()=>{var L;if(!R.current)return;W.current(R.current);let D=cx(R.current,e||"",i||r||"text",a||""),M=cx(R.current,n||"",s||r||"text",o||"");(L=N.current)==null||L.setModel({original:D,modified:M})},[r,n,s,e,i,a,o]),I=y.useCallback(()=>{var D;!z.current&&$.current&&(N.current=R.current.editor.createDiffEditor($.current,{automaticLayout:!0,...f}),U(),(D=R.current)==null||D.editor.setTheme(d),j(!0),z.current=!0)},[f,d,U]);y.useEffect(()=>{C&&G.current(N.current,R.current)},[C]),y.useEffect(()=>{!T&&!C&&I()},[T,C,I]);function O(){var M,L,B,q;let D=(M=N.current)==null?void 0:M.getModel();l||((L=D==null?void 0:D.original)==null||L.dispose()),u||((B=D==null?void 0:D.modified)==null||B.dispose()),(q=N.current)==null||q.dispose()}return Ht.createElement(gte,{width:x,height:m,isEditorReady:C,loading:h,_ref:$,className:v,wrapperProps:_})}var oIe=aIe,lIe=y.memo(oIe);function cIe(e){let n=y.useRef();return y.useEffect(()=>{n.current=e},[e]),n.current}var uIe=cIe,mC=new Map;function dIe({defaultValue:e,defaultLanguage:n,defaultPath:r,value:i,language:s,path:a,theme:o="light",line:l,loading:u="Loading...",options:d={},overrideServices:h={},saveViewState:f=!0,keepCurrentModel:m=!1,width:x="100%",height:v="100%",className:_,wrapperProps:w={},beforeMount:S=y_,onMount:C=y_,onChange:j,onValidate:T=y_}){let[E,N]=y.useState(!1),[R,$]=y.useState(!0),G=y.useRef(null),W=y.useRef(null),z=y.useRef(null),U=y.useRef(C),I=y.useRef(S),O=y.useRef(),D=y.useRef(i),M=uIe(a),L=y.useRef(!1),B=y.useRef(!1);yte(()=>{let F=z4.init();return F.then(X=>(G.current=X)&&$(!1)).catch(X=>(X==null?void 0:X.type)!=="cancelation"&&console.error("Monaco initialization: error:",X)),()=>W.current?H():F.cancel()}),wc(()=>{var X,V,ne,J;let F=cx(G.current,e||i||"",n||s||"",a||r||"");F!==((X=W.current)==null?void 0:X.getModel())&&(f&&mC.set(M,(V=W.current)==null?void 0:V.saveViewState()),(ne=W.current)==null||ne.setModel(F),f&&((J=W.current)==null||J.restoreViewState(mC.get(a))))},[a],E),wc(()=>{var F;(F=W.current)==null||F.updateOptions(d)},[d],E),wc(()=>{!W.current||i===void 0||(W.current.getOption(G.current.editor.EditorOption.readOnly)?W.current.setValue(i):i!==W.current.getValue()&&(B.current=!0,W.current.executeEdits("",[{range:W.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),W.current.pushUndoStop(),B.current=!1))},[i],E),wc(()=>{var X,V;let F=(X=W.current)==null?void 0:X.getModel();F&&s&&((V=G.current)==null||V.editor.setModelLanguage(F,s))},[s],E),wc(()=>{var F;l!==void 0&&((F=W.current)==null||F.revealLine(l))},[l],E),wc(()=>{var F;(F=G.current)==null||F.editor.setTheme(o)},[o],E);let q=y.useCallback(()=>{var F;if(!(!z.current||!G.current)&&!L.current){I.current(G.current);let X=a||r,V=cx(G.current,i||e||"",n||s||"",X||"");W.current=(F=G.current)==null?void 0:F.editor.create(z.current,{model:V,automaticLayout:!0,...d},h),f&&W.current.restoreViewState(mC.get(X)),G.current.editor.setTheme(o),l!==void 0&&W.current.revealLine(l),N(!0),L.current=!0}},[e,n,r,i,s,a,d,h,f,o,l]);y.useEffect(()=>{E&&U.current(W.current,G.current)},[E]),y.useEffect(()=>{!R&&!E&&q()},[R,E,q]),D.current=i,y.useEffect(()=>{var F,X;E&&j&&((F=O.current)==null||F.dispose(),O.current=(X=W.current)==null?void 0:X.onDidChangeModelContent(V=>{B.current||j(W.current.getValue(),V)}))},[E,j]),y.useEffect(()=>{if(E){let F=G.current.editor.onDidChangeMarkers(X=>{var ne;let V=(ne=W.current.getModel())==null?void 0:ne.uri;if(V&&X.find(J=>J.path===V.path)){let J=G.current.editor.getModelMarkers({resource:V});T==null||T(J)}});return()=>{F==null||F.dispose()}}return()=>{}},[E,T]);function H(){var F,X;(F=O.current)==null||F.dispose(),m?f&&mC.set(a,W.current.saveViewState()):(X=W.current.getModel())==null||X.dispose(),W.current.dispose()}return Ht.createElement(gte,{width:x,height:v,isEditorReady:E,loading:u,_ref:z,className:_,wrapperProps:w})}var hIe=dIe,fIe=y.memo(hIe),wS=fIe;const pIe=Nr();function mIe(){return If()}function gIe(e=!1){const n={};e&&(n["Content-Type"]="application/json");const r=mIe();return r&&(n.Authorization=`Bearer ${r}`),n}async function Hi(e,n){const r=await fetch(`${pIe}/api/git/${e}`,{method:"POST",headers:gIe(!0),body:JSON.stringify(n)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error||`Git ${e} failed: ${r.statusText}`)}return r.json()}const js={status(e,n){return Hi("status",{cwd:e,...n?{branch:n}:{}})},listBranches(e){return Hi("branches",{cwd:e})},pull(e){return Hi("pull",{cwd:e})},sync(e){return Hi("sync",{cwd:e})},fetch(e,n=!1){return Hi("fetch",{cwd:e,all:n})},runStackedAction(e,n,r){return Hi("run-stacked-action",{cwd:e,action:n,...r!=null&&r.commitMessage?{commitMessage:r.commitMessage}:{},...r!=null&&r.featureBranch?{featureBranch:!0}:{},...r!=null&&r.baseBranch?{baseBranch:r.baseBranch}:{}})},checkout(e,n){return Hi("checkout",{cwd:e,branch:n})},createBranch(e,n,r){return Hi("create-branch",{cwd:e,branch:n,baseBranch:r})},discard(e,n){return Hi("discard",{cwd:e,paths:n})},stage(e,n){return Hi("stage",{cwd:e,paths:n})},unstage(e,n){return Hi("unstage",{cwd:e,paths:n})},init(e){return Hi("init",{cwd:e})},diff(e){return Hi("diff",{cwd:e})},diffStats(e,n,r){return Hi("diff-stats",{cwd:e,...n?{baseBranch:n}:{},...r?{branch:r}:{}})},fileDiffs(e,n,r){return Hi("file-diffs",{cwd:e,...n?{baseBranch:n}:{},...r?{branch:r}:{}}).then(i=>i.files)},createWorktree(e,n,r,i){return Hi("create-worktree",{cwd:e,baseBranch:n,newBranch:r,...i?{path:i}:{}})},removeWorktree(e,n,r=!1){return Hi("remove-worktree",{cwd:e,path:n,force:r})},ghStatus(e){return Hi("gh-status",{...e?{cwd:e}:{}})},ghAuth(e,n){return Hi("gh-auth",{token:e,...n?{cwd:n}:{}})},forgeStatus(e,n){return Hi("forge-status",{...e?{cwd:e}:{},...n?{remoteUrl:n}:{}})},forgeAuth(e,n,r){return Hi("forge-auth",{token:e,...n?{cwd:n}:{},...r?{remoteUrl:r}:{}})},forgePrChecks(e,n,r){return Hi("forge-pr-checks",{cwd:e,branch:n,...r?{remoteUrl:r}:{}})},identity(e){return Hi("identity",{cwd:e})},setIdentity(e,n,r){return Hi("identity",{cwd:e,name:n,email:r})},prChecks(e,n){return Hi("pr-checks",{cwd:e,branch:n})},generateCommitMessage(e,n,r){return Hi("generate-commit-message",{cwd:e,...n?{provider:n}:{},...r?{model:r}:{}})}};var vte=Object.defineProperty,Y=(e,n)=>vte(e,"name",{value:n,configurable:!0}),yIe=(e,n)=>{for(var r in n)vte(e,r,{get:n[r],enumerable:!0})},Nf={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},At={trace:Y((...e)=>{},"trace"),debug:Y((...e)=>{},"debug"),info:Y((...e)=>{},"info"),warn:Y((...e)=>{},"warn"),error:Y((...e)=>{},"error"),fatal:Y((...e)=>{},"fatal")},P9=Y(function(e="fatal"){let n=Nf.fatal;typeof e=="string"?e.toLowerCase()in Nf&&(n=Nf[e]):typeof e=="number"&&(n=e),At.trace=()=>{},At.debug=()=>{},At.info=()=>{},At.warn=()=>{},At.error=()=>{},At.fatal=()=>{},n<=Nf.fatal&&(At.fatal=console.error?console.error.bind(console,iu("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",iu("FATAL"))),n<=Nf.error&&(At.error=console.error?console.error.bind(console,iu("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",iu("ERROR"))),n<=Nf.warn&&(At.warn=console.warn?console.warn.bind(console,iu("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",iu("WARN"))),n<=Nf.info&&(At.info=console.info?console.info.bind(console,iu("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",iu("INFO"))),n<=Nf.debug&&(At.debug=console.debug?console.debug.bind(console,iu("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",iu("DEBUG"))),n<=Nf.trace&&(At.trace=console.debug?console.debug.bind(console,iu("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",iu("TRACE")))},"setLogLevel"),iu=Y(e=>`%c${MAe().format("ss.SSS")} : ${e} : `,"format");const w3={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const n=e/255;return e>.03928?Math.pow((n+.055)/1.055,2.4):n/12.92},hue2rgb:(e,n,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(n-e)*6*r:r<1/2?n:r<2/3?e+(n-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:n,l:r},i)=>{if(!n)return r*2.55;e/=360,n/=100,r/=100;const s=r<.5?r*(1+n):r+n-r*n,a=2*r-s;switch(i){case"r":return w3.hue2rgb(a,s,e+1/3)*255;case"g":return w3.hue2rgb(a,s,e)*255;case"b":return w3.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:n,b:r},i)=>{e/=255,n/=255,r/=255;const s=Math.max(e,n,r),a=Math.min(e,n,r),o=(s+a)/2;if(i==="l")return o*100;if(s===a)return 0;const l=s-a,u=o>.5?l/(2-s-a):l/(s+a);if(i==="s")return u*100;switch(s){case e:return((n-r)/l+(n<r?6:0))*60;case n:return((r-e)/l+2)*60;case r:return((e-n)/l+4)*60;default:return-1}}},xIe={clamp:(e,n,r)=>n>r?Math.min(n,Math.max(r,e)):Math.min(r,Math.max(n,e)),round:e=>Math.round(e*1e10)/1e10},vIe={dec2hex:e=>{const n=Math.round(e).toString(16);return n.length>1?n:`0${n}`}},gr={channel:w3,lang:xIe,unit:vIe},hm={};for(let e=0;e<=255;e++)hm[e]=gr.unit.dec2hex(e);const Oo={ALL:0,RGB:1,HSL:2};class bIe{constructor(){this.type=Oo.ALL}get(){return this.type}set(n){if(this.type&&this.type!==n)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=n}reset(){this.type=Oo.ALL}is(n){return this.type===n}}class _Ie{constructor(n,r){this.color=r,this.changed=!1,this.data=n,this.type=new bIe}set(n,r){return this.color=r,this.changed=!1,this.data=n,this.type.type=Oo.ALL,this}_ensureHSL(){const n=this.data,{h:r,s:i,l:s}=n;r===void 0&&(n.h=gr.channel.rgb2hsl(n,"h")),i===void 0&&(n.s=gr.channel.rgb2hsl(n,"s")),s===void 0&&(n.l=gr.channel.rgb2hsl(n,"l"))}_ensureRGB(){const n=this.data,{r,g:i,b:s}=n;r===void 0&&(n.r=gr.channel.hsl2rgb(n,"r")),i===void 0&&(n.g=gr.channel.hsl2rgb(n,"g")),s===void 0&&(n.b=gr.channel.hsl2rgb(n,"b"))}get r(){const n=this.data,r=n.r;return!this.type.is(Oo.HSL)&&r!==void 0?r:(this._ensureHSL(),gr.channel.hsl2rgb(n,"r"))}get g(){const n=this.data,r=n.g;return!this.type.is(Oo.HSL)&&r!==void 0?r:(this._ensureHSL(),gr.channel.hsl2rgb(n,"g"))}get b(){const n=this.data,r=n.b;return!this.type.is(Oo.HSL)&&r!==void 0?r:(this._ensureHSL(),gr.channel.hsl2rgb(n,"b"))}get h(){const n=this.data,r=n.h;return!this.type.is(Oo.RGB)&&r!==void 0?r:(this._ensureRGB(),gr.channel.rgb2hsl(n,"h"))}get s(){const n=this.data,r=n.s;return!this.type.is(Oo.RGB)&&r!==void 0?r:(this._ensureRGB(),gr.channel.rgb2hsl(n,"s"))}get l(){const n=this.data,r=n.l;return!this.type.is(Oo.RGB)&&r!==void 0?r:(this._ensureRGB(),gr.channel.rgb2hsl(n,"l"))}get a(){return this.data.a}set r(n){this.type.set(Oo.RGB),this.changed=!0,this.data.r=n}set g(n){this.type.set(Oo.RGB),this.changed=!0,this.data.g=n}set b(n){this.type.set(Oo.RGB),this.changed=!0,this.data.b=n}set h(n){this.type.set(Oo.HSL),this.changed=!0,this.data.h=n}set s(n){this.type.set(Oo.HSL),this.changed=!0,this.data.s=n}set l(n){this.type.set(Oo.HSL),this.changed=!0,this.data.l=n}set a(n){this.changed=!0,this.data.a=n}}const F4=new _Ie({r:0,g:0,b:0,a:0},"transparent"),kx={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const n=e.match(kx.re);if(!n)return;const r=n[1],i=parseInt(r,16),s=r.length,a=s%4===0,o=s>4,l=o?1:17,u=o?8:4,d=a?0:-1,h=o?255:15;return F4.set({r:(i>>u*(d+3)&h)*l,g:(i>>u*(d+2)&h)*l,b:(i>>u*(d+1)&h)*l,a:a?(i&h)*l/255:1},e)},stringify:e=>{const{r:n,g:r,b:i,a:s}=e;return s<1?`#${hm[Math.round(n)]}${hm[Math.round(r)]}${hm[Math.round(i)]}${hm[Math.round(s*255)]}`:`#${hm[Math.round(n)]}${hm[Math.round(r)]}${hm[Math.round(i)]}`}},t0={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const n=e.match(t0.hueRe);if(n){const[,r,i]=n;switch(i){case"grad":return gr.channel.clamp.h(parseFloat(r)*.9);case"rad":return gr.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return gr.channel.clamp.h(parseFloat(r)*360)}}return gr.channel.clamp.h(parseFloat(e))},parse:e=>{const n=e.charCodeAt(0);if(n!==104&&n!==72)return;const r=e.match(t0.re);if(!r)return;const[,i,s,a,o,l]=r;return F4.set({h:t0._hue2deg(i),s:gr.channel.clamp.s(parseFloat(s)),l:gr.channel.clamp.l(parseFloat(a)),a:o?gr.channel.clamp.a(l?parseFloat(o)/100:parseFloat(o)):1},e)},stringify:e=>{const{h:n,s:r,l:i,a:s}=e;return s<1?`hsla(${gr.lang.round(n)}, ${gr.lang.round(r)}%, ${gr.lang.round(i)}%, ${s})`:`hsl(${gr.lang.round(n)}, ${gr.lang.round(r)}%, ${gr.lang.round(i)}%)`}},x_={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const n=x_.colors[e];if(n)return kx.parse(n)},stringify:e=>{const n=kx.stringify(e);for(const r in x_.colors)if(x_.colors[r]===n)return r}},Fb={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const n=e.charCodeAt(0);if(n!==114&&n!==82)return;const r=e.match(Fb.re);if(!r)return;const[,i,s,a,o,l,u,d,h]=r;return F4.set({r:gr.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:gr.channel.clamp.g(o?parseFloat(a)*2.55:parseFloat(a)),b:gr.channel.clamp.b(u?parseFloat(l)*2.55:parseFloat(l)),a:d?gr.channel.clamp.a(h?parseFloat(d)/100:parseFloat(d)):1},e)},stringify:e=>{const{r:n,g:r,b:i,a:s}=e;return s<1?`rgba(${gr.lang.round(n)}, ${gr.lang.round(r)}, ${gr.lang.round(i)}, ${gr.lang.round(s)})`:`rgb(${gr.lang.round(n)}, ${gr.lang.round(r)}, ${gr.lang.round(i)})`}},Rh={format:{keyword:x_,hex:kx,rgb:Fb,rgba:Fb,hsl:t0,hsla:t0},parse:e=>{if(typeof e!="string")return e;const n=kx.parse(e)||Fb.parse(e)||t0.parse(e)||x_.parse(e);if(n)return n;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Oo.HSL)||e.data.r===void 0?t0.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Fb.stringify(e):kx.stringify(e)},bte=(e,n)=>{const r=Rh.parse(e);for(const i in n)r[i]=gr.channel.clamp[i](n[i]);return Rh.stringify(r)},v_=(e,n,r=0,i=1)=>{if(typeof e!="number")return bte(e,{a:n});const s=F4.set({r:gr.channel.clamp.r(e),g:gr.channel.clamp.g(n),b:gr.channel.clamp.b(r),a:gr.channel.clamp.a(i)});return Rh.stringify(s)},wIe=e=>{const{r:n,g:r,b:i}=Rh.parse(e),s=.2126*gr.channel.toLinear(n)+.7152*gr.channel.toLinear(r)+.0722*gr.channel.toLinear(i);return gr.lang.round(s)},SIe=e=>wIe(e)>=.5,SS=e=>!SIe(e),_te=(e,n,r)=>{const i=Rh.parse(e),s=i[n],a=gr.channel.clamp[n](s+r);return s!==a&&(i[n]=a),Rh.stringify(i)},En=(e,n)=>_te(e,"l",n),Kn=(e,n)=>_te(e,"l",-n),Ie=(e,n)=>{const r=Rh.parse(e),i={};for(const s in n)n[s]&&(i[s]=r[s]+n[s]);return bte(e,i)},kIe=(e,n,r=50)=>{const{r:i,g:s,b:a,a:o}=Rh.parse(e),{r:l,g:u,b:d,a:h}=Rh.parse(n),f=r/100,m=f*2-1,x=o-h,_=((m*x===-1?m:(m+x)/(1+m*x))+1)/2,w=1-_,S=i*_+l*w,C=s*_+u*w,j=a*_+d*w,T=o*f+h*(1-f);return v_(S,C,j,T)},an=(e,n=100)=>{const r=Rh.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,kIe(r,e,n)};/*! @license DOMPurify 3.3.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.2/LICENSE */const{entries:wte,setPrototypeOf:AF,isFrozen:CIe,getPrototypeOf:jIe,getOwnPropertyDescriptor:NIe}=Object;let{freeze:dl,seal:Tu,create:S3}=Object,{apply:UA,construct:VA}=typeof Reflect<"u"&&Reflect;dl||(dl=function(n){return n});Tu||(Tu=function(n){return n});UA||(UA=function(n,r){for(var i=arguments.length,s=new Array(i>2?i-2:0),a=2;a<i;a++)s[a-2]=arguments[a];return n.apply(r,s)});VA||(VA=function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return new n(...i)});const gC=hl(Array.prototype.forEach),TIe=hl(Array.prototype.lastIndexOf),OF=hl(Array.prototype.pop),Yv=hl(Array.prototype.push),EIe=hl(Array.prototype.splice),k3=hl(String.prototype.toLowerCase),bE=hl(String.prototype.toString),_E=hl(String.prototype.match),Xv=hl(String.prototype.replace),AIe=hl(String.prototype.indexOf),OIe=hl(String.prototype.trim),xc=hl(Object.prototype.hasOwnProperty),Qo=hl(RegExp.prototype.test),Jv=RIe(TypeError);function hl(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return UA(e,n,i)}}function RIe(e){return function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return VA(e,r)}}function Ir(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:k3;AF&&AF(e,null);let i=n.length;for(;i--;){let s=n[i];if(typeof s=="string"){const a=r(s);a!==s&&(CIe(n)||(n[i]=a),s=a)}e[s]=!0}return e}function MIe(e){for(let n=0;n<e.length;n++)xc(e,n)||(e[n]=null);return e}function ch(e){const n=S3(null);for(const[r,i]of wte(e))xc(e,r)&&(Array.isArray(i)?n[r]=MIe(i):i&&typeof i=="object"&&i.constructor===Object?n[r]=ch(i):n[r]=i);return n}function Zv(e,n){for(;e!==null;){const i=NIe(e,n);if(i){if(i.get)return hl(i.get);if(typeof i.value=="function")return hl(i.value)}e=jIe(e)}function r(){return null}return r}const RF=dl(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),wE=dl(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),SE=dl(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),PIe=dl(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),kE=dl(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),LIe=dl(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),MF=dl(["#text"]),PF=dl(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),CE=dl(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),LF=dl(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),yC=dl(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$Ie=Tu(/\{\{[\w\W]*|[\w\W]*\}\}/gm),DIe=Tu(/<%[\w\W]*|[\w\W]*%>/gm),IIe=Tu(/\$\{[\w\W]*/gm),BIe=Tu(/^data-[\-\w.\u00B7-\uFFFF]+$/),zIe=Tu(/^aria-[\-\w]+$/),Ste=Tu(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),FIe=Tu(/^(?:\w+script|data):/i),HIe=Tu(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kte=Tu(/^html$/i),WIe=Tu(/^[a-z][.\w]*(-[.\w]+)+$/i);var $F=Object.freeze({__proto__:null,ARIA_ATTR:zIe,ATTR_WHITESPACE:HIe,CUSTOM_ELEMENT:WIe,DATA_ATTR:BIe,DOCTYPE_NAME:kte,ERB_EXPR:DIe,IS_ALLOWED_URI:Ste,IS_SCRIPT_OR_DATA:FIe,MUSTACHE_EXPR:$Ie,TMPLIT_EXPR:IIe});const Qv={element:1,text:3,progressingInstruction:7,comment:8,document:9},UIe=function(){return typeof window>"u"?null:window},VIe=function(n,r){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(i=r.getAttribute(s));const a="dompurify"+(i?"#"+i:"");try{return n.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},DF=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cte(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:UIe();const n=_t=>Cte(_t);if(n.version="3.3.2",n.removed=[],!e||!e.document||e.document.nodeType!==Qv.document||!e.Element)return n.isSupported=!1,n;let{document:r}=e;const i=r,s=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:u,NodeFilter:d,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:m,trustedTypes:x}=e,v=u.prototype,_=Zv(v,"cloneNode"),w=Zv(v,"remove"),S=Zv(v,"nextSibling"),C=Zv(v,"childNodes"),j=Zv(v,"parentNode");if(typeof o=="function"){const _t=r.createElement("template");_t.content&&_t.content.ownerDocument&&(r=_t.content.ownerDocument)}let T,E="";const{implementation:N,createNodeIterator:R,createDocumentFragment:$,getElementsByTagName:G}=r,{importNode:W}=i;let z=DF();n.isSupported=typeof wte=="function"&&typeof j=="function"&&N&&N.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:U,ERB_EXPR:I,TMPLIT_EXPR:O,DATA_ATTR:D,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:B,CUSTOM_ELEMENT:q}=$F;let{IS_ALLOWED_URI:H}=$F,F=null;const X=Ir({},[...RF,...wE,...SE,...kE,...MF]);let V=null;const ne=Ir({},[...PF,...CE,...LF,...yC]);let J=Object.seal(S3(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),te=null,re=null;const Q=Object.seal(S3(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ue=!0,ge=!0,se=!1,oe=!0,ve=!1,_e=!0,Ae=!1,Ke=!1,ot=!1,Nt=!1,$t=!1,en=!1,on=!0,Vt=!1;const Gt="user-content-";let Et=!0,_n=!1,xe={},pe=null;const ze=Ir({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ft=null;const Je=Ir({},["audio","video","img","source","image","track"]);let ht=null;const yt=Ir({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),St="http://www.w3.org/1998/Math/MathML",We="http://www.w3.org/2000/svg",Fe="http://www.w3.org/1999/xhtml";let lt=Fe,et=!1,Be=null;const ke=Ir({},[St,We,Fe],bE);let we=Ir({},["mi","mo","mn","ms","mtext"]),Ge=Ir({},["annotation-xml"]);const rt=Ir({},["title","style","font","a","script"]);let Ze=null;const Ye=["application/xhtml+xml","text/html"],ut="text/html";let xt=null,zt=null;const rn=r.createElement("form"),sn=function(ie){return ie instanceof RegExp||ie instanceof Function},dt=function(){let ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(zt&&zt===ie)){if((!ie||typeof ie!="object")&&(ie={}),ie=ch(ie),Ze=Ye.indexOf(ie.PARSER_MEDIA_TYPE)===-1?ut:ie.PARSER_MEDIA_TYPE,xt=Ze==="application/xhtml+xml"?bE:k3,F=xc(ie,"ALLOWED_TAGS")?Ir({},ie.ALLOWED_TAGS,xt):X,V=xc(ie,"ALLOWED_ATTR")?Ir({},ie.ALLOWED_ATTR,xt):ne,Be=xc(ie,"ALLOWED_NAMESPACES")?Ir({},ie.ALLOWED_NAMESPACES,bE):ke,ht=xc(ie,"ADD_URI_SAFE_ATTR")?Ir(ch(yt),ie.ADD_URI_SAFE_ATTR,xt):yt,ft=xc(ie,"ADD_DATA_URI_TAGS")?Ir(ch(Je),ie.ADD_DATA_URI_TAGS,xt):Je,pe=xc(ie,"FORBID_CONTENTS")?Ir({},ie.FORBID_CONTENTS,xt):ze,te=xc(ie,"FORBID_TAGS")?Ir({},ie.FORBID_TAGS,xt):ch({}),re=xc(ie,"FORBID_ATTR")?Ir({},ie.FORBID_ATTR,xt):ch({}),xe=xc(ie,"USE_PROFILES")?ie.USE_PROFILES:!1,ue=ie.ALLOW_ARIA_ATTR!==!1,ge=ie.ALLOW_DATA_ATTR!==!1,se=ie.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=ie.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ve=ie.SAFE_FOR_TEMPLATES||!1,_e=ie.SAFE_FOR_XML!==!1,Ae=ie.WHOLE_DOCUMENT||!1,Nt=ie.RETURN_DOM||!1,$t=ie.RETURN_DOM_FRAGMENT||!1,en=ie.RETURN_TRUSTED_TYPE||!1,ot=ie.FORCE_BODY||!1,on=ie.SANITIZE_DOM!==!1,Vt=ie.SANITIZE_NAMED_PROPS||!1,Et=ie.KEEP_CONTENT!==!1,_n=ie.IN_PLACE||!1,H=ie.ALLOWED_URI_REGEXP||Ste,lt=ie.NAMESPACE||Fe,we=ie.MATHML_TEXT_INTEGRATION_POINTS||we,Ge=ie.HTML_INTEGRATION_POINTS||Ge,J=ie.CUSTOM_ELEMENT_HANDLING||{},ie.CUSTOM_ELEMENT_HANDLING&&sn(ie.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=ie.CUSTOM_ELEMENT_HANDLING.tagNameCheck),ie.CUSTOM_ELEMENT_HANDLING&&sn(ie.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=ie.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),ie.CUSTOM_ELEMENT_HANDLING&&typeof ie.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=ie.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ve&&(ge=!1),$t&&(Nt=!0),xe&&(F=Ir({},MF),V=S3(null),xe.html===!0&&(Ir(F,RF),Ir(V,PF)),xe.svg===!0&&(Ir(F,wE),Ir(V,CE),Ir(V,yC)),xe.svgFilters===!0&&(Ir(F,SE),Ir(V,CE),Ir(V,yC)),xe.mathMl===!0&&(Ir(F,kE),Ir(V,LF),Ir(V,yC))),xc(ie,"ADD_TAGS")||(Q.tagCheck=null),xc(ie,"ADD_ATTR")||(Q.attributeCheck=null),ie.ADD_TAGS&&(typeof ie.ADD_TAGS=="function"?Q.tagCheck=ie.ADD_TAGS:(F===X&&(F=ch(F)),Ir(F,ie.ADD_TAGS,xt))),ie.ADD_ATTR&&(typeof ie.ADD_ATTR=="function"?Q.attributeCheck=ie.ADD_ATTR:(V===ne&&(V=ch(V)),Ir(V,ie.ADD_ATTR,xt))),ie.ADD_URI_SAFE_ATTR&&Ir(ht,ie.ADD_URI_SAFE_ATTR,xt),ie.FORBID_CONTENTS&&(pe===ze&&(pe=ch(pe)),Ir(pe,ie.FORBID_CONTENTS,xt)),ie.ADD_FORBID_CONTENTS&&(pe===ze&&(pe=ch(pe)),Ir(pe,ie.ADD_FORBID_CONTENTS,xt)),Et&&(F["#text"]=!0),Ae&&Ir(F,["html","head","body"]),F.table&&(Ir(F,["tbody"]),delete te.tbody),ie.TRUSTED_TYPES_POLICY){if(typeof ie.TRUSTED_TYPES_POLICY.createHTML!="function")throw Jv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ie.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Jv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=ie.TRUSTED_TYPES_POLICY,E=T.createHTML("")}else T===void 0&&(T=VIe(x,s)),T!==null&&typeof E=="string"&&(E=T.createHTML(""));dl&&dl(ie),zt=ie}},Tt=Ir({},[...wE,...SE,...PIe]),Oe=Ir({},[...kE,...LIe]),pt=function(ie){let Se=j(ie);(!Se||!Se.tagName)&&(Se={namespaceURI:lt,tagName:"template"});const fe=k3(ie.tagName),$e=k3(Se.tagName);return Be[ie.namespaceURI]?ie.namespaceURI===We?Se.namespaceURI===Fe?fe==="svg":Se.namespaceURI===St?fe==="svg"&&($e==="annotation-xml"||we[$e]):!!Tt[fe]:ie.namespaceURI===St?Se.namespaceURI===Fe?fe==="math":Se.namespaceURI===We?fe==="math"&&Ge[$e]:!!Oe[fe]:ie.namespaceURI===Fe?Se.namespaceURI===We&&!Ge[$e]||Se.namespaceURI===St&&!we[$e]?!1:!Oe[fe]&&(rt[fe]||!Tt[fe]):!!(Ze==="application/xhtml+xml"&&Be[ie.namespaceURI]):!1},Ot=function(ie){Yv(n.removed,{element:ie});try{j(ie).removeChild(ie)}catch{w(ie)}},Pt=function(ie,Se){try{Yv(n.removed,{attribute:Se.getAttributeNode(ie),from:Se})}catch{Yv(n.removed,{attribute:null,from:Se})}if(Se.removeAttribute(ie),ie==="is")if(Nt||$t)try{Ot(Se)}catch{}else try{Se.setAttribute(ie,"")}catch{}},hn=function(ie){let Se=null,fe=null;if(ot)ie="<remove></remove>"+ie;else{const He=_E(ie,/^[\r\n\t ]+/);fe=He&&He[0]}Ze==="application/xhtml+xml"&&lt===Fe&&(ie='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+ie+"</body></html>");const $e=T?T.createHTML(ie):ie;if(lt===Fe)try{Se=new m().parseFromString($e,Ze)}catch{}if(!Se||!Se.documentElement){Se=N.createDocument(lt,"template",null);try{Se.documentElement.innerHTML=et?E:$e}catch{}}const Ft=Se.body||Se.documentElement;return ie&&fe&&Ft.insertBefore(r.createTextNode(fe),Ft.childNodes[0]||null),lt===Fe?G.call(Se,Ae?"html":"body")[0]:Ae?Se.documentElement:Ft},un=function(ie){return R.call(ie.ownerDocument||ie,ie,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},dn=function(ie){return ie instanceof f&&(typeof ie.nodeName!="string"||typeof ie.textContent!="string"||typeof ie.removeChild!="function"||!(ie.attributes instanceof h)||typeof ie.removeAttribute!="function"||typeof ie.setAttribute!="function"||typeof ie.namespaceURI!="string"||typeof ie.insertBefore!="function"||typeof ie.hasChildNodes!="function")},pn=function(ie){return typeof l=="function"&&ie instanceof l};function Bt(_t,ie,Se){gC(_t,fe=>{fe.call(n,ie,Se,zt)})}const qn=function(ie){let Se=null;if(Bt(z.beforeSanitizeElements,ie,null),dn(ie))return Ot(ie),!0;const fe=xt(ie.nodeName);if(Bt(z.uponSanitizeElement,ie,{tagName:fe,allowedTags:F}),_e&&ie.hasChildNodes()&&!pn(ie.firstElementChild)&&Qo(/<[/\w!]/g,ie.innerHTML)&&Qo(/<[/\w!]/g,ie.textContent)||ie.nodeType===Qv.progressingInstruction||_e&&ie.nodeType===Qv.comment&&Qo(/<[/\w]/g,ie.data))return Ot(ie),!0;if(!(Q.tagCheck instanceof Function&&Q.tagCheck(fe))&&(!F[fe]||te[fe])){if(!te[fe]&&gt(fe)&&(J.tagNameCheck instanceof RegExp&&Qo(J.tagNameCheck,fe)||J.tagNameCheck instanceof Function&&J.tagNameCheck(fe)))return!1;if(Et&&!pe[fe]){const $e=j(ie)||ie.parentNode,Ft=C(ie)||ie.childNodes;if(Ft&&$e){const He=Ft.length;for(let It=He-1;It>=0;--It){const fn=_(Ft[It],!0);fn.__removalCount=(ie.__removalCount||0)+1,$e.insertBefore(fn,S(ie))}}}return Ot(ie),!0}return ie instanceof u&&!pt(ie)||(fe==="noscript"||fe==="noembed"||fe==="noframes")&&Qo(/<\/no(script|embed|frames)/i,ie.innerHTML)?(Ot(ie),!0):(ve&&ie.nodeType===Qv.text&&(Se=ie.textContent,gC([U,I,O],$e=>{Se=Xv(Se,$e," ")}),ie.textContent!==Se&&(Yv(n.removed,{element:ie.cloneNode()}),ie.textContent=Se)),Bt(z.afterSanitizeElements,ie,null),!1)},Ne=function(ie,Se,fe){if(re[Se]||on&&(Se==="id"||Se==="name")&&(fe in r||fe in rn))return!1;if(!(ge&&!re[Se]&&Qo(D,Se))){if(!(ue&&Qo(M,Se))){if(!(Q.attributeCheck instanceof Function&&Q.attributeCheck(Se,ie))){if(!V[Se]||re[Se]){if(!(gt(ie)&&(J.tagNameCheck instanceof RegExp&&Qo(J.tagNameCheck,ie)||J.tagNameCheck instanceof Function&&J.tagNameCheck(ie))&&(J.attributeNameCheck instanceof RegExp&&Qo(J.attributeNameCheck,Se)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(Se,ie))||Se==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&Qo(J.tagNameCheck,fe)||J.tagNameCheck instanceof Function&&J.tagNameCheck(fe))))return!1}else if(!ht[Se]){if(!Qo(H,Xv(fe,B,""))){if(!((Se==="src"||Se==="xlink:href"||Se==="href")&&ie!=="script"&&AIe(fe,"data:")===0&&ft[ie])){if(!(se&&!Qo(L,Xv(fe,B,"")))){if(fe)return!1}}}}}}}return!0},gt=function(ie){return ie!=="annotation-xml"&&_E(ie,q)},Dt=function(ie){Bt(z.beforeSanitizeAttributes,ie,null);const{attributes:Se}=ie;if(!Se||dn(ie))return;const fe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0};let $e=Se.length;for(;$e--;){const Ft=Se[$e],{name:He,namespaceURI:It,value:fn}=Ft,Kt=xt(He),sr=fn;let Tr=He==="value"?sr:OIe(sr);if(fe.attrName=Kt,fe.attrValue=Tr,fe.keepAttr=!0,fe.forceKeepAttr=void 0,Bt(z.uponSanitizeAttribute,ie,fe),Tr=fe.attrValue,Vt&&(Kt==="id"||Kt==="name")&&(Pt(He,ie),Tr=Gt+Tr),_e&&Qo(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Tr)){Pt(He,ie);continue}if(Kt==="attributename"&&_E(Tr,"href")){Pt(He,ie);continue}if(fe.forceKeepAttr)continue;if(!fe.keepAttr){Pt(He,ie);continue}if(!oe&&Qo(/\/>/i,Tr)){Pt(He,ie);continue}ve&&gC([U,I,O],hi=>{Tr=Xv(Tr,hi," ")});const cn=xt(ie.nodeName);if(!Ne(cn,Kt,Tr)){Pt(He,ie);continue}if(T&&typeof x=="object"&&typeof x.getAttributeType=="function"&&!It)switch(x.getAttributeType(cn,Kt)){case"TrustedHTML":{Tr=T.createHTML(Tr);break}case"TrustedScriptURL":{Tr=T.createScriptURL(Tr);break}}if(Tr!==sr)try{It?ie.setAttributeNS(It,He,Tr):ie.setAttribute(He,Tr),dn(ie)?Ot(ie):OF(n.removed)}catch{Pt(He,ie)}}Bt(z.afterSanitizeAttributes,ie,null)},kt=function _t(ie){let Se=null;const fe=un(ie);for(Bt(z.beforeSanitizeShadowDOM,ie,null);Se=fe.nextNode();)Bt(z.uponSanitizeShadowNode,Se,null),qn(Se),Dt(Se),Se.content instanceof a&&_t(Se.content);Bt(z.afterSanitizeShadowDOM,ie,null)};return n.sanitize=function(_t){let ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Se=null,fe=null,$e=null,Ft=null;if(et=!_t,et&&(_t="<!-->"),typeof _t!="string"&&!pn(_t))if(typeof _t.toString=="function"){if(_t=_t.toString(),typeof _t!="string")throw Jv("dirty is not a string, aborting")}else throw Jv("toString is not a function");if(!n.isSupported)return _t;if(Ke||dt(ie),n.removed=[],typeof _t=="string"&&(_n=!1),_n){if(_t.nodeName){const fn=xt(_t.nodeName);if(!F[fn]||te[fn])throw Jv("root node is forbidden and cannot be sanitized in-place")}}else if(_t instanceof l)Se=hn("<!---->"),fe=Se.ownerDocument.importNode(_t,!0),fe.nodeType===Qv.element&&fe.nodeName==="BODY"||fe.nodeName==="HTML"?Se=fe:Se.appendChild(fe);else{if(!Nt&&!ve&&!Ae&&_t.indexOf("<")===-1)return T&&en?T.createHTML(_t):_t;if(Se=hn(_t),!Se)return Nt?null:en?E:""}Se&&ot&&Ot(Se.firstChild);const He=un(_n?_t:Se);for(;$e=He.nextNode();)qn($e),Dt($e),$e.content instanceof a&&kt($e.content);if(_n)return _t;if(Nt){if($t)for(Ft=$.call(Se.ownerDocument);Se.firstChild;)Ft.appendChild(Se.firstChild);else Ft=Se;return(V.shadowroot||V.shadowrootmode)&&(Ft=W.call(i,Ft,!0)),Ft}let It=Ae?Se.outerHTML:Se.innerHTML;return Ae&&F["!doctype"]&&Se.ownerDocument&&Se.ownerDocument.doctype&&Se.ownerDocument.doctype.name&&Qo(kte,Se.ownerDocument.doctype.name)&&(It="<!DOCTYPE "+Se.ownerDocument.doctype.name+`>
@@ -1204,8 +1204,8 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
1204
1204
  node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,s=e.y,a=Math.abs(i-r.x),o=e.width/2;let l=r.x<n.x?o-a:o+a;const u=e.height/2,d=Math.abs(n.y-r.y),h=Math.abs(n.x-r.x);if(Math.abs(s-n.y)*o>Math.abs(i-n.x)*u){let f=r.y<n.y?n.y-u-s:s-u-n.y;l=h*f/d;const m={x:r.x<n.x?r.x+l:r.x-h+l,y:r.y<n.y?r.y+d-f:r.y-d+f};return l===0&&(m.x=n.x,m.y=n.y),h===0&&(m.x=n.x),d===0&&(m.y=n.y),At.debug(`abc89 top/bottom calc, Q ${d}, q ${f}, R ${h}, r ${l}`,m),m}else{r.x<n.x?l=n.x-o-i:l=i-o-n.x;let f=d*l/h,m=r.x<n.x?r.x+h-l:r.x-h+l,x=r.y<n.y?r.y+f:r.y-f;return At.debug(`sides calc abc89, Q ${d}, q ${f}, R ${h}, r ${l}`,{_x:m,_y:x}),l===0&&(m=n.x,x=n.y),h===0&&(m=n.x),d===0&&(x=n.y),{x:m,y:x}}},"intersection"),sW=Y((e,n)=>{At.warn("abc88 cutPathAtIntersect",e,n);let r=[],i=e[0],s=!1;return e.forEach(a=>{if(At.info("abc88 checking point",a,n),!uXe(n,a)&&!s){const o=dXe(n,i,a);At.debug("abc88 inside",a,i,o),At.debug("abc88 intersection",o,n);let l=!1;r.forEach(u=>{l=l||u.x===o.x&&u.y===o.y}),r.some(u=>u.x===o.x&&u.y===o.y)?At.warn("abc88 no intersect",o,r):r.push(o),s=!0}else At.warn("abc88 outside",a,i),i=a,s||r.push(a)}),At.debug("returning points",r),r},"cutPathAtIntersect");function qae(e){const n=[],r=[];for(let i=1;i<e.length-1;i++){const s=e[i-1],a=e[i],o=e[i+1];(s.x===a.x&&a.y===o.y&&Math.abs(a.x-o.x)>5&&Math.abs(a.y-s.y)>5||s.y===a.y&&a.x===o.x&&Math.abs(a.x-s.x)>5&&Math.abs(a.y-o.y)>5)&&(n.push(a),r.push(i))}return{cornerPoints:n,cornerPointPositions:r}}Y(qae,"extractCornerPoints");var aW=Y(function(e,n,r){const i=n.x-e.x,s=n.y-e.y,a=Math.sqrt(i*i+s*s),o=r/a;return{x:n.x-o*i,y:n.y-o*s}},"findAdjacentPoint"),hXe=Y(function(e){const{cornerPointPositions:n}=qae(e),r=[];for(let i=0;i<e.length;i++)if(n.includes(i)){const s=e[i-1],a=e[i+1],o=e[i],l=aW(s,o,5),u=aW(a,o,5),d=u.x-l.x,h=u.y-l.y;r.push(l);const f=Math.sqrt(2)*2;let m={x:o.x,y:o.y};if(Math.abs(a.x-s.x)>10&&Math.abs(a.y-s.y)>=10){At.debug("Corner point fixing",Math.abs(a.x-s.x),Math.abs(a.y-s.y));const x=5;o.x===l.x?m={x:d<0?l.x-x+f:l.x+x-f,y:h<0?l.y-f:l.y+f}:m={x:d<0?l.x-f:l.x+f,y:h<0?l.y-x+f:l.y+x-f}}else At.debug("Corner point skipping fixing",Math.abs(a.x-s.x),Math.abs(a.y-s.y));r.push(m,u)}else r.push(e[i]);return r},"fixCorners"),fXe=Y((e,n,r)=>{const i=e-n-r,s=2,a=2,o=s+a,l=Math.floor(i/o),u=Array(l).fill(`${s} ${a}`).join(" ");return`0 ${n} ${u} ${r}`},"generateDashArray"),pXe=Y(function(e,n,r,i,s,a,o,l=!1){var M;const{handDrawnSeed:u}=di();let d=n.points,h=!1;const f=s;var m=a;const x=[];for(const L in n.cssCompiledStyles)qie(L)||x.push(n.cssCompiledStyles[L]);At.debug("UIO intersect check",n.points,m.x,f.x),m.intersect&&f.intersect&&!l&&(d=d.slice(1,n.points.length-1),d.unshift(f.intersect(d[0])),At.debug("Last point UIO",n.start,"-->",n.end,d[d.length-1],m,m.intersect(d[d.length-1])),d.push(m.intersect(d[d.length-1])));const v=btoa(JSON.stringify(d));n.toCluster&&(At.info("to cluster abc88",r.get(n.toCluster)),d=sW(n.points,r.get(n.toCluster).node),h=!0),n.fromCluster&&(At.debug("from cluster abc88",r.get(n.fromCluster),JSON.stringify(d,null,2)),d=sW(d.reverse(),r.get(n.fromCluster).node).reverse(),h=!0);let _=d.filter(L=>!Number.isNaN(L.y));const w=oXe(n.curve);w!=="rounded"&&(_=hXe(_));let S=w_;switch(w){case"linear":S=w_;break;case"basis":S=oO;break;case"cardinal":S=jne;break;case"bumpX":S=_ne;break;case"bumpY":S=wne;break;case"catmullRom":S=Tne;break;case"monotoneX":S=Pne;break;case"monotoneY":S=Lne;break;case"natural":S=Dne;break;case"step":S=Ine;break;case"stepAfter":S=zne;break;case"stepBefore":S=Bne;break;case"rounded":S=w_;break;default:S=oO}const{x:C,y:j}=uVe(n),T=zWe().x(C).y(j).curve(S);let E;switch(n.thickness){case"normal":E="edge-thickness-normal";break;case"thick":E="edge-thickness-thick";break;case"invisible":E="edge-thickness-invisible";break;default:E="edge-thickness-normal"}switch(n.pattern){case"solid":E+=" edge-pattern-solid";break;case"dotted":E+=" edge-pattern-dotted";break;case"dashed":E+=" edge-pattern-dashed";break;default:E+=" edge-pattern-solid"}let N,R=w==="rounded"?Gae(Kae(_,n),5):T(_);const $=Array.isArray(n.style)?n.style:[n.style];let G=$.find(L=>L==null?void 0:L.startsWith("stroke:")),W="";n.animate&&(W="edge-animation-fast"),n.animation&&(W="edge-animation-"+n.animation);let z=!1;if(n.look==="handDrawn"){const L=Mn.svg(e);Object.assign([],_);const B=L.path(R,{roughness:.3,seed:u});E+=" transition",N=tr(B).select("path").attr("id",n.id).attr("class"," "+E+(n.classes?" "+n.classes:"")+(W?" "+W:"")).attr("style",$?$.reduce((H,F)=>H+";"+F,""):"");let q=N.attr("d");N.attr("d",q),e.node().appendChild(N.node())}else{const L=x.join(";"),B=$?$.reduce((ne,J)=>ne+J+";",""):"",q=(L?L+";"+B+";":B)+";"+($?$.reduce((ne,J)=>ne+";"+J,""):"");N=e.append("path").attr("d",R).attr("id",n.id).attr("class"," "+E+(n.classes?" "+n.classes:"")+(W?" "+W:"")).attr("style",q),G=(M=q.match(/stroke:([^;]+)/))==null?void 0:M[1],z=n.animate===!0||!!n.animation||L.includes("animation");const H=N.node(),F=typeof H.getTotalLength=="function"?H.getTotalLength():0,X=_H[n.arrowTypeStart]||0,V=_H[n.arrowTypeEnd]||0;if(n.look==="neo"&&!z){const J=`stroke-dasharray: ${n.pattern==="dotted"||n.pattern==="dashed"?fXe(F,X,V):`0 ${X} ${F-X-V} ${V}`}; stroke-dashoffset: 0;`;N.attr("style",J+N.attr("style"))}}N.attr("data-edge",!0),N.attr("data-et","edge"),N.attr("data-id",n.id),N.attr("data-points",v),n.showPoints&&_.forEach(L=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",L.x).attr("cy",L.y)});let U="";(di().flowchart.arrowMarkerAbsolute||di().state.arrowMarkerAbsolute)&&(U=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,U=U.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),At.info("arrowTypeStart",n.arrowTypeStart),At.info("arrowTypeEnd",n.arrowTypeEnd),sXe(N,n,U,o,i,G);const I=Math.floor(d.length/2),O=d[I];dd.isLabelCoordinateInPath(O,N.attr("d"))||(h=!0);let D={};return h&&(D.updatedPath=d),D.originalPath=n.points,D},"insertEdge");function Gae(e,n){if(e.length<2)return"";let r="";const i=e.length,s=1e-5;for(let a=0;a<i;a++){const o=e[a],l=e[a-1],u=e[a+1];if(a===0)r+=`M${o.x},${o.y}`;else if(a===i-1)r+=`L${o.x},${o.y}`;else{const d=o.x-l.x,h=o.y-l.y,f=u.x-o.x,m=u.y-o.y,x=Math.hypot(d,h),v=Math.hypot(f,m);if(x<s||v<s){r+=`L${o.x},${o.y}`;continue}const _=d/x,w=h/x,S=f/v,C=m/v,j=_*S+w*C,T=Math.max(-1,Math.min(1,j)),E=Math.acos(T);if(E<s||Math.abs(Math.PI-E)<s){r+=`L${o.x},${o.y}`;continue}const N=Math.min(n/Math.sin(E/2),x/2,v/2),R=o.x-_*N,$=o.y-w*N,G=o.x+S*N,W=o.y+C*N;r+=`L${R},${$}`,r+=`Q${o.x},${o.y} ${G},${W}`}}return r}Y(Gae,"generateRoundedPath");function LO(e,n){if(!e||!n)return{angle:0,deltaX:0,deltaY:0};const r=n.x-e.x,i=n.y-e.y;return{angle:Math.atan2(i,r),deltaX:r,deltaY:i}}Y(LO,"calculateDeltaAndAngle");function Kae(e,n){const r=e.map(s=>({...s}));if(e.length>=2&&Ro[n.arrowTypeStart]){const s=Ro[n.arrowTypeStart],a=e[0],o=e[1],{angle:l}=LO(a,o),u=s*Math.cos(l),d=s*Math.sin(l);r[0].x=a.x+u,r[0].y=a.y+d}const i=e.length;if(i>=2&&Ro[n.arrowTypeEnd]){const s=Ro[n.arrowTypeEnd],a=e[i-1],o=e[i-2],{angle:l}=LO(o,a),u=s*Math.cos(l),d=s*Math.sin(l);r[i-1].x=a.x-u,r[i-1].y=a.y-d}return r}Y(Kae,"applyMarkerOffsetsToPoints");var mXe=Y((e,n,r,i)=>{n.forEach(s=>{OXe[s](e,r,i)})},"insertMarkers"),gXe=Y((e,n,r)=>{At.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+n+"-extensionStart").attr("class","marker extension "+n).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+n+"-extensionEnd").attr("class","marker extension "+n).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),yXe=Y((e,n,r)=>{e.append("defs").append("marker").attr("id",r+"_"+n+"-compositionStart").attr("class","marker composition "+n).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+n+"-compositionEnd").attr("class","marker composition "+n).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),xXe=Y((e,n,r)=>{e.append("defs").append("marker").attr("id",r+"_"+n+"-aggregationStart").attr("class","marker aggregation "+n).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+n+"-aggregationEnd").attr("class","marker aggregation "+n).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),vXe=Y((e,n,r)=>{e.append("defs").append("marker").attr("id",r+"_"+n+"-dependencyStart").attr("class","marker dependency "+n).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+n+"-dependencyEnd").attr("class","marker dependency "+n).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),bXe=Y((e,n,r)=>{e.append("defs").append("marker").attr("id",r+"_"+n+"-lollipopStart").attr("class","marker lollipop "+n).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+n+"-lollipopEnd").attr("class","marker lollipop "+n).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),_Xe=Y((e,n,r)=>{e.append("marker").attr("id",r+"_"+n+"-pointEnd").attr("class","marker "+n).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+n+"-pointStart").attr("class","marker "+n).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),wXe=Y((e,n,r)=>{e.append("marker").attr("id",r+"_"+n+"-circleEnd").attr("class","marker "+n).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+n+"-circleStart").attr("class","marker "+n).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),SXe=Y((e,n,r)=>{e.append("marker").attr("id",r+"_"+n+"-crossEnd").attr("class","marker cross "+n).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+n+"-crossStart").attr("class","marker cross "+n).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),kXe=Y((e,n,r)=>{e.append("defs").append("marker").attr("id",r+"_"+n+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),CXe=Y((e,n,r)=>{e.append("defs").append("marker").attr("id",r+"_"+n+"-onlyOneStart").attr("class","marker onlyOne "+n).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+n+"-onlyOneEnd").attr("class","marker onlyOne "+n).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),jXe=Y((e,n,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+n+"-zeroOrOneStart").attr("class","marker zeroOrOne "+n).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),i.append("path").attr("d","M9,0 L9,18");const s=e.append("defs").append("marker").attr("id",r+"_"+n+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+n).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),s.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),NXe=Y((e,n,r)=>{e.append("defs").append("marker").attr("id",r+"_"+n+"-oneOrMoreStart").attr("class","marker oneOrMore "+n).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+n+"-oneOrMoreEnd").attr("class","marker oneOrMore "+n).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),TXe=Y((e,n,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+n+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+n).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),i.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const s=e.append("defs").append("marker").attr("id",r+"_"+n+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+n).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),s.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),EXe=Y((e,n,r)=>{e.append("defs").append("marker").attr("id",r+"_"+n+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
1205
1205
  L20,10
1206
1206
  M20,10
1207
- L0,20`)},"requirement_arrow"),AXe=Y((e,n,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+n+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),OXe={extension:gXe,composition:yXe,aggregation:xXe,dependency:vXe,lollipop:bXe,point:_Xe,circle:wXe,cross:SXe,barb:kXe,only_one:CXe,zero_or_one:jXe,one_or_more:NXe,zero_or_more:TXe,requirement_arrow:EXe,requirement_contains:AXe},RXe=mXe,MXe={common:CS,getConfig:Do,insertCluster:BYe,insertEdge:pXe,insertEdgeLabel:lXe,insertMarkers:RXe,insertNode:Vae,interpolateToCurve:pP,labelHelper:cr,log:At,positionEdgeLabel:cXe},p2={},Yae=Y(e=>{for(const n of e)p2[n.name]=n},"registerLayoutLoaders"),PXe=Y(()=>{Yae([{name:"dagre",loader:Y(async()=>await nt(()=>import("./dagre-KLK3FWXG-NZhPNhMW.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:Y(async()=>await nt(()=>import("./cose-bilkent-S5V4N54A-qyQOdIdo.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");PXe();var nwt=Y(async(e,n)=>{if(!(e.layoutAlgorithm in p2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=p2[e.layoutAlgorithm];return(await r.loader()).render(e,n,MXe,{algorithm:r.algorithm})},"render"),rwt=Y((e="",{fallback:n="dagre"}={})=>{if(e in p2)return e;if(n in p2)return At.warn(`Layout algorithm ${e} is not registered. Using ${n} as fallback.`),n;throw new Error(`Both layout algorithms ${e} and ${n} are not registered.`)},"getRegisteredLayoutAlgorithm"),LXe=Cie(Object.keys,Object),$Xe=Object.prototype,DXe=$Xe.hasOwnProperty;function IXe(e){if(!tN(e))return LXe(e);var n=[];for(var r in Object(e))DXe.call(e,r)&&r!="constructor"&&n.push(r);return n}var $O=ey(Md,"DataView"),DO=ey(Md,"Promise"),IO=ey(Md,"Set"),BO=ey(Md,"WeakMap"),oW="[object Map]",BXe="[object Object]",lW="[object Promise]",cW="[object Set]",uW="[object WeakMap]",dW="[object DataView]",zXe=Q0($O),FXe=Q0(h2),HXe=Q0(DO),WXe=Q0(IO),UXe=Q0(BO),Kg=Z0;($O&&Kg(new $O(new ArrayBuffer(1)))!=dW||h2&&Kg(new h2)!=oW||DO&&Kg(DO.resolve())!=lW||IO&&Kg(new IO)!=cW||BO&&Kg(new BO)!=uW)&&(Kg=function(e){var n=Z0(e),r=n==BXe?e.constructor:void 0,i=r?Q0(r):"";if(i)switch(i){case zXe:return dW;case FXe:return oW;case HXe:return lW;case WXe:return cW;case UXe:return uW}return n});var VXe="[object Map]",qXe="[object Set]",GXe=Object.prototype,KXe=GXe.hasOwnProperty;function hW(e){if(e==null)return!0;if(nN(e)&&(rj(e)||typeof e=="string"||typeof e.splice=="function"||hP(e)||fP(e)||nj(e)))return!e.length;var n=Kg(e);if(n==VXe||n==qXe)return!e.size;if(tN(e))return!IXe(e).length;for(var r in e)if(KXe.call(e,r))return!1;return!0}var Xae="c4",YXe=Y(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),XXe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./c4Diagram-IC4MRINW-BOzaNXK7.js");return{diagram:n}},__vite__mapDeps([55,56]),import.meta.url);return{id:Xae,diagram:e}},"loader"),JXe={id:Xae,detector:YXe,loader:XXe},ZXe=JXe,Jae="flowchart",QXe=Y((e,n)=>{var r,i;return((r=n==null?void 0:n.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=n==null?void 0:n.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),eJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./flowDiagram-PKNHOUZH-DxA4mpTS.js");return{diagram:n}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Jae,diagram:e}},"loader"),tJe={id:Jae,detector:QXe,loader:eJe},nJe=tJe,Zae="flowchart-v2",rJe=Y((e,n)=>{var r,i,s;return((r=n==null?void 0:n.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=n==null?void 0:n.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(n.layout="elk"),/^\s*graph/.test(e)&&((s=n==null?void 0:n.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),iJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./flowDiagram-PKNHOUZH-DxA4mpTS.js");return{diagram:n}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Zae,diagram:e}},"loader"),sJe={id:Zae,detector:rJe,loader:iJe},aJe=sJe,Qae="er",oJe=Y(e=>/^\s*erDiagram/.test(e),"detector"),lJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./erDiagram-INFDFZHY-CUBKFJ6q.js");return{diagram:n}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:Qae,diagram:e}},"loader"),cJe={id:Qae,detector:oJe,loader:lJe},uJe=cJe,eoe="gitGraph",dJe=Y(e=>/^\s*gitGraph/.test(e),"detector"),hJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./gitGraphDiagram-K3NZZRJ6-KV4gJGNe.js");return{diagram:n}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:eoe,diagram:e}},"loader"),fJe={id:eoe,detector:dJe,loader:hJe},pJe=fJe,toe="gantt",mJe=Y(e=>/^\s*gantt/.test(e),"detector"),gJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./ganttDiagram-A5KZAMGK-DN864NFf.js");return{diagram:n}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:toe,diagram:e}},"loader"),yJe={id:toe,detector:mJe,loader:gJe},xJe=yJe,noe="info",vJe=Y(e=>/^\s*info/.test(e),"detector"),bJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./infoDiagram-LFFYTUFH-C-5588N4.js");return{diagram:n}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:noe,diagram:e}},"loader"),_Je={id:noe,detector:vJe,loader:bJe},roe="pie",wJe=Y(e=>/^\s*pie/.test(e),"detector"),SJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./pieDiagram-SKSYHLDU-Bx9yjqXE.js");return{diagram:n}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:roe,diagram:e}},"loader"),kJe={id:roe,detector:wJe,loader:SJe},ioe="quadrantChart",CJe=Y(e=>/^\s*quadrantChart/.test(e),"detector"),jJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./quadrantDiagram-337W2JSQ-D4Q_28kp.js");return{diagram:n}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:ioe,diagram:e}},"loader"),NJe={id:ioe,detector:CJe,loader:jJe},TJe=NJe,soe="xychart",EJe=Y(e=>/^\s*xychart(-beta)?/.test(e),"detector"),AJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./xychartDiagram-JWTSCODW-3NzJEq_p.js");return{diagram:n}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:soe,diagram:e}},"loader"),OJe={id:soe,detector:EJe,loader:AJe},RJe=OJe,aoe="requirement",MJe=Y(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),PJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./requirementDiagram-Z7DCOOCP-D4kOlANe.js");return{diagram:n}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:aoe,diagram:e}},"loader"),LJe={id:aoe,detector:MJe,loader:PJe},$Je=LJe,ooe="sequence",DJe=Y(e=>/^\s*sequenceDiagram/.test(e),"detector"),IJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./sequenceDiagram-2WXFIKYE-CQVRIihX.js");return{diagram:n}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:ooe,diagram:e}},"loader"),BJe={id:ooe,detector:DJe,loader:IJe},zJe=BJe,loe="class",FJe=Y((e,n)=>{var r;return((r=n==null?void 0:n.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),HJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./classDiagram-VBA2DB6C-DRd91lBt.js");return{diagram:n}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:loe,diagram:e}},"loader"),WJe={id:loe,detector:FJe,loader:HJe},UJe=WJe,coe="classDiagram",VJe=Y((e,n)=>{var r;return/^\s*classDiagram/.test(e)&&((r=n==null?void 0:n.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),qJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./classDiagram-v2-RAHNMMFH-DRd91lBt.js");return{diagram:n}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:coe,diagram:e}},"loader"),GJe={id:coe,detector:VJe,loader:qJe},KJe=GJe,uoe="state",YJe=Y((e,n)=>{var r;return((r=n==null?void 0:n.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),XJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./stateDiagram-RAJIS63D-DR35Qjwc.js");return{diagram:n}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:uoe,diagram:e}},"loader"),JJe={id:uoe,detector:YJe,loader:XJe},ZJe=JJe,doe="stateDiagram",QJe=Y((e,n)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=n==null?void 0:n.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),eZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./stateDiagram-v2-FVOUBMTO-D_Azcqlt.js");return{diagram:n}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:doe,diagram:e}},"loader"),tZe={id:doe,detector:QJe,loader:eZe},nZe=tZe,hoe="journey",rZe=Y(e=>/^\s*journey/.test(e),"detector"),iZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./journeyDiagram-4ABVD52K-BJQ73CEY.js");return{diagram:n}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:hoe,diagram:e}},"loader"),sZe={id:hoe,detector:rZe,loader:iZe},aZe=sZe,oZe=Y((e,n,r)=>{At.debug(`rendering svg for syntax error
1208
- `);const i=nUe(n),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Fte(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),foe={draw:oZe},lZe=foe,cZe={db:{},renderer:foe,parser:{parse:Y(()=>{},"parse")}},uZe=cZe,poe="flowchart-elk",dZe=Y((e,n={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=n==null?void 0:n.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(n.layout="elk",!0):!1},"detector"),hZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./flowDiagram-PKNHOUZH-DxA4mpTS.js");return{diagram:n}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:poe,diagram:e}},"loader"),fZe={id:poe,detector:dZe,loader:hZe},pZe=fZe,moe="timeline",mZe=Y(e=>/^\s*timeline/.test(e),"detector"),gZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./timeline-definition-YZTLITO2-5TpIUxnL.js");return{diagram:n}},__vite__mapDeps([84,72]),import.meta.url);return{id:moe,diagram:e}},"loader"),yZe={id:moe,detector:mZe,loader:gZe},xZe=yZe,goe="mindmap",vZe=Y(e=>/^\s*mindmap/.test(e),"detector"),bZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./mindmap-definition-YRQLILUH-CiODXVD6.js");return{diagram:n}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:goe,diagram:e}},"loader"),_Ze={id:goe,detector:vZe,loader:bZe},wZe=_Ze,yoe="kanban",SZe=Y(e=>/^\s*kanban/.test(e),"detector"),kZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./kanban-definition-K7BYSVSG-Crarbala.js");return{diagram:n}},__vite__mapDeps([86,58]),import.meta.url);return{id:yoe,diagram:e}},"loader"),CZe={id:yoe,detector:SZe,loader:kZe},jZe=CZe,xoe="sankey",NZe=Y(e=>/^\s*sankey(-beta)?/.test(e),"detector"),TZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./sankeyDiagram-WA2Y5GQK-BfBuHxxg.js");return{diagram:n}},[],import.meta.url);return{id:xoe,diagram:e}},"loader"),EZe={id:xoe,detector:NZe,loader:TZe},AZe=EZe,voe="packet",OZe=Y(e=>/^\s*packet(-beta)?/.test(e),"detector"),RZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./diagram-P4PSJMXO-Cgem35Ym.js");return{diagram:n}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:voe,diagram:e}},"loader"),MZe={id:voe,detector:OZe,loader:RZe},boe="radar",PZe=Y(e=>/^\s*radar-beta/.test(e),"detector"),LZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./diagram-IFDJBPK2-_kmWclxF.js");return{diagram:n}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:boe,diagram:e}},"loader"),$Ze={id:boe,detector:PZe,loader:LZe},_oe="block",DZe=Y(e=>/^\s*block(-beta)?/.test(e),"detector"),IZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./blockDiagram-WCTKOSBZ-oZSw42CW.js");return{diagram:n}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:_oe,diagram:e}},"loader"),BZe={id:_oe,detector:DZe,loader:IZe},zZe=BZe,woe="architecture",FZe=Y(e=>/^\s*architecture/.test(e),"detector"),HZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./architectureDiagram-2XIMDMQ5-BnxgHiHD.js");return{diagram:n}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:woe,diagram:e}},"loader"),WZe={id:woe,detector:FZe,loader:HZe},UZe=WZe,Soe="ishikawa",VZe=Y(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),qZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./ishikawaDiagram-PHBUUO56-CGBkxSvB.js");return{diagram:n}},[],import.meta.url);return{id:Soe,diagram:e}},"loader"),GZe={id:Soe,detector:VZe,loader:qZe},koe="venn",KZe=Y(e=>/^\s*venn-beta/.test(e),"detector"),YZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./vennDiagram-LZ73GAT5-mn4mC3uT.js");return{diagram:n}},[],import.meta.url);return{id:koe,diagram:e}},"loader"),XZe={id:koe,detector:KZe,loader:YZe},JZe=XZe,Coe="treemap",ZZe=Y(e=>/^\s*treemap/.test(e),"detector"),QZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./diagram-E7M64L7V-13slynO_.js");return{diagram:n}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Coe,diagram:e}},"loader"),eQe={id:Coe,detector:ZZe,loader:QZe},fW=!1,uN=Y(()=>{fW||(fW=!0,I5("error",uZe,e=>e.toLowerCase().trim()==="error"),I5("---",{db:{clear:Y(()=>{},"clear")},styles:{},renderer:{draw:Y(()=>{},"draw")},parser:{parse:Y(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:Y(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),qA(pZe,wZe,UZe),qA(ZXe,jZe,KJe,UJe,uJe,xJe,_Je,kJe,$Je,zJe,aJe,nJe,xZe,pJe,nZe,ZJe,aZe,TJe,AZe,MZe,RJe,zZe,$Ze,GZe,eQe,JZe))},"addDiagrams"),tQe=Y(async()=>{At.debug("Loading registered diagrams");const n=(await Promise.allSettled(Object.entries(N0).map(async([r,{detector:i,loader:s}])=>{if(s)try{XA(r)}catch{try{const{diagram:a,id:o}=await s();I5(o,a,i)}catch(a){throw At.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete N0[r],a}}}))).filter(r=>r.status==="rejected");if(n.length>0){At.error(`Failed to load ${n.length} external diagrams`);for(const r of n)At.error(r);throw new Error(`Failed to load ${n.length} external diagrams`)}},"loadRegisteredDiagrams"),nQe="graphics-document document";function joe(e,n){e.attr("role",nQe),n!==""&&e.attr("aria-roledescription",n)}Y(joe,"setA11yDiagramInfo");function Noe(e,n,r,i){if(e.insert!==void 0){if(r){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(n){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(n)}}}Y(Noe,"addSVGa11yTitleDescription");var g0,zO=(g0=class{constructor(n,r,i,s,a){this.type=n,this.text=r,this.db=i,this.parser=s,this.renderer=a}static async fromText(n,r={}){var d,h;const i=Do(),s=L9(n,i);n=sKe(n)+`
1207
+ L0,20`)},"requirement_arrow"),AXe=Y((e,n,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+n+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),OXe={extension:gXe,composition:yXe,aggregation:xXe,dependency:vXe,lollipop:bXe,point:_Xe,circle:wXe,cross:SXe,barb:kXe,only_one:CXe,zero_or_one:jXe,one_or_more:NXe,zero_or_more:TXe,requirement_arrow:EXe,requirement_contains:AXe},RXe=mXe,MXe={common:CS,getConfig:Do,insertCluster:BYe,insertEdge:pXe,insertEdgeLabel:lXe,insertMarkers:RXe,insertNode:Vae,interpolateToCurve:pP,labelHelper:cr,log:At,positionEdgeLabel:cXe},p2={},Yae=Y(e=>{for(const n of e)p2[n.name]=n},"registerLayoutLoaders"),PXe=Y(()=>{Yae([{name:"dagre",loader:Y(async()=>await nt(()=>import("./dagre-KLK3FWXG-3ki_LOOM.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:Y(async()=>await nt(()=>import("./cose-bilkent-S5V4N54A-06j-dUkk.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");PXe();var nwt=Y(async(e,n)=>{if(!(e.layoutAlgorithm in p2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=p2[e.layoutAlgorithm];return(await r.loader()).render(e,n,MXe,{algorithm:r.algorithm})},"render"),rwt=Y((e="",{fallback:n="dagre"}={})=>{if(e in p2)return e;if(n in p2)return At.warn(`Layout algorithm ${e} is not registered. Using ${n} as fallback.`),n;throw new Error(`Both layout algorithms ${e} and ${n} are not registered.`)},"getRegisteredLayoutAlgorithm"),LXe=Cie(Object.keys,Object),$Xe=Object.prototype,DXe=$Xe.hasOwnProperty;function IXe(e){if(!tN(e))return LXe(e);var n=[];for(var r in Object(e))DXe.call(e,r)&&r!="constructor"&&n.push(r);return n}var $O=ey(Md,"DataView"),DO=ey(Md,"Promise"),IO=ey(Md,"Set"),BO=ey(Md,"WeakMap"),oW="[object Map]",BXe="[object Object]",lW="[object Promise]",cW="[object Set]",uW="[object WeakMap]",dW="[object DataView]",zXe=Q0($O),FXe=Q0(h2),HXe=Q0(DO),WXe=Q0(IO),UXe=Q0(BO),Kg=Z0;($O&&Kg(new $O(new ArrayBuffer(1)))!=dW||h2&&Kg(new h2)!=oW||DO&&Kg(DO.resolve())!=lW||IO&&Kg(new IO)!=cW||BO&&Kg(new BO)!=uW)&&(Kg=function(e){var n=Z0(e),r=n==BXe?e.constructor:void 0,i=r?Q0(r):"";if(i)switch(i){case zXe:return dW;case FXe:return oW;case HXe:return lW;case WXe:return cW;case UXe:return uW}return n});var VXe="[object Map]",qXe="[object Set]",GXe=Object.prototype,KXe=GXe.hasOwnProperty;function hW(e){if(e==null)return!0;if(nN(e)&&(rj(e)||typeof e=="string"||typeof e.splice=="function"||hP(e)||fP(e)||nj(e)))return!e.length;var n=Kg(e);if(n==VXe||n==qXe)return!e.size;if(tN(e))return!IXe(e).length;for(var r in e)if(KXe.call(e,r))return!1;return!0}var Xae="c4",YXe=Y(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),XXe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./c4Diagram-IC4MRINW-CBzV98Qe.js");return{diagram:n}},__vite__mapDeps([55,56]),import.meta.url);return{id:Xae,diagram:e}},"loader"),JXe={id:Xae,detector:YXe,loader:XXe},ZXe=JXe,Jae="flowchart",QXe=Y((e,n)=>{var r,i;return((r=n==null?void 0:n.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=n==null?void 0:n.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),eJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./flowDiagram-PKNHOUZH-CglkA6AQ.js");return{diagram:n}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Jae,diagram:e}},"loader"),tJe={id:Jae,detector:QXe,loader:eJe},nJe=tJe,Zae="flowchart-v2",rJe=Y((e,n)=>{var r,i,s;return((r=n==null?void 0:n.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=n==null?void 0:n.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(n.layout="elk"),/^\s*graph/.test(e)&&((s=n==null?void 0:n.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),iJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./flowDiagram-PKNHOUZH-CglkA6AQ.js");return{diagram:n}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Zae,diagram:e}},"loader"),sJe={id:Zae,detector:rJe,loader:iJe},aJe=sJe,Qae="er",oJe=Y(e=>/^\s*erDiagram/.test(e),"detector"),lJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./erDiagram-INFDFZHY-Bee1DAgo.js");return{diagram:n}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:Qae,diagram:e}},"loader"),cJe={id:Qae,detector:oJe,loader:lJe},uJe=cJe,eoe="gitGraph",dJe=Y(e=>/^\s*gitGraph/.test(e),"detector"),hJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./gitGraphDiagram-K3NZZRJ6-HKy0H0y9.js");return{diagram:n}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:eoe,diagram:e}},"loader"),fJe={id:eoe,detector:dJe,loader:hJe},pJe=fJe,toe="gantt",mJe=Y(e=>/^\s*gantt/.test(e),"detector"),gJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./ganttDiagram-A5KZAMGK-Cu1B0De9.js");return{diagram:n}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:toe,diagram:e}},"loader"),yJe={id:toe,detector:mJe,loader:gJe},xJe=yJe,noe="info",vJe=Y(e=>/^\s*info/.test(e),"detector"),bJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./infoDiagram-LFFYTUFH-SIXp09w7.js");return{diagram:n}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:noe,diagram:e}},"loader"),_Je={id:noe,detector:vJe,loader:bJe},roe="pie",wJe=Y(e=>/^\s*pie/.test(e),"detector"),SJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./pieDiagram-SKSYHLDU-C9S12F53.js");return{diagram:n}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:roe,diagram:e}},"loader"),kJe={id:roe,detector:wJe,loader:SJe},ioe="quadrantChart",CJe=Y(e=>/^\s*quadrantChart/.test(e),"detector"),jJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./quadrantDiagram-337W2JSQ-Dh3vbLvN.js");return{diagram:n}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:ioe,diagram:e}},"loader"),NJe={id:ioe,detector:CJe,loader:jJe},TJe=NJe,soe="xychart",EJe=Y(e=>/^\s*xychart(-beta)?/.test(e),"detector"),AJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./xychartDiagram-JWTSCODW-BGjJmP2y.js");return{diagram:n}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:soe,diagram:e}},"loader"),OJe={id:soe,detector:EJe,loader:AJe},RJe=OJe,aoe="requirement",MJe=Y(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),PJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./requirementDiagram-Z7DCOOCP-C3TgXeOA.js");return{diagram:n}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:aoe,diagram:e}},"loader"),LJe={id:aoe,detector:MJe,loader:PJe},$Je=LJe,ooe="sequence",DJe=Y(e=>/^\s*sequenceDiagram/.test(e),"detector"),IJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./sequenceDiagram-2WXFIKYE-Vx0NgNh6.js");return{diagram:n}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:ooe,diagram:e}},"loader"),BJe={id:ooe,detector:DJe,loader:IJe},zJe=BJe,loe="class",FJe=Y((e,n)=>{var r;return((r=n==null?void 0:n.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),HJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./classDiagram-VBA2DB6C-JNVtn0w7.js");return{diagram:n}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:loe,diagram:e}},"loader"),WJe={id:loe,detector:FJe,loader:HJe},UJe=WJe,coe="classDiagram",VJe=Y((e,n)=>{var r;return/^\s*classDiagram/.test(e)&&((r=n==null?void 0:n.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),qJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./classDiagram-v2-RAHNMMFH-JNVtn0w7.js");return{diagram:n}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:coe,diagram:e}},"loader"),GJe={id:coe,detector:VJe,loader:qJe},KJe=GJe,uoe="state",YJe=Y((e,n)=>{var r;return((r=n==null?void 0:n.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),XJe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./stateDiagram-RAJIS63D-vVKVdyAg.js");return{diagram:n}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:uoe,diagram:e}},"loader"),JJe={id:uoe,detector:YJe,loader:XJe},ZJe=JJe,doe="stateDiagram",QJe=Y((e,n)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=n==null?void 0:n.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),eZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./stateDiagram-v2-FVOUBMTO-Bn1EqFCn.js");return{diagram:n}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:doe,diagram:e}},"loader"),tZe={id:doe,detector:QJe,loader:eZe},nZe=tZe,hoe="journey",rZe=Y(e=>/^\s*journey/.test(e),"detector"),iZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./journeyDiagram-4ABVD52K-CgVCGXlc.js");return{diagram:n}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:hoe,diagram:e}},"loader"),sZe={id:hoe,detector:rZe,loader:iZe},aZe=sZe,oZe=Y((e,n,r)=>{At.debug(`rendering svg for syntax error
1208
+ `);const i=nUe(n),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Fte(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),foe={draw:oZe},lZe=foe,cZe={db:{},renderer:foe,parser:{parse:Y(()=>{},"parse")}},uZe=cZe,poe="flowchart-elk",dZe=Y((e,n={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=n==null?void 0:n.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(n.layout="elk",!0):!1},"detector"),hZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./flowDiagram-PKNHOUZH-CglkA6AQ.js");return{diagram:n}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:poe,diagram:e}},"loader"),fZe={id:poe,detector:dZe,loader:hZe},pZe=fZe,moe="timeline",mZe=Y(e=>/^\s*timeline/.test(e),"detector"),gZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./timeline-definition-YZTLITO2-C7zuY5DX.js");return{diagram:n}},__vite__mapDeps([84,72]),import.meta.url);return{id:moe,diagram:e}},"loader"),yZe={id:moe,detector:mZe,loader:gZe},xZe=yZe,goe="mindmap",vZe=Y(e=>/^\s*mindmap/.test(e),"detector"),bZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./mindmap-definition-YRQLILUH-Dk0nd2_l.js");return{diagram:n}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:goe,diagram:e}},"loader"),_Ze={id:goe,detector:vZe,loader:bZe},wZe=_Ze,yoe="kanban",SZe=Y(e=>/^\s*kanban/.test(e),"detector"),kZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./kanban-definition-K7BYSVSG-Be9BBTIb.js");return{diagram:n}},__vite__mapDeps([86,58]),import.meta.url);return{id:yoe,diagram:e}},"loader"),CZe={id:yoe,detector:SZe,loader:kZe},jZe=CZe,xoe="sankey",NZe=Y(e=>/^\s*sankey(-beta)?/.test(e),"detector"),TZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./sankeyDiagram-WA2Y5GQK-CYFw-fgv.js");return{diagram:n}},[],import.meta.url);return{id:xoe,diagram:e}},"loader"),EZe={id:xoe,detector:NZe,loader:TZe},AZe=EZe,voe="packet",OZe=Y(e=>/^\s*packet(-beta)?/.test(e),"detector"),RZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./diagram-P4PSJMXO-Cbsyt6Gs.js");return{diagram:n}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:voe,diagram:e}},"loader"),MZe={id:voe,detector:OZe,loader:RZe},boe="radar",PZe=Y(e=>/^\s*radar-beta/.test(e),"detector"),LZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./diagram-IFDJBPK2-21O6kr93.js");return{diagram:n}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:boe,diagram:e}},"loader"),$Ze={id:boe,detector:PZe,loader:LZe},_oe="block",DZe=Y(e=>/^\s*block(-beta)?/.test(e),"detector"),IZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./blockDiagram-WCTKOSBZ-Bz8AeP4b.js");return{diagram:n}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:_oe,diagram:e}},"loader"),BZe={id:_oe,detector:DZe,loader:IZe},zZe=BZe,woe="architecture",FZe=Y(e=>/^\s*architecture/.test(e),"detector"),HZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./architectureDiagram-2XIMDMQ5-D7Cs9zUf.js");return{diagram:n}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:woe,diagram:e}},"loader"),WZe={id:woe,detector:FZe,loader:HZe},UZe=WZe,Soe="ishikawa",VZe=Y(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),qZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./ishikawaDiagram-PHBUUO56-C8ot5FTh.js");return{diagram:n}},[],import.meta.url);return{id:Soe,diagram:e}},"loader"),GZe={id:Soe,detector:VZe,loader:qZe},koe="venn",KZe=Y(e=>/^\s*venn-beta/.test(e),"detector"),YZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./vennDiagram-LZ73GAT5-C16ci4of.js");return{diagram:n}},[],import.meta.url);return{id:koe,diagram:e}},"loader"),XZe={id:koe,detector:KZe,loader:YZe},JZe=XZe,Coe="treemap",ZZe=Y(e=>/^\s*treemap/.test(e),"detector"),QZe=Y(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:n}=await import("./diagram-E7M64L7V-DvxYS4vM.js");return{diagram:n}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Coe,diagram:e}},"loader"),eQe={id:Coe,detector:ZZe,loader:QZe},fW=!1,uN=Y(()=>{fW||(fW=!0,I5("error",uZe,e=>e.toLowerCase().trim()==="error"),I5("---",{db:{clear:Y(()=>{},"clear")},styles:{},renderer:{draw:Y(()=>{},"draw")},parser:{parse:Y(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:Y(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),qA(pZe,wZe,UZe),qA(ZXe,jZe,KJe,UJe,uJe,xJe,_Je,kJe,$Je,zJe,aJe,nJe,xZe,pJe,nZe,ZJe,aZe,TJe,AZe,MZe,RJe,zZe,$Ze,GZe,eQe,JZe))},"addDiagrams"),tQe=Y(async()=>{At.debug("Loading registered diagrams");const n=(await Promise.allSettled(Object.entries(N0).map(async([r,{detector:i,loader:s}])=>{if(s)try{XA(r)}catch{try{const{diagram:a,id:o}=await s();I5(o,a,i)}catch(a){throw At.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete N0[r],a}}}))).filter(r=>r.status==="rejected");if(n.length>0){At.error(`Failed to load ${n.length} external diagrams`);for(const r of n)At.error(r);throw new Error(`Failed to load ${n.length} external diagrams`)}},"loadRegisteredDiagrams"),nQe="graphics-document document";function joe(e,n){e.attr("role",nQe),n!==""&&e.attr("aria-roledescription",n)}Y(joe,"setA11yDiagramInfo");function Noe(e,n,r,i){if(e.insert!==void 0){if(r){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(n){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(n)}}}Y(Noe,"addSVGa11yTitleDescription");var g0,zO=(g0=class{constructor(n,r,i,s,a){this.type=n,this.text=r,this.db=i,this.parser=s,this.renderer=a}static async fromText(n,r={}){var d,h;const i=Do(),s=L9(n,i);n=sKe(n)+`
1209
1209
  `;try{XA(s)}catch{const f=GIe(s);if(!f)throw new Nte(`Diagram ${s} not found.`);const{id:m,diagram:x}=await f();I5(m,x)}const{db:a,parser:o,renderer:l,init:u}=XA(s);return o.parser&&(o.parser.yy=a),(d=a.clear)==null||d.call(a),u==null||u(i),r.title&&((h=a.setDiagramTitle)==null||h.call(a,r.title)),await o.parse(n),new g0(s,n,a,o,l)}async render(n,r){await this.renderer.draw(this.text,n,r,this)}getParser(){return this.parser}getType(){return this.type}},Y(g0,"Diagram"),g0),pW=[],rQe=Y(()=>{pW.forEach(e=>{e()}),pW=[]},"attachFunctions"),iQe=Y(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Toe(e){const n=e.match(jte);if(!n)return{text:e,metadata:{}};let r=cVe(n[1],{schema:lVe})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const i={};return r.displayMode&&(i.displayMode=r.displayMode.toString()),r.title&&(i.title=r.title.toString()),r.config&&(i.config=r.config),{text:e.slice(n[0].length),metadata:i}}Y(Toe,"extractFrontMatter");var sQe=Y(e=>e.replace(/\r\n?/g,`
1210
1210
  `).replace(/<(\w+)([^>]*)>/g,(n,r,i)=>"<"+r+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),aQe=Y(e=>{const{text:n,metadata:r}=Toe(e),{displayMode:i,title:s,config:a={}}=r;return i&&(a.gantt||(a.gantt={}),a.gantt.displayMode=i),{title:s,config:a,text:n}},"processFrontmatter"),oQe=Y(e=>{const n=dd.detectInit(e)??{},r=dd.detectDirective(e,"wrap");return Array.isArray(r)?n.wrap=r.some(({type:i})=>i==="wrap"):(r==null?void 0:r.type)==="wrap"&&(n.wrap=!0),{text:qGe(e),directive:n}},"processDirectives");function LP(e){const n=sQe(e),r=aQe(n),i=oQe(r.text),s=vP(r.config,i.directive);return e=iQe(i.text),{code:e,title:r.title,config:s}}Y(LP,"preprocessDiagram");function Eoe(e){const n=new TextEncoder().encode(e),r=Array.from(n,i=>String.fromCodePoint(i)).join("");return btoa(r)}Y(Eoe,"toBase64");var lQe=5e4,cQe="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",uQe="sandbox",dQe="loose",hQe="http://www.w3.org/2000/svg",fQe="http://www.w3.org/1999/xlink",pQe="http://www.w3.org/1999/xhtml",mQe="100%",gQe="100%",yQe="border:0;margin:0;",xQe="margin:0",vQe="allow-top-navigation-by-user-activation allow-popups",bQe='The "iframe" tag is not supported by your browser.',_Qe=["foreignobject"],wQe=["dominant-baseline"];function $P(e){const n=LP(e);return $5(),cBe(n.config??{}),n}Y($P,"processAndSetConfigs");async function Aoe(e,n){uN();try{const{code:r,config:i}=$P(e);return{diagramType:(await Roe(r)).type,config:i}}catch(r){if(n!=null&&n.suppressErrors)return!1;throw r}}Y(Aoe,"parse");var mW=Y((e,n,r=[])=>`
1211
1211
  .${e} ${n} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),SQe=Y((e,n=new Map)=>{let r="";if(e.themeCSS!==void 0&&(r+=`
@@ -1247,7 +1247,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(r+=`
1247
1247
  `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function pu(e,n){if(!e)return null;const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`"${r}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`),s=e.match(i);return s?s[1].replace(/\\n/g,`
1248
1248
  `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function cle(e){if(!e)return null;const n=pu(e,"url")??pu(e,"uri")??pu(e,"href")??pu(e,"query")??pu(e,"q");if(n)return Yf(n)??n;const r=pu(e,"type"),i=pu(e,"action");return r==="webSearch"||i==="webSearch"?"web search":r==="fetch"||i==="fetch"?"website":null}function ftt({tool:e,streamingArgs:n}){const r=fo(e),i=Qoe[r],s=r.startsWith("terminal.")||r==="jait.terminal"||r==="execute",a=s?lle(n):null,o=r==="web"||r==="web.search"||r==="web.fetch"||r==="browser.search"||r==="browser.fetch",l=o?cle(n):null;return i&&s&&a?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsx("span",{className:"shrink-0 text-xs text-emerald-500 dark:text-emerald-400 font-mono",children:"$"}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",children:a}),c.jsx("span",{className:"inline-block w-1 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):i&&o&&l?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsxs("span",{children:[i.label,":"]}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",children:l}),c.jsx("span",{className:"inline-block w-1 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):i?c.jsxs("span",{className:"text-blue-400",children:[i.label,c.jsx("span",{className:"inline-block w-1 h-3 bg-blue-400 animate-pulse ml-1 align-text-bottom"})]}):e?c.jsxs("span",{className:"text-blue-400",children:[c.jsx("code",{className:"text-xs font-mono",children:e}),c.jsx("span",{className:"inline-block w-1 h-3 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):c.jsx("span",{className:"text-muted-foreground",children:"Preparing..."})}function ptt({tool:e,streamingArgs:n,scrollRef:r}){const i=fo(e),s=i.startsWith("terminal."),a=s?lle(n):null,o=i==="web"||i==="web.search"||i==="web.fetch"||i==="browser.search"||i==="browser.fetch",l=o?cle(n):null;if(s&&a)return c.jsxs("pre",{ref:r,className:je("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-foreground"),children:[c.jsx("span",{className:"text-emerald-400",children:"$ "}),a,c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]});if(o&&l){const u=i==="web.search"||i==="browser.search"?"Searching":"Fetching";return c.jsx("div",{className:je("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Lt,{className:"h-3 w-3 shrink-0 animate-spin text-blue-400"}),c.jsxs("span",{className:"break-all",children:[u," ",l,"..."]})]})})}if(i==="memory.save"){const u=pu(n,"scope")??"memory",d=pu(n,"content");return c.jsxs("div",{className:je("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Lt,{className:"h-3 w-3 shrink-0 animate-spin text-blue-400"}),c.jsxs("span",{children:["Saving memory (",u,")..."]})]}),d?c.jsxs("div",{className:"mt-1 opacity-80",children:['"',Nc(d,120),'"']}):null]})}if(i==="cron.add"){const u=pu(n,"name"),d=pu(n,"cron"),h=pu(n,"toolName");return c.jsxs("div",{className:je("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Lt,{className:"h-3 w-3 shrink-0 animate-spin text-blue-400"}),c.jsxs("span",{children:["Creating cron job",u?`: ${u}`:"..."]})]}),(d||h)&&c.jsxs("div",{className:"mt-1 opacity-80",children:[d?`schedule ${d}`:"",d&&h?" • ":"",h?`tool ${h}`:""]})]})}return n?c.jsxs("pre",{ref:r,className:je("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-36 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-muted-foreground"),children:[n,c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):c.jsx("div",{className:je("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Lt,{className:"h-3 w-3 shrink-0 animate-spin text-blue-400"}),c.jsx("span",{children:"Preparing..."})]})})}function ule(e){const n=new Map,r=new Set,i=new Map(e.map(s=>[s.callId,s]));for(const s of e){if(!s.parentCallId||!i.has(s.parentCallId))continue;const a=n.get(s.parentCallId)??[];n.set(s.parentCallId,[...a,s]),r.add(s.callId)}for(let s=0;s<e.length;s++){const a=e[s];if(!ry(a.tool))continue;const o=[];for(let l=s+1;l<e.length;l++){const u=e[l];if(r.has(u.callId))continue;const d=a.status==="running"||a.status==="pending",h=a.completedAt!=null&&u.startedAt<=a.completedAt;if(d||h)o.push(u),r.add(u.callId);else break}if(o.length>0){const l=n.get(a.callId)??[];n.set(a.callId,[...l,...o])}}return{childMap:n,parentSet:r}}function dle(e){return e==="browserScreenshot"}function hle(e){var a,o;const n=fo(e.tool),r=(a=e.result)!=null&&a.data&&typeof e.result.data=="object"?e.result.data:void 0,i=Ec(n,e.args,r),s=Joe(n,i,r,(o=e.result)==null?void 0:o.message);return dle(Zoe({tool:n,args:i,status:e.status,displayOutput:ale(e.result,n)||e.streamingOutput||"",snapshotText:typeof(r==null?void 0:r.snapshot)=="string"?r.snapshot:null,screenshotPath:s}))}function mtt({path:e,onOpenDiff:n,disabled:r}){const i=fN(e),s=!!n&&!r,a=c.jsxs(c.Fragment,{children:[c.jsx(ga,{filename:i,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"whitespace-nowrap",children:i})]});return s?c.jsx("span",{role:"button",tabIndex:0,className:"inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground transition-colors hover:bg-muted cursor-pointer",title:`Open diff for ${e}`,onClick:o=>{o.preventDefault(),o.stopPropagation(),n(e)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),o.stopPropagation(),n(e))},children:a}):c.jsx("span",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground",title:e,children:a})}function gtt({status:e}){const n=e==="completed"?"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400":e==="error"||e==="interrupted"?"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400":e==="running"||e==="starting"?"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400":"border-border/70 bg-muted/45 text-muted-foreground",r=e==="completed"?Ns:e==="error"||e==="interrupted"?Th:e==="running"||e==="starting"?Lt:bc;return c.jsxs("span",{className:je("inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-2xs font-medium capitalize",n),children:[c.jsx(r,{className:je("h-3 w-3",(e==="running"||e==="starting")&&"animate-spin")}),e]})}function ytt({items:e,resultMessage:n}){return e.length===0?c.jsx("div",{className:"rounded-md border border-border/60 bg-muted/25 px-3 py-2 text-xs text-muted-foreground",children:"No thread details available."}):c.jsxs("div",{className:"rounded-md border border-purple-500/20 bg-purple-500/[0.025] text-xs",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-purple-500/15 px-3 py-2",children:[c.jsxs("span",{className:"font-medium text-foreground",children:[e.length," thread",e.length===1?"":"s"]}),c.jsxs("span",{className:"text-muted-foreground",children:[e.filter(r=>r.status==="completed").length," completed"]})]}),c.jsx("div",{className:"divide-y divide-border/35",children:e.map((r,i)=>{const s=r.id?r.id.slice(-8):null,a=r.branch??(r.workingDirectory?fN(r.workingDirectory):null);return c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2 px-3 py-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate font-medium text-foreground",title:r.title,children:r.title}),c.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-2xs text-muted-foreground",children:[s&&c.jsx("code",{className:"rounded bg-background/70 px-1 py-0.5 font-mono",children:s}),r.providerId&&c.jsx("span",{children:r.providerId}),r.kind&&c.jsx("span",{children:r.kind}),a&&c.jsx("span",{className:"min-w-0 truncate",children:a})]}),r.error&&c.jsx("div",{className:"mt-1 truncate text-2xs text-red-500",title:r.error,children:r.error})]}),c.jsx(gtt,{status:r.status})]},r.id??`${r.title}-${i}`)})}),n&&c.jsx("div",{className:"border-t border-purple-500/15 px-3 py-2 text-2xs text-muted-foreground",children:n})]})}function xtt({call:e,childCalls:n,threadControlThreads:r,onOpenTerminal:i,onOpenDiff:s,inlineSecretPrompt:a,renderInlineSecretPrompt:o,onApprovalResponse:l,hideTopConnector:u=!1,hideBottomConnector:d=!1}){var xe,pe,ze,ft,Je,ht,yt,St,We,Fe,lt,et,Be,ke;const h=hle(e),[f,m]=y.useState(e.status==="running"||e.status==="pending"||h),[x,v]=y.useState(()=>Date.now()),[_,w]=y.useState(null),S=y.useRef(e.status),C=fo(e.tool),j=(xe=e.result)!=null&&xe.data&&typeof e.result.data=="object"?e.result.data:void 0,T=Ec(C,e.args,j),E=ny(C)?hN({...C.startsWith("mcp.")&&!T.title?{title:C}:{},...T},j):null,N=E?Det(E.title):null,R=IP(C),$=(N==null?void 0:N.icon)??R.icon,G=(N==null?void 0:N.color)??R.color,W=qet(C,T,(pe=e.result)==null?void 0:pe.data,(ze=e.result)==null?void 0:ze.message),z=YO(C,T),I=ale(e.result,C)||e.streamingOutput||"",O=typeof(j==null?void 0:j.snapshot)=="string"?j.snapshot:null,D=Joe(C,T,j,(ft=e.result)==null?void 0:ft.message),M=C.startsWith("terminal.")||C==="jait.terminal"||C==="execute"||C.startsWith("ssh.")||C==="run.ssh"||C==="elevated.run",L=itt(e),B=htt(e),q=B?L3(e):null,H=ntt(C,T),F=a??(o==null?void 0:o(e))??null,X=F!=null,V=e.status==="pending",ne=!!e.approvalRequestId&&e.status==="pending",J=y.useCallback(async we=>{if(!(!e.approvalRequestId||!l||_)){w(we?"approve":"reject");try{await l(e.approvalRequestId,we)}finally{w(null)}}},[_,e.approvalRequestId,l]),te=Xoe(C,T,(Je=e.result)==null?void 0:Je.data,(ht=e.result)==null?void 0:ht.message).map(we=>we.trim()).filter(Boolean),re=te[0]??((St=g2(C,T,j,(yt=e.result)==null?void 0:yt.message))==null?void 0:St.trim())??"",Q=!!re&&(FW(C)||C==="read"||C==="file.read"),ue=DW(I),ge=DW(e.streamingArgs),se=Zoe({tool:C,args:T,status:e.status,displayOutput:I,snapshotText:O,screenshotPath:D}),oe=dle(se),ve=se==="terminal"?!0:se!=="none"&&!oe,_e=se==="threadList"?ele(T,j,e.status,r):[],Ae=X?!0:f,Ke=y.useCallback(we=>{X&&!we||m(we)},[X]),ot=e.status==="pending"||e.status==="running"?Lt:e.status==="success"?Ns:Th,Nt=e.status==="pending"?"text-blue-400":e.status==="running"?"text-muted-foreground":e.status==="success"?"text-green-500":"text-red-500",$t=e.status==="error"?{row:"bg-red-500/[0.035] hover:bg-red-500/[0.06]",icon:"bg-red-500/10",connector:"bg-red-500/25",body:"bg-red-500/[0.025]"}:e.status==="success"?{row:"bg-card/58 hover:bg-muted/42",icon:"bg-emerald-500/[0.08]",connector:"bg-border/55",body:"bg-card/42"}:{row:"bg-primary/[0.045] hover:bg-primary/[0.075]",icon:"bg-primary/10",connector:"bg-primary/30",body:"bg-primary/[0.025]"};y.useEffect(()=>{const we=S.current;!oe&&se!=="threadList"&&(we==="running"||we==="pending")&&e.status!=="running"&&e.status!=="pending"&&m(!1),(e.status==="pending"||e.status==="running"||oe||X)&&m(!0),S.current=e.status},[se,e.status,X,oe]),y.useEffect(()=>{var we;C!=="web"&&C!=="web.search"&&C!=="web.fetch"&&C!=="browser.search"&&C!=="browser.fetch"||console.debug("[tool-call-card:web]",{tool:e.tool,normalizedTool:C,callId:e.callId,status:e.status,rawArgs:e.args,normalizedArgs:T,resultMessage:(we=e.result)==null?void 0:we.message,resultData:j,streamingArgs:e.streamingArgs})},[e.args,e.callId,(We=e.result)==null?void 0:We.message,e.status,e.streamingArgs,e.tool,T,C,j]),y.useEffect(()=>{if(e.status!=="running"&&e.status!=="pending")return;const we=window.setInterval(()=>v(Date.now()),250);return()=>window.clearInterval(we)},[e.status]);const en=$et(C,T,(Fe=e.result)==null?void 0:Fe.data,(lt=e.result)==null?void 0:lt.message),on=e.status==="running"||e.status==="pending",Vt=on?en.running:en.done,Gt=Q?Het(C,on):Vt,Et=c.jsxs(c.Fragment,{children:[c.jsx(ot,{className:je("h-4 w-4 shrink-0",Nt,(e.status==="running"||e.status==="pending")&&"animate-spin")}),c.jsx("span",{className:"flex-1 truncate text-[13px] font-medium text-muted-foreground",children:V?c.jsx(ftt,{tool:e.tool,streamingArgs:e.streamingArgs}):M?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsx("span",{className:"shrink-0 text-xs text-emerald-500 dark:text-emerald-400 font-mono",children:"$"}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",title:W,children:W})]}):Q?c.jsxs("span",{className:"flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{className:"shrink-0",children:[Gt,":"]}),c.jsx("span",{className:"flex min-w-0 items-center gap-1 overflow-x-auto [scrollbar-width:thin]",children:(te.length>0?te:[re]).filter(Boolean).map((we,Ge)=>c.jsx(mtt,{path:we,onOpenDiff:FW(C)?s:void 0,disabled:e.status!=="success"},`${we}-${Ge}`))})]}):E&&(E.title||E.details)?c.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:E.title?c.jsxs("span",{className:"min-w-0 truncate",children:[c.jsx("code",{className:"text-[11px] font-mono",children:E.title}),E.details?c.jsx("span",{className:"text-muted-foreground",children:" • "}):null,E.details?c.jsx("span",{className:"text-xs text-muted-foreground",children:E.details}):null]}):c.jsxs("span",{children:[Vt,": ",c.jsx("span",{className:"text-xs text-muted-foreground",children:E.details})]})}):c.jsxs("span",{children:[Vt,": ",c.jsx("code",{className:"text-[11px] font-mono",children:W})]})}),c.jsx("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:c.jsx(JO,{startedAt:e.startedAt,completedAt:e.completedAt,now:x})}),z&&(z.insertions>0||z.deletions>0)&&c.jsx(Wet,{counts:z}),L&&c.jsx("span",{className:je("rounded border px-1.5 py-0.5 text-2xs font-semibold uppercase tracking-wide shrink-0",L.className),children:L.label})]}),_n=se==="pending"?c.jsx(ptt,{tool:e.tool,streamingArgs:e.streamingArgs,scrollRef:ge}):se==="terminal"?c.jsxs("pre",{ref:ue,className:je("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-72 overflow-y-auto whitespace-pre","bg-zinc-950 text-zinc-100 shadow-inner ring-1 ring-border/40",e.result&&!e.result.ok&&"text-red-200"),children:[!I&&e.status!=="running"&&c.jsxs("span",{className:"text-zinc-400",children:[c.jsx("span",{className:"text-emerald-400",children:"$ "}),W]}),I,e.status==="running"&&!I&&c.jsx("span",{className:"text-zinc-400",children:W?`Executing ${W}...`:"Running..."}),e.status==="running"&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-zinc-100 animate-pulse ml-0.5 align-text-bottom"})]}):se==="browserSnapshot"?c.jsx(utt,{snapshot:O}):se==="browserScreenshot"?c.jsx(dtt,{path:D}):se==="subagent"?n&&n.length>0?c.jsxs("div",{className:"rounded-lg border border-purple-500/20 bg-purple-500/[0.03] text-xs",children:[(e.status==="running"||e.status==="pending")&&n.length>0&&c.jsxs("div",{className:"flex items-center justify-end gap-2 border-b border-purple-500/15 px-3 py-2 text-xs text-muted-foreground",children:[c.jsx(Lt,{className:"h-3 w-3 animate-spin text-purple-500"}),c.jsxs("span",{children:[n.length," tool",n.length!==1?"s":""]})]}),(e.status==="running"||e.status==="pending")&&n.length===0&&c.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Agent is working..."}),c.jsx("div",{className:"divide-y divide-border/30",children:n.map(we=>c.jsx(Xf,{call:we,threadControlThreads:r,onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:o,onApprovalResponse:l},we.callId))}),((et=e.result)==null?void 0:et.message)&&(e.status==="success"||e.status==="error")&&c.jsxs("div",{className:"border-t border-purple-500/15 px-3 py-2",children:[c.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Result"}),c.jsx("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap rounded bg-background/60 p-2 font-mono text-xs leading-5",children:e.result.message})]})]}):c.jsx(ctt,{data:j??{},message:(Be=e.result)==null?void 0:Be.message,status:e.status}):se==="threadList"?c.jsx(ytt,{items:_e,resultMessage:(ke=e.result)==null?void 0:ke.message}):se==="editDiff"?c.jsx(jet,{filePath:String(T.path??""),oldText:C==="file.patch"||C==="edit"&&T.search!=null?String(T.search??""):void 0,newText:C==="file.patch"||C==="edit"&&T.replace!=null?String(T.replace??""):void 0,writtenContent:C==="file.write"||C==="edit"&&T.content!=null?String(T.content??""):void 0,isNewFile:C==="file.write"}):se==="output"?c.jsx(ltt,{output:I,tool:C,isError:!!e.result&&!e.result.ok,isRunning:e.status==="running"}):se==="runningHint"?c.jsxs("div",{className:je("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Lt,{className:"h-3 w-3 shrink-0 animate-spin"}),c.jsx("span",{className:"break-all",children:H})]}),c.jsxs("div",{className:"mt-1 text-xs opacity-75",children:["Elapsed: ",c.jsx(JO,{startedAt:e.startedAt,completedAt:e.completedAt,now:x})]})]}):null;return c.jsxs(fS,{open:ve?Ae:!1,onOpenChange:Ke,children:[c.jsxs("div",{className:"relative pl-8",children:[!u&&c.jsx("span",{className:je("absolute left-[12.5px] top-0 h-6 w-px",$t.connector),style:{maskImage:"linear-gradient(to bottom, transparent 0 22px, #000 22px 100%)"},"aria-hidden":"true"}),!d&&c.jsx("span",{className:je("absolute left-[12.5px] top-0 bottom-0 w-px",$t.connector),style:{maskImage:"linear-gradient(to bottom, #000 0 5px, transparent 5px 23px, #000 23px 100%)"},"aria-hidden":"true"}),d&&!u&&c.jsx("span",{className:je("absolute left-[12.5px] top-0 bottom-0 w-px",$t.connector),style:{maskImage:"linear-gradient(to bottom, #000 0 5px, transparent 5px 100%)"},"aria-hidden":"true"}),c.jsx("div",{className:je("absolute left-[3px] top-[6px] z-10 flex h-5 w-5 items-center justify-center rounded-md shadow-sm ring-2 ring-background",$t.icon),children:c.jsx($,{className:je("h-3.5 w-3.5 shrink-0",G)})}),c.jsx("div",{className:"group pb-1",children:c.jsxs("div",{className:je("flex min-h-8 items-center gap-2 rounded-md px-2 py-1 transition-colors",$t.row),children:[ve?c.jsxs(pS,{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx(cs,{className:je("h-3 w-3 shrink-0 text-muted-foreground transition-transform duration-200",Ae&&"rotate-90")}),Et]}):c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx("span",{className:"h-3 w-3 shrink-0"}),Et]}),B&&i&&c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 sm:h-6 sm:w-6 shrink-0",onClick:we=>{we.preventDefault(),we.stopPropagation(),i(q)},children:c.jsx(ep,{className:"h-3.5 w-3.5"})})}),c.jsx(Rr,{side:"top",children:"Open terminal"})]}),se==="editDiff"&&s&&e.status==="success"&&re&&c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 sm:h-6 sm:w-6 shrink-0",onClick:we=>{we.preventDefault(),we.stopPropagation(),s(re)},children:c.jsx(ep,{className:"h-3.5 w-3.5"})})}),c.jsx(Rr,{side:"top",children:"Open diff in editor"})]})]})})]}),ve&&c.jsx(mS,{children:c.jsx("div",{className:je("ml-8 mr-3 mb-2 rounded-md px-3 py-2",$t.body),children:_n})}),oe&&c.jsx("div",{className:je("ml-8 mr-3 mb-2 rounded-md px-3 py-2",$t.body),children:_n}),ne&&c.jsx("div",{className:"ml-6 mr-1.5 mb-2 rounded-md bg-amber-500/[0.045] px-2.5 py-2 ring-1 ring-amber-500/20 sm:ml-8 sm:mr-3 sm:px-3",children:c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md bg-background/35 px-2.5 py-2 sm:px-3",children:[c.jsx("span",{className:"text-xs text-muted-foreground",children:"Approval required to continue."}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(ye,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:!l||_!==null,onClick:we=>{we.preventDefault(),we.stopPropagation(),J(!1)},children:_==="reject"?"Rejecting...":"Reject"}),c.jsx(ye,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:!l||_!==null,onClick:we=>{we.preventDefault(),we.stopPropagation(),J(!0)},children:_==="approve"?"Approving...":"Approve"})]})]})}),X&&c.jsx("div",{className:"ml-6 mr-1.5 mb-2 rounded-md bg-yellow-500/[0.035] px-2.5 py-2 ring-1 ring-yellow-500/15 sm:ml-8 sm:mr-3 sm:px-3",children:c.jsx("div",{className:"rounded-md bg-background/35 px-2.5 py-2 sm:px-3",children:F})})]})}const Xf=y.memo(xtt);Xf.displayName="ToolCallCard";const fle=3,Tx=6;function ple(e,n){return!!n&&e.some(r=>n(r)!=null)}function vtt(e,n){if(!n||e.some(hle))return!1;const r=e.filter(i=>i.status!=="running"&&i.status!=="pending");return r.length>=fle&&r.length===e.length}function btt({calls:e,collapsible:n,threadControlThreads:r,onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,onApprovalResponse:o}){const[l,u]=y.useState(!1),[d,h]=y.useState(()=>!vtt(e,n)),f=y.useRef(!1),{childMap:m,parentSet:x}=y.useMemo(()=>ule(e),[e]),v=y.useMemo(()=>e.filter(U=>!x.has(U.callId)),[e,x]),_=v.filter(U=>U.status==="running"||U.status==="pending"),w=v.filter(U=>U.status!=="running"&&U.status!=="pending"),S=_.length===0&&w.length>0,C=ple(e,a),j=n&&!C&&S&&w.length>=fle;if(y.useEffect(()=>{if(C){h(!0);return}j&&!f.current&&h(!1),f.current=S},[S,C,j]),e.length===0)return null;const T=w.filter(U=>U.status==="success").length,E=w.filter(U=>U.status==="error").length,N=tle(w);if(j&&!d)return c.jsx("div",{className:"my-2",children:c.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(cs,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx(N,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"font-medium",children:XO(w)}),T>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-green-500",children:[c.jsx(Ns,{className:"h-3 w-3"})," ",T]}),E>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-red-500",children:[c.jsx(Th,{className:"h-3 w-3"})," ",E]})]})});const R=!l&&w.length>Tx,$=R?w.length-Tx:0,G=R?w.slice(-Tx):w,W=R?w.slice(0,$).filter(U=>U.status==="success").length:0,z=$-W;return c.jsxs("div",{className:"my-2",children:[j&&c.jsxs("button",{type:"button",onClick:()=>h(!1),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(cs,{className:"h-3 w-3 rotate-90 transition-transform"}),c.jsxs("span",{children:["Collapse ",XO(w)]})]}),R&&c.jsxs("button",{type:"button",onClick:()=>u(!0),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(cs,{className:"h-3 w-3"}),c.jsxs("span",{children:[$," earlier tool call",$!==1?"s":"",W>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",W," passed)"]}),z>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",z," failed)"]})]})]}),l&&w.slice(0,$).map((U,I,O)=>c.jsx(Xf,{call:U,childCalls:m.get(U.callId),threadControlThreads:r,onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,onApprovalResponse:o,hideTopConnector:I===0,hideBottomConnector:I===O.length-1&&G.length===0&&_.length===0},U.callId)),G.map((U,I)=>c.jsx(Xf,{call:U,childCalls:m.get(U.callId),threadControlThreads:r,onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,onApprovalResponse:o,hideTopConnector:l?!1:I===0,hideBottomConnector:I===G.length-1&&_.length===0},U.callId)),_.map((U,I)=>c.jsx(Xf,{call:U,childCalls:m.get(U.callId),threadControlThreads:r,onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,onApprovalResponse:o,hideTopConnector:w.length===0&&I===0,hideBottomConnector:I===_.length-1},U.callId))]})}function mle(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}const QO=y.memo(btt,(e,n)=>e.onOpenTerminal===n.onOpenTerminal&&e.onOpenDiff===n.onOpenDiff&&e.renderInlineSecretPrompt===n.renderInlineSecretPrompt&&e.onApprovalResponse===n.onApprovalResponse&&e.threadControlThreads===n.threadControlThreads&&e.collapsible===n.collapsible&&mle(e.calls,n.calls));QO.displayName="ToolCallGroup";function qW(e,n){return n?!1:e.length>0&&e.every(r=>r.status!=="running"&&r.status!=="pending")}function _tt({provider:e,calls:n,isStreaming:r,threadControlThreads:i,onOpenTerminal:s,onOpenDiff:a,renderInlineSecretPrompt:o,onApprovalResponse:l}){const[u,d]=y.useState(()=>!qW(n,r)),[h,f]=y.useState(!1),[m,x]=y.useState(()=>Date.now()),v=y.useRef(!qW(n,r)),_=!!r||n.some(B=>B.status==="running"||B.status==="pending"),w=ple(n,o),S=w?!0:u,C=y.useCallback(B=>{w&&!B||d(B)},[w]),j=n.filter(B=>B.status==="success").length,T=n.filter(B=>B.status==="error").length,E=n.length>0?Math.min(...n.map(B=>B.startedAt)):Date.now(),N=!_&&n.length>0?Math.max(...n.map(B=>B.completedAt??B.startedAt)):void 0,R=tle(n),{childMap:$,parentSet:G}=y.useMemo(()=>ule(n),[n]),W=y.useMemo(()=>n.filter(B=>!G.has(B.callId)),[n,G]),z=W.filter(B=>B.status==="running"||B.status==="pending"),U=W.filter(B=>B.status!=="running"&&B.status!=="pending"),I=!h&&U.length>Tx,O=I?U.length-Tx:0,D=I?U.slice(-Tx):U,M=I?U.slice(0,O).filter(B=>B.status==="success").length:0,L=O-M;return y.useEffect(()=>{if(w){d(!0),v.current=_;return}v.current&&!_&&n.length>0&&d(!1),v.current=_},[w,_,n.length]),y.useEffect(()=>{if(!_)return;const B=window.setInterval(()=>x(Date.now()),250);return()=>window.clearInterval(B)},[_]),n.length===0?null:c.jsx(fS,{open:S,onOpenChange:C,children:c.jsxs("div",{className:"my-2",children:[c.jsxs(pS,{className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left transition-colors hover:bg-muted/35",children:[c.jsx(cs,{className:je("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",S&&"rotate-90")}),_?c.jsx(Lt,{className:"h-4 w-4 shrink-0 text-muted-foreground animate-spin"}):c.jsx(R,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:XO(n)}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto text-xs text-muted-foreground tabular-nums shrink-0",children:[!_&&T>0&&c.jsxs("span",{className:"text-red-500",children:[T," failed"]}),c.jsx(JO,{startedAt:E,completedAt:N,now:m})]}),!_&&T===0&&j>0&&c.jsx(Ns,{className:"h-3.5 w-3.5 shrink-0 text-green-500"}),!_&&T>0&&c.jsx(Th,{className:"h-3.5 w-3.5 shrink-0 text-red-500"})]}),c.jsx(mS,{children:c.jsxs("div",{className:"mt-1",children:[I&&c.jsxs("button",{type:"button",onClick:()=>f(!0),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(cs,{className:"h-3 w-3"}),c.jsxs("span",{children:[O," earlier tool call",O!==1?"s":"",M>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",M," passed)"]}),L>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",L," failed)"]})]})]}),h&&U.slice(0,O).map((B,q,H)=>c.jsx(Xf,{call:B,childCalls:$.get(B.callId),threadControlThreads:i,onOpenTerminal:s,onOpenDiff:a,renderInlineSecretPrompt:o,onApprovalResponse:l,hideTopConnector:q===0,hideBottomConnector:q===H.length-1&&D.length===0&&z.length===0},B.callId)),D.map((B,q)=>c.jsx(Xf,{call:B,childCalls:$.get(B.callId),threadControlThreads:i,onOpenTerminal:s,onOpenDiff:a,renderInlineSecretPrompt:o,onApprovalResponse:l,hideTopConnector:h?!1:q===0,hideBottomConnector:q===D.length-1&&z.length===0},B.callId)),z.map((B,q)=>c.jsx(Xf,{call:B,childCalls:$.get(B.callId),threadControlThreads:i,onOpenTerminal:s,onOpenDiff:a,renderInlineSecretPrompt:o,onApprovalResponse:l,hideTopConnector:U.length===0&&q===0,hideBottomConnector:q===z.length-1},B.callId))]})})]})})}const e7=y.memo(_tt,(e,n)=>e.provider===n.provider&&e.isStreaming===n.isStreaming&&e.onOpenTerminal===n.onOpenTerminal&&e.onOpenDiff===n.onOpenDiff&&e.renderInlineSecretPrompt===n.renderInlineSecretPrompt&&e.onApprovalResponse===n.onApprovalResponse&&e.threadControlThreads===n.threadControlThreads&&mle(e.calls,n.calls));e7.displayName="AgentToolCallWrapper";function GW(e){switch(e){case"system":return"border-red-500/35 bg-red-500/10 text-red-700 dark:text-red-300";case"user":return"border-blue-500/35 bg-blue-500/10 text-blue-700 dark:text-blue-300";case"assistant":return"border-emerald-500/35 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300";case"tool":return"border-amber-500/35 bg-amber-500/10 text-amber-700 dark:text-amber-300";default:return"border-border bg-muted text-muted-foreground"}}function Jf(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}function wtt(e){return"content"in e?Jf(e.content):Jf(e)}function Stt(e){return(Array.isArray(e.tool_calls)?e.tool_calls:Array.isArray(e.toolCalls)?e.toolCalls:[]).map((r,i)=>{const s=r&&typeof r=="object"?r:{},a=s.function&&typeof s.function=="object"?s.function:{};return{id:Jf(s.id||s.call_id||s.tool_call_id||`tool-call-${i+1}`),name:Jf(a.name||s.name||s.tool||"tool"),args:Jf(a.arguments||s.arguments||s.args||{})}})}function ktt(e,n){const r=e&&typeof e=="object"?e:{},i=r.function&&typeof r.function=="object"?r.function:{};return{name:Jf(i.name||r.name||`tool_${n+1}`),description:typeof i.description=="string"?i.description:typeof r.description=="string"?r.description:void 0,raw:e}}function gle(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function mm(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function KW({badge:e,meta:n,preview:r,children:i,tone:s="default",defaultOpen:a=!1}){const[o,l]=y.useState(a);return c.jsx(fS,{open:o,onOpenChange:l,children:c.jsxs("div",{className:je("rounded-md border p-3",s==="assistant"?"border-emerald-500/25 bg-emerald-500/10":"border-border/80 bg-background"),children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs(pS,{className:"mt-0.5 rounded-sm p-0.5 text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground",children:[c.jsx(cs,{className:je("h-4 w-4 transition-transform",o&&"rotate-90")}),c.jsx("span",{className:"sr-only",children:o?"Collapse section":"Expand section"})]}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e,n]}),r?c.jsx("div",{className:"mt-1 text-xs text-muted-foreground/70",children:r}):null]})]}),c.jsx(mS,{className:"pl-6",children:c.jsx("div",{className:"pt-3",children:i})})]})})}function Ctt({flow:e}){const n=e.rounds;if(!n.some(f=>f.metrics))return null;let i=0,s=0,a=0,o=0,l,u=0,d=0;for(const f of n){const m=f.metrics;m&&(i+=m.durationMs,m.promptTokens&&(s+=m.promptTokens),m.completionTokens&&(a+=m.completionTokens),m.totalTokens&&(o+=m.totalTokens),m.tokensPerSecond&&m.completionTokens&&(u+=m.tokensPerSecond*m.completionTokens,d+=m.completionTokens),m.contextUsage&&(l=m.contextUsage))}const h=d>0?Math.round(u/d*10)/10:void 0;return c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(Gm,{className:"h-3 w-3"}),"Total Duration"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:gle(i)}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[n.length," round",n.length!==1?"s":""]})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(tA,{className:"h-3 w-3"}),"Tokens"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:o>0?mm(o):s+a>0?mm(s+a):"—"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[s>0?`${mm(s)} in`:"",s>0&&a>0?" · ":"",a>0?`${mm(a)} out`:"",s===0&&a===0?"estimated":""]})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(FY,{className:"h-3 w-3"}),"Speed"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:h?`${h} tok/s`:"—"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"completion tokens/sec"})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(Vye,{className:"h-3 w-3"}),"Context Window"]}),l?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:[Math.round(l.ratio*100),"%"]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[mm(l.total)," / ",mm(l.limit)," tokens",l.pruned?" (pruned)":""]})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:"—"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"no data"})]})]})]})}function jtt({metrics:e}){return e?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[c.jsx("span",{title:"LLM request duration",children:gle(e.durationMs)}),e.promptTokens!=null&&c.jsxs("span",{title:"Prompt tokens",children:[mm(e.promptTokens)," prompt"]}),e.completionTokens!=null&&c.jsxs("span",{title:"Completion tokens",children:[mm(e.completionTokens)," completion"]}),e.tokensPerSecond!=null&&c.jsxs("span",{title:"Completion tokens per second",className:"font-medium text-foreground/80",children:[e.tokensPerSecond," tok/s"]}),e.contextUsage&&c.jsxs("span",{title:"Context window utilisation",children:["ctx ",Math.round(e.contextUsage.ratio*100),"%",e.contextUsage.pruned?" (pruned)":""]})]}):null}function Ntt(e,n){const r=[];if(!e)return n?[{id:"assistant-response",kind:"response",content:n}]:r;e.rounds.some(i=>i.metrics)&&r.push({id:"summary",kind:"summary",flow:e}),e.memory&&r.push({id:"memory",kind:"memory",flow:e.memory});for(const i of e.rounds){const s=Array.isArray(i.messages)?i.messages:[],a=Array.isArray(i.tools)?i.tools.map(ktt):[];r.push({id:`round-${i.round}`,kind:"round",round:i,messageCount:s.length,toolCount:a.length}),s.forEach((o,l)=>{const u=o&&typeof o=="object"?o:{content:o};r.push({id:`round-${i.round}-message-${l}`,kind:"message",roundNumber:i.round,index:l,role:Jf(u.role||"message"),content:wtt(u),raw:o,toolCalls:Stt(u)})}),a.length>0&&r.push({id:`round-${i.round}-tools`,kind:"tools",roundNumber:i.round,tools:a})}return n&&r.push({id:"assistant-response",kind:"response",content:n}),r}function Ttt({row:e}){if(e.kind==="summary")return c.jsx(Ctt,{flow:e.flow});if(e.kind==="memory")return c.jsxs("div",{className:"min-w-0 overflow-hidden rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2",children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[c.jsx(oo,{className:"h-3.5 w-3.5 text-amber-600 dark:text-amber-300"}),c.jsx("span",{className:"text-xs font-semibold text-foreground",children:"Relevant memory"}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.flow.injectedIds.length," injected / ",e.flow.retrieved.length," retrieved"]})]}),c.jsx("div",{className:"mt-2 space-y-1",children:e.flow.retrieved.length>0?e.flow.retrieved.map(r=>c.jsxs("div",{className:"min-w-0 rounded border border-border/60 bg-background/65 px-2 py-1",children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[c.jsx("span",{children:r.scope}),c.jsx("span",{className:"truncate",title:r.source,children:r.source}),r.sourceId?c.jsxs("span",{className:"truncate",title:r.sourceId,children:["source ",r.sourceId]}):null,c.jsx("span",{children:new Date(r.updatedAt).toLocaleDateString()})]}),c.jsx("div",{className:"mt-0.5 break-words text-xs text-foreground",children:r.content})]},r.id)):c.jsx("div",{className:"text-xs text-muted-foreground",children:"No memory injected for this turn."})})]});if(e.kind==="round")return c.jsxs("div",{className:"min-w-0 overflow-hidden rounded-md border border-border bg-background px-3 py-2",children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"rounded-md bg-foreground px-2 py-1 text-xs font-semibold text-background",children:["Round ",e.round.round]}),c.jsx("span",{className:"min-w-0 break-words text-xs text-muted-foreground",children:e.round.model}),c.jsx("span",{className:"min-w-0 break-words text-xs text-muted-foreground",children:new Date(e.round.createdAt).toLocaleString()})]}),c.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap gap-2 text-xs text-muted-foreground",children:[c.jsxs("span",{children:[e.messageCount," messages sent"]}),c.jsxs("span",{children:[e.toolCount," tool schemas available"]}),e.round.tool_choice?c.jsxs("span",{className:"min-w-0 break-words",children:["tool_choice: ",e.round.tool_choice]}):null]}),c.jsx(jtt,{metrics:e.round.metrics})]});if(e.kind==="tools")return c.jsxs("div",{className:"relative ml-2 sm:ml-4 border-l border-border pl-2 sm:pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-border bg-background"}),c.jsxs("div",{className:"rounded-md border border-border/80 bg-muted/25 p-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-medium text-foreground",children:[c.jsx(lM,{className:"h-3.5 w-3.5"}),"Tools offered to model in round ",e.roundNumber]}),c.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.tools.map(r=>c.jsxs("details",{className:"rounded-md border border-border/70 bg-background/70 p-2",children:[c.jsx("summary",{className:"cursor-pointer text-xs font-medium text-foreground",children:r.name}),r.description?c.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:r.description}):null,c.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/40 p-2 font-mono text-xs leading-5",children:Jf(r.raw)})]},r.name))})]})]});if(e.kind==="response")return c.jsxs("div",{className:"relative ml-2 sm:ml-4 border-l border-border pl-2 sm:pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-emerald-500/40 bg-background"}),c.jsx(KW,{tone:"assistant",defaultOpen:!1,badge:c.jsx("span",{className:je("rounded-md border px-2 py-0.5 text-xs font-semibold",GW("assistant")),children:"assistant response"}),meta:c.jsx("span",{className:"text-xs text-muted-foreground",children:"rendered chat answer"}),preview:c.jsx("span",{className:"block truncate",children:e.content||"(empty response)"}),children:c.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-background/70 p-3 font-mono text-xs leading-5 text-foreground [overflow-wrap:anywhere]",children:e.content||"(empty response)"})})]});const n=e.content?e.content.length>80?e.content.slice(0,80)+"...":e.content:"(empty content)";return c.jsxs("div",{className:"relative ml-2 sm:ml-4 border-l border-border pl-2 sm:pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-border bg-background"}),c.jsxs(KW,{defaultOpen:!1,badge:c.jsx("span",{className:je("rounded-md border px-2 py-0.5 text-xs font-semibold",GW(e.role)),children:e.role}),meta:c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"text-xs text-muted-foreground",children:["round ",e.roundNumber," / message ",e.index+1]}),e.toolCalls.length>0?c.jsxs("span",{className:"text-xs text-amber-600 dark:text-amber-400",children:[e.toolCalls.length," tool call",e.toolCalls.length!==1?"s":""]}):null]}),preview:c.jsx("span",{className:"block truncate",children:n}),children:[c.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/35 p-3 font-mono text-xs leading-5 text-foreground [overflow-wrap:anywhere]",children:e.content||"(empty content)"}),e.toolCalls.length>0?c.jsx("div",{className:"mt-3 space-y-2",children:e.toolCalls.map(r=>c.jsxs("details",{className:"rounded-md border border-amber-500/25 bg-amber-500/10 p-2",children:[c.jsxs("summary",{className:"cursor-pointer text-xs font-medium text-amber-800 dark:text-amber-200",children:["Tool call: ",r.name," ",c.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",r.id,")"]})]}),c.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-background/70 p-2 font-mono text-xs leading-5",children:r.args||"{}"})]},r.id))}):null,c.jsxs("details",{className:"mt-2",children:[c.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground",children:"Raw message JSON"}),c.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/35 p-2 font-mono text-xs leading-5",children:Jf(e.raw)})]})]})]})}function Ett({open:e,rows:n,contextFlow:r,loading:i}){const s=y.useRef(null),a=dM({count:n.length,getScrollElement:()=>s.current,estimateSize:o=>{const l=n[o];return l?l.kind==="summary"?110:l.kind==="memory"?Math.min(360,84+l.flow.retrieved.length*74):l.kind==="round"?120:l.kind==="tools"?Math.min(420,110+l.tools.length*72):l.kind==="response"?72:52:120},overscan:5,enabled:e});return y.useEffect(()=>{if(!e)return;const o=window.requestAnimationFrame(()=>{a.measure()});return()=>window.cancelAnimationFrame(o)},[e,n.length,a]),c.jsxs("div",{className:"flex h-full min-h-0 flex-col px-3 pb-3 pt-2",children:[r!=null&&r.note?c.jsx("p",{className:"mb-2 shrink-0 rounded-md border border-border/70 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground",children:r.note}):null,n.length>0?c.jsx("div",{ref:s,className:"min-h-0 flex-1 overflow-auto pr-2",children:c.jsx("div",{className:"relative w-full",style:{height:`${a.getTotalSize()}px`},children:a.getVirtualItems().map(o=>{const l=n[o.index];return l?c.jsx("div",{"data-index":o.index,ref:a.measureElement,className:"absolute left-0 top-0 w-full pb-3",style:{transform:`translateY(${o.start}px)`},children:c.jsx(Ttt,{row:l})},l.id):null})})}):i?c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border text-sm text-muted-foreground",children:[c.jsx(Lt,{className:"h-5 w-5 animate-spin"}),c.jsx("span",{children:"Loading context trace…"})]}):c.jsxs("div",{className:"flex min-h-0 flex-1 items-center justify-center rounded-md border border-dashed border-border text-sm text-muted-foreground",children:[c.jsx(Ah,{className:"mr-2 h-4 w-4"}),"No context snapshot is available for this message."]})]})}function Att({rawText:e}){const n=_S(),r=e||"No context snapshot is available for this message.";return c.jsx("div",{className:"h-full min-h-0 p-3 pt-2",children:c.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border border-border/70 bg-background",children:c.jsx(wS,{height:"100%",language:e?"json":"plaintext",beforeMount:i=>Yl(i,n),theme:n,value:r,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},"semanticHighlighting.enabled":!0,automaticLayout:!0,wordWrap:"on",fontSize:12,lineHeight:18,padding:{top:12,bottom:12},scrollBeyondLastLine:!1,renderLineHighlight:"none",overviewRulerLanes:0,tabSize:2}})})})}function Ott({open:e,onOpenChange:n,contextFlow:r,responseContent:i,loading:s}){const[a,o]=y.useState("trace"),[l,u]=y.useState(!1),d=y.useMemo(()=>Ntt(r,i),[r,i]),h=y.useMemo(()=>r?JSON.stringify(r,null,2):"",[r]),f=!!(s&&!r),m=async()=>{h&&(await navigator.clipboard.writeText(h),u(!0),window.setTimeout(()=>u(!1),1200))};return c.jsx(zo,{open:e,onOpenChange:n,children:c.jsxs(uo,{showCloseButton:!1,className:"grid h-[95vh] w-[calc(100dvw-1rem)] max-w-[1200px] grid-rows-[auto_minmax(0,1fr)] overflow-hidden p-0 sm:h-[85vh] sm:w-[96vw]",children:[c.jsx(ul,{className:"border-b px-3 py-2",children:c.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx(ho,{className:"truncate text-sm font-semibold",children:"LLM Context Flow"}),c.jsx(ju,{className:"truncate text-xs",children:r?`${r.provider}${r.model?` / ${r.model}`:""} · ${r.rounds.length} round${r.rounds.length===1?"":"s"}`:f?"Loading context trace…":"No context snapshot available"})]}),c.jsxs("div",{className:"-my-1 flex shrink-0 items-center gap-1 p-1",children:[c.jsx(ye,{type:"button",variant:a==="trace"?"default":"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>o("trace"),children:"Trace"}),c.jsx(ye,{type:"button",variant:a==="raw"?"default":"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>o("raw"),children:"Raw"}),c.jsxs(ye,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:m,disabled:!h,children:[l?c.jsx(Ii,{className:"h-3 w-3 sm:mr-1"}):c.jsx(nl,{className:"h-3 w-3 sm:mr-1"}),c.jsx("span",{className:"hidden sm:inline",children:l?"Copied":"Copy"}),c.jsx("span",{className:"sr-only",children:l?"Copied":"Copy raw trace"})]}),c.jsxs(QR,{className:"ml-1 rounded-sm p-1 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[c.jsx(Ur,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}),a==="trace"?c.jsx(Ett,{open:e,rows:d,contextFlow:r,loading:f},"trace-list"):c.jsx(Att,{rawText:h})]})})}const $3=new Map,GE=new Map,Rtt={current:0};function yle(e,n){return`${Rtt.current}:${e}:${n}`}function Mtt(e,n){const r=$3.get(yle(e,n));return r==null?void 0:r.flow}async function Ptt(e,n,r){const i=yle(e,n),s=$3.get(i);if(s)return s.flow;const a=GE.get(i);if(a)return(await a).flow;const o=(async()=>{try{const u={};r&&(u.Authorization=`Bearer ${r}`);const d=await fetch(`${Nr()}/api/sessions/${e}/messages/${n}/context-flow`,{headers:u});if(!d.ok){const x={flow:null,at:Date.now()};return $3.set(i,x),x}const m={flow:(await d.json()).contextFlow??null,at:Date.now()};return $3.set(i,m),m}catch{return{flow:null,at:Date.now()}}finally{GE.delete(i)}})();return GE.set(i,o),(await o).flow}const t7=/^[A-Za-z]:[\\/]/,Ltt=/^\//;function YW(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")||(e.startsWith("/")?"/":"")}function $tt(e){const n=e.pathname||"/",r=/^\/[A-Za-z]:\//.test(n)?n.slice(1):n;return!e.hostname||e.hostname==="localhost"?r:`//${e.hostname}${r}`}function xle(e){return t7.test(e)||Ltt.test(e)}function vle(e,n){const r=e.replace(/\\/g,"/");if(!r||r==="/")return!1;if(/^L\d+(?:C\d+)?$/i.test(n))return!0;const i=r.split("/").pop()??"";return/\.[A-Za-z0-9]+(?::\d+(?::\d+)?)?$/.test(i)}function Dtt(e,n){if(n)return null;const r=e.replace(/\\/g,"/"),i=r.lastIndexOf("/"),a=(i>=0?r.slice(i+1):r).match(/^(.*?):(\d+)(?::(\d+))?$/);if(!a)return null;const o=i>=0?`${e.slice(0,i+1)}${a[1]??""}`:a[1]??"";if(!xle(o)||!vle(o,`L${a[2]}`))return null;const l={path:o,line:Number.parseInt(a[2],10)};return a[3]&&(l.column=Number.parseInt(a[3],10)),l}function Itt(e){if(!e)return null;const n=e.trim();if(!n)return null;let r=n,i="";try{const u=new URL(n);if(u.protocol==="http:"||u.protocol==="https:"){if(r=u.pathname,i=u.hash.startsWith("#")?u.hash.slice(1):u.hash,!vle(r,i))return null}else if(u.protocol==="file:")r=$tt(u),i=u.hash.startsWith("#")?u.hash.slice(1):u.hash;else{const d=n.indexOf("#");d>=0&&(r=n.slice(0,d),i=n.slice(d+1))}}catch{const u=n.indexOf("#");u>=0&&(r=n.slice(0,u),i=n.slice(u+1))}let s;try{s=decodeURIComponent(r)}catch{return null}const a=Dtt(s,i);if(a)return a;if(!xle(s))return null;const o={path:s},l=i.match(/^L(\d+)(?:C(\d+))?$/i);return l&&(o.line=Number.parseInt(l[1],10),l[2]&&(o.column=Number.parseInt(l[2],10))),o}function XW(e,n){if(!n)return!1;const r=YW(e),i=YW(n);if(!r||!i)return!1;const s=t7.test(r)?r.toLowerCase():r,a=t7.test(i)?i.toLowerCase():i;return s===a||(a==="/"?s.startsWith("/"):s.startsWith(`${a}/`))}function Btt(e){const n=e==null?void 0:e.memory;if(!n||n.injectedIds.length===0)return[];const r=new Set(n.injectedIds);return n.retrieved.filter(i=>r.has(i.id))}const ztt="memory_feedback",JW=500,zP={should_have_remembered:{label:"Memorize this",description:"The user wants this assistant answer reviewed as durable memory.",tag:"should-have-remembered"},wrong_memory_used:{label:"Wrong memory used",description:"The user says an incorrect or irrelevant memory influenced this answer.",tag:"wrong-memory-used"}};function Ftt(e){return zP[e].label}function Htt(e){return`${zP[e].label} feedback saved`}function Wtt(e){const n=(e??"").replace(/\s+/g," ").trim();return n?n.length<=JW?n:`${n.slice(0,JW-3).trimEnd()}...`:null}function Utt({kind:e,messageId:n,sessionId:r,projectId:i,answerContent:s}){const a=zP[e],o=Wtt(s);return{content:[`Memory feedback: ${a.label}. ${a.description}`,o?`Assistant answer excerpt: ${o}`:null].filter(Boolean).join(`
1249
1249
  `),projectId:i??null,sessionId:r??null,sourceType:ztt,sourceId:n,sourceSurface:"chat",tags:["memory-feedback","feedback",a.tag]}}function Vtt(e){return e.content.length>0||e.userDisplayText.length>0||e.userDisplaySegments.length>0||e.attachmentCount>0}function qtt(){return["fixed left-1/2 bottom-[max(0.75rem,env(safe-area-inset-bottom))] z-50","w-[min(42rem,calc(100vw-1rem))] max-w-[calc(100vw-1rem)] -translate-x-1/2","rounded-2xl border border-border bg-background p-1.5 shadow-2xl shadow-black/30","md:static md:w-full md:max-w-3xl md:translate-x-0","md:rounded-none md:border-0 md:bg-transparent md:p-0 md:shadow-none"].join(" ")}function Gtt(e){return["space-y-3 origin-bottom transition-opacity duration-150 ease-out",e?"opacity-100":"opacity-0"].join(" ")}const Ktt=3,Ytt=120,dx=new Map;function ZW(e,n){return!!(e&&e!=="jait"&&n.length>=Ktt)}const QW=/<pre[^>]*><code>([\s\S]*)<\/code><\/pre>/;function eU(){return c.jsx("span",{className:"inline-flex items-center gap-1",children:[0,1,2].map(e=>c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current animate-pulse",style:{animationDelay:`${e*160}ms`}},e))})}function ble(e){const n=e.toLowerCase();return!n||n==="text"||n==="plain"?"txt":n==="shell"||n==="sh"?"bash":n}function Xtt(e,n,r){return`${r}\0${ble(n)}\0${e}`}function KE(e,n){if(dx.size>=Ytt){const r=dx.keys().next().value;r&&dx.delete(r)}dx.set(e,n)}function Jtt({code:e,language:n,className:r}){const[i,s]=y.useState(null);return y.useEffect(()=>{let a=!1;const o=setTimeout(()=>{(async()=>{var f,m;const u=document.documentElement.classList.contains("dark")?"github-dark":"github-light",d=ble(n),h=Xtt(e,n,u);if(dx.has(h)){s(dx.get(h)??null);return}try{const x=await PB(e,{lang:d,theme:u});if(a)return;const v=((f=x.match(QW))==null?void 0:f[1])??null;KE(h,v),s(v)}catch{try{const x=await PB(e,{lang:"txt",theme:u});if(a)return;const v=((m=x.match(QW))==null?void 0:m[1])??null;KE(h,v),s(v)}catch{a||(KE(h,null),s(null))}}})()},150);return()=>{a=!0,clearTimeout(o)}},[e,n]),i?c.jsx("code",{className:je(r,"whitespace-pre"),dangerouslySetInnerHTML:{__html:i}}):c.jsx("code",{className:je(r,"whitespace-pre"),children:e})}function _le(e){return"prose dark:prose-invert max-w-none break-words [overflow-wrap:anywhere] prose-pre:bg-muted prose-pre:border prose-pre:max-w-full prose-pre:overflow-x-auto prose-code:before:content-none prose-code:after:content-none prose-p:leading-relaxed [font-size:0.9rem]"}function Ztt(e){const n=e.replace(/\\/g,"/"),r=n.split("/");return r[r.length-1]??n}function Qtt({href:e,target:n,onOpenPath:r}){const i=Ztt(n.path),s=n.line?`L${n.line}${n.column?`:${n.column}`:""}`:null;return c.jsxs("a",{href:e,className:je("not-prose inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 align-middle text-xs font-medium leading-none text-foreground no-underline transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),title:n.path,onClick:a=>{a.preventDefault(),r(n.path,n.line,n.column)},children:[c.jsx(ga,{filename:i,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[220px] truncate",children:i}),s?c.jsx("span",{className:"shrink-0 rounded bg-background/80 px-1 py-0.5 text-2xs text-muted-foreground",children:s}):null]})}function wle(e){return{pre:({children:n})=>c.jsx(c.Fragment,{children:n}),code:({node:n,className:r,children:i,ref:s,...a})=>{var l,u;if(!(((l=n==null?void 0:n.position)==null?void 0:l.start.line)===((u=n==null?void 0:n.position)==null?void 0:u.end.line)&&!r)){const d=typeof r=="string"&&r.replace(/^language-/,"").split(" ")[0]||"text",h=String(i??"").replace(/\n$/,"");return c.jsxs(v6e,{code:h,language:d,children:[c.jsxs(b6e,{children:[c.jsx(_6e,{children:c.jsx(w6e,{children:d})}),c.jsx(S6e,{children:c.jsx(k6e,{})})]}),c.jsx("div",{className:"overflow-x-auto px-3 py-2 text-sm",children:c.jsx(Jtt,{code:h,language:d,className:r})})]})}return c.jsx("code",{className:je("not-prose inline-flex max-w-full items-baseline rounded-md border border-border/70 bg-muted/45 px-2 py-1 align-middle font-mono text-xs font-medium leading-[1.2] text-foreground","shadow-[inset_0_1px_0_hsl(var(--background)/0.55)]"),...a,children:c.jsx("span",{className:"max-w-[32rem] truncate sm:max-w-[40rem]",children:i})})},a:({href:n,ref:r,...i})=>{if(!e)return c.jsx("a",{href:n,...i,children:i.children});const s=Itt(n);return s?c.jsx(Qtt,{href:n,target:s,onOpenPath:e}):c.jsx("a",{href:n,...i,children:i.children})},img:({src:n,alt:r,ref:i,...s})=>{const a=typeof n=="string"?qoe(n):null;return a?c.jsx("a",{href:a,target:"_blank",rel:"noreferrer",className:"not-prose block overflow-hidden rounded-xl border border-border/60 bg-muted/20 no-underline",children:c.jsx("img",{src:a,alt:r??"Chat image",loading:"lazy",className:"max-h-[28rem] w-full object-contain bg-background/80",...s})}):c.jsx("span",{className:"inline-flex rounded-md border border-dashed border-border/70 px-2 py-1 text-xs text-muted-foreground",children:"image unavailable"})}}}function ent({content:e,compact:n,onOpenPath:r}){const i=y.useMemo(()=>wle(r),[r]);return c.jsx("div",{className:_le(),children:c.jsx(VJ,{remarkPlugins:[qJ],components:i,children:e})})}function tnt({content:e,compact:n,onOpenPath:r}){const i=y.useMemo(()=>wle(r),[r]),s=({blockMatch:o})=>c.jsx(VJ,{remarkPlugins:[qJ],components:i,children:o.output}),{blockMatches:a}=u3e({llmOutput:e,blocks:[],fallbackBlock:{component:s,lookBack:QCe()},isStreamFinished:!1});return c.jsx("div",{className:_le(),children:a.map((o,l)=>{const u=o.block.component;return c.jsx(u,{blockMatch:o},l)})})}const n7=y.memo(function({content:n,compact:r,isStreaming:i,preferLlmUi:s,onOpenPath:a}){return s&&i?c.jsx(tnt,{content:n,compact:r,onOpenPath:a}):c.jsx(ent,{content:n,compact:r,onOpenPath:a})});n7.displayName="AssistantMarkdown";function nnt({messageId:e,messageIndex:n,messageFromEnd:r,role:i,content:s,contextFlow:a,hasContextFlow:o,hasMemoryProvenance:l,sessionId:u,authToken:d,displayContent:h,referencedFiles:f,displaySegments:m,attachments:x,thinking:v,thinkingDuration:_,toolCalls:w,segments:S,isStreaming:C,compact:j,preferLlmUi:T,provider:E,threadControlThreads:N,onOpenTerminal:R,renderInlineSecretPrompt:$,onApprovalResponse:G,onEditMessage:W,editComposer:z,onOpenPath:U,onOpenDiff:I,onOpenMemorySource:O,onMemoryFeedback:D}){const M=i==="user",L=Km(),B=Array.isArray(S)?S:[],q=Array.isArray(w)?w:[],[H,F]=y.useState(()=>typeof n=="number"&&u?Mtt(u,n)??null:null),[X,V]=y.useState(!1),ne=a??H??void 0,J=!a&&(o===!0||l===!0),te=y.useCallback(async()=>{if(!(H||X||a)&&!(typeof n!="number"||!u)){V(!0);try{const ie=await Ptt(u,n,d??void 0);ie&&F(ie)}catch{}finally{V(!1)}}},[H,X,a,n,u,d]),{userDisplayText:re,userDisplaySegments:Q}=y.useMemo(()=>{if(!M)return{userDisplayText:s,userDisplaySegments:[]};if(m!=null&&m.length)return{userDisplayText:w0(m),userDisplaySegments:m};if(h){const Se=C5(h,f);return{userDisplayText:h,userDisplaySegments:Se}}const ie=DA(s);return{userDisplayText:ie.text,userDisplaySegments:ie.displaySegments}},[M,s,h,f,m]),[ue,ge]=y.useState(!1),[se,oe]=y.useState(!1),[ve,_e]=y.useState(!1),[Ae,Ke]=y.useState(!1),[ot,Nt]=y.useState(!1),[$t,en]=y.useState(!1),[on,Vt]=y.useState(!1),[Gt,Et]=y.useState(null),[_n,xe]=y.useState(""),[pe,ze]=y.useState([]),[ft,Je]=y.useState(null),[ht,yt]=y.useState(null),St=y.useMemo(()=>{if(!M)return[];const ie=Ds(ht??Q).flatMap(Se=>Se.type==="image"||Se.type==="attachment"?[{name:Se.name,mimeType:Se.mimeType,data:Se.data,...Se.type==="image"?{preview:`data:${Se.mimeType};base64,${Se.data}`}:{}}]:[]);return ie.length>0?ie:x??[]},[x,M,ht,Q]),We=y.useMemo(()=>St.filter(ie=>ie.mimeType.startsWith("image/")),[St]),Fe=y.useMemo(()=>St.filter(ie=>!ie.mimeType.startsWith("image/")),[St]),lt=M&&Vtt({content:s,userDisplayText:ft??re,userDisplaySegments:ht??Q,attachmentCount:St.length}),et=y.useRef(null),Be=y.useRef(null),ke=y.useRef(null),we=y.useRef(null);y.useEffect(()=>()=>{et.current!==null&&window.clearTimeout(et.current),Be.current!==null&&window.clearTimeout(Be.current)},[]),y.useEffect(()=>{ve||(xe(re),ze(Q))},[ve,Q,re]),y.useEffect(()=>{if(!ht&&ft==null)return;const ie=ft===re,Se=ht===Q||JSON.stringify(ht??[])===JSON.stringify(Q);ie&&Se&&(Je(null),yt(null))},[ht,ft,Q,re]),y.useEffect(()=>{var Se;if(!ve){Ke(!1);return}const ie=window.requestAnimationFrame(()=>{Ke(!0)});return(Se=we.current)==null||Se.focus(),()=>window.cancelAnimationFrame(ie)},[ve]);const Ge=()=>YQ(Q)||re,rt=()=>{var fe;const ie=[];if(q&&q.length>0)for(const $e of q){const Ft=$e.tool.replace(/_/g,"."),He=Object.entries($e.args).filter(([,Kt])=>Kt!=null&&Kt!=="").map(([Kt,sr])=>`${Kt}: ${typeof sr=="string"?sr:JSON.stringify(sr)}`).join(", "),It=$e.status==="success"?"✓":$e.status==="error"?"✗":"…",fn=$e.completedAt&&$e.startedAt?ole($e.startedAt,$e.completedAt):"";if(ie.push(`[${It} ${Ft}] ${He}`),(fe=$e.result)!=null&&fe.message){const Kt=$e.result.message.length>500?$e.result.message.slice(0,500)+"…":$e.result.message;ie.push(Kt)}fn&&ie.push(`Duration: ${fn}`),ie.push("")}const Se=M?Ge():s;return Se&&ie.push(Se),ie.join(`
1250
- `).trim()},Ze=async()=>{var fe,$e,Ft;const ie=rt();if(!ie)return;const Se=M?XQ(Q):null;try{if(Se&&typeof ClipboardItem<"u"&&((fe=navigator.clipboard)!=null&&fe.write))try{await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([ie],{type:"text/plain"}),[k5]:new Blob([Se],{type:k5})})])}catch{if(!(($e=navigator.clipboard)!=null&&$e.writeText))throw new Error("Clipboard text API unavailable");await navigator.clipboard.writeText(ie)}else if((Ft=navigator.clipboard)!=null&&Ft.writeText)await navigator.clipboard.writeText(ie);else throw new Error("Clipboard API unavailable")}catch{const He=document.createElement("textarea");He.value=ie,He.style.position="fixed",He.style.opacity="0",document.body.appendChild(He),He.focus(),He.select(),document.execCommand("copy"),document.body.removeChild(He)}ge(!0),et.current!==null&&window.clearTimeout(et.current),et.current=window.setTimeout(()=>ge(!1),1200)},Ye=K0(),ut=M&&!!e&&!!W,xt=ut,zt=C&&!v&&!(typeof s=="string"?s:"").trim(),rn=rt().length>0,sn=(M||!C)&&rn,dt=!M&&!!e&&!!D&&!C,Tt=(Gt==null?void 0:Gt.status)==="saving",Oe=y.useCallback(()=>{!ut||ot||(xe(re),ze(Q),_e(!0))},[ut,ot,Q,re]),pt=y.useCallback(()=>{xe(re),ze(Q),_e(!1)},[Q,re]),Ot=()=>{var Se;!ut||ve||typeof window<"u"&&(Se=window.getSelection())!=null&&Se.toString().trim()||Oe()},Pt=y.useCallback(async(ie,Se)=>{if(!ut||!e||!W||ot)return;const fe=uAe(ie??_n,Se??pe,Q);if(fe){Je(fe.text),yt(fe.displaySegments),_e(!1),Nt(!0);try{await W(e,fe.text,n,r,{referencedFiles:fe.referencedFiles,displaySegments:fe.displaySegments})}catch($e){throw Je(null),yt(null),_e(!0),$e}finally{Nt(!1)}}},[ut,_n,pe,ot,e,r,n,W]),hn=async(ie,Se)=>{if(!ut||!e||!W)return;const fe=ie.trim();fe&&await W(e,fe,n,r,{referencedFiles:(Se??Q).filter($e=>$e.type==="file").map($e=>({path:$e.path,name:$e.name})),displaySegments:Se??Q})},un=async()=>{if(xt){oe(!0);try{await hn(re,Q)}finally{oe(!1)}}},dn=async ie=>{if(!(!dt||!e||Tt)&&await L({title:"Memorize this?",description:"This saves a memory feedback item with this assistant message as context. Future agents can use it when reviewing or updating memory for this chat and project.",confirmLabel:"Memorize",cancelLabel:"Cancel"})){Et({kind:ie,status:"saving"});try{await(D==null?void 0:D({messageId:e,kind:ie,content:s})),Et({kind:ie,status:"saved"}),Be.current!==null&&window.clearTimeout(Be.current),Be.current=window.setTimeout(()=>Et(null),1200)}catch{Et(null)}}},pn=(ie,Se)=>(Gt==null?void 0:Gt.kind)!==ie?Se:Gt.status==="saving"?c.jsx(Lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Ii,{className:"h-3.5 w-3.5"}),Bt=[...ut?[{key:"edit",label:"Edit message",icon:c.jsx(H_,{className:"h-3.5 w-3.5"}),onClick:()=>Oe()}]:[],...xt?[{key:"retry",label:"Retry from this message",icon:c.jsx(IY,{className:je("h-3.5 w-3.5",se&&"animate-spin")}),onClick:()=>{un()},disabled:se}]:[],...!M&&(ne||J)?[{key:"context",label:"View LLM context",icon:X?c.jsx(Lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Nm,{className:"h-3.5 w-3.5"}),onClick:()=>{ne||te(),en(!0)}}]:[],...dt?[{key:"memory",label:Ftt("should_have_remembered"),icon:pn("should_have_remembered",c.jsx(oo,{className:"h-3.5 w-3.5"})),onClick:()=>{dn("should_have_remembered")},disabled:Tt}]:[],{key:"copy",label:ue?"Copied":"Copy message",icon:ue?c.jsx(Ii,{className:"h-3.5 w-3.5"}):c.jsx(nl,{className:"h-3.5 w-3.5"}),onClick:()=>{Ze()}}],qn=ie=>ve||!sn||Bt.length===0?null:Ye?c.jsx("div",{className:je("absolute z-10","right-0.5 bottom-0.5"),children:c.jsxs(Mc,{children:[c.jsx(Pc,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":"Message actions",className:"flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:c.jsx(F_,{className:"h-4 w-4"})})}),c.jsx(Kl,{align:"end",side:"top",className:"min-w-[10rem]",children:Bt.map(Se=>c.jsxs($i,{disabled:Se.disabled,onSelect:fe=>{fe.preventDefault(),Se.onClick()},className:"gap-2",children:[Se.icon,c.jsx("span",{children:Se.label})]},Se.key))})]})}):c.jsx("div",{className:je("absolute z-10 rounded-md border border-border/60 bg-background/95 p-0.5 shadow-sm","right-1 bottom-[.25rem]","opacity-0 transition-opacity group-hover/message:opacity-100 focus-within:opacity-100",ue&&"opacity-100"),children:c.jsx(j6e,{children:Bt.map(Se=>c.jsx(N6e,{onClick:fe=>{fe.preventDefault(),fe.stopPropagation(),Se.onClick()},disabled:Se.disabled,"aria-label":Se.label,tooltip:Se.label,className:"h-5 w-5 rounded-md p-0 [&_svg]:h-3 [&_svg]:w-3",children:Se.icon},Se.key))})}),Ne=M?null:qn(),gt=!M&&(B==null?void 0:B.some(ie=>ie.type==="thinking"&&ie.content.trim())),Dt=M?[]:Btt(ne),_t=!M&&(Dt.length>0||l&&!ne)?c.jsxs("div",{className:"not-prose mt-2 flex min-w-0 flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsxs("button",{type:"button",className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2 py-1 font-medium text-amber-700 transition-colors hover:bg-amber-500/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 dark:text-amber-200",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),!ne&&l&&te(),Vt(Se=>!Se)},"aria-expanded":on,title:on?"Hide injected memories":"Show memories injected for this answer",children:[c.jsx(oo,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{children:"Memory"}),Dt.length>0?c.jsx("span",{className:"rounded bg-background/75 px-1 text-2xs",children:Dt.length}):X?c.jsx(Lt,{className:"h-3 w-3 animate-spin"}):c.jsx("span",{className:"rounded bg-background/75 px-1 text-2xs",children:"•"})]}),on&&Dt.slice(0,3).map(ie=>{const Se={memoryId:ie.id,sourceType:ie.sourceType,sourceId:ie.sourceId,sourceSurface:ie.sourceSurface},fe=!!(O&&ie.sourceSurface==="chat"&&ie.sourceId);return c.jsxs("button",{type:"button",className:"inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",onClick:$e=>{$e.preventDefault(),$e.stopPropagation(),fe?O==null||O(Se):en(!0)},title:fe?`Open source chat for injected memory: ${ie.source||ie.id}`:`View injected memory source: ${ie.source||ie.id}`,children:[fe?c.jsx(Ah,{className:"h-3.5 w-3.5 shrink-0"}):c.jsx(oo,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:ie.source||ie.id})]},ie.id)})]}):null;return c.jsxs(c.Fragment,{children:[c.jsx(C6e,{from:i,className:je(j?"py-2":"py-4"),children:c.jsxs("div",{className:je("min-w-0 max-w-[85%] space-y-2",M&&"order-1"),children:[!M&&v&&!gt&&c.jsx(QB,{content:v,isStreaming:!!C&&!s,duration:_}),!M&&B&&B.length>0?c.jsxs("div",{className:"relative min-w-0 max-w-full select-text break-words [overflow-wrap:anywhere]",children:[B.map((ie,Se)=>{if(ie.type==="toolGroup"){const fe=Array.isArray(ie.callIds)?ie.callIds:[],$e=(q??[]).filter(He=>fe.includes(He.callId)),Ft=B.slice(Se+1).some(He=>He.type==="text"&&typeof He.content=="string"&&He.content.trim());return $e.length>0?ZW(E,$e)?c.jsx(e7,{provider:E,calls:$e,isStreaming:!!C&&Se===B.length-1,threadControlThreads:N,onOpenTerminal:R,onOpenDiff:I,renderInlineSecretPrompt:$,onApprovalResponse:G},`tg-${Se}`):c.jsx(QO,{calls:$e,collapsible:Ft,threadControlThreads:N,onOpenTerminal:R,onOpenDiff:I,renderInlineSecretPrompt:$,onApprovalResponse:G},`tg-${Se}`):null}return ie.type==="thinking"?ie.content.trim()?c.jsx(QB,{content:ie.content,isStreaming:!!C&&Se===B.length-1,duration:_},`th-${Se}`):null:ie.type==="error"?c.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 py-2.5 text-sm text-red-600 dark:text-red-400",children:[c.jsx(Fx,{className:"mt-0.5 h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:ie.content})]},`err-${Se}`):typeof ie.content=="string"&&ie.content.trim()?c.jsx(kT,{"data-message-from":"assistant",className:"max-w-full bg-card/78",children:c.jsx(n7,{content:ie.content,compact:j,isStreaming:!!C&&Se===B.length-1,preferLlmUi:T,onOpenPath:U})},`ts-${Se}`):null}),C&&!s&&!B.some(ie=>ie.type==="text"&&typeof ie.content=="string"&&ie.content.trim())&&c.jsx("div",{className:"flex items-center gap-3 px-1 py-1 text-sm text-muted-foreground",children:c.jsx(eU,{})}),Ne,_t]}):c.jsxs(c.Fragment,{children:[q&&q.length>0&&(ZW(E,q)?c.jsx(e7,{provider:E,calls:q,isStreaming:C,threadControlThreads:N,onOpenTerminal:R,onOpenDiff:I,renderInlineSecretPrompt:$,onApprovalResponse:G}):c.jsx(QO,{calls:q,collapsible:E!=="jait",threadControlThreads:N,onOpenTerminal:R,onOpenDiff:I,renderInlineSecretPrompt:$,onApprovalResponse:G})),lt||s?M?ve?c.jsx("div",{className:qtt(),onClick:ie=>ie.stopPropagation(),children:c.jsx("div",{className:Gtt(Ae),children:c.jsx(Jw,{ref:we,draftStateKey:`edit:${e??"user-message"}`,value:_n,segments:pe,onChange:ie=>{var Se;xe(ie),ze(((Se=we.current)==null?void 0:Se.getSegments())??[])},onSubmit:(ie,Se,fe)=>{const $e=fe??[],Ft=w0($e)||_n;ze($e),Pt(Ft,$e)},disabled:ot,controlsDisabled:ot,placeholder:"Edit message...",onVoiceInput:z==null?void 0:z.onVoiceInput,voiceRecording:z==null?void 0:z.voiceRecording,voiceLevels:z==null?void 0:z.voiceLevels,voiceTranscribing:z==null?void 0:z.voiceTranscribing,onVoiceStop:z==null?void 0:z.onVoiceStop,mode:z==null?void 0:z.mode,onModeChange:z==null?void 0:z.onModeChange,provider:z==null?void 0:z.provider,onProviderChange:z==null?void 0:z.onProviderChange,responseStyle:z==null?void 0:z.responseStyle,onResponseStyleChange:z==null?void 0:z.onResponseStyleChange,providerRuntimeMode:z==null?void 0:z.providerRuntimeMode,onProviderRuntimeModeChange:z==null?void 0:z.onProviderRuntimeModeChange,cliModel:z==null?void 0:z.cliModel,onCliModelChange:z==null?void 0:z.onCliModelChange,sessionInfo:z==null?void 0:z.sessionInfo,projectNodeId:z==null?void 0:z.projectNodeId,availableFiles:(z==null?void 0:z.availableFiles)??S0(Q),onSearchFiles:z==null?void 0:z.onSearchFiles,projectOpen:(z==null?void 0:z.projectOpen)??S0(Q).length>0,footerTrailingContent:c.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-lg",onClick:pt,disabled:ot,"aria-label":"Cancel editing message",title:"Cancel editing",children:c.jsx(Ur,{className:"h-3.5 w-3.5"})}),className:"rounded-lg border-primary/20 bg-primary/[0.08] dark:!bg-primary/[0.08] shadow-none [&_.text-muted-foreground]:text-muted-foreground [&>div]:!bg-transparent [&_[contenteditable='true']]:!bg-transparent"},`edit-${e??"user-message"}`)})}):c.jsxs("div",{className:"relative w-fit max-w-full",children:[c.jsx(kT,{ref:ke,"data-message-from":"user",className:je("min-w-0 rounded-lg bg-muted px-4 py-3 break-words [overflow-wrap:anywhere]",ut&&!ve&&"cursor-text transition-colors hover:bg-muted/80","leading-relaxed [font-size:0.9rem]"),onClick:Ot,title:ut&&!ve?"Click to edit message":void 0,children:c.jsxs("div",{className:"min-w-0 space-y-3",children:[c.jsx("div",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:(ht??Q).length>0?(ht??Q).map((ie,Se)=>ie.type==="text"?c.jsx("span",{children:ie.text},`text-${Se}`):ie.type==="file"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ie.path,children:[c.jsx(ga,{filename:ie.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ie.lineRange?`${ie.name}:${nw(ie.lineRange).replace(/^lines? /,"")}`:ie.name})]},`${ie.path}-${Se}`):ie.type==="project"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ie.path,children:[c.jsx(P4,{name:ie.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ie.name})]},`${ie.path}-${Se}`):ie.type==="terminal"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ie.projectRoot?`${ie.terminalId} · ${ie.projectRoot}`:ie.terminalId,children:[c.jsx("span",{className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-sm bg-muted-foreground/15 text-2xs font-bold uppercase text-muted-foreground",children:"T"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ie.lineRange?`${ie.name}:${nw(ie.lineRange).replace(/^lines? /,"")}`:ie.name})]},`${ie.terminalId}-${Se}`):null):ft??re}),We.length>0&&c.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:We.map((ie,Se)=>{const fe=ie.preview??`data:${ie.mimeType};base64,${ie.data}`;return c.jsxs(zo,{children:[c.jsx(Ave,{asChild:!0,children:c.jsxs("button",{type:"button",className:"group block overflow-hidden rounded-lg border border-primary/10 bg-background/65 text-left transition-colors hover:border-primary/25 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","aria-label":`Expand image ${ie.name}`,children:[c.jsxs("span",{className:"relative block",children:[c.jsx("img",{src:fe,alt:ie.name,className:"max-h-72 w-full object-cover transition-opacity group-hover:opacity-85"}),c.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",children:c.jsx("span",{className:"rounded-full bg-black/65 px-3 py-1.5 text-xs font-medium text-white",children:"Click to expand"})})]}),c.jsx("span",{className:"block truncate border-t border-border/60 px-2 py-1 text-xs text-muted-foreground",children:ie.name})]})}),c.jsxs(uo,{className:"max-h-[92vh] max-w-[96vw] gap-2 overflow-hidden p-2",showCloseButton:!0,children:[c.jsx(ho,{className:"mr-8 truncate px-1 text-sm font-medium",children:ie.name}),c.jsx("img",{src:fe,alt:ie.name,className:"max-h-[82vh] w-full object-contain"})]})]},`${ie.name}-${Se}`)})}),Fe.length>0&&c.jsx("div",{className:"flex flex-wrap gap-2",children:Fe.map((ie,Se)=>c.jsxs("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground",title:ie.mimeType,children:[c.jsx(ga,{filename:ie.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ie.name})]},`${ie.name}-${Se}`))})]})}),qn()]}):c.jsxs("div",{className:"relative min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:[c.jsx(kT,{"data-message-from":"assistant",className:"min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:c.jsx(n7,{content:s,compact:j,isStreaming:C,preferLlmUi:T,onOpenPath:U})}),Ne,_t]}):zt?c.jsx("div",{className:"flex items-center gap-3 px-1 py-1 text-sm text-muted-foreground",children:c.jsx(eU,{})}):null]})]})}),c.jsx(Ott,{open:$t,onOpenChange:en,contextFlow:ne,responseContent:s,loading:X})]})}const FP=y.memo(nnt,(e,n)=>{const{messageFromEnd:r,messageIndex:i,...s}=e,{messageFromEnd:a,messageIndex:o,...l}=n,u=Object.keys(l);return u.length===Object.keys(s).length&&u.every(d=>Object.is(s[d],l[d]))});FP.displayName="Message";function rnt(e){if(!(e!=null&&e.metadata))return{};try{const n=JSON.parse(e.metadata);return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}}function Sle(e){const n=rnt(e),r=n.repositoryId??n.repoId;return typeof r=="string"&&r.trim()?r.trim():null}function tU(e,n){const r=Sle(e);return r?n.find(i=>i.id===r)??null:null}function int(e,n){return!e||e==="gateway"?!1:!n.has(e)}function nU(e){const n=new Date(e),i=new Date().getTime()-n.getTime();return i<6e4?"just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:n.toLocaleDateString()}function snt({platform:e}){switch(e){case"windows":case"macos":case"linux":return c.jsx($o,{className:"h-2.5 w-2.5"});case"android":case"ios":return c.jsx(i4,{className:"h-2.5 w-2.5"});default:return c.jsx(gi,{className:"h-2.5 w-2.5"})}}function kle({projects:e,personalSessions:n=[],activeProjectId:r,activeSessionId:i,loading:s=!1,hasMoreProjects:a=!1,showFewerProjects:o=!1,onSelectProject:l,onSelectPersonalSession:u,onNewPersonalSession:d,onCreateProject:h,onRemoveProject:f,onChangeDirectory:m,onAssignRepository:x,onShowMore:v,onShowFewer:_,sessionInfo:w,nodes:S=[],repositories:C=[]}){const j=y.useMemo(()=>new Set(S.filter(D=>!D.isGateway).map(D=>D.id)),[S]),[T,E]=y.useState(""),[N,R]=y.useState(!0),[$,G]=y.useState(!0),W=T.trim().toLowerCase(),z=W.length>0||!N,U=W.length>0||!$,I=y.useMemo(()=>W?e.filter(D=>{const M=tU(D,C),L=D.nodeId&&D.nodeId!=="gateway"?S.find(q=>q.id===D.nodeId):null;return[D.title,D.rootPath,M==null?void 0:M.name,L==null?void 0:L.name,...D.sessions.flatMap(q=>[q.name,q.projectPath])].some(q=>q==null?void 0:q.toLowerCase().includes(W))}):e,[S,W,C,e]),O=y.useMemo(()=>W?n.filter(D=>[D.name,D.projectPath].some(M=>M==null?void 0:M.toLowerCase().includes(W))):n,[W,n]);return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex h-[35px] shrink-0 items-center gap-2 px-2.5 border-b",children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md bg-muted/60 px-2 py-1",children:[c.jsx(co,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("input",{type:"search",value:T,onChange:D=>E(D.target.value),placeholder:"Search chats and projects","aria-label":"Search chats and projects",className:"min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground"})]}),c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:h,children:c.jsx(Ls,{className:"h-3.5 w-3.5"})})}),c.jsx(Rr,{side:"right",children:"New project"})]})]}),s?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Lt,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex max-h-[50%] min-h-0 shrink-0 flex-col border-b",children:[c.jsxs("button",{type:"button",className:"flex h-8 shrink-0 items-center justify-between px-3 text-left transition-colors hover:bg-muted/30",onClick:()=>R(D=>!D),"aria-expanded":z,children:[c.jsx("span",{className:"text-2xs font-medium text-muted-foreground",children:"Projects"}),c.jsx(cs,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${z?"rotate-90":""}`})]}),z&&c.jsx(kc,{className:"min-h-0 flex-1",children:c.jsxs("div",{className:"space-y-0.5 px-1.5 pb-1.5",children:[e.length===0&&c.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No projects yet.",c.jsx("br",{}),c.jsx("button",{onClick:h,className:"underline underline-offset-2 hover:text-foreground mt-1 inline-block",children:"Choose project folder"})]}),e.length>0&&I.length===0&&c.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No matching projects."}),I.map(D=>{const M=D.id===r,L=D.nodeId&&D.nodeId!=="gateway"?S.find(H=>H.id===D.nodeId):null,B=int(D.nodeId,j),q=tU(D,C);return c.jsxs("div",{className:`group grid w-full grid-cols-[auto,minmax(0,1fr),auto] items-start gap-1.5 px-1.5 py-1.5 text-sm transition-colors ${B||M?"cursor-default":"cursor-pointer"} ${M?"rounded-md bg-secondary/70":B?"opacity-50":"hover:rounded-md hover:bg-muted/40"}`,draggable:!!D.rootPath,onDragStart:H=>{if(!D.rootPath){H.preventDefault();return}H.dataTransfer.effectAllowed="copy",H.dataTransfer.setData(ete,JSON.stringify(y$e(D.rootPath,D.title||void 0)))},onClick:()=>{!B&&!M&&l(D.id)},children:[M?c.jsx(Eh,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-primary"}):c.jsx(iM,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsxs("div",{className:"min-w-0 overflow-hidden",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[c.jsx("span",{className:"min-w-0 truncate text-xs font-medium",children:D.title||"Untitled Project"}),q&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"shrink-0 text-2xs text-muted-foreground",children:"·"}),c.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-2xs text-muted-foreground",children:[c.jsx(Vf,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:q.name})]})]})]}),c.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden text-2xs text-muted-foreground",children:[c.jsx("span",{className:"min-w-0 truncate",children:D.rootPath||"No folder linked"}),c.jsx("span",{className:"shrink-0",children:"·"}),c.jsx("span",{className:"shrink-0",children:nU(D.lastActiveAt)})]}),B&&c.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-2xs text-orange-500",children:[c.jsx(vve,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:"Node offline"})]}),L&&!B&&c.jsx("div",{className:"mt-0.5 flex min-w-0 items-center gap-1 text-2xs",children:c.jsxs("span",{className:"inline-flex max-w-full items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-muted-foreground",children:[c.jsx(snt,{platform:L.platform}),c.jsx("span",{className:"truncate max-w-[80px]",children:L.name})]})}),M&&w&&c.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1 text-2xs text-blue-500",children:[c.jsx("span",{className:"truncate",children:w.provider}),c.jsx("span",{className:"shrink-0 text-muted-foreground",children:"·"}),c.jsx($o,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:w.isRemote&&w.remoteNode?w.remoteNode.nodeName:"Gateway"})]})]}),c.jsx("div",{className:"flex shrink-0 self-start",children:c.jsxs(Mc,{children:[c.jsx(Pc,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"icon","aria-label":"Project actions",className:"h-5.5 w-5.5 shrink-0 text-muted-foreground transition-opacity hover:text-foreground data-[state=open]:opacity-100 sm:opacity-0 sm:group-hover:opacity-100",onClick:H=>H.stopPropagation(),children:c.jsx(F_,{className:"h-3 w-3"})})}),c.jsxs(Kl,{align:"end",side:"right",className:"min-w-[10rem]",children:[x&&c.jsxs($i,{disabled:!D.rootPath,className:`gap-2 ${q?"text-primary focus:text-primary":""}`,onSelect:H=>{H.preventDefault(),x(D.id)},children:[c.jsx(Vf,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:q?`Repository: ${q.name}`:"Assign repository"})]}),c.jsxs($i,{className:"gap-2",onSelect:H=>{H.preventDefault(),m(D.id)},children:[c.jsx(dxe,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Change directory"})]}),c.jsxs($i,{className:"gap-2 text-destructive focus:text-destructive",onSelect:H=>{H.preventDefault(),f(D.id)},children:[c.jsx(eM,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Archive project"})]})]})]})})]},D.id)}),!W&&a&&v&&c.jsx("button",{className:"w-full px-2 py-2 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:v,children:"Show more projects"}),!W&&o&&_&&c.jsx("button",{className:"w-full px-2 py-2 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:_,children:"Show fewer projects"})]})})]}),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[c.jsxs("div",{className:"flex h-8 shrink-0 items-center justify-between px-3",children:[c.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center justify-between text-left transition-colors hover:text-foreground",onClick:()=>G(D=>!D),"aria-expanded":U,children:[c.jsx("span",{className:"text-2xs font-medium text-muted-foreground",children:"Personal chats"}),c.jsx(cs,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform ${U?"rotate-90":""}`})]}),d&&c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"icon",className:"ml-1 h-5 w-5",onClick:d,children:c.jsx(Ls,{className:"h-3 w-3"})})}),c.jsx(Rr,{side:"right",children:"New personal chat"})]})]}),U&&c.jsx(kc,{className:"min-h-0 flex-1",children:c.jsxs("div",{className:"space-y-0.5 px-1.5 pb-1.5",children:[n.length===0&&c.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No personal chats yet.",d&&c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("button",{onClick:d,className:"underline underline-offset-2 hover:text-foreground mt-1 inline-block",children:"Start a chat"})]})]}),n.length>0&&O.length===0&&c.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No matching personal chats."}),O.map(D=>{const M=r===null&&D.id===i;return c.jsxs("div",{className:`group flex items-center gap-1.5 rounded-md px-1.5 py-1 transition-colors text-sm ${M?"bg-secondary/70 cursor-default":"cursor-pointer hover:bg-muted/40"}`,onClick:()=>{!M&&u&&u(D.id)},children:[c.jsx(Ah,{className:`h-3.5 w-3.5 shrink-0 ${M?"text-primary":"text-muted-foreground"}`}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate text-xs font-medium",children:D.name||"Personal chat"}),c.jsx("div",{className:"text-2xs text-muted-foreground",children:nU(D.lastActiveAt??D.createdAt)})]})]},D.id)})]})})]})]})]})}function ant(e){const n=new Date(e),i=new Date().getTime()-n.getTime();return i<6e4?"just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:n.toLocaleDateString()}function ont({sessions:e,activeSessionId:n,projectTitle:r,onSelectSession:i,onNewSession:s,onOpenChange:a,showTitle:o=!0,triggerLabel:l=null}){const[u,d]=y.useState(!1),h=e.find(m=>m.id===n)??e[0]??null,f=m=>{d(m),a==null||a(m)};return c.jsxs("div",{className:o?"flex min-w-0 flex-1 items-center justify-between gap-1.5":"flex items-center gap-1.5",children:[o?c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold leading-tight",children:h!=null&&h.name&&h.name!=="New Chat"?h.name:""}):null,c.jsxs(Mc,{open:u,onOpenChange:f,children:[c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsx(Pc,{asChild:!0,children:c.jsxs(ye,{variant:"ghost",size:l?"sm":"icon",className:l?"h-7 shrink-0 rounded-md px-2 text-xs text-muted-foreground hover:text-foreground":"h-6 w-6 shrink-0 rounded-md text-muted-foreground hover:text-foreground",children:[c.jsx(e5,{className:"h-3.5 w-3.5"}),l?c.jsx("span",{children:l}):null]})})}),c.jsx(Rr,{side:"bottom",children:l??"Sessions"})]}),c.jsxs(Kl,{align:"start",className:"w-[min(28rem,calc(100vw-1rem))] p-0",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-medium",children:"Sessions"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:r||"Current project"})]}),c.jsxs(ye,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{s(),d(!1)},children:[c.jsx(n1e,{className:"mr-1 h-3 w-3"}),"New chat"]})]}),c.jsx("div",{className:"max-h-[min(28rem,70vh)] overflow-y-auto p-2",children:e.length===0?c.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No sessions yet."}):c.jsx("div",{className:"space-y-0.5",children:e.map(m=>{const x=m.id===n;return c.jsxs("button",{type:"button",className:`flex w-full items-start gap-2 rounded-md px-3 py-2 text-left transition-colors ${x?"bg-secondary text-secondary-foreground":"hover:bg-muted/50"}`,onClick:()=>{i(m.id),d(!1)},children:[x?c.jsx(Ii,{className:"mt-0.5 h-3 w-3 shrink-0 text-primary"}):c.jsx("span",{className:"mt-1 h-2 w-2 shrink-0 rounded-full bg-muted-foreground/50"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"truncate text-xs font-medium",children:m.name||"Untitled"}),m.status==="archived"&&c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-1.5 py-0 text-2xs text-muted-foreground",children:[c.jsx(eM,{className:"h-2.5 w-2.5"}),"Archived"]})]}),c.jsx("div",{className:"text-2xs text-muted-foreground",children:ant(m.lastActiveAt)})]})]},m.id)})})})]})]})]})}function lnt({suggestions:e,onSelect:n,className:r}){return c.jsx("div",{className:je("flex flex-wrap gap-2 justify-center",r),children:e.map(i=>c.jsx("button",{onClick:()=>n(i),className:"px-4 py-2 text-sm rounded-full border bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:i},i))})}const cnt=Xj("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium leading-4 transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500/15 text-green-700 dark:text-green-400",warning:"border-transparent bg-yellow-500/15 text-yellow-700 dark:text-yellow-400"}},defaultVariants:{variant:"default"}});function Wn({className:e,variant:n,...r}){return c.jsx("div",{className:je(cnt({variant:n}),e),...r})}const Xn=y.forwardRef(({className:e,...n},r)=>c.jsx("div",{ref:r,className:je("rounded-xl border border-border/70 bg-card text-card-foreground shadow-sm",e),...n}));Xn.displayName="Card";const Cle=y.forwardRef(({className:e,...n},r)=>c.jsx("div",{ref:r,className:je("flex flex-col space-y-1.5 p-6",e),...n}));Cle.displayName="CardHeader";const jle=y.forwardRef(({className:e,...n},r)=>c.jsx("h3",{ref:r,className:je("font-semibold leading-none tracking-tight",e),...n}));jle.displayName="CardTitle";const unt=y.forwardRef(({className:e,...n},r)=>c.jsx("p",{ref:r,className:je("text-sm text-muted-foreground",e),...n}));unt.displayName="CardDescription";const vc=y.forwardRef(({className:e,...n},r)=>c.jsx("div",{ref:r,className:je("p-6 pt-0",e),...n}));vc.displayName="CardContent";const dnt=y.forwardRef(({className:e,...n},r)=>c.jsx("div",{ref:r,className:je("flex items-center p-6 pt-0",e),...n}));dnt.displayName="CardFooter";const hnt={pending:{icon:Gm,label:"Pending",color:"text-muted-foreground"},approved:{icon:Lt,label:"Running",color:"text-blue-500"},rejected:{icon:Ur,label:"Rejected",color:"text-destructive"},executed:{icon:Ns,label:"Done",color:"text-green-500"},failed:{icon:Bs,label:"Failed",color:"text-destructive"}};function fnt({action:e,expanded:n,onToggle:r}){const i=hnt[e.status],s=i.icon;return c.jsxs("div",{className:"border rounded-md",children:[c.jsxs("button",{type:"button",className:"flex items-center gap-3 w-full px-3 py-2.5 text-left hover:bg-muted/50 transition-colors",onClick:r,children:[c.jsx(s,{className:je("h-4 w-4 shrink-0",i.color,e.status==="approved"&&"animate-spin")}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"font-mono text-sm font-medium",children:e.tool}),c.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["Step ",e.order+1]})]}),c.jsx(Wn,{variant:"outline",className:"text-2xs px-1.5 py-0",children:i.label}),n?c.jsx(fl,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(cs,{className:"h-4 w-4 text-muted-foreground"})]}),n&&c.jsxs("div",{className:"px-3 pb-3 pt-1 border-t bg-muted/30",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),c.jsx("pre",{className:"text-xs bg-background rounded p-2 overflow-x-auto max-h-48",children:JSON.stringify(e.args,null,2)}),e.result&&c.jsx("div",{className:je("mt-2 text-xs rounded p-2",e.result.ok?"bg-green-500/10 text-green-700 dark:text-green-400":"bg-destructive/10 text-destructive"),children:e.result.message})]})]})}function pnt({plan:e,onApprove:n,onReject:r,isExecuting:i,className:s}){const[a,o]=y.useState(new Set),l=Array.isArray(e==null?void 0:e.actions)?e.actions:[],u=x=>{o(v=>{const _=new Set(v);return _.has(x)?_.delete(x):_.add(x),_})},d=l.filter(x=>x.status==="pending").length,h=l.filter(x=>x.status==="executed").length,f=l.filter(x=>x.status==="failed").length,m=d===0;return c.jsxs(Xn,{className:je("p-4 space-y-3",s),children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(mnt,{className:"h-4 w-4"}),"Plan",c.jsxs(Wn,{variant:"secondary",className:"text-2xs px-1.5 py-0",children:[l.length," step",l.length!==1?"s":""]})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.summary})]}),m&&c.jsx(Wn,{variant:f>0?"destructive":"success",className:"shrink-0",children:f>0?`${f} failed`:"Complete"})]}),c.jsx("div",{className:"space-y-1.5",children:l.map(x=>c.jsx(fnt,{action:x,expanded:a.has(x.id),onToggle:()=>u(x.id)},x.id))}),d>0&&c.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[c.jsx(ye,{size:"sm",onClick:()=>n(),disabled:i,children:i?c.jsxs(c.Fragment,{children:[c.jsx(Lt,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Executing..."]}):c.jsxs(c.Fragment,{children:[c.jsx(eS,{className:"h-3.5 w-3.5 mr-1.5"}),"Execute all (",d,")"]})}),c.jsxs(ye,{size:"sm",variant:"outline",onClick:r,disabled:i,children:[c.jsx(Ur,{className:"h-3.5 w-3.5 mr-1.5"}),"Reject"]})]}),m&&!i&&c.jsxs("p",{className:"text-xs text-muted-foreground",children:[h>0&&`${h} action${h!==1?"s":""} executed.`,f>0&&` ${f} failed.`]})]})}function mnt({className:e}){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[c.jsx("rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}),c.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),c.jsx("path",{d:"M12 11h4"}),c.jsx("path",{d:"M12 16h4"}),c.jsx("path",{d:"M8 11h.01"}),c.jsx("path",{d:"M8 16h.01"})]})}function gnt(e){return e.find(n=>n.status==="in-progress")??null}function Nle(e){return e.length>0&&e.every(n=>n.status==="completed")}function ynt(e){const n=gnt(e),r=Nle(e);return{headerLabel:n?n.title:r?"All tasks completed":"Tasks",showHeaderSpinner:!!n,showHeaderCompleted:!n&&r}}function r7({items:e,className:n,onClear:r}){const i=Array.isArray(e)?e:[],[s,a]=y.useState(!1),o=y.useMemo(()=>Nle(i),[i]),l=y.useMemo(()=>ynt(i),[i]);if(i.length===0)return null;const u=i.filter(x=>x.status==="completed").length,d=i.length,h=d>0?Math.round(u/d*100):0,f=s?"Tasks":l.headerLabel,m=o?"bg-green-500":"bg-primary";return c.jsxs("div",{className:je("rounded-lg border bg-muted/30 p-3 space-y-2",n),children:[c.jsxs("button",{type:"button",onClick:()=>a(x=>!x),className:"flex items-center gap-2 w-full text-left",children:[c.jsx(fl,{className:je("h-3 w-3 shrink-0 text-muted-foreground transition-transform duration-200",!s&&"-rotate-90")}),!s&&l.showHeaderSpinner&&c.jsx(Lt,{className:"h-3.5 w-3.5 shrink-0 text-primary animate-spin"}),!s&&l.showHeaderCompleted&&c.jsx(Ns,{className:"h-3.5 w-3.5 shrink-0 text-green-500"}),c.jsx("span",{className:"min-w-0 truncate text-xs font-medium text-foreground",children:f}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:je("h-full rounded-full transition-all duration-300",m),style:{width:`${h}%`}})}),c.jsxs("span",{className:"text-2xs text-muted-foreground tabular-nums",children:[u,"/",d]}),r&&c.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),r()},className:"shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Clear todo list",children:c.jsx(Ur,{className:"h-3 w-3"})})]}),s&&c.jsx("div",{className:"space-y-1",children:i.map(x=>c.jsxs("div",{className:je("flex items-start gap-2 text-xs py-0.5",x.status==="completed"&&"text-muted-foreground"),children:[x.status==="completed"?c.jsx(Ns,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-green-500"}):x.status==="in-progress"?c.jsx(Lt,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary animate-spin"}):c.jsx(rM,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-muted-foreground/50"}),c.jsx("span",{className:je("flex-1 min-w-0",x.status==="completed"&&"line-through"),children:x.title})]},x.id))})]})}function xnt({files:e,onAccept:n,onReject:r,onAcceptAll:i,onRejectAll:s,onFileClick:a,className:o}){const l=y.useRef(null),[u,d]=y.useState(!1),[h,f]=y.useState(!1);if(y.useEffect(()=>{const C=l.current;if(!C||typeof ResizeObserver>"u")return;const j=()=>{d(C.clientWidth<560)};j();const T=new ResizeObserver(()=>j());return T.observe(C),()=>T.disconnect()},[]),e.length===0)return null;const m=e.filter(C=>C.state==="undecided").length,x=e.reduce((C,j)=>C+(j.insertions??0),0),v=e.reduce((C,j)=>C+(j.deletions??0),0),_=e.some(C=>C.insertions!==void 0||C.deletions!==void 0),w=_?null:`${e.length} ${e.length===1?"file":"files"}`,S=({insertions:C,deletions:j})=>c.jsxs("span",{className:"shrink-0 whitespace-nowrap text-2xs tabular-nums",children:[c.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["+",C]}),c.jsxs("span",{className:"ml-1 text-red-600 dark:text-red-400",children:["-",j]})]});return c.jsxs("div",{ref:l,className:je("overflow-hidden rounded-lg border bg-muted/30",o),children:[c.jsxs("div",{className:je("flex items-center justify-between gap-2 bg-muted/20 px-3 py-2",h&&"border-b"),children:[c.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-1.5 text-left",onClick:()=>f(C=>!C),"aria-expanded":h,children:[c.jsx(cs,{className:je("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",h&&"rotate-90")}),c.jsx(mh,{className:"h-3.5 w-3.5 text-muted-foreground"}),c.jsx("span",{className:"truncate text-xs font-medium",children:"Files changed"}),_&&c.jsx(S,{insertions:x,deletions:v}),w&&c.jsx("span",{className:"shrink-0 whitespace-nowrap text-2xs tabular-nums text-muted-foreground",children:w}),h&&m>0&&c.jsxs("span",{className:"shrink-0 text-2xs text-amber-500 dark:text-amber-400",children:[m," pending"]})]}),m>0&&c.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[c.jsxs(ye,{size:u?"icon":"sm",variant:"ghost",className:je("h-6 shrink-0 text-xs",u?"w-6 p-0":"px-2"),onClick:i,title:"Keep all","aria-label":"Keep all",children:[c.jsx(Ii,{className:je("h-3 w-3 shrink-0",!u&&"mr-1")}),!u&&"Keep all"]}),c.jsxs(ye,{size:u?"icon":"sm",variant:"ghost",className:je("h-6 shrink-0 text-xs",u?"w-6 p-0":"px-2"),onClick:s,title:"Undo all","aria-label":"Undo all",children:[c.jsx(gu,{className:je("h-3 w-3 shrink-0",!u&&"mr-1")}),!u&&"Undo all"]})]})]}),h&&c.jsx("div",{className:"divide-y",children:e.map(C=>c.jsxs("div",{className:je("flex items-center gap-2 px-3 py-1.5 text-xs",C.state==="accepted"&&"bg-green-500/5",C.state==="rejected"&&"bg-red-500/5 text-muted-foreground"),children:[c.jsx(ga,{filename:C.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("button",{type:"button",className:je("min-w-0 flex-1 truncate text-left hover:underline cursor-pointer",C.state==="rejected"&&"line-through"),title:`Review diff for ${C.path}`,onClick:()=>a==null?void 0:a(C.path),children:C.path}),_&&c.jsx(S,{insertions:C.insertions??0,deletions:C.deletions??0}),C.state==="undecided"&&c.jsxs("div",{className:"ml-auto flex items-center gap-0.5 shrink-0",children:[c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-primary/10 text-primary transition-colors",onClick:()=>a==null?void 0:a(C.path),title:"Review changes",children:c.jsx(ep,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-green-500/20 text-green-600 dark:text-green-400 transition-colors",onClick:()=>n==null?void 0:n(C.path),title:"Keep all changes",children:c.jsx(Ii,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-red-500/20 text-red-600 dark:text-red-400 transition-colors",onClick:()=>r==null?void 0:r(C.path),title:"Undo all changes",children:c.jsx(gu,{className:"h-3 w-3"})})]}),C.state==="accepted"&&c.jsx("span",{className:"text-2xs text-green-600 dark:text-green-400 shrink-0",children:"Kept"}),C.state==="rejected"&&c.jsx("span",{className:"text-2xs text-red-500 shrink-0",children:"Undone"})]},C.path))})]})}function vnt(e,n,r,i){const s=e.findIndex(u=>u.id===n);if(s<0)return e;const a=[...e],[o]=a.splice(s,1);if(!o)return e;if(r==null)return a.push(o),a;const l=a.findIndex(u=>u.id===r);return l<0?e:(a.splice(l+(i==="after"?1:0),0,o),a)}function bnt({item:e,index:n}){return c.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border/40 bg-background px-3 py-2 text-sm shadow-2xl ring-1 ring-primary/10",children:[c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground",children:n===0?c.jsx(sM,{className:"h-3.5 w-3.5 text-primary"}):c.jsx(cs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground",children:c.jsx(n4,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[n===0?c.jsx("span",{className:"mb-0.5 block text-2xs font-medium uppercase tracking-wider text-primary/70",children:"Next"}):c.jsxs("span",{className:"mb-0.5 block text-2xs font-medium uppercase tracking-wider text-muted-foreground",children:["Queued #",n+1]}),c.jsx("span",{className:"whitespace-pre-wrap break-words text-foreground",children:e.displayContent??e.content})]})]})}function _nt({item:e,index:n,onRemove:r,onEdit:i,onReorder:s,onSteer:a,onSendToParallelThread:o,dragActive:l,dropBefore:u,dropAfter:d,onDragStart:h}){const[f,m]=y.useState(!1),[x,v]=y.useState(!0),[_,w]=y.useState(e.displayContent??e.content),S=y.useRef(null),C=f||!l;y.useEffect(()=>{if(f){const N=S.current;N&&(N.focus(),N.setSelectionRange(N.value.length,N.value.length))}},[f]),y.useEffect(()=>{f||w(e.displayContent??e.content)},[e.content,e.displayContent,f]);const j=y.useCallback(()=>{const N=_.trim(),R=e.displayContent??e.content;N&&N!==R&&(i==null||i(e.id,N)),m(!1)},[_,e.content,e.displayContent,e.id,i]),T=y.useCallback(()=>{w(e.displayContent??e.content),m(!1)},[e.content,e.displayContent]),E=y.useCallback(N=>{N.key==="Enter"&&!N.shiftKey?(N.preventDefault(),j()):N.key==="Escape"&&T()},[j,T]);return c.jsxs(c.Fragment,{children:[u&&c.jsx("div",{className:"relative h-0",children:c.jsx("div",{className:"absolute inset-x-2 -top-px h-0.5 rounded-full bg-primary shadow-[0_0_0_1px_hsl(var(--background))]"})}),c.jsxs("div",{"data-queue-id":e.id,className:je("group flex cursor-grab touch-none items-start gap-2 rounded-lg border border-border/40 bg-muted/50 px-3 py-2 text-sm transition-all duration-150 ease-out hover:bg-muted/70 active:cursor-grabbing",l&&"border-dashed border-primary/35 bg-primary/5 opacity-0"),onPointerDown:N=>{f||!s||N.target.closest('button, textarea, input, a, [data-no-drag="true"]')||h==null||h(e.id,N)},children:[c.jsx("button",{type:"button","data-no-drag":"true",className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground hover:bg-foreground/10 hover:text-foreground transition-colors",onClick:()=>v(N=>!N),"aria-label":x?"Expand queued message":"Collapse queued message",title:x?"Expand queued message":"Collapse queued message",children:x?c.jsx(cs,{className:"h-3.5 w-3.5"}):n===0?c.jsx(sM,{className:"h-3.5 w-3.5 text-primary"}):c.jsx(fl,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s&&!f&&c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground cursor-grab active:cursor-grabbing touch-none",title:"Drag to reorder","aria-label":"Drag to reorder",children:c.jsx(n4,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[n===0&&!f&&c.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-primary/70 block mb-0.5",children:"Next"}),n>0&&!f&&c.jsxs("span",{className:"text-2xs font-medium uppercase tracking-wider text-muted-foreground block mb-0.5",children:["Queued #",n+1]}),f?c.jsx("textarea",{ref:S,value:_,onChange:N=>w(N.target.value),onKeyDown:E,onBlur:j,rows:Math.min(_.split(`
1250
+ `).trim()},Ze=async()=>{var fe,$e,Ft;const ie=rt();if(!ie)return;const Se=M?XQ(Q):null;try{if(Se&&typeof ClipboardItem<"u"&&((fe=navigator.clipboard)!=null&&fe.write))try{await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([ie],{type:"text/plain"}),[k5]:new Blob([Se],{type:k5})})])}catch{if(!(($e=navigator.clipboard)!=null&&$e.writeText))throw new Error("Clipboard text API unavailable");await navigator.clipboard.writeText(ie)}else if((Ft=navigator.clipboard)!=null&&Ft.writeText)await navigator.clipboard.writeText(ie);else throw new Error("Clipboard API unavailable")}catch{const He=document.createElement("textarea");He.value=ie,He.style.position="fixed",He.style.opacity="0",document.body.appendChild(He),He.focus(),He.select(),document.execCommand("copy"),document.body.removeChild(He)}ge(!0),et.current!==null&&window.clearTimeout(et.current),et.current=window.setTimeout(()=>ge(!1),1200)},Ye=K0(),ut=M&&!!e&&!!W,xt=ut,zt=C&&!v&&!(typeof s=="string"?s:"").trim(),rn=rt().length>0,sn=(M||!C)&&rn,dt=!M&&!!e&&!!D&&!C,Tt=(Gt==null?void 0:Gt.status)==="saving",Oe=y.useCallback(()=>{!ut||ot||(xe(re),ze(Q),_e(!0))},[ut,ot,Q,re]),pt=y.useCallback(()=>{xe(re),ze(Q),_e(!1)},[Q,re]),Ot=()=>{var Se;!ut||ve||typeof window<"u"&&(Se=window.getSelection())!=null&&Se.toString().trim()||Oe()},Pt=y.useCallback(async(ie,Se)=>{if(!ut||!e||!W||ot)return;const fe=uAe(ie??_n,Se??pe,Q);if(fe){Je(fe.text),yt(fe.displaySegments),_e(!1),Nt(!0);try{await W(e,fe.text,n,r,{referencedFiles:fe.referencedFiles,displaySegments:fe.displaySegments})}catch($e){throw Je(null),yt(null),_e(!0),$e}finally{Nt(!1)}}},[ut,_n,pe,ot,e,r,n,W]),hn=async(ie,Se)=>{if(!ut||!e||!W)return;const fe=ie.trim();fe&&await W(e,fe,n,r,{referencedFiles:(Se??Q).filter($e=>$e.type==="file").map($e=>({path:$e.path,name:$e.name})),displaySegments:Se??Q})},un=async()=>{if(xt){oe(!0);try{await hn(re,Q)}finally{oe(!1)}}},dn=async ie=>{if(!(!dt||!e||Tt)&&await L({title:"Memorize this?",description:"This saves a memory feedback item with this assistant message as context. Future agents can use it when reviewing or updating memory for this chat and project.",confirmLabel:"Memorize",cancelLabel:"Cancel"})){Et({kind:ie,status:"saving"});try{await(D==null?void 0:D({messageId:e,kind:ie,content:s})),Et({kind:ie,status:"saved"}),Be.current!==null&&window.clearTimeout(Be.current),Be.current=window.setTimeout(()=>Et(null),1200)}catch{Et(null)}}},pn=(ie,Se)=>(Gt==null?void 0:Gt.kind)!==ie?Se:Gt.status==="saving"?c.jsx(Lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Ii,{className:"h-3.5 w-3.5"}),Bt=[...ut?[{key:"edit",label:"Edit message",icon:c.jsx(H_,{className:"h-3.5 w-3.5"}),onClick:()=>Oe()}]:[],...xt?[{key:"retry",label:"Retry from this message",icon:c.jsx(IY,{className:je("h-3.5 w-3.5",se&&"animate-spin")}),onClick:()=>{un()},disabled:se}]:[],...!M&&(ne||J)?[{key:"context",label:"View LLM context",icon:X?c.jsx(Lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Nm,{className:"h-3.5 w-3.5"}),onClick:()=>{ne||te(),en(!0)}}]:[],...dt?[{key:"memory",label:Ftt("should_have_remembered"),icon:pn("should_have_remembered",c.jsx(oo,{className:"h-3.5 w-3.5"})),onClick:()=>{dn("should_have_remembered")},disabled:Tt}]:[],{key:"copy",label:ue?"Copied":"Copy message",icon:ue?c.jsx(Ii,{className:"h-3.5 w-3.5"}):c.jsx(nl,{className:"h-3.5 w-3.5"}),onClick:()=>{Ze()}}],qn=ie=>ve||!sn||Bt.length===0?null:Ye?c.jsx("div",{className:je("absolute z-10","right-0.5 bottom-0.5"),children:c.jsxs(Mc,{children:[c.jsx(Pc,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":"Message actions",className:"flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:c.jsx(F_,{className:"h-4 w-4"})})}),c.jsx(Kl,{align:"end",side:"top",className:"min-w-[10rem]",children:Bt.map(Se=>c.jsxs($i,{disabled:Se.disabled,onSelect:fe=>{fe.preventDefault(),Se.onClick()},className:"gap-2",children:[Se.icon,c.jsx("span",{children:Se.label})]},Se.key))})]})}):c.jsx("div",{className:je("absolute z-10 rounded-md border border-border/60 bg-background/95 p-0.5 shadow-sm","right-1 bottom-[.25rem]","opacity-0 transition-opacity group-hover/message:opacity-100 focus-within:opacity-100",ue&&"opacity-100"),children:c.jsx(j6e,{children:Bt.map(Se=>c.jsx(N6e,{onClick:fe=>{fe.preventDefault(),fe.stopPropagation(),Se.onClick()},disabled:Se.disabled,"aria-label":Se.label,tooltip:Se.label,className:"h-5 w-5 rounded-md p-0 [&_svg]:h-3 [&_svg]:w-3",children:Se.icon},Se.key))})}),Ne=M?null:qn(),gt=!M&&(B==null?void 0:B.some(ie=>ie.type==="thinking"&&ie.content.trim())),Dt=M?[]:Btt(ne),_t=!M&&(Dt.length>0||l&&!ne)?c.jsxs("div",{className:"not-prose mt-2 flex min-w-0 flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsxs("button",{type:"button",className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2 py-1 font-medium text-amber-700 transition-colors hover:bg-amber-500/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 dark:text-amber-200",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),!ne&&l&&te(),Vt(Se=>!Se)},"aria-expanded":on,title:on?"Hide injected memories":"Show memories injected for this answer",children:[c.jsx(oo,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{children:"Memory"}),Dt.length>0?c.jsx("span",{className:"rounded bg-background/75 px-1 text-2xs",children:Dt.length}):X?c.jsx(Lt,{className:"h-3 w-3 animate-spin"}):c.jsx("span",{className:"rounded bg-background/75 px-1 text-2xs",children:"•"})]}),on&&Dt.slice(0,3).map(ie=>{const Se={memoryId:ie.id,sourceType:ie.sourceType,sourceId:ie.sourceId,sourceSurface:ie.sourceSurface},fe=!!(O&&ie.sourceSurface==="chat"&&ie.sourceId);return c.jsxs("button",{type:"button",className:"inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",onClick:$e=>{$e.preventDefault(),$e.stopPropagation(),fe?O==null||O(Se):en(!0)},title:fe?`Open source chat for injected memory: ${ie.source||ie.id}`:`View injected memory source: ${ie.source||ie.id}`,children:[fe?c.jsx(Ah,{className:"h-3.5 w-3.5 shrink-0"}):c.jsx(oo,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:ie.source||ie.id})]},ie.id)})]}):null;return c.jsxs(c.Fragment,{children:[c.jsx(C6e,{from:i,className:je(j?"py-2":"py-4"),children:c.jsxs("div",{className:je("min-w-0 max-w-[85%] space-y-2",M&&"order-1"),children:[!M&&v&&!gt&&c.jsx(QB,{content:v,isStreaming:!!C&&!s,duration:_}),!M&&B&&B.length>0?c.jsxs("div",{className:"relative min-w-0 max-w-full select-text break-words [overflow-wrap:anywhere]",children:[B.map((ie,Se)=>{if(ie.type==="toolGroup"){const fe=Array.isArray(ie.callIds)?ie.callIds:[],$e=(q??[]).filter(He=>fe.includes(He.callId)),Ft=B.slice(Se+1).some(He=>He.type==="text"&&typeof He.content=="string"&&He.content.trim());return $e.length>0?ZW(E,$e)?c.jsx(e7,{provider:E,calls:$e,isStreaming:!!C&&Se===B.length-1,threadControlThreads:N,onOpenTerminal:R,onOpenDiff:I,renderInlineSecretPrompt:$,onApprovalResponse:G},`tg-${Se}`):c.jsx(QO,{calls:$e,collapsible:Ft,threadControlThreads:N,onOpenTerminal:R,onOpenDiff:I,renderInlineSecretPrompt:$,onApprovalResponse:G},`tg-${Se}`):null}return ie.type==="thinking"?ie.content.trim()?c.jsx(QB,{content:ie.content,isStreaming:!!C&&Se===B.length-1,duration:_},`th-${Se}`):null:ie.type==="error"?c.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 py-2.5 text-sm text-red-600 dark:text-red-400",children:[c.jsx(Fx,{className:"mt-0.5 h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:ie.content})]},`err-${Se}`):typeof ie.content=="string"&&ie.content.trim()?c.jsx(kT,{"data-message-from":"assistant",className:"max-w-full bg-card/78",children:c.jsx(n7,{content:ie.content,compact:j,isStreaming:!!C&&Se===B.length-1,preferLlmUi:T,onOpenPath:U})},`ts-${Se}`):null}),C&&!s&&!B.some(ie=>ie.type==="text"&&typeof ie.content=="string"&&ie.content.trim())&&c.jsx("div",{className:"flex items-center gap-3 px-1 py-1 text-sm text-muted-foreground",children:c.jsx(eU,{})}),Ne,_t]}):c.jsxs(c.Fragment,{children:[q&&q.length>0&&(ZW(E,q)?c.jsx(e7,{provider:E,calls:q,isStreaming:C,threadControlThreads:N,onOpenTerminal:R,onOpenDiff:I,renderInlineSecretPrompt:$,onApprovalResponse:G}):c.jsx(QO,{calls:q,collapsible:E!=="jait",threadControlThreads:N,onOpenTerminal:R,onOpenDiff:I,renderInlineSecretPrompt:$,onApprovalResponse:G})),lt||s?M?ve?c.jsx("div",{className:qtt(),onClick:ie=>ie.stopPropagation(),children:c.jsx("div",{className:Gtt(Ae),children:c.jsx(Jw,{ref:we,draftStateKey:`edit:${e??"user-message"}`,value:_n,segments:pe,onChange:ie=>{var Se;xe(ie),ze(((Se=we.current)==null?void 0:Se.getSegments())??[])},onSubmit:(ie,Se,fe)=>{const $e=fe??[],Ft=w0($e)||_n;ze($e),Pt(Ft,$e)},disabled:ot,controlsDisabled:ot,placeholder:"Edit message...",onVoiceInput:z==null?void 0:z.onVoiceInput,voiceRecording:z==null?void 0:z.voiceRecording,voiceLevels:z==null?void 0:z.voiceLevels,voiceTranscribing:z==null?void 0:z.voiceTranscribing,onVoiceStop:z==null?void 0:z.onVoiceStop,mode:z==null?void 0:z.mode,onModeChange:z==null?void 0:z.onModeChange,provider:z==null?void 0:z.provider,onProviderChange:z==null?void 0:z.onProviderChange,responseStyle:z==null?void 0:z.responseStyle,onResponseStyleChange:z==null?void 0:z.onResponseStyleChange,providerRuntimeMode:z==null?void 0:z.providerRuntimeMode,onProviderRuntimeModeChange:z==null?void 0:z.onProviderRuntimeModeChange,cliModel:z==null?void 0:z.cliModel,onCliModelChange:z==null?void 0:z.onCliModelChange,sessionInfo:z==null?void 0:z.sessionInfo,projectNodeId:z==null?void 0:z.projectNodeId,availableFiles:(z==null?void 0:z.availableFiles)??S0(Q),onSearchFiles:z==null?void 0:z.onSearchFiles,projectOpen:(z==null?void 0:z.projectOpen)??S0(Q).length>0,footerTrailingContent:c.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-lg",onClick:pt,disabled:ot,"aria-label":"Cancel editing message",title:"Cancel editing",children:c.jsx(Ur,{className:"h-3.5 w-3.5"})}),className:"rounded-lg border-primary/20 bg-primary/[0.08] dark:!bg-primary/[0.08] shadow-none [&_.text-muted-foreground]:text-muted-foreground [&>div]:!bg-transparent [&_[contenteditable='true']]:!bg-transparent"},`edit-${e??"user-message"}`)})}):c.jsxs("div",{className:"relative w-fit max-w-full",children:[c.jsx(kT,{ref:ke,"data-message-from":"user",className:je("min-w-0 rounded-lg bg-muted px-4 py-3 break-words [overflow-wrap:anywhere]",ut&&!ve&&"cursor-text transition-colors hover:bg-muted/80","leading-relaxed [font-size:0.9rem]"),onClick:Ot,title:ut&&!ve?"Click to edit message":void 0,children:c.jsxs("div",{className:"min-w-0 space-y-3",children:[c.jsx("div",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:(ht??Q).length>0?(ht??Q).map((ie,Se)=>ie.type==="text"?c.jsx("span",{children:ie.text},`text-${Se}`):ie.type==="file"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ie.path,children:[c.jsx(ga,{filename:ie.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ie.lineRange?`${ie.name}:${nw(ie.lineRange).replace(/^lines? /,"")}`:ie.name})]},`${ie.path}-${Se}`):ie.type==="project"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ie.path,children:[c.jsx(P4,{name:ie.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ie.name})]},`${ie.path}-${Se}`):ie.type==="terminal"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ie.projectRoot?`${ie.terminalId} · ${ie.projectRoot}`:ie.terminalId,children:[c.jsx("span",{className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-sm bg-muted-foreground/15 text-2xs font-bold uppercase text-muted-foreground",children:"T"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ie.lineRange?`${ie.name}:${nw(ie.lineRange).replace(/^lines? /,"")}`:ie.name})]},`${ie.terminalId}-${Se}`):null):ft??re}),We.length>0&&c.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:We.map((ie,Se)=>{const fe=ie.preview??`data:${ie.mimeType};base64,${ie.data}`;return c.jsxs(zo,{children:[c.jsx(Ave,{asChild:!0,children:c.jsxs("button",{type:"button",className:"group block overflow-hidden rounded-lg border border-primary/10 bg-background/65 text-left transition-colors hover:border-primary/25 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","aria-label":`Expand image ${ie.name}`,children:[c.jsxs("span",{className:"relative block",children:[c.jsx("img",{src:fe,alt:ie.name,className:"max-h-72 w-full object-cover transition-opacity group-hover:opacity-85"}),c.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",children:c.jsx("span",{className:"rounded-full bg-black/65 px-3 py-1.5 text-xs font-medium text-white",children:"Click to expand"})})]}),c.jsx("span",{className:"block truncate border-t border-border/60 px-2 py-1 text-xs text-muted-foreground",children:ie.name})]})}),c.jsxs(uo,{className:"max-h-[92vh] max-w-[96vw] gap-2 overflow-hidden p-2",showCloseButton:!0,children:[c.jsx(ho,{className:"mr-8 truncate px-1 text-sm font-medium",children:ie.name}),c.jsx("img",{src:fe,alt:ie.name,className:"max-h-[82vh] w-full object-contain"})]})]},`${ie.name}-${Se}`)})}),Fe.length>0&&c.jsx("div",{className:"flex flex-wrap gap-2",children:Fe.map((ie,Se)=>c.jsxs("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground",title:ie.mimeType,children:[c.jsx(ga,{filename:ie.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ie.name})]},`${ie.name}-${Se}`))})]})}),qn()]}):c.jsxs("div",{className:"relative min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:[c.jsx(kT,{"data-message-from":"assistant",className:"min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:c.jsx(n7,{content:s,compact:j,isStreaming:C,preferLlmUi:T,onOpenPath:U})}),Ne,_t]}):zt?c.jsx("div",{className:"flex items-center gap-3 px-1 py-1 text-sm text-muted-foreground",children:c.jsx(eU,{})}):null]})]})}),c.jsx(Ott,{open:$t,onOpenChange:en,contextFlow:ne,responseContent:s,loading:X})]})}const FP=y.memo(nnt,(e,n)=>{const{messageFromEnd:r,messageIndex:i,...s}=e,{messageFromEnd:a,messageIndex:o,...l}=n,u=Object.keys(l);return u.length===Object.keys(s).length&&u.every(d=>Object.is(s[d],l[d]))});FP.displayName="Message";function rnt(e){if(!(e!=null&&e.metadata))return{};try{const n=JSON.parse(e.metadata);return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}}function Sle(e){const n=rnt(e),r=n.repositoryId??n.repoId;return typeof r=="string"&&r.trim()?r.trim():null}function tU(e,n){const r=Sle(e);return r?n.find(i=>i.id===r)??null:null}function int(e,n){return!e||e==="gateway"?!1:!n.has(e)}function nU(e){const n=new Date(e),i=new Date().getTime()-n.getTime();return i<6e4?"just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:n.toLocaleDateString()}function snt({platform:e}){switch(e){case"windows":case"macos":case"linux":return c.jsx($o,{className:"h-2.5 w-2.5"});case"android":case"ios":return c.jsx(i4,{className:"h-2.5 w-2.5"});default:return c.jsx(gi,{className:"h-2.5 w-2.5"})}}function kle({projects:e,personalSessions:n=[],activeProjectId:r,activeSessionId:i,loading:s=!1,hasMoreProjects:a=!1,showFewerProjects:o=!1,onSelectProject:l,onSelectPersonalSession:u,onNewPersonalSession:d,onCreateProject:h,onRemoveProject:f,onChangeDirectory:m,onAssignRepository:x,onShowMore:v,onShowFewer:_,sessionInfo:w,nodes:S=[],repositories:C=[]}){const j=y.useMemo(()=>new Set(S.filter(D=>!D.isGateway).map(D=>D.id)),[S]),[T,E]=y.useState(""),[N,R]=y.useState(!0),[$,G]=y.useState(!0),W=T.trim().toLowerCase(),z=W.length>0||!N,U=W.length>0||!$,I=y.useMemo(()=>W?e.filter(D=>{const M=tU(D,C),L=D.nodeId&&D.nodeId!=="gateway"?S.find(q=>q.id===D.nodeId):null;return[D.title,D.rootPath,M==null?void 0:M.name,L==null?void 0:L.name,...D.sessions.flatMap(q=>[q.name,q.projectPath])].some(q=>q==null?void 0:q.toLowerCase().includes(W))}):e,[S,W,C,e]),O=y.useMemo(()=>W?n.filter(D=>[D.name,D.projectPath].some(M=>M==null?void 0:M.toLowerCase().includes(W))):n,[W,n]);return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex h-[35px] shrink-0 items-center gap-2 px-2.5 border-b",children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md bg-muted/60 px-2 py-1",children:[c.jsx(co,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("input",{type:"search",value:T,onChange:D=>E(D.target.value),placeholder:"Search chats and projects","aria-label":"Search chats and projects",className:"min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground"})]}),c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-md p-1",onClick:h,children:c.jsx(Ls,{className:"h-3.5 w-3.5"})})}),c.jsx(Rr,{side:"right",children:"New project"})]})]}),s?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Lt,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex max-h-[50%] min-h-0 shrink-0 flex-col border-b",children:[c.jsxs("button",{type:"button",className:"flex h-8 shrink-0 items-center justify-between px-3 text-left transition-colors hover:bg-muted/30",onClick:()=>R(D=>!D),"aria-expanded":z,children:[c.jsx("span",{className:"text-2xs font-medium text-muted-foreground",children:"Projects"}),c.jsx(cs,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${z?"rotate-90":""}`})]}),z&&c.jsx(kc,{className:"min-h-0 flex-1",children:c.jsxs("div",{className:"space-y-0.5 px-1.5 pb-1.5",children:[e.length===0&&c.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No projects yet.",c.jsx("br",{}),c.jsx("button",{onClick:h,className:"underline underline-offset-2 hover:text-foreground mt-1 inline-block",children:"Choose project folder"})]}),e.length>0&&I.length===0&&c.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No matching projects."}),I.map(D=>{const M=D.id===r,L=D.nodeId&&D.nodeId!=="gateway"?S.find(H=>H.id===D.nodeId):null,B=int(D.nodeId,j),q=tU(D,C);return c.jsxs("div",{className:`group grid w-full grid-cols-[auto,minmax(0,1fr),auto] items-start gap-1.5 px-1.5 py-1.5 text-sm transition-colors ${B||M?"cursor-default":"cursor-pointer"} ${M?"rounded-md bg-secondary/70":B?"opacity-50":"hover:rounded-md hover:bg-muted/40"}`,draggable:!!D.rootPath,onDragStart:H=>{if(!D.rootPath){H.preventDefault();return}H.dataTransfer.effectAllowed="copy",H.dataTransfer.setData(ete,JSON.stringify(y$e(D.rootPath,D.title||void 0)))},onClick:()=>{!B&&!M&&l(D.id)},children:[M?c.jsx(Eh,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-primary"}):c.jsx(iM,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsxs("div",{className:"min-w-0 overflow-hidden",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[c.jsx("span",{className:"min-w-0 truncate text-xs font-medium",children:D.title||"Untitled Project"}),q&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"shrink-0 text-2xs text-muted-foreground",children:"·"}),c.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-2xs text-muted-foreground",children:[c.jsx(Vf,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:q.name})]})]})]}),c.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden text-2xs text-muted-foreground",children:[c.jsx("span",{className:"min-w-0 truncate",children:D.rootPath||"No folder linked"}),c.jsx("span",{className:"shrink-0",children:"·"}),c.jsx("span",{className:"shrink-0",children:nU(D.lastActiveAt)})]}),B&&c.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-2xs text-orange-500",children:[c.jsx(vve,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:"Node offline"})]}),L&&!B&&c.jsx("div",{className:"mt-0.5 flex min-w-0 items-center gap-1 text-2xs",children:c.jsxs("span",{className:"inline-flex max-w-full items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-muted-foreground",children:[c.jsx(snt,{platform:L.platform}),c.jsx("span",{className:"truncate max-w-[80px]",children:L.name})]})}),M&&w&&c.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1 text-2xs text-blue-500",children:[c.jsx("span",{className:"truncate",children:w.provider}),c.jsx("span",{className:"shrink-0 text-muted-foreground",children:"·"}),c.jsx($o,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:w.isRemote&&w.remoteNode?w.remoteNode.nodeName:"Gateway"})]})]}),c.jsx("div",{className:"flex shrink-0 self-start",children:c.jsxs(Mc,{children:[c.jsx(Pc,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"icon","aria-label":"Project actions",className:"h-5.5 w-5.5 shrink-0 text-muted-foreground transition-opacity hover:text-foreground data-[state=open]:opacity-100 sm:opacity-0 sm:group-hover:opacity-100",onClick:H=>H.stopPropagation(),children:c.jsx(F_,{className:"h-3 w-3"})})}),c.jsxs(Kl,{align:"end",side:"right",className:"min-w-[10rem]",children:[x&&c.jsxs($i,{disabled:!D.rootPath,className:`gap-2 ${q?"text-primary focus:text-primary":""}`,onSelect:H=>{H.preventDefault(),x(D.id)},children:[c.jsx(Vf,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:q?`Repository: ${q.name}`:"Assign repository"})]}),c.jsxs($i,{className:"gap-2",onSelect:H=>{H.preventDefault(),m(D.id)},children:[c.jsx(dxe,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Change directory"})]}),c.jsxs($i,{className:"gap-2 text-destructive focus:text-destructive",onSelect:H=>{H.preventDefault(),f(D.id)},children:[c.jsx(eM,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Archive project"})]})]})]})})]},D.id)}),!W&&a&&v&&c.jsx("button",{className:"w-full px-2 py-2 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:v,children:"Show more projects"}),!W&&o&&_&&c.jsx("button",{className:"w-full px-2 py-2 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:_,children:"Show fewer projects"})]})})]}),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[c.jsxs("div",{className:"flex h-8 shrink-0 items-center justify-between px-3",children:[c.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center justify-between text-left transition-colors hover:text-foreground",onClick:()=>G(D=>!D),"aria-expanded":U,children:[c.jsx("span",{className:"text-2xs font-medium text-muted-foreground",children:"Personal chats"}),c.jsx(cs,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform ${U?"rotate-90":""}`})]}),d&&c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsx(ye,{variant:"ghost",size:"icon",className:"ml-1 h-6 w-6 rounded-md p-1",onClick:d,children:c.jsx(Ls,{className:"h-3 w-3"})})}),c.jsx(Rr,{side:"right",children:"New personal chat"})]})]}),U&&c.jsx(kc,{className:"min-h-0 flex-1",children:c.jsxs("div",{className:"space-y-0.5 px-1.5 pb-1.5",children:[n.length===0&&c.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No personal chats yet.",d&&c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("button",{onClick:d,className:"underline underline-offset-2 hover:text-foreground mt-1 inline-block",children:"Start a chat"})]})]}),n.length>0&&O.length===0&&c.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No matching personal chats."}),O.map(D=>{const M=r===null&&D.id===i;return c.jsxs("div",{className:`group flex items-center gap-1.5 rounded-md px-1.5 py-1 transition-colors text-sm ${M?"bg-secondary/70 cursor-default":"cursor-pointer hover:bg-muted/40"}`,onClick:()=>{!M&&u&&u(D.id)},children:[c.jsx(Ah,{className:`h-3.5 w-3.5 shrink-0 ${M?"text-primary":"text-muted-foreground"}`}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate text-xs font-medium",children:D.name||"Personal chat"}),c.jsx("div",{className:"text-2xs text-muted-foreground",children:nU(D.lastActiveAt??D.createdAt)})]})]},D.id)})]})})]})]})]})}function ant(e){const n=new Date(e),i=new Date().getTime()-n.getTime();return i<6e4?"just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:n.toLocaleDateString()}function ont({sessions:e,activeSessionId:n,projectTitle:r,onSelectSession:i,onNewSession:s,onOpenChange:a,showTitle:o=!0,triggerLabel:l=null}){const[u,d]=y.useState(!1),h=e.find(m=>m.id===n)??e[0]??null,f=m=>{d(m),a==null||a(m)};return c.jsxs("div",{className:o?"flex min-w-0 flex-1 items-center justify-between gap-1.5":"flex items-center gap-1.5",children:[o?c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold leading-tight",children:h!=null&&h.name&&h.name!=="New Chat"?h.name:""}):null,c.jsxs(Mc,{open:u,onOpenChange:f,children:[c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsx(Pc,{asChild:!0,children:c.jsxs(ye,{variant:"ghost",size:l?"sm":"icon",className:l?"h-7 shrink-0 rounded-md px-2 text-xs text-muted-foreground hover:text-foreground":"h-6 w-6 shrink-0 rounded-md text-muted-foreground hover:text-foreground",children:[c.jsx(e5,{className:"h-3.5 w-3.5"}),l?c.jsx("span",{children:l}):null]})})}),c.jsx(Rr,{side:"bottom",children:l??"Sessions"})]}),c.jsxs(Kl,{align:"start",className:"w-[min(28rem,calc(100vw-1rem))] p-0",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-medium",children:"Sessions"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:r||"Current project"})]}),c.jsxs(ye,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{s(),d(!1)},children:[c.jsx(n1e,{className:"mr-1 h-3 w-3"}),"New chat"]})]}),c.jsx("div",{className:"max-h-[min(28rem,70vh)] overflow-y-auto p-2",children:e.length===0?c.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No sessions yet."}):c.jsx("div",{className:"space-y-0.5",children:e.map(m=>{const x=m.id===n;return c.jsxs("button",{type:"button",className:`flex w-full items-start gap-2 rounded-md px-3 py-2 text-left transition-colors ${x?"bg-secondary text-secondary-foreground":"hover:bg-muted/50"}`,onClick:()=>{i(m.id),d(!1)},children:[x?c.jsx(Ii,{className:"mt-0.5 h-3 w-3 shrink-0 text-primary"}):c.jsx("span",{className:"mt-1 h-2 w-2 shrink-0 rounded-full bg-muted-foreground/50"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"truncate text-xs font-medium",children:m.name||"Untitled"}),m.status==="archived"&&c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-1.5 py-0 text-2xs text-muted-foreground",children:[c.jsx(eM,{className:"h-2.5 w-2.5"}),"Archived"]})]}),c.jsx("div",{className:"text-2xs text-muted-foreground",children:ant(m.lastActiveAt)})]})]},m.id)})})})]})]})]})}function lnt({suggestions:e,onSelect:n,className:r}){return c.jsx("div",{className:je("flex flex-wrap gap-2 justify-center",r),children:e.map(i=>c.jsx("button",{onClick:()=>n(i),className:"px-4 py-2 text-sm rounded-full border bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:i},i))})}const cnt=Xj("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium leading-4 transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500/15 text-green-700 dark:text-green-400",warning:"border-transparent bg-yellow-500/15 text-yellow-700 dark:text-yellow-400"}},defaultVariants:{variant:"default"}});function Wn({className:e,variant:n,...r}){return c.jsx("div",{className:je(cnt({variant:n}),e),...r})}const Xn=y.forwardRef(({className:e,...n},r)=>c.jsx("div",{ref:r,className:je("rounded-xl border border-border/70 bg-card text-card-foreground shadow-sm",e),...n}));Xn.displayName="Card";const Cle=y.forwardRef(({className:e,...n},r)=>c.jsx("div",{ref:r,className:je("flex flex-col space-y-1.5 p-6",e),...n}));Cle.displayName="CardHeader";const jle=y.forwardRef(({className:e,...n},r)=>c.jsx("h3",{ref:r,className:je("font-semibold leading-none tracking-tight",e),...n}));jle.displayName="CardTitle";const unt=y.forwardRef(({className:e,...n},r)=>c.jsx("p",{ref:r,className:je("text-sm text-muted-foreground",e),...n}));unt.displayName="CardDescription";const vc=y.forwardRef(({className:e,...n},r)=>c.jsx("div",{ref:r,className:je("p-6 pt-0",e),...n}));vc.displayName="CardContent";const dnt=y.forwardRef(({className:e,...n},r)=>c.jsx("div",{ref:r,className:je("flex items-center p-6 pt-0",e),...n}));dnt.displayName="CardFooter";const hnt={pending:{icon:Gm,label:"Pending",color:"text-muted-foreground"},approved:{icon:Lt,label:"Running",color:"text-blue-500"},rejected:{icon:Ur,label:"Rejected",color:"text-destructive"},executed:{icon:Ns,label:"Done",color:"text-green-500"},failed:{icon:Bs,label:"Failed",color:"text-destructive"}};function fnt({action:e,expanded:n,onToggle:r}){const i=hnt[e.status],s=i.icon;return c.jsxs("div",{className:"border rounded-md",children:[c.jsxs("button",{type:"button",className:"flex items-center gap-3 w-full px-3 py-2.5 text-left hover:bg-muted/50 transition-colors",onClick:r,children:[c.jsx(s,{className:je("h-4 w-4 shrink-0",i.color,e.status==="approved"&&"animate-spin")}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"font-mono text-sm font-medium",children:e.tool}),c.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["Step ",e.order+1]})]}),c.jsx(Wn,{variant:"outline",className:"text-2xs px-1.5 py-0",children:i.label}),n?c.jsx(fl,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(cs,{className:"h-4 w-4 text-muted-foreground"})]}),n&&c.jsxs("div",{className:"px-3 pb-3 pt-1 border-t bg-muted/30",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),c.jsx("pre",{className:"text-xs bg-background rounded p-2 overflow-x-auto max-h-48",children:JSON.stringify(e.args,null,2)}),e.result&&c.jsx("div",{className:je("mt-2 text-xs rounded p-2",e.result.ok?"bg-green-500/10 text-green-700 dark:text-green-400":"bg-destructive/10 text-destructive"),children:e.result.message})]})]})}function pnt({plan:e,onApprove:n,onReject:r,isExecuting:i,className:s}){const[a,o]=y.useState(new Set),l=Array.isArray(e==null?void 0:e.actions)?e.actions:[],u=x=>{o(v=>{const _=new Set(v);return _.has(x)?_.delete(x):_.add(x),_})},d=l.filter(x=>x.status==="pending").length,h=l.filter(x=>x.status==="executed").length,f=l.filter(x=>x.status==="failed").length,m=d===0;return c.jsxs(Xn,{className:je("p-4 space-y-3",s),children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(mnt,{className:"h-4 w-4"}),"Plan",c.jsxs(Wn,{variant:"secondary",className:"text-2xs px-1.5 py-0",children:[l.length," step",l.length!==1?"s":""]})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.summary})]}),m&&c.jsx(Wn,{variant:f>0?"destructive":"success",className:"shrink-0",children:f>0?`${f} failed`:"Complete"})]}),c.jsx("div",{className:"space-y-1.5",children:l.map(x=>c.jsx(fnt,{action:x,expanded:a.has(x.id),onToggle:()=>u(x.id)},x.id))}),d>0&&c.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[c.jsx(ye,{size:"sm",onClick:()=>n(),disabled:i,children:i?c.jsxs(c.Fragment,{children:[c.jsx(Lt,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Executing..."]}):c.jsxs(c.Fragment,{children:[c.jsx(eS,{className:"h-3.5 w-3.5 mr-1.5"}),"Execute all (",d,")"]})}),c.jsxs(ye,{size:"sm",variant:"outline",onClick:r,disabled:i,children:[c.jsx(Ur,{className:"h-3.5 w-3.5 mr-1.5"}),"Reject"]})]}),m&&!i&&c.jsxs("p",{className:"text-xs text-muted-foreground",children:[h>0&&`${h} action${h!==1?"s":""} executed.`,f>0&&` ${f} failed.`]})]})}function mnt({className:e}){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[c.jsx("rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}),c.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),c.jsx("path",{d:"M12 11h4"}),c.jsx("path",{d:"M12 16h4"}),c.jsx("path",{d:"M8 11h.01"}),c.jsx("path",{d:"M8 16h.01"})]})}function gnt(e){return e.find(n=>n.status==="in-progress")??null}function Nle(e){return e.length>0&&e.every(n=>n.status==="completed")}function ynt(e){const n=gnt(e),r=Nle(e);return{headerLabel:n?n.title:r?"All tasks completed":"Tasks",showHeaderSpinner:!!n,showHeaderCompleted:!n&&r}}function r7({items:e,className:n,onClear:r}){const i=Array.isArray(e)?e:[],[s,a]=y.useState(!1),o=y.useMemo(()=>Nle(i),[i]),l=y.useMemo(()=>ynt(i),[i]);if(i.length===0)return null;const u=i.filter(x=>x.status==="completed").length,d=i.length,h=d>0?Math.round(u/d*100):0,f=s?"Tasks":l.headerLabel,m=o?"bg-green-500":"bg-primary";return c.jsxs("div",{className:je("rounded-lg border bg-muted/30 p-3 space-y-2",n),children:[c.jsxs("button",{type:"button",onClick:()=>a(x=>!x),className:"flex items-center gap-2 w-full text-left",children:[c.jsx(fl,{className:je("h-3 w-3 shrink-0 text-muted-foreground transition-transform duration-200",!s&&"-rotate-90")}),!s&&l.showHeaderSpinner&&c.jsx(Lt,{className:"h-3.5 w-3.5 shrink-0 text-primary animate-spin"}),!s&&l.showHeaderCompleted&&c.jsx(Ns,{className:"h-3.5 w-3.5 shrink-0 text-green-500"}),c.jsx("span",{className:"min-w-0 truncate text-xs font-medium text-foreground",children:f}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:je("h-full rounded-full transition-all duration-300",m),style:{width:`${h}%`}})}),c.jsxs("span",{className:"text-2xs text-muted-foreground tabular-nums",children:[u,"/",d]}),r&&c.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),r()},className:"shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Clear todo list",children:c.jsx(Ur,{className:"h-3 w-3"})})]}),s&&c.jsx("div",{className:"space-y-1",children:i.map(x=>c.jsxs("div",{className:je("flex items-start gap-2 text-xs py-0.5",x.status==="completed"&&"text-muted-foreground"),children:[x.status==="completed"?c.jsx(Ns,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-green-500"}):x.status==="in-progress"?c.jsx(Lt,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary animate-spin"}):c.jsx(rM,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-muted-foreground/50"}),c.jsx("span",{className:je("flex-1 min-w-0",x.status==="completed"&&"line-through"),children:x.title})]},x.id))})]})}function xnt({files:e,onAccept:n,onReject:r,onAcceptAll:i,onRejectAll:s,onFileClick:a,className:o}){const l=y.useRef(null),[u,d]=y.useState(!1),[h,f]=y.useState(!1);if(y.useEffect(()=>{const C=l.current;if(!C||typeof ResizeObserver>"u")return;const j=()=>{d(C.clientWidth<560)};j();const T=new ResizeObserver(()=>j());return T.observe(C),()=>T.disconnect()},[]),e.length===0)return null;const m=e.filter(C=>C.state==="undecided").length,x=e.reduce((C,j)=>C+(j.insertions??0),0),v=e.reduce((C,j)=>C+(j.deletions??0),0),_=e.some(C=>C.insertions!==void 0||C.deletions!==void 0),w=_?null:`${e.length} ${e.length===1?"file":"files"}`,S=({insertions:C,deletions:j})=>c.jsxs("span",{className:"shrink-0 whitespace-nowrap text-2xs tabular-nums",children:[c.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["+",C]}),c.jsxs("span",{className:"ml-1 text-red-600 dark:text-red-400",children:["-",j]})]});return c.jsxs("div",{ref:l,className:je("overflow-hidden rounded-lg border bg-muted/30",o),children:[c.jsxs("div",{className:je("flex items-center justify-between gap-2 bg-muted/20 px-3 py-2",h&&"border-b"),children:[c.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-1.5 text-left",onClick:()=>f(C=>!C),"aria-expanded":h,children:[c.jsx(cs,{className:je("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",h&&"rotate-90")}),c.jsx(mh,{className:"h-3.5 w-3.5 text-muted-foreground"}),c.jsx("span",{className:"truncate text-xs font-medium",children:"Files changed"}),_&&c.jsx(S,{insertions:x,deletions:v}),w&&c.jsx("span",{className:"shrink-0 whitespace-nowrap text-2xs tabular-nums text-muted-foreground",children:w}),h&&m>0&&c.jsxs("span",{className:"shrink-0 text-2xs text-amber-500 dark:text-amber-400",children:[m," pending"]})]}),m>0&&c.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[c.jsxs(ye,{size:u?"icon":"sm",variant:"ghost",className:je("h-6 shrink-0 text-xs",u?"w-6 p-0":"px-2"),onClick:i,title:"Keep all","aria-label":"Keep all",children:[c.jsx(Ii,{className:je("h-3 w-3 shrink-0",!u&&"mr-1")}),!u&&"Keep all"]}),c.jsxs(ye,{size:u?"icon":"sm",variant:"ghost",className:je("h-6 shrink-0 text-xs",u?"w-6 p-0":"px-2"),onClick:s,title:"Undo all","aria-label":"Undo all",children:[c.jsx(gu,{className:je("h-3 w-3 shrink-0",!u&&"mr-1")}),!u&&"Undo all"]})]})]}),h&&c.jsx("div",{className:"divide-y",children:e.map(C=>c.jsxs("div",{className:je("flex items-center gap-2 px-3 py-1.5 text-xs",C.state==="accepted"&&"bg-green-500/5",C.state==="rejected"&&"bg-red-500/5 text-muted-foreground"),children:[c.jsx(ga,{filename:C.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("button",{type:"button",className:je("min-w-0 flex-1 truncate text-left hover:underline cursor-pointer",C.state==="rejected"&&"line-through"),title:`Review diff for ${C.path}`,onClick:()=>a==null?void 0:a(C.path),children:C.path}),_&&c.jsx(S,{insertions:C.insertions??0,deletions:C.deletions??0}),C.state==="undecided"&&c.jsxs("div",{className:"ml-auto flex items-center gap-0.5 shrink-0",children:[c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-primary/10 text-primary transition-colors",onClick:()=>a==null?void 0:a(C.path),title:"Review changes",children:c.jsx(ep,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-green-500/20 text-green-600 dark:text-green-400 transition-colors",onClick:()=>n==null?void 0:n(C.path),title:"Keep all changes",children:c.jsx(Ii,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-red-500/20 text-red-600 dark:text-red-400 transition-colors",onClick:()=>r==null?void 0:r(C.path),title:"Undo all changes",children:c.jsx(gu,{className:"h-3 w-3"})})]}),C.state==="accepted"&&c.jsx("span",{className:"text-2xs text-green-600 dark:text-green-400 shrink-0",children:"Kept"}),C.state==="rejected"&&c.jsx("span",{className:"text-2xs text-red-500 shrink-0",children:"Undone"})]},C.path))})]})}function vnt(e,n,r,i){const s=e.findIndex(u=>u.id===n);if(s<0)return e;const a=[...e],[o]=a.splice(s,1);if(!o)return e;if(r==null)return a.push(o),a;const l=a.findIndex(u=>u.id===r);return l<0?e:(a.splice(l+(i==="after"?1:0),0,o),a)}function bnt({item:e,index:n}){return c.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border/40 bg-background px-3 py-2 text-sm shadow-2xl ring-1 ring-primary/10",children:[c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground",children:n===0?c.jsx(sM,{className:"h-3.5 w-3.5 text-primary"}):c.jsx(cs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground",children:c.jsx(n4,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[n===0?c.jsx("span",{className:"mb-0.5 block text-2xs font-medium uppercase tracking-wider text-primary/70",children:"Next"}):c.jsxs("span",{className:"mb-0.5 block text-2xs font-medium uppercase tracking-wider text-muted-foreground",children:["Queued #",n+1]}),c.jsx("span",{className:"whitespace-pre-wrap break-words text-foreground",children:e.displayContent??e.content})]})]})}function _nt({item:e,index:n,onRemove:r,onEdit:i,onReorder:s,onSteer:a,onSendToParallelThread:o,dragActive:l,dropBefore:u,dropAfter:d,onDragStart:h}){const[f,m]=y.useState(!1),[x,v]=y.useState(!0),[_,w]=y.useState(e.displayContent??e.content),S=y.useRef(null),C=f||!l;y.useEffect(()=>{if(f){const N=S.current;N&&(N.focus(),N.setSelectionRange(N.value.length,N.value.length))}},[f]),y.useEffect(()=>{f||w(e.displayContent??e.content)},[e.content,e.displayContent,f]);const j=y.useCallback(()=>{const N=_.trim(),R=e.displayContent??e.content;N&&N!==R&&(i==null||i(e.id,N)),m(!1)},[_,e.content,e.displayContent,e.id,i]),T=y.useCallback(()=>{w(e.displayContent??e.content),m(!1)},[e.content,e.displayContent]),E=y.useCallback(N=>{N.key==="Enter"&&!N.shiftKey?(N.preventDefault(),j()):N.key==="Escape"&&T()},[j,T]);return c.jsxs(c.Fragment,{children:[u&&c.jsx("div",{className:"relative h-0",children:c.jsx("div",{className:"absolute inset-x-2 -top-px h-0.5 rounded-full bg-primary shadow-[0_0_0_1px_hsl(var(--background))]"})}),c.jsxs("div",{"data-queue-id":e.id,className:je("group flex cursor-grab touch-none items-start gap-2 rounded-lg border border-border/40 bg-muted/50 px-3 py-2 text-sm transition-all duration-150 ease-out hover:bg-muted/70 active:cursor-grabbing",l&&"border-dashed border-primary/35 bg-primary/5 opacity-0"),onPointerDown:N=>{f||!s||N.target.closest('button, textarea, input, a, [data-no-drag="true"]')||h==null||h(e.id,N)},children:[c.jsx("button",{type:"button","data-no-drag":"true",className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground hover:bg-foreground/10 hover:text-foreground transition-colors",onClick:()=>v(N=>!N),"aria-label":x?"Expand queued message":"Collapse queued message",title:x?"Expand queued message":"Collapse queued message",children:x?c.jsx(cs,{className:"h-3.5 w-3.5"}):n===0?c.jsx(sM,{className:"h-3.5 w-3.5 text-primary"}):c.jsx(fl,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s&&!f&&c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground cursor-grab active:cursor-grabbing touch-none",title:"Drag to reorder","aria-label":"Drag to reorder",children:c.jsx(n4,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[n===0&&!f&&c.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-primary/70 block mb-0.5",children:"Next"}),n>0&&!f&&c.jsxs("span",{className:"text-2xs font-medium uppercase tracking-wider text-muted-foreground block mb-0.5",children:["Queued #",n+1]}),f?c.jsx("textarea",{ref:S,value:_,onChange:N=>w(N.target.value),onKeyDown:E,onBlur:j,rows:Math.min(_.split(`
1251
1251
  `).length,5),className:"w-full resize-none rounded border border-primary/30 bg-background px-2 py-1 text-sm outline-none focus:border-primary focus:ring-1 focus:ring-primary/20"}):x?c.jsx("span",{className:"block truncate text-foreground",children:e.displayContent??e.content}):c.jsx("span",{className:"whitespace-pre-wrap break-words text-foreground",children:e.displayContent??e.content})]}),c.jsx("div",{className:je("mt-0.5 flex shrink-0 items-center gap-0.5 transition-opacity",a?"opacity-100":C?"opacity-0 group-hover:opacity-100":"opacity-0"),children:f?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-primary/10 text-primary transition-colors",onClick:j,title:"Save",children:c.jsx(Ii,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-foreground/10 text-muted-foreground transition-colors",onClick:T,title:"Cancel",children:c.jsx(Ur,{className:"h-3.5 w-3.5"})})]}):c.jsxs(c.Fragment,{children:[i&&c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-foreground/10 text-muted-foreground transition-colors",onClick:()=>m(!0),title:"Edit message",children:c.jsx(H_,{className:"h-3 w-3"})}),a&&c.jsxs("button",{type:"button","data-no-drag":"true",className:"inline-flex h-6 items-center gap-1 rounded border border-primary/25 bg-primary/5 px-1.5 text-2xs font-medium text-primary transition-colors hover:bg-primary/10",onClick:()=>a(e.id),title:"Steer with message",children:[c.jsx("span",{children:"Steer"}),c.jsx(cye,{className:"h-3 w-3"})]}),o&&c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-primary/10 text-muted-foreground hover:text-primary transition-colors",onClick:()=>o(e.id),title:"Send to parallel thread",children:c.jsx(Vf,{className:"h-3 w-3"})}),c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:()=>r==null?void 0:r(e.id),title:"Remove from queue",children:c.jsx(Ur,{className:"h-3.5 w-3.5"})})]})})]}),d&&c.jsx("div",{className:"relative h-0",children:c.jsx("div",{className:"absolute inset-x-2 -top-px h-0.5 rounded-full bg-primary shadow-[0_0_0_1px_hsl(var(--background))]"})})]})}function Tle({items:e,onRemove:n,onEdit:r,onReorder:i,onSteer:s,onSendToParallelThread:a,className:o}){const l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(null),[f,m]=y.useState(null),[x,v]=y.useState(null);y.useEffect(()=>{if(d&&!e.some(j=>j.id===d)){h(null),m(null),v(null);return}f!=null&&f.targetId&&!e.some(j=>j.id===f.targetId)&&m(d?{targetId:d,placement:"before"}:null)},[d,f,e]),y.useEffect(()=>{var $;if(!d||!x)return;document.body.style.cursor="grabbing",document.body.style.userSelect="none",document.body.style.touchAction="none";const j=(G,W)=>{var O,D;const z=Array.from(((O=l.current)==null?void 0:O.querySelectorAll("[data-queue-id]"))??[]);if(z.length===0){m(null);return}const U=z.filter(M=>M.dataset.queueId&&M.dataset.queueId!==d);if(U.length===0){m({targetId:null,placement:"after"});return}for(const M of U){const L=M.dataset.queueId;if(!L)continue;const B=M.getBoundingClientRect(),q=B.top+B.height/2;if(W<q){m({targetId:L,placement:"before"});return}}const I=((D=U[U.length-1])==null?void 0:D.dataset.queueId)??null;m(I?{targetId:I,placement:"after"}:{targetId:null,placement:"after"})},T=G=>{G.pointerId===x.pointerId&&(v(W=>W&&{...W,x:G.clientX,y:G.clientY}),j(G.clientX,G.clientY))},E=G=>{var z,U;if(G&&G.pointerId!==x.pointerId)return;d&&f&&f.targetId!==d&&(i==null||i(d,f.targetId,f.placement));const W=u.current;(z=W==null?void 0:W.hasPointerCapture)!=null&&z.call(W,x.pointerId)&&((U=W.releasePointerCapture)==null||U.call(W,x.pointerId)),u.current=null,h(null),m(null),v(null)},N=()=>{E()},R=()=>{E()};return window.addEventListener("pointermove",T),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),window.addEventListener("blur",R),($=u.current)==null||$.addEventListener("lostpointercapture",N),()=>{var G;document.body.style.cursor="",document.body.style.userSelect="",document.body.style.touchAction="",window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E),window.removeEventListener("blur",R),(G=u.current)==null||G.removeEventListener("lostpointercapture",N)}},[x,d,f,i]);const _=y.useCallback((j,T)=>{var R;if(!i||T.button!==0&&T.pointerType!=="touch"&&T.pointerType!=="pen")return;T.preventDefault();const E=T.currentTarget.closest("[data-queue-id]");if(!E)return;u.current=E,(R=E.setPointerCapture)==null||R.call(E,T.pointerId);const N=E.getBoundingClientRect();h(j),m({targetId:j,placement:"before"}),v({id:j,pointerId:T.pointerId,x:T.clientX,y:T.clientY,offsetX:T.clientX-N.left,offsetY:T.clientY-N.top,width:N.width,height:N.height})},[i]);if(e.length===0)return null;const w=d&&f&&(f.targetId!==d||f.placement==="after")?vnt(e,d,f.targetId,f.placement):e,S=x?w.findIndex(j=>j.id===x.id):-1,C=S>=0?w[S]:null;return c.jsxs("div",{ref:l,className:je("space-y-1.5",o),children:[c.jsx("div",{className:"flex items-center gap-1.5 px-0.5",children:c.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:[e.length," queued message",e.length!==1?"s":""]})}),w.map((j,T)=>c.jsx(_nt,{item:j,index:T,onRemove:n,onEdit:r,onReorder:i,onSteer:s,onSendToParallelThread:a,dragActive:d===j.id,dropBefore:!!(d&&(f==null?void 0:f.targetId)===j.id&&f.placement==="before"&&d!==j.id),dropAfter:!!(d&&(f==null?void 0:f.targetId)===j.id&&f.placement==="after"&&d!==j.id),onDragStart:_},j.id)),x&&C&&c.jsx("div",{className:"pointer-events-none fixed z-50",style:{left:`${x.x-x.offsetX}px`,top:`${x.y-x.offsetY}px`,width:`${x.width}px`,minHeight:`${x.height}px`},children:c.jsx("div",{className:"scale-[1.01] opacity-95",children:c.jsx(bnt,{item:C,index:S})})})]})}const rU=5e3;let wnt=0,hx=[],xj=new Set;function YE(e,n){hx.push({id:wnt++,ts:Date.now(),type:e,raw:n}),hx.length>rU&&(hx=hx.slice(-rU)),xj.forEach(r=>r())}function Snt(){hx=[],xj.forEach(e=>e())}function knt(){const[,e]=y.useState(0);return y.useEffect(()=>{const n=()=>e(r=>r+1);return xj.add(n),()=>{xj.delete(n)}},[]),hx}const Cnt={request:"text-orange-400",token:"text-gray-400",tool_call_delta:"text-blue-400",tool_start:"text-yellow-400",tool_output:"text-green-400",tool_result:"text-emerald-400",thinking:"text-purple-400",done:"text-gray-500",error:"text-red-400"},XE=20;function jnt({onClose:e}){const n=knt(),r=y.useRef(null),[i,s]=y.useState(!0),[a,o]=y.useState(""),[l,u]=y.useState(!1),[d,h]=y.useState(new Set),f=y.useCallback(w=>{h(S=>{const C=new Set(S);return C.has(w)?C.delete(w):C.add(w),C})},[]),m=a?n.filter(w=>w.type.includes(a)||w.raw.includes(a)):n,x=dM({count:m.length,getScrollElement:()=>r.current,estimateSize:()=>XE,overscan:30}),v=()=>{const w=m.map(S=>`${new Date(S.ts).toISOString().slice(11,23)} ${S.type} ${S.raw}`).join(`
1252
1252
  `);navigator.clipboard.writeText(w),u(!0),setTimeout(()=>u(!1),1500)};y.useEffect(()=>{i&&m.length>0&&x.scrollToIndex(m.length-1,{align:"end"})},[m.length,i]);const _=y.useCallback(()=>{const w=r.current;if(!w)return;const S=w.scrollHeight-w.scrollTop-w.clientHeight<40;s(S)},[]);return c.jsxs("div",{className:"flex flex-col h-full bg-[#0d1117] text-[#c9d1d9] text-xs font-mono",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-zinc-700/60 shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-zinc-400 uppercase tracking-wider",children:"SSE Debug"}),c.jsxs("span",{className:"text-2xs text-zinc-500",children:[m.length,"/",n.length]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("input",{type:"text",placeholder:"Filter...",value:a,onChange:w=>o(w.target.value),className:"h-5 w-28 px-1.5 text-2xs rounded bg-zinc-800 border border-zinc-700 text-zinc-300 placeholder-zinc-500 focus:outline-none focus:border-blue-500"}),c.jsx(ye,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:v,title:"Copy all events",children:l?c.jsx(Ii,{className:"h-3 w-3 text-green-400"}):c.jsx(nl,{className:"h-3 w-3"})}),c.jsx(ye,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:Snt,children:c.jsx(cl,{className:"h-3 w-3"})}),c.jsx(ye,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:e,children:c.jsx(Ur,{className:"h-3 w-3"})})]})]}),c.jsx("div",{ref:r,onScroll:_,className:"flex-1 overflow-y-auto overflow-x-hidden",children:c.jsx("div",{style:{height:`${x.getTotalSize()}px`,position:"relative",width:"100%"},children:x.getVirtualItems().map(w=>{const S=m[w.index],C=new Date(S.ts).toISOString().slice(11,23),j=Cnt[S.type]??"text-zinc-400",T=S.raw.length>120,E=d.has(S.id),N=T&&!E?S.raw.slice(0,120)+"…":S.raw;return c.jsxs("div",{"data-index":w.index,ref:x.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${w.start}px)`},className:je("flex gap-2 px-2 hover:bg-zinc-800/50 leading-tight cursor-pointer select-none",E?"items-start py-1 bg-zinc-800/30":"items-center"),onClick:()=>f(S.id),children:[c.jsx("span",{className:"text-zinc-600 shrink-0 w-20",style:{minHeight:XE},children:C}),c.jsx("span",{className:je("shrink-0 w-28 text-right",j),style:{minHeight:XE},children:S.type}),c.jsxs("span",{className:je("text-zinc-400 min-w-0",E?"break-all whitespace-pre-wrap":"truncate"),children:[N,T&&!E&&c.jsx("span",{className:"text-zinc-600 ml-1",children:"▸"})]})]},S.id)})})}),!i&&c.jsx("div",{className:"absolute bottom-2 right-4",children:c.jsx(ye,{variant:"outline",size:"icon",className:"h-6 w-6 rounded-full bg-zinc-800 border-zinc-600",onClick:()=>{s(!0),x.scrollToIndex(m.length-1,{align:"end"})},children:c.jsx(jY,{className:"h-3 w-3"})})})]})}function iU({status:e}){switch(e){case"A":case"?":return c.jsx(l3,{className:"h-3.5 w-3.5 text-green-500 shrink-0"});case"D":return c.jsx(lxe,{className:"h-3.5 w-3.5 text-red-500 shrink-0"});case"R":return c.jsx(ixe,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"});default:return c.jsx(AY,{className:"h-3.5 w-3.5 text-yellow-500 shrink-0"})}}function sU(e){switch(e){case"A":return"Added";case"?":return"Untracked";case"D":return"Deleted";case"R":return"Renamed";default:return"Modified"}}function Nnt({cwd:e,baseBranch:n,branch:r,onClose:i}){const[s,a]=y.useState([]),[o,l]=y.useState(!0),[u,d]=y.useState(0),[h,f]=y.useState(()=>typeof window<"u"&&window.innerWidth<960);y.useEffect(()=>{let _=!1;return l(!0),js.fileDiffs(e,n,r).then(w=>{_||(a(w),d(0))}).catch(()=>{_||a([])}).finally(()=>{_||l(!1)}),()=>{_=!0}},[n,r,e]),y.useEffect(()=>{const _=()=>f(window.innerWidth<960);return _(),window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const m=s[u]??null,x=m?N_(m.path):"plaintext",v=y.useCallback(_=>{_.key==="Escape"?i():_.key==="ArrowDown"||_.key==="j"?(_.preventDefault(),d(w=>Math.min(w+1,s.length-1))):(_.key==="ArrowUp"||_.key==="k")&&(_.preventDefault(),d(w=>Math.max(w-1,0)))},[i,s.length]);return c.jsx("div",{className:"fixed inset-0 z-[100] bg-background/80 backdrop-blur-sm flex items-center justify-center p-4",onKeyDown:v,tabIndex:-1,children:c.jsxs("div",{className:"bg-popover border rounded-lg shadow-xl w-full max-w-6xl h-[85vh] flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(AY,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("h3",{className:"text-sm font-medium",children:"Changes"}),!o&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.length," file",s.length!==1?"s":""," changed"]})]}),c.jsx(ye,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:i,children:c.jsx(Ur,{className:"h-4 w-4"})})]}),o?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx(Lt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):s.length===0?c.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"No changes detected."}):c.jsxs("div",{className:je("flex-1 flex min-h-0",h&&"flex-col"),children:[c.jsxs("div",{className:je("border-r flex flex-col shrink-0 bg-muted/20",h?"w-full border-r-0 border-b max-h-40":"w-56"),children:[c.jsx("div",{className:"px-3 py-2 border-b",children:c.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Files"})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:s.map((_,w)=>c.jsxs("button",{className:je("flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs hover:bg-accent/50 transition-colors",w===u&&"bg-accent"),onClick:()=>d(w),title:`${_.path} (${sU(_.status)})`,children:[c.jsx(iU,{status:_.status}),c.jsx("span",{className:"truncate font-mono",children:_.path.split(/[/\\]/).pop()})]},_.path))})]}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b bg-muted/10 shrink-0",children:[c.jsx(iU,{status:(m==null?void 0:m.status)??"M"}),c.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate",children:m==null?void 0:m.path}),c.jsx("span",{className:je("text-2xs px-1.5 py-0.5 rounded font-medium",(m==null?void 0:m.status)==="A"||(m==null?void 0:m.status)==="?"?"bg-green-500/10 text-green-500":(m==null?void 0:m.status)==="D"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:sU((m==null?void 0:m.status)??"M")})]}),c.jsx("div",{className:"flex-1 min-h-0",children:m&&c.jsx(e2,{original:m.original,modified:m.modified,language:x,modelKey:m.path,className:"h-full",editorClassName:"h-full",renderSideBySide:!h,options:{readOnly:!0,minimap:{enabled:!1},renderOverviewRuler:!0,ignoreTrimWhitespace:!1,enableSplitViewResizing:!0}},m.path)})]})]})]})})}const aU={github:{placeholder:"ghp_... or github_pat_...",createUrl:"https://github.com/settings/tokens/new?scopes=repo,read:org,workflow&description=Jait+CLI",createLabel:"Create a GitHub token",scopes:"repo, read:org, and workflow",cliName:"gh",cliUrl:"https://cli.github.com"},gitlab:{placeholder:"glpat-...",createUrl:"https://gitlab.com/-/user_settings/personal_access_tokens",createLabel:"Create a GitLab token",scopes:"api and write_repository",cliName:"glab",cliUrl:"https://gitlab.com/gitlab-org/cli"},gitea:{placeholder:"your-gitea-token",createUrl:"",createLabel:"Create a token in your Gitea settings",scopes:"repo access",cliName:"tea",cliUrl:"https://gitea.com/gitea/tea"},"azure-devops":{placeholder:"your-azure-devops-pat",createUrl:"https://dev.azure.com/_usersSettings/tokens",createLabel:"Create an Azure DevOps PAT",scopes:"Code (Read & Write)",cliName:"az",cliUrl:"https://learn.microsoft.com/en-us/cli/azure/install-azure-cli"},bitbucket:{placeholder:"your-bitbucket-app-password",createUrl:"https://bitbucket.org/account/settings/app-passwords/",createLabel:"Create a Bitbucket app password",scopes:"Repositories (Read/Write) and Pull Requests (Read/Write)"}};function Tnt({open:e,onOpenChange:n,cwd:r,remoteUrl:i,onReady:s}){const[a,o]=y.useState("checking"),[l,u]=y.useState(null),[d,h]=y.useState(""),[f,m]=y.useState(null),x=(l==null?void 0:l.provider)??"github",v=(l==null?void 0:l.forgeName)??"Git Forge",_=aU[x]??aU.github,w=y.useCallback(async()=>{o("checking"),m(null);try{const j=await js.forgeStatus(r,i);u(j),!j.installed&&!j.authenticated?o("not-installed"):j.authenticated?o("success"):o("not-authenticated")}catch(j){m(j instanceof Error?j.message:"Failed to check forge status"),o("error")}},[r,i]);y.useEffect(()=>{e&&(w(),h(""))},[e,w]);const S=y.useCallback(async()=>{if(d.trim()){o("authenticating"),m(null);try{const j=await js.forgeAuth(d.trim(),r,i);j.ok?(u(T=>T&&{...T,authenticated:!0,username:j.username}),o("success"),h("")):(m(j.error??"Authentication failed — check your token permissions."),o("not-authenticated"))}catch(j){m(j instanceof Error?j.message:"Authentication failed"),o("not-authenticated")}}},[d,r,i]),C=y.useCallback(()=>{n(!1),s==null||s()},[n,s]);return c.jsx(zo,{open:e,onOpenChange:n,children:c.jsxs(uo,{className:"max-w-md",children:[c.jsxs(ul,{children:[c.jsxs(ho,{children:[v," Setup"]}),c.jsxs(ju,{children:["Pull request creation requires authentication with ",v,"."]})]}),a==="checking"&&c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(Lt,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsxs("span",{className:"text-sm text-muted-foreground",children:["Checking ",v," status…"]})]}),(a==="not-installed"||a==="not-authenticated")&&c.jsxs("div",{className:"space-y-4 py-2",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Th,{className:`h-5 w-5 mt-0.5 shrink-0 ${a==="not-installed"?"text-red-500":"text-amber-500"}`}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-sm font-medium",children:a==="not-installed"?`${v} CLI not detected`:`${v} is not authenticated`}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paste a Personal Access Token with ",_.scopes," scope to sign in."]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yi,{htmlFor:"forge-token",className:"text-xs",children:"Personal Access Token"}),c.jsx(Mr,{id:"forge-token",type:"password",placeholder:_.placeholder,value:d,onChange:j=>h(j.target.value),onKeyDown:j=>{j.key==="Enter"&&S()},autoFocus:!0}),c.jsxs("p",{className:"text-2xs text-muted-foreground",children:[_.createUrl?c.jsx("a",{href:_.createUrl,target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:_.createLabel}):c.jsx("span",{children:_.createLabel})," ","with ",c.jsx("code",{className:"text-2xs",children:_.scopes})," permissions."]})]}),a==="not-installed"&&_.cliName&&_.cliUrl&&c.jsxs("p",{className:"text-2xs text-muted-foreground",children:["Optionally install the ",c.jsx("code",{className:"text-2xs",children:_.cliName})," CLI:"," ",c.jsx("a",{href:_.cliUrl,target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:_.cliUrl})]}),f&&c.jsx("p",{className:"text-xs text-red-500",children:f})]}),a==="authenticating"&&c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(Lt,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsxs("span",{className:"text-sm text-muted-foreground",children:["Authenticating with ",v,"…"]})]}),a==="success"&&c.jsxs("div",{className:"flex items-start gap-3 py-4",children:[c.jsx(Ns,{className:"h-5 w-5 text-green-500 mt-0.5 shrink-0"}),c.jsxs("div",{className:"space-y-1",children:[c.jsxs("p",{className:"text-sm font-medium",children:["Authenticated",l!=null&&l.username?` as ${l.username}`:""," on ",v]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"You can now create pull requests."})]})]}),a==="error"&&c.jsxs("div",{className:"flex items-start gap-3 py-4",children:[c.jsx(Th,{className:"h-5 w-5 text-red-500 mt-0.5 shrink-0"}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-sm font-medium",children:"Something went wrong"}),f&&c.jsx("p",{className:"text-xs text-muted-foreground",children:f})]})]}),c.jsxs(lp,{children:[(a==="not-installed"||a==="not-authenticated"||a==="error")&&c.jsxs(c.Fragment,{children:[a==="error"&&c.jsx(ye,{variant:"outline",size:"sm",onClick:()=>void w(),children:"Re-check"}),c.jsx(ye,{size:"sm",disabled:!d.trim(),onClick:()=>void S(),children:"Sign in"})]}),a==="success"&&c.jsx(ye,{size:"sm",onClick:C,children:"Continue"})]})]})})}const Ent=Tnt;function Ele(e,n,r,i){return e?n==="creating"||n==="open"||n==="merged"||n==="closed"||i!=null&&i.branch&&i.branch!==e?!0:r==="completed"?!((i==null?void 0:i.branch)===e&&i.hasWorkingTreeChanges):!1:!1}function oU(e,n,r,i,s){return n?Ele(n,r,i,s)?{baseBranch:e,branch:n}:{baseBranch:e}:{}}function Ant(e){return e!=="creating"}function lU(e,n,r){return e==null||n==null||r==null?null:{insertions:n,deletions:r,hasChanges:e>0}}function Ont(e,n,r){return e?e.hasWorkingTreeChanges||!(r==="merged"||r==="closed")?!0:!!n:!1}function Rnt({hasRepository:e,threadKind:n,threadStatus:r,threadBranch:i,prUrl:s,prState:a}){return!e||n!=="delivery"?!1:!!(i||r==="completed"||s||a==="creating"||a==="open")}function Mnt({insertions:e,deletions:n}){return c.jsxs("span",{className:"inline-flex items-center gap-1 font-medium tabular-nums",children:[c.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["+",e]}),c.jsxs("span",{className:"text-red-600 dark:text-red-400",children:["-",n]})]})}function HP({threadId:e,cwd:n,branch:r,baseBranch:i,threadTitle:s,prUrl:a,prState:o,threadStatus:l,threadKind:u="delivery",showStatusBadge:d=!0,changeFiles:h,changeInsertions:f,changeDeletions:m}){var ue;const x=K0(),v=lU(h,f,m),[_,w]=y.useState(!1),[S,C]=y.useState(!1),[j,T]=y.useState(!1),[E,N]=y.useState(null),[R,$]=y.useState(()=>v),G=y.useRef(!1),W=y.useRef(!1),[z,U]=y.useState(a?{url:a,kind:"created"}:null);y.useEffect(()=>{U(ge=>a?{url:a,kind:"created"}:(ge==null?void 0:ge.kind)==="create"?ge:null)},[a]),y.useEffect(()=>{let ge=!1;return Ant(o)?((async()=>{try{const oe=await js.status(n,r??void 0);if(ge)return;N(oe);const ve=lU(h,f,m);if(ve){$(ve);return}const _e=oU(i,r,o,l,oe),Ae=r?await js.diffStats(n,_e.baseBranch,_e.branch).catch(()=>null):null;if(ge)return;if(Ae){$({insertions:Ae.insertions,deletions:Ae.deletions,hasChanges:Ae.hasChanges});return}if(r){$(null);return}$({insertions:oe.index.insertions+oe.workingTree.insertions,deletions:oe.index.deletions+oe.workingTree.deletions,hasChanges:oe.hasWorkingTreeChanges})}catch{ge||(N(null),$(null))}})(),()=>{ge=!0}):void 0},[i,r,m,h,f,n,o,a,l]);const[I,O]=y.useState(null),D=y.useRef(null);y.useEffect(()=>{if(!r||!a||o==="merged"||o==="closed"){O(null),D.current&&(clearInterval(D.current),D.current=null);return}const ge=async()=>{try{const se=await js.prChecks(n,r);if(!se||se.length===0){O(null);return}const oe=se.some(_e=>_e.conclusion==="failure"||_e.conclusion==="cancelled"),ve=se.some(_e=>_e.state==="PENDING"||_e.state==="QUEUED"||_e.state==="IN_PROGRESS"||!_e.conclusion);O(oe?"failing":ve?"pending":"passing")}catch{}};return ge(),D.current=setInterval(ge,15e3),()=>{D.current&&(clearInterval(D.current),D.current=null)}},[r,n,a,o]);const M=z??(a?{url:a,kind:"created"}:null)??((ue=E==null?void 0:E.pr)!=null&&ue.url?{url:E.pr.url,kind:"created"}:null),L=o==="creating"&&(M==null?void 0:M.kind)==="created"?"open":o,B=Ele(r,L,l,E),q=oU(i,r,L,l,E),H=L==="creating",F=v??R,X=B?!!(F!=null&&F.hasChanges):Ont(E,r,L),V=H&&!M?"Creating PR...":M?M.kind==="created"?"Open PR":"Open PR Page":"Create Pull Request",ne=H&&!M?"Creating pull request":M?V:"Create pull request",J=u==="delivery"&&(M!=null||l==="completed"),te=_||H,re=y.useCallback(async()=>{if(M){window.open(M.url,"_blank");return}if(l!=="completed"){Zn.error("Thread not completed",{description:"Finish the thread before creating a pull request."});return}if(u!=="delivery"){Zn.error("PR creation unavailable",{description:"Delegation threads are helper workers and do not create pull requests."});return}if(w(!0),!W.current)try{if((await js.status(n)).prProvider==="github"){const se=await js.ghStatus(n);if(!se.installed||!se.authenticated){w(!1),G.current=!0,T(!0);return}}}catch{}W.current=!1;try{const ge=s.replace(/^\[.*?\]\s*/,""),se=await bn.createPullRequest(e,{commitMessage:ge,baseBranch:i}),oe=se.result;se.pushFailed?se.resumed?Zn.info("Push failed — thread resumed",{description:"The agent is investigating the push failure and will fix the issue."}):Zn.error("Push failed",{description:se.error??"Git push failed. Re-open the thread to fix the issue."}):oe.pr.url?U({url:oe.pr.url,kind:"created"}):oe.push.createPrUrl&&U({url:oe.push.createPrUrl,kind:"create"})}catch(ge){Zn.error("Failed",{description:ge instanceof Error?ge.message:"Unknown error"})}finally{w(!1)}},[i,n,e,u,l,s,M]),Q=y.useCallback(()=>{G.current&&(G.current=!1,W.current=!0,re())},[re]);return c.jsxs(c.Fragment,{children:[c.jsx(Ent,{open:j,onOpenChange:T,cwd:n,onReady:Q}),c.jsxs("div",{className:"inline-flex items-center gap-1",children:[X&&F&&c.jsxs(ye,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs sm:h-6 sm:text-2xs",onClick:()=>C(!0),title:"View changes","aria-label":`View changes: +${F.insertions} -${F.deletions}`,children:[c.jsx(Mnt,{insertions:F.insertions,deletions:F.deletions}),!x&&"Changes"]}),c.jsxs(ye,{variant:"ghost",size:"sm",className:"h-7 min-w-8 gap-1 px-2 text-xs sm:h-6 sm:min-w-7 sm:text-2xs",disabled:te||!J,onClick:re,title:u!=="delivery"?"Delegation threads do not create pull requests.":!M&&l!=="completed"?"Finish the thread before creating a pull request.":ne,"aria-label":ne,children:[te?c.jsx(Lt,{className:"h-3.5 w-3.5 animate-spin sm:h-3 sm:w-3"}):c.jsx(_xe,{className:"h-3.5 w-3.5 sm:h-3 sm:w-3"}),!x&&V]}),d&&M&&c.jsx(Wn,{variant:"outline",className:`h-5 px-1.5 text-2xs font-medium ${L==="merged"?"border-purple-500/40 text-purple-700 bg-purple-500/10 dark:text-purple-300 dark:bg-purple-500/20 dark:border-purple-400/40":L==="closed"?"border-red-500/40 text-red-700 bg-red-500/10 dark:text-red-300 dark:bg-red-500/20 dark:border-red-400/40":L==="creating"?"border-amber-500/40 text-amber-700 bg-amber-500/10 dark:text-amber-300 dark:bg-amber-500/20 dark:border-amber-400/40":M.kind==="created"?"border-green-500/40 text-green-700 dark:text-green-300 dark:border-green-400/40":"border-amber-500/40 text-amber-700 dark:text-amber-300 dark:border-amber-400/40"}`,children:L==="merged"?"PR merged":L==="closed"?"PR closed":L==="creating"?"PR creating":M.kind==="created"?"PR open":"PR ready to open"}),d&&(M==null?void 0:M.kind)==="created"&&L==="open"&&I&&c.jsxs(Wn,{variant:"outline",className:`h-5 px-1.5 text-2xs font-medium inline-flex items-center gap-0.5 ${I==="failing"?"border-red-500/40 text-red-700 bg-red-500/10 dark:text-red-300 dark:bg-red-500/20 dark:border-red-400/40":I==="pending"?"border-amber-500/40 text-amber-700 bg-amber-500/10 dark:text-amber-300 dark:bg-amber-500/20 dark:border-amber-400/40":"border-green-500/40 text-green-700 bg-green-500/10 dark:text-green-300 dark:bg-green-500/20 dark:border-green-400/40"}`,children:[I==="failing"?c.jsx(Th,{className:"h-3 w-3"}):I==="pending"?c.jsx(Gm,{className:"h-3 w-3"}):c.jsx(Ns,{className:"h-3 w-3"}),I==="failing"?"Checks failing":I==="pending"?"Checks pending":"Checks passed"]})]}),S&&c.jsx(Nnt,{cwd:n,baseBranch:q.baseBranch,branch:q.branch,onClose:()=>C(!1)})]})}function WP(e){return e.status==="running"}function hb(e){return{id:e.id,name:e.name,defaultBranch:e.defaultBranch,localPath:e.localPath,deviceId:e.deviceId,forgeUrl:e.forgeUrl,githubUrl:e.githubUrl,source:"local"}}function vj(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function Pnt(e){const r=vj(e).split("/").filter(Boolean);return r[r.length-1]??e}function Lnt(e){var r;const n=e.match(/^\[([^\]]+)\]/);return((r=n==null?void 0:n[1])==null?void 0:r.trim())||null}function Ale(e){if(!e)return null;const r=vj(e).split("/").filter(Boolean),i=r.lastIndexOf("worktrees");return i===-1?null:r[i+1]??null}function $nt(e){return e.replace(/\.git$/i,"")}function cU(e){let n=e.split("/").filter(Boolean);if(n.length===0)return null;const r=n.indexOf("_git");if(r>=0&&n[r+1])n=[...n.slice(0,r),n[r+1]];else{const s=n.findIndex((o,l)=>o==="-"&&n[l+1]==="merge_requests"),a=s>=0?s:n.findIndex(o=>o==="pull"||o==="pulls"||o==="pullrequest"||o==="pull-requests"||o==="merge_requests");a>0&&(n=n.slice(0,a))}const i=n[n.length-1];return i?(n[n.length-1]=$nt(i),n.join("/")):null}function bj(e){const n=e==null?void 0:e.trim();if(!n)return null;const r=n.match(/^git@([^:]+):(.+)$/);if(r){const i=cU(r[2]??"");if(!i)return null;const s=i.split("/");return{host:(r[1]??"").toLowerCase(),path:i,name:s[s.length-1]??i}}try{const i=new URL(n),s=cU(i.pathname);if(!s)return null;const a=s.split("/");return{host:i.hostname.toLowerCase(),path:s,name:a[a.length-1]??s}}catch{return null}}function Dnt(e,n){return!!(e&&n&&e.host===n.host&&e.path.toLowerCase()===n.path.toLowerCase())}function Int(e){return[bj(e.forgeUrl),bj(e.githubUrl)].filter(n=>!!n)}function pN(e){var n;return Lnt(e.title)??Ale(e.workingDirectory)??((n=bj(e.prUrl))==null?void 0:n.name)??(e.workingDirectory?Pnt(e.workingDirectory):null)}function i7(e,n){var u,d;const r=n.name.trim().toLowerCase(),i=(u=pN(e))==null?void 0:u.toLowerCase(),s=e.workingDirectory?vj(e.workingDirectory):null,a=vj(n.localPath);if(s&&(s===a||s.startsWith(`${a}/`)))return!0;const o=(d=Ale(e.workingDirectory))==null?void 0:d.toLowerCase();if(o&&o===r)return!0;const l=bj(e.prUrl);return l&&Int(n).some(h=>Dnt(l,h))?!0:i===r}function Bnt(e,n){const r=[],i=new Set;for(const s of e){if(n.some(l=>i7(s,l)))continue;const a=pN(s),o=a==null?void 0:a.trim().toLowerCase();!a||!o||i.has(o)||(r.push({id:`shared:${o}`,name:a,defaultBranch:"main",localPath:s.workingDirectory??a,source:"shared"}),i.add(o))}return r}function znt(e){const n=e.trim();return n||null}function Fnt(e){const n=new Set;for(const r of e){const i=znt(r);i&&n.add(i)}return[...n]}function Hnt(e,n){const{localDeviceId:r,localProviders:i,remoteProviders:s,providersLoaded:a}=n;if(!e.deviceId)return{hostType:"gateway",locationLabel:"Gateway",online:!0,loading:!1,availableProviders:i.filter(d=>d.available).map(d=>d.id)};const o=s.find(d=>d.nodeId===e.deviceId),l=e.deviceId===r?"This device":(o==null?void 0:o.nodeName)??"Desktop app",u=!!o;return{hostType:"device",locationLabel:l,online:u,loading:!u&&!a,availableProviders:Fnt((o==null?void 0:o.providers)??[])}}function uU(e,n){return e.githubUrl?`Couldn't reach ${n.locationLabel}.`:n.hostType==="device"&&!n.online?`${n.locationLabel==="This device"?"This desktop app":n.locationLabel} is offline and no GitHub URL is configured for gateway fallback. Reconnect it or pick a connected repo/device.`:"No GitHub URL is configured for this repo, so the gateway cannot clone it as a fallback."}const Wnt="Generating title…";function _j(e){return e.replace(/^\[.*?\]\s*/,"").trim()===Wnt}function s7({className:e=""}){return c.jsx("span",{className:`inline-block rounded bg-muted animate-pulse ${e}`,children:c.jsx("span",{className:"invisible",children:"Generating title"})})}function UP({status:e,kind:n}){const r={running:{icon:Lt,color:"text-blue-500 animate-spin"},...n==="delegation"?{idle:{icon:Lt,color:"text-blue-500 animate-spin"}}:{},paused:{icon:iI,color:"text-yellow-500"},interrupted:{icon:iI,color:"text-yellow-500"},done:{icon:Ns,color:"text-green-500"},completed:{icon:Ns,color:"text-green-500"},error:{icon:Th,color:"text-red-500"}},{icon:i,color:s}=r[e]??{icon:Bs,color:"text-muted-foreground"};return c.jsx(i,{className:`h-3 w-3 shrink-0 ${s}`})}function Ole(e,n){return(n!==void 0?n:e.prState)??(e.prUrl?"open":null)}function Rle({prState:e}){if(!e)return null;const n=e==="creating"?"PR creating":e==="open"?"PR open":e==="merged"?"PR merged":"PR closed",r=e==="creating"?"bg-amber-500/10 text-amber-700 border-amber-500/20 dark:text-amber-300 dark:bg-amber-500/20 dark:border-amber-400/30":e==="open"?"bg-blue-500/10 text-blue-700 border-blue-500/20 dark:text-blue-300 dark:bg-blue-500/20 dark:border-blue-400/30":e==="merged"?"bg-purple-500/10 text-purple-700 border-purple-500/20 dark:text-purple-300 dark:bg-purple-500/20 dark:border-purple-400/30":"bg-red-500/10 text-red-700 border-red-500/20 dark:text-red-300 dark:bg-red-500/20 dark:border-red-400/30";return c.jsx(Wn,{variant:"outline",className:`h-4 shrink-0 whitespace-nowrap px-1 py-0 text-2xs ${r}`,children:n})}function a7({kind:e}){return c.jsx(Wn,{variant:"outline",className:`h-4 shrink-0 whitespace-nowrap px-1 py-0 text-2xs ${e==="delegation"?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300 dark:border-amber-400/30":"bg-blue-500/10 text-blue-700 border-blue-500/20 dark:text-blue-300 dark:bg-blue-500/20 dark:border-blue-400/30"}`,children:e==="delegation"?"Delegate":"Delivery"})}const Unt={codex:"Codex","claude-code":"Claude"};function wj({runtime:e,className:n=""}){const r=e.availableProviders.filter(i=>i==="codex"||i==="claude-code");return c.jsxs("div",{className:`flex min-w-0 flex-wrap items-center gap-1 text-2xs text-muted-foreground ${n}`.trim(),children:[c.jsx("span",{className:"min-w-0 max-w-full truncate",children:e.locationLabel}),e.loading?c.jsx(Lt,{className:"h-3 w-3 animate-spin text-muted-foreground"}):!e.online&&c.jsx(Wn,{variant:"outline",className:"h-4 border-amber-500/30 bg-amber-500/10 px-1 py-0 text-2xs text-amber-700 dark:text-amber-300",children:"Offline"}),r.map(i=>c.jsx(Wn,{variant:"outline",className:"h-4 px-1 py-0 text-2xs",children:Unt[i]},i))]})}function Mle({repositories:e,selectedRepo:n,disabled:r=!1,compact:i=!1,className:s="",getRuntimeInfo:a,onSelect:o,onAddRepository:l}){return c.jsxs(Mc,{children:[c.jsx(Pc,{asChild:!0,children:c.jsxs(ye,{variant:"outline",size:"sm",className:`h-8 min-w-0 max-w-full gap-1.5 rounded-lg px-2 text-xs ${s}`.trim(),disabled:r,title:n?n.name:"Select repository",children:[c.jsx(Eh,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:`min-w-0 truncate ${i?"max-w-[8rem]":"max-w-[140px]"}`,children:n?n.name:"Select repository"}),c.jsx(fl,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),c.jsxs(Kl,{align:"start",side:"top",className:"w-64 max-w-[calc(100vw-1rem)]",children:[c.jsx(wx,{children:"Repository"}),e.map(u=>{const d=a(u);return c.jsx($i,{onSelect:()=>o(u.id),className:"min-w-0",children:c.jsxs("div",{className:"flex min-w-0 w-full items-start gap-2",children:[c.jsx(Eh,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx("span",{className:"min-w-0 truncate",children:u.name}),c.jsx("span",{className:"shrink-0 text-2xs text-muted-foreground",children:u.defaultBranch}),u.source==="shared"&&c.jsx(Wn,{variant:"outline",className:"h-4 px-1 py-0 text-2xs",children:"Shared"})]}),c.jsx(wj,{runtime:d,className:"mt-1"})]})]})},u.id)}),e.length===0&&c.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No repositories yet."}),c.jsx(gh,{}),c.jsxs($i,{onSelect:l,children:[c.jsx(Ls,{className:"mr-2 h-3.5 w-3.5"}),"Add repository"]})]})]})}function Vnt({repositories:e,selectedRepoId:n,isMobile:r=!1,getRuntimeInfo:i,onSelect:s,onAddRepository:a,onRemoveRepository:o,onOpenStrategy:l,onOpenPlan:u}){return c.jsxs("div",{className:"flex h-full flex-col",children:[c.jsxs("div",{className:"flex h-[35px] items-center justify-between border-b px-3",children:[c.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repositories"}),c.jsxs(ye,{variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-xs",onClick:a,children:[c.jsx(Ls,{className:"h-3 w-3"}),"Add"]})]}),c.jsx("div",{className:r?"flex-1 overflow-y-auto p-1.5 space-y-0.5":"flex-1 overflow-y-auto p-2 space-y-1",children:e.length===0?c.jsxs("p",{className:"py-4 text-center text-xs text-muted-foreground",children:["No repositories yet.",c.jsx("br",{}),c.jsx("button",{type:"button",onClick:a,className:"mt-1 inline-block underline underline-offset-2 hover:text-foreground",children:"Add one"})]}):e.map(d=>{const h=i(d);return c.jsxs("div",{role:"button",tabIndex:0,className:`flex w-full items-start gap-2 px-2 py-1.5 text-left transition-colors ${r?"cursor-pointer rounded-md text-sm":"rounded-lg text-xs"} ${n===d.id?r?"bg-secondary text-secondary-foreground":"bg-primary/10 text-primary":r?"hover:bg-muted/50":"hover:bg-muted"}`,onClick:()=>s(d.id),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),s(d.id))},children:[c.jsx(Eh,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:r?"truncate text-xs font-medium":"truncate font-medium",children:d.name}),c.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1",children:[c.jsx("span",{className:"text-2xs text-muted-foreground",children:d.defaultBranch}),d.source==="shared"&&c.jsx(Wn,{variant:"outline",className:"h-4 shrink-0 px-1 py-0 text-2xs",children:"Shared"})]}),c.jsx(wj,{runtime:h,className:"mt-1"})]}),c.jsxs("div",{className:"mt-0.5 flex shrink-0 flex-col gap-0.5",children:[c.jsx("button",{type:"button",title:"Strategy",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-primary",onClick:f=>{f.stopPropagation(),l(d)},children:c.jsx(BY,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",title:"Plans",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-primary",onClick:f=>{f.stopPropagation(),u(d)},children:c.jsx(u0,{className:"h-3 w-3"})}),d.source==="local"&&c.jsx("button",{type:"button",title:"Remove",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-destructive",onClick:f=>{f.stopPropagation(),o(d.id)},children:c.jsx(cl,{className:"h-3 w-3"})})]})]},d.id)})})]})}function qnt(e){const n=Math.floor(e/1e3);if(n<60)return`${n}s`;const r=Math.floor(n/60),i=n%60;if(r<60)return`${r}m ${i.toString().padStart(2,"0")}s`;const s=Math.floor(r/60),a=r%60;return`${s}h ${a.toString().padStart(2,"0")}m`}function Gnt({createdAt:e,completedAt:n,status:r}){const[i,s]=y.useState(Date.now),a=r==="running"||r==="queued";y.useEffect(()=>{if(!a)return;const d=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(d)},[a]);const o=new Date(e).getTime(),l=a?i:n?new Date(n).getTime():i,u=Math.max(0,l-o);return c.jsxs("span",{className:"shrink-0 tabular-nums",title:a?"Elapsed time":"Total duration",children:[a&&c.jsx(hve,{className:"inline h-3 w-3 mr-0.5 -mt-px"}),qnt(u)]})}function Knt({thread:e,repo:n,repoName:r,prState:i,ghAvailable:s,onOpen:a,onStop:o,onDelete:l}){const u=K0(),d=Km(),[h,f]=y.useState(!1),m=Rnt({hasRepository:n!=null,threadKind:e.kind,threadStatus:e.status,threadBranch:e.branch,prUrl:e.prUrl,prState:i}),x=WP(e),v=e.kind==="delegation"||!u,_=y.useCallback(async()=>{if(await d({title:"Delete thread?",description:c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{children:"Are you sure you want to delete this thread?"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"This removes the thread and its local worktree cleanup will run in the background."})]}),confirmLabel:"Delete",cancelLabel:"Cancel",variant:"destructive"})){f(!0);try{await l()}finally{f(!1)}}},[d,l]);return c.jsxs("div",{role:"button",tabIndex:0,className:`group relative grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-2.5 border-b px-2.5 py-2.5 text-sm transition-colors hover:bg-muted/40 sm:gap-5 sm:px-3 sm:py-3.5 ${e.kind==="delegation"?"bg-amber-500/[0.04]":""}`,onClick:a,onKeyDown:w=>{w.target===w.currentTarget&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),a())},children:[c.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[c.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1.5",children:[c.jsx(UP,{status:e.status,kind:e.kind}),c.jsx("div",{className:"flex-1 truncate text-sm font-medium sm:text-sm",children:_j(e.title)?c.jsx(s7,{className:"h-3.5 w-28"}):c.jsx("span",{children:e.title.replace(/^\[.*?\]\s*/,"")})}),c.jsx(Gnt,{createdAt:e.createdAt,completedAt:e.completedAt,status:e.status})]}),c.jsxs("div",{className:"flex min-w-0 flex-nowrap items-center gap-x-1.5 overflow-hidden pl-[calc(0.75rem+6px)] text-xs leading-tight text-muted-foreground sm:gap-x-1 sm:text-xs",children:[c.jsx("span",{className:"min-w-0 truncate",children:r}),v&&c.jsx(a7,{kind:e.kind}),e.kind==="delegation"&&c.jsx("span",{className:"hidden shrink-0 text-amber-700 dark:text-amber-300 sm:inline",children:"Helper thread"}),e.branch&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden sm:inline",children:"·"}),c.jsx("span",{className:"hidden max-w-full truncate font-mono sm:inline",children:e.branch})]}),e.providerId&&e.providerId!=="jait"&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden sm:inline",children:"·"}),c.jsx("span",{className:"hidden shrink-0 whitespace-nowrap sm:inline",children:e.providerId})]}),e.executionNodeName&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden sm:inline",children:"·"}),c.jsxs("span",{className:"hidden max-w-full items-center gap-1 truncate text-blue-500 dark:text-blue-400 sm:inline-flex",children:[c.jsx($o,{className:"inline h-3 w-3 mr-0.5 -mt-px"}),e.executionNodeName]})]}),i&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden sm:inline",children:"·"}),c.jsx(Rle,{prState:i})]})]})]}),c.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[m&&n&&c.jsx("div",{className:"shrink-0",onClick:w=>w.stopPropagation(),onMouseDown:w=>w.stopPropagation(),onKeyDown:w=>w.stopPropagation(),children:c.jsx(HP,{threadId:e.id,cwd:e.workingDirectory??n.localPath,branch:e.branch,baseBranch:e.prBaseBranch??n.defaultBranch,threadTitle:e.title,threadStatus:e.status,threadKind:e.kind,prUrl:e.prUrl,prState:i,ghAvailable:s,showStatusBadge:!1,changeFiles:e.changeFiles,changeInsertions:e.changeInsertions,changeDeletions:e.changeDeletions})}),x&&c.jsx(ye,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-lg sm:h-7 sm:w-7",onClick:w=>{w.stopPropagation(),o()},title:e.kind==="delegation"?"End helper thread":"Stop thread",children:c.jsx(f1,{className:"h-3 w-3"})}),c.jsx(ye,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-lg opacity-100 transition-opacity",disabled:h,onClick:w=>{w.stopPropagation(),_()},title:"Delete thread",children:h?c.jsx(Lt,{className:"h-4 w-4 animate-spin"}):c.jsx(cl,{className:"h-4 w-4"})})]})]})}function dU({threads:e,getRepositoryForThread:n,threadPrStates:r,ghAvailable:i,onOpenThread:s,onStopThread:a}){const[o,l]=y.useState(!1);return e.length===0?null:c.jsxs(Mc,{open:o,onOpenChange:l,children:[c.jsx(Pc,{asChild:!0,children:c.jsxs(ye,{variant:"outline",size:"sm",className:"mr-1 h-8 gap-1.5 rounded-lg px-2 text-xs sm:mr-0",title:`${e.length} active ${e.length===1?"thread":"threads"}`,children:[c.jsx(Lt,{className:"h-3.5 w-3.5 animate-spin text-blue-500"}),c.jsx("span",{className:"hidden sm:inline",children:"Active"}),c.jsx(Wn,{variant:"secondary",className:"h-4 rounded-md px-1 text-2xs",children:e.length})]})}),c.jsxs(Kl,{align:"end",className:"w-[min(34rem,calc(100vw-1rem))] p-0",children:[c.jsx("div",{className:"flex items-center justify-between border-b px-3 py-2",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Lt,{className:"h-3.5 w-3.5 animate-spin text-blue-500"}),c.jsxs("span",{className:"text-sm font-medium",children:[e.length," active ",e.length===1?"thread":"threads"]})]})}),c.jsx("div",{className:"max-h-[min(28rem,70vh)] overflow-y-auto",children:e.map(u=>{const d=n(u),h=(d==null?void 0:d.name)??pN(u)??"Unknown repo",f=Ole(u,u.id in r?r[u.id]:void 0);return c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-3 border-b px-3 py-3 last:border-b-0",children:[c.jsxs("button",{type:"button",className:"min-w-0 text-left transition-colors hover:text-foreground",onClick:()=>{l(!1),s(u.id)},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[c.jsx(UP,{status:u.status,kind:u.kind}),c.jsx("span",{className:"truncate text-sm font-medium",children:_j(u.title)?"Generating title...":u.title.replace(/^\[.*?\]\s*/,"")})]}),c.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-xs text-muted-foreground",children:[c.jsx("span",{className:"truncate",children:h}),u.branch&&c.jsx(Wn,{variant:"outline",className:"h-4 px-1 py-0 font-mono text-2xs",children:u.branch}),u.providerId&&u.providerId!=="jait"&&c.jsx(Wn,{variant:"outline",className:"h-4 px-1 py-0 text-2xs",children:u.providerId}),u.executionNodeName&&c.jsxs(Wn,{variant:"outline",className:"h-4 px-1 py-0 text-2xs text-blue-500 dark:text-blue-400 border-blue-200 dark:border-blue-800",children:[c.jsx($o,{className:"inline h-2.5 w-2.5 mr-0.5"}),u.executionNodeName]}),c.jsx(Rle,{prState:f})]})]}),c.jsxs("div",{className:"flex items-center gap-1 self-start",children:[d&&c.jsx("div",{onClick:m=>m.stopPropagation(),onMouseDown:m=>m.stopPropagation(),children:c.jsx(HP,{threadId:u.id,cwd:u.workingDirectory??d.localPath,branch:u.branch,baseBranch:u.prBaseBranch??d.defaultBranch,threadTitle:u.title,threadStatus:u.status,threadKind:u.kind,prUrl:u.prUrl,prState:f,ghAvailable:i,showStatusBadge:!1,changeFiles:u.changeFiles,changeInsertions:u.changeInsertions,changeDeletions:u.changeDeletions})}),WP(u)&&c.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg",onClick:m=>{m.stopPropagation(),Promise.resolve(a(u.id))},title:"Stop thread",children:c.jsx(f1,{className:"h-3 w-3"})})]})]},u.id)})})]})]})}function Ynt({usage:e}){const[n,r]=y.useState(!1),i=e&&e.limit>0?Math.round(e.ratio*100):0,s=y.useMemo(()=>{if(!e||e.total===0)return[];const m=e.total;return[{label:"System",tokens:e.system,pct:Math.round(e.system/m*100),color:"var(--ctx-system)"},{label:"History",tokens:e.history,pct:Math.round(e.history/m*100),color:"var(--ctx-history)"},{label:"Tool Results",tokens:e.toolResults,pct:Math.round(e.toolResults/m*100),color:"var(--ctx-tool-results)"},{label:"Tools",tokens:e.tools,pct:Math.round(e.tools/m*100),color:"var(--ctx-tools)"}].filter(x=>x.tokens>0)},[e]),a=22,o=3,l=(a-o)/2,u=2*Math.PI*l,d=y.useMemo(()=>{if(!e||e.limit<=0)return[];const m=[];let x=0;for(const v of s){const w=v.tokens/e.limit*u;m.push({offset:x,length:w,color:v.color}),x+=w}return m},[s,e,u]),h=i>=90?"text-red-500":i>=75?"text-amber-500":"text-emerald-500",f=m=>m>=1e3?`${(m/1e3).toFixed(1)}k`:String(m);return!e||e.limit<=0?null:c.jsxs(c.Fragment,{children:[c.jsxs(Pr,{children:[c.jsx(Or,{asChild:!0,children:c.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1.5 px-1.5 py-1 rounded-md hover:bg-muted/50 cursor-pointer transition-colors",children:[c.jsxs("svg",{width:a,height:a,viewBox:`0 0 ${a} ${a}`,className:`-rotate-90 ${h}`,children:[c.jsx("circle",{cx:a/2,cy:a/2,r:l,fill:"none",stroke:"currentColor",strokeWidth:o,opacity:.15}),d.map((m,x)=>c.jsx("circle",{cx:a/2,cy:a/2,r:l,fill:"none",stroke:m.color,strokeWidth:o,strokeDasharray:`${m.length} ${u-m.length}`,strokeDashoffset:-m.offset,strokeLinecap:"round",opacity:.85},x))]}),c.jsxs("span",{className:"text-2xs tabular-nums text-muted-foreground",children:[i,"%"]})]})}),c.jsx(Rr,{side:"bottom",className:"max-w-[220px] bg-popover text-popover-foreground border shadow-md",children:c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center justify-between text-xs font-medium",children:[c.jsx("span",{children:"Context Window"}),c.jsxs("span",{className:"tabular-nums",children:[f(e.total)," / ",f(e.limit)]})]}),c.jsx("div",{className:"w-full h-1.5 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:`h-full rounded-full transition-all ${i>=90?"bg-red-500":i>=75?"bg-amber-500":"bg-emerald-500"}`,style:{width:`${Math.min(i,100)}%`}})}),c.jsx("div",{className:"space-y-0.5",children:s.map(m=>c.jsxs("div",{className:"flex items-center justify-between text-xs",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:m.color}}),c.jsx("span",{className:"text-muted-foreground",children:m.label})]}),c.jsxs("span",{className:"tabular-nums text-muted-foreground",children:[m.pct,"%"]})]},m.label))}),e.pruned&&c.jsx("div",{className:"text-2xs text-amber-500 pt-0.5 border-t border-border",children:"Old messages pruned to fit context"})]})})]}),c.jsx(zo,{open:n,onOpenChange:r,children:c.jsxs(uo,{className:"max-w-sm",children:[c.jsxs(ul,{children:[c.jsx(ho,{className:"text-sm",children:"Context Window Breakdown"}),c.jsxs(ju,{className:"text-xs",children:[f(e.total)," / ",f(e.limit)," tokens used (",i,"%)"]})]}),c.jsxs("div",{className:"space-y-3 pt-1",children:[c.jsx("div",{className:"w-full h-2 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:`h-full rounded-full transition-all ${i>=90?"bg-red-500":i>=75?"bg-amber-500":"bg-emerald-500"}`,style:{width:`${Math.min(i,100)}%`}})}),c.jsx("div",{className:"space-y-2",children:s.map(m=>c.jsxs("div",{className:"flex items-center justify-between text-sm",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full",style:{backgroundColor:m.color}}),c.jsx("span",{children:m.label})]}),c.jsxs("div",{className:"text-muted-foreground tabular-nums",children:[c.jsx("span",{className:"font-medium text-foreground",children:f(m.tokens)})," ",c.jsxs("span",{className:"text-xs",children:["(",m.pct,"%)"]})]})]},m.label))}),e.pruned&&c.jsx("div",{className:"rounded-md border border-amber-500/20 bg-amber-500/5 p-2 text-xs text-amber-600",children:"Older messages were pruned to fit within the context window limit."})]})]})})]})}const hU=[{value:"developer",label:"Developer",icon:z_,description:"Chat with the AI assistant — ask, plan, and execute"},{value:"manager",label:"Manager",icon:oA,description:"Automation — delegate tasks to agent threads on repos"}];function Xnt({mode:e,onChange:n,disabled:r,className:i,compact:s=!1}){const a=hU.findIndex(l=>l.value===e),o=a>=0?a:0;return c.jsxs("div",{role:"tablist","aria-label":"View mode",className:je("relative inline-grid h-10 grid-cols-2 rounded-lg bg-muted/40 p-0.5 sm:h-8",s?"border-0":"border border-border/70","shadow-sm transition-colors",r&&"pointer-events-none opacity-50",i),children:[c.jsx("div",{"aria-hidden":"true",className:je("absolute inset-y-0.5 left-0.5 w-[calc(50%-2px)] rounded-md bg-background shadow-sm","transition-transform duration-200 ease-out"),style:{transform:`translateX(${o*100}%)`}}),hU.map(l=>{const u=l.icon,d=e===l.value;return c.jsxs("button",{type:"button",role:"tab","aria-selected":d,"aria-label":l.label,title:`${l.label}: ${l.description}`,disabled:r,onClick:()=>n(l.value),className:je("relative z-10 flex min-w-0 items-center justify-center gap-1.5 rounded-md px-2 text-xs font-medium","transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",d?"text-foreground":"text-muted-foreground hover:text-foreground",s?"w-10 sm:w-9":"min-w-[5.75rem]"),children:[c.jsx(u,{className:"h-3.5 w-3.5 shrink-0"}),!s&&c.jsx("span",{children:l.label})]},l.value)})]})}function Jnt({isMaximized:e}){return c.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[c.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:c.jsx(c3,{className:"h-4 w-4"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:e?c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:c.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):c.jsx(f1,{className:"h-3 w-3"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowClose(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-red-600 hover:text-white transition-colors",children:c.jsx(Ur,{className:"h-4 w-4"})})]})}function Znt(e,n=[]){let r=[];function i(a,o){const l=y.createContext(o);l.displayName=a+"Context";const u=r.length;r=[...r,o];const d=f=>{var S;const{scope:m,children:x,...v}=f,_=((S=m==null?void 0:m[e])==null?void 0:S[u])||l,w=y.useMemo(()=>v,Object.values(v));return c.jsx(_.Provider,{value:w,children:x})};d.displayName=a+"Provider";function h(f,m){var _;const x=((_=m==null?void 0:m[e])==null?void 0:_[u])||l,v=y.useContext(x);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[d,h]}const s=()=>{const a=r.map(o=>y.createContext(o));return function(l){const u=(l==null?void 0:l[e])||a;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return s.scopeName=e,[i,Qnt(s,...n)]}function Qnt(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=i.reduce((l,{useScope:u,scopeName:d})=>{const f=u(a)[`__scope${d}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return r.scopeName=n.scopeName,r}function ert(){return qAe.useSyncExternalStore(trt,()=>!0,()=>!1)}function trt(){return()=>{}}var VP="Avatar",[nrt]=Znt(VP),[rrt,Ple]=nrt(VP),Lle=y.forwardRef((e,n)=>{const{__scopeAvatar:r,...i}=e,[s,a]=y.useState("idle");return c.jsx(rrt,{scope:r,imageLoadingStatus:s,onImageLoadingStatusChange:a,children:c.jsx(tS.span,{...i,ref:n})})});Lle.displayName=VP;var $le="AvatarImage",Dle=y.forwardRef((e,n)=>{const{__scopeAvatar:r,src:i,onLoadingStatusChange:s=()=>{},...a}=e,o=Ple($le,r),l=irt(i,a),u=Cd(d=>{s(d),o.onImageLoadingStatusChange(d)});return na(()=>{l!=="idle"&&u(l)},[l,u]),l==="loaded"?c.jsx(tS.img,{...a,ref:n,src:i}):null});Dle.displayName=$le;var Ile="AvatarFallback",Ble=y.forwardRef((e,n)=>{const{__scopeAvatar:r,delayMs:i,...s}=e,a=Ple(Ile,r),[o,l]=y.useState(i===void 0);return y.useEffect(()=>{if(i!==void 0){const u=window.setTimeout(()=>l(!0),i);return()=>window.clearTimeout(u)}},[i]),o&&a.imageLoadingStatus!=="loaded"?c.jsx(tS.span,{...s,ref:n}):null});Ble.displayName=Ile;function fU(e,n){return e?n?(e.src!==n&&(e.src=n),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function irt(e,{referrerPolicy:n,crossOrigin:r}){const i=ert(),s=y.useRef(null),a=i?(s.current||(s.current=new window.Image),s.current):null,[o,l]=y.useState(()=>fU(a,e));return na(()=>{l(fU(a,e))},[a,e]),na(()=>{const u=f=>()=>{l(f)};if(!a)return;const d=u("loaded"),h=u("error");return a.addEventListener("load",d),a.addEventListener("error",h),n&&(a.referrerPolicy=n),typeof r=="string"&&(a.crossOrigin=r),()=>{a.removeEventListener("load",d),a.removeEventListener("error",h)}},[a,r,n]),o}var zle=Lle,Fle=Dle,Hle=Ble;const o7=y.forwardRef(({className:e,...n},r)=>c.jsx(zle,{ref:r,className:je("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...n}));o7.displayName=zle.displayName;const srt=y.forwardRef(({className:e,...n},r)=>c.jsx(Fle,{ref:r,className:je("aspect-square h-full w-full",e),...n}));srt.displayName=Fle.displayName;const l7=y.forwardRef(({className:e,...n},r)=>c.jsx(Hle,{ref:r,className:je("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...n}));l7.displayName=Hle.displayName;const pU=["lowp","mediump","highp"],art=`
1253
1253
  void main(void){