@jait/gateway 0.1.302 → 0.1.303
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web-dist/assets/{_basePickBy-DZGKKK9x.js → _basePickBy-BgC2rNUG.js} +1 -1
- package/web-dist/assets/{_baseUniq-Cg6dKB9S.js → _baseUniq-DwbJum7y.js} +1 -1
- package/web-dist/assets/{arc-D_p_SuYQ.js → arc-8ZZGxfps.js} +1 -1
- package/web-dist/assets/{architectureDiagram-2XIMDMQ5-BapkPGDU.js → architectureDiagram-2XIMDMQ5-BIRHVOVy.js} +1 -1
- package/web-dist/assets/{blockDiagram-WCTKOSBZ-D4rImOrf.js → blockDiagram-WCTKOSBZ-DYH8NE9b.js} +1 -1
- package/web-dist/assets/{c4Diagram-IC4MRINW-DvH6VGKv.js → c4Diagram-IC4MRINW-MJZoA94O.js} +1 -1
- package/web-dist/assets/channel-Cw88TIiQ.js +1 -0
- package/web-dist/assets/{chunk-4BX2VUAB-jhd3l5pv.js → chunk-4BX2VUAB-8kTLbAvo.js} +1 -1
- package/web-dist/assets/{chunk-55IACEB6-DRe7xS-J.js → chunk-55IACEB6-DdIs-0JM.js} +1 -1
- package/web-dist/assets/{chunk-FMBD7UC4-Csnem7Pv.js → chunk-FMBD7UC4-Clsh2IA4.js} +1 -1
- package/web-dist/assets/{chunk-JSJVCQXG-3WzK_tWR.js → chunk-JSJVCQXG-DOPi-ir0.js} +1 -1
- package/web-dist/assets/{chunk-KX2RTZJC-ta7STeDZ.js → chunk-KX2RTZJC-D6GI22pJ.js} +1 -1
- package/web-dist/assets/{chunk-NQ4KR5QH-C5rcLR7r.js → chunk-NQ4KR5QH-CizlILRd.js} +1 -1
- package/web-dist/assets/{chunk-QZHKN3VN-91dXhSGW.js → chunk-QZHKN3VN-DAQNXoOS.js} +1 -1
- package/web-dist/assets/{chunk-WL4C6EOR-Bfxy7Qes.js → chunk-WL4C6EOR-BxSQ0WZ5.js} +1 -1
- package/web-dist/assets/classDiagram-VBA2DB6C-C2mVFiAh.js +1 -0
- package/web-dist/assets/classDiagram-v2-RAHNMMFH-C2mVFiAh.js +1 -0
- package/web-dist/assets/clone-CIbo0o1s.js +1 -0
- package/web-dist/assets/{cose-bilkent-S5V4N54A-yI4FYkLt.js → cose-bilkent-S5V4N54A-C6g4l6Ql.js} +1 -1
- package/web-dist/assets/{dagre-KLK3FWXG-ql_Qolo4.js → dagre-KLK3FWXG-BxgiL9pM.js} +1 -1
- package/web-dist/assets/{diagram-E7M64L7V-D9F4wqvd.js → diagram-E7M64L7V-JYAhICIm.js} +1 -1
- package/web-dist/assets/{diagram-IFDJBPK2-hGl2tlvE.js → diagram-IFDJBPK2-BTA1xdpL.js} +1 -1
- package/web-dist/assets/{diagram-P4PSJMXO-BeflH_B7.js → diagram-P4PSJMXO-Cc32T5x0.js} +1 -1
- package/web-dist/assets/{erDiagram-INFDFZHY-BFUGxl2Z.js → erDiagram-INFDFZHY-BInCXgkf.js} +1 -1
- package/web-dist/assets/{flowDiagram-PKNHOUZH-FwoJu6Ir.js → flowDiagram-PKNHOUZH-OQ5bom4C.js} +1 -1
- package/web-dist/assets/{ganttDiagram-A5KZAMGK-BFjzR2lU.js → ganttDiagram-A5KZAMGK-QHxjp7V_.js} +1 -1
- package/web-dist/assets/{gitGraphDiagram-K3NZZRJ6-y1-IY6AA.js → gitGraphDiagram-K3NZZRJ6-DMwkkIrk.js} +1 -1
- package/web-dist/assets/{graph-D3fiA1yF.js → graph-BxMwYUqQ.js} +1 -1
- package/web-dist/assets/{index-DvkADF6v.js → index-Dq41yItG.js} +4 -4
- package/web-dist/assets/{infoDiagram-LFFYTUFH-D4ia-2pB.js → infoDiagram-LFFYTUFH-Cw8LQL1O.js} +1 -1
- package/web-dist/assets/{ishikawaDiagram-PHBUUO56-ORtuIfvv.js → ishikawaDiagram-PHBUUO56-OcfxZEH2.js} +1 -1
- package/web-dist/assets/{journeyDiagram-4ABVD52K-D3LliMQG.js → journeyDiagram-4ABVD52K-DK9eccjh.js} +1 -1
- package/web-dist/assets/{kanban-definition-K7BYSVSG-BJVuvNzm.js → kanban-definition-K7BYSVSG-E-VBNMAP.js} +1 -1
- package/web-dist/assets/{layout-Bbp4_Ntg.js → layout-BmRO6wPP.js} +1 -1
- package/web-dist/assets/{linear-BGLUIIiX.js → linear-DpovdJ-d.js} +1 -1
- package/web-dist/assets/{mindmap-definition-YRQLILUH-DrEesgUC.js → mindmap-definition-YRQLILUH-rgBIkFrT.js} +1 -1
- package/web-dist/assets/{pieDiagram-SKSYHLDU-0p3W75az.js → pieDiagram-SKSYHLDU-CTcbBuFU.js} +1 -1
- package/web-dist/assets/{quadrantDiagram-337W2JSQ-CpJga4R_.js → quadrantDiagram-337W2JSQ-Bg0mh1ui.js} +1 -1
- package/web-dist/assets/{requirementDiagram-Z7DCOOCP-CGrLw35d.js → requirementDiagram-Z7DCOOCP-DHg6iIYI.js} +1 -1
- package/web-dist/assets/{sankeyDiagram-WA2Y5GQK-DaSE1lXd.js → sankeyDiagram-WA2Y5GQK-DxI3ew3V.js} +1 -1
- package/web-dist/assets/{sequenceDiagram-2WXFIKYE-BTcO0nH_.js → sequenceDiagram-2WXFIKYE-BRpg0rQN.js} +1 -1
- package/web-dist/assets/{stateDiagram-RAJIS63D-COza0oQJ.js → stateDiagram-RAJIS63D-DHJ8iYcQ.js} +1 -1
- package/web-dist/assets/stateDiagram-v2-FVOUBMTO-_nxUW_Jf.js +1 -0
- package/web-dist/assets/{timeline-definition-YZTLITO2-DDlXWFhI.js → timeline-definition-YZTLITO2-DXlStXKl.js} +1 -1
- package/web-dist/assets/{treemap-KZPCXAKY-Cc93Tj3t.js → treemap-KZPCXAKY-8EgFmnrX.js} +1 -1
- package/web-dist/assets/{vennDiagram-LZ73GAT5-BklaAhSn.js → vennDiagram-LZ73GAT5-DKJjZGOv.js} +1 -1
- package/web-dist/assets/{xychartDiagram-JWTSCODW-CmbJdoF-.js → xychartDiagram-JWTSCODW-DrCgL1xX.js} +1 -1
- package/web-dist/index.html +1 -1
- package/web-dist/assets/channel-0W4y5Fhi.js +0 -1
- package/web-dist/assets/classDiagram-VBA2DB6C-CE8VqvFx.js +0 -1
- package/web-dist/assets/classDiagram-v2-RAHNMMFH-CE8VqvFx.js +0 -1
- package/web-dist/assets/clone-CSN2CcS7.js +0 -1
- package/web-dist/assets/stateDiagram-v2-FVOUBMTO-Bo20-Z8f.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-
|
|
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-BxgiL9pM.js","./graph-BxMwYUqQ.js","./_baseUniq-DwbJum7y.js","./layout-BmRO6wPP.js","./_basePickBy-BgC2rNUG.js","./clone-CIbo0o1s.js","./cose-bilkent-S5V4N54A-C6g4l6Ql.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-MJZoA94O.js","./chunk-JSJVCQXG-DOPi-ir0.js","./flowDiagram-PKNHOUZH-OQ5bom4C.js","./chunk-FMBD7UC4-Clsh2IA4.js","./chunk-55IACEB6-DdIs-0JM.js","./chunk-KX2RTZJC-D6GI22pJ.js","./channel-Cw88TIiQ.js","./erDiagram-INFDFZHY-BInCXgkf.js","./gitGraphDiagram-K3NZZRJ6-DMwkkIrk.js","./chunk-4BX2VUAB-8kTLbAvo.js","./chunk-QZHKN3VN-DAQNXoOS.js","./treemap-KZPCXAKY-8EgFmnrX.js","./ganttDiagram-A5KZAMGK-QHxjp7V_.js","./linear-DpovdJ-d.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-Cw8LQL1O.js","./pieDiagram-SKSYHLDU-CTcbBuFU.js","./arc-8ZZGxfps.js","./quadrantDiagram-337W2JSQ-Bg0mh1ui.js","./xychartDiagram-JWTSCODW-DrCgL1xX.js","./requirementDiagram-Z7DCOOCP-DHg6iIYI.js","./sequenceDiagram-2WXFIKYE-BRpg0rQN.js","./classDiagram-VBA2DB6C-C2mVFiAh.js","./chunk-WL4C6EOR-BxSQ0WZ5.js","./classDiagram-v2-RAHNMMFH-C2mVFiAh.js","./stateDiagram-RAJIS63D-DHJ8iYcQ.js","./chunk-NQ4KR5QH-CizlILRd.js","./stateDiagram-v2-FVOUBMTO-_nxUW_Jf.js","./journeyDiagram-4ABVD52K-DK9eccjh.js","./timeline-definition-YZTLITO2-DXlStXKl.js","./mindmap-definition-YRQLILUH-rgBIkFrT.js","./kanban-definition-K7BYSVSG-E-VBNMAP.js","./diagram-P4PSJMXO-Cc32T5x0.js","./diagram-IFDJBPK2-BTA1xdpL.js","./blockDiagram-WCTKOSBZ-DYH8NE9b.js","./architectureDiagram-2XIMDMQ5-BIRHVOVy.js","./diagram-E7M64L7V-JYAhICIm.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var Bhe=Object.defineProperty;var zhe=(e,r,n)=>r in e?Bhe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var Fe=(e,r,n)=>zhe(e,typeof r!="symbol"?r+"":r,n);function Fhe(e,r){for(var n=0;n<r.length;n++){const i=r[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function p0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Z0t(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var n=function i(){return this instanceof i?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}),n}var N6={exports:{}},jx={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -1056,8 +1056,8 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
1056
1056
|
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,s=e.y,o=Math.abs(i-n.x),a=e.width/2;let l=n.x<r.x?a-o:a+o;const u=e.height/2,c=Math.abs(r.y-n.y),p=Math.abs(r.x-n.x);if(Math.abs(s-r.y)*a>Math.abs(i-r.x)*u){let f=n.y<r.y?r.y-u-s:s-u-r.y;l=p*f/c;const g={x:n.x<r.x?n.x+l:n.x-p+l,y:n.y<r.y?n.y+c-f:n.y-c+f};return l===0&&(g.x=r.x,g.y=r.y),p===0&&(g.x=r.x),c===0&&(g.y=r.y),yt.debug(`abc89 top/bottom calc, Q ${c}, q ${f}, R ${p}, r ${l}`,g),g}else{n.x<r.x?l=r.x-a-i:l=i-a-r.x;let f=c*l/p,g=n.x<r.x?n.x+p-l:n.x-p+l,y=n.y<r.y?n.y+f:n.y-f;return yt.debug(`sides calc abc89, Q ${c}, q ${f}, R ${p}, r ${l}`,{_x:g,_y:y}),l===0&&(g=r.x,y=r.y),p===0&&(g=r.x),c===0&&(y=r.y),{x:g,y}}},"intersection"),eF=Y((e,r)=>{yt.warn("abc88 cutPathAtIntersect",e,r);let n=[],i=e[0],s=!1;return e.forEach(o=>{if(yt.info("abc88 checking point",o,r),!uUe(r,o)&&!s){const a=hUe(r,i,o);yt.debug("abc88 inside",o,i,a),yt.debug("abc88 intersection",a,r);let l=!1;n.forEach(u=>{l=l||u.x===a.x&&u.y===a.y}),n.some(u=>u.x===a.x&&u.y===a.y)?yt.warn("abc88 no intersect",a,n):n.push(a),s=!0}else yt.warn("abc88 outside",o,i),i=o,s||n.push(o)}),yt.debug("returning points",n),n},"cutPathAtIntersect");function Rie(e){const r=[],n=[];for(let i=1;i<e.length-1;i++){const s=e[i-1],o=e[i],a=e[i+1];(s.x===o.x&&o.y===a.y&&Math.abs(o.x-a.x)>5&&Math.abs(o.y-s.y)>5||s.y===o.y&&o.x===a.x&&Math.abs(o.x-s.x)>5&&Math.abs(o.y-a.y)>5)&&(r.push(o),n.push(i))}return{cornerPoints:r,cornerPointPositions:n}}Y(Rie,"extractCornerPoints");var tF=Y(function(e,r,n){const i=r.x-e.x,s=r.y-e.y,o=Math.sqrt(i*i+s*s),a=n/o;return{x:r.x-a*i,y:r.y-a*s}},"findAdjacentPoint"),dUe=Y(function(e){const{cornerPointPositions:r}=Rie(e),n=[];for(let i=0;i<e.length;i++)if(r.includes(i)){const s=e[i-1],o=e[i+1],a=e[i],l=tF(s,a,5),u=tF(o,a,5),c=u.x-l.x,p=u.y-l.y;n.push(l);const f=Math.sqrt(2)*2;let g={x:a.x,y:a.y};if(Math.abs(o.x-s.x)>10&&Math.abs(o.y-s.y)>=10){yt.debug("Corner point fixing",Math.abs(o.x-s.x),Math.abs(o.y-s.y));const y=5;a.x===l.x?g={x:c<0?l.x-y+f:l.x+y-f,y:p<0?l.y-f:l.y+f}:g={x:c<0?l.x-f:l.x+f,y:p<0?l.y-y+f:l.y+y-f}}else yt.debug("Corner point skipping fixing",Math.abs(o.x-s.x),Math.abs(o.y-s.y));n.push(g,u)}else n.push(e[i]);return n},"fixCorners"),fUe=Y((e,r,n)=>{const i=e-r-n,s=2,o=2,a=s+o,l=Math.floor(i/a),u=Array(l).fill(`${s} ${o}`).join(" ");return`0 ${r} ${u} ${n}`},"generateDashArray"),pUe=Y(function(e,r,n,i,s,o,a,l=!1){var P;const{handDrawnSeed:u}=Vn();let c=r.points,p=!1;const f=s;var g=o;const y=[];for(const L in r.cssCompiledStyles)Rre(L)||y.push(r.cssCompiledStyles[L]);yt.debug("UIO intersect check",r.points,g.x,f.x),g.intersect&&f.intersect&&!l&&(c=c.slice(1,r.points.length-1),c.unshift(f.intersect(c[0])),yt.debug("Last point UIO",r.start,"-->",r.end,c[c.length-1],g,g.intersect(c[c.length-1])),c.push(g.intersect(c[c.length-1])));const b=btoa(JSON.stringify(c));r.toCluster&&(yt.info("to cluster abc88",n.get(r.toCluster)),c=eF(r.points,n.get(r.toCluster).node),p=!0),r.fromCluster&&(yt.debug("from cluster abc88",n.get(r.fromCluster),JSON.stringify(c,null,2)),c=eF(c.reverse(),n.get(r.fromCluster).node).reverse(),p=!0);let _=c.filter(L=>!Number.isNaN(L.y));const C=aUe(r.curve);C!=="rounded"&&(_=dUe(_));let w=o_;switch(C){case"linear":w=o_;break;case"basis":w=nO;break;case"cardinal":w=fee;break;case"bumpX":w=lee;break;case"bumpY":w=cee;break;case"catmullRom":w=mee;break;case"monotoneX":w=_ee;break;case"monotoneY":w=wee;break;case"natural":w=Cee;break;case"step":w=kee;break;case"stepAfter":w=Tee;break;case"stepBefore":w=jee;break;case"rounded":w=o_;break;default:w=nO}const{x:k,y:j}=uBe(r),N=zDe().x(k).y(j).curve(w);let O;switch(r.thickness){case"normal":O="edge-thickness-normal";break;case"thick":O="edge-thickness-thick";break;case"invisible":O="edge-thickness-invisible";break;default:O="edge-thickness-normal"}switch(r.pattern){case"solid":O+=" edge-pattern-solid";break;case"dotted":O+=" edge-pattern-dotted";break;case"dashed":O+=" edge-pattern-dashed";break;default:O+=" edge-pattern-solid"}let E,M=C==="rounded"?Pie(Lie(_,r),5):N(_);const R=Array.isArray(r.style)?r.style:[r.style];let W=R.find(L=>L==null?void 0:L.startsWith("stroke:")),I="";r.animate&&(I="edge-animation-fast"),r.animation&&(I="edge-animation-"+r.animation);let F=!1;if(r.look==="handDrawn"){const L=ur.svg(e);Object.assign([],_);const B=L.path(M,{roughness:.3,seed:u});O+=" transition",E=Lr(B).select("path").attr("id",r.id).attr("class"," "+O+(r.classes?" "+r.classes:"")+(I?" "+I:"")).attr("style",R?R.reduce((z,q)=>z+";"+q,""):"");let K=E.attr("d");E.attr("d",K),e.node().appendChild(E.node())}else{const L=y.join(";"),B=R?R.reduce((se,te)=>se+te+";",""):"",K=(L?L+";"+B+";":B)+";"+(R?R.reduce((se,te)=>se+";"+te,""):"");E=e.append("path").attr("d",M).attr("id",r.id).attr("class"," "+O+(r.classes?" "+r.classes:"")+(I?" "+I:"")).attr("style",K),W=(P=K.match(/stroke:([^;]+)/))==null?void 0:P[1],F=r.animate===!0||!!r.animation||L.includes("animation");const z=E.node(),q=typeof z.getTotalLength=="function"?z.getTotalLength():0,J=gz[r.arrowTypeStart]||0,X=gz[r.arrowTypeEnd]||0;if(r.look==="neo"&&!F){const te=`stroke-dasharray: ${r.pattern==="dotted"||r.pattern==="dashed"?fUe(q,J,X):`0 ${J} ${q-J-X} ${X}`}; stroke-dashoffset: 0;`;E.attr("style",te+E.attr("style"))}}E.attr("data-edge",!0),E.attr("data-et","edge"),E.attr("data-id",r.id),E.attr("data-points",b),r.showPoints&&_.forEach(L=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",L.x).attr("cy",L.y)});let D="";(Vn().flowchart.arrowMarkerAbsolute||Vn().state.arrowMarkerAbsolute)&&(D=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,D=D.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),yt.info("arrowTypeStart",r.arrowTypeStart),yt.info("arrowTypeEnd",r.arrowTypeEnd),sUe(E,r,D,a,i,W);const G=Math.floor(c.length/2),$=c[G];Qu.isLabelCoordinateInPath($,E.attr("d"))||(p=!0);let H={};return p&&(H.updatedPath=c),H.originalPath=r.points,H},"insertEdge");function Pie(e,r){if(e.length<2)return"";let n="";const i=e.length,s=1e-5;for(let o=0;o<i;o++){const a=e[o],l=e[o-1],u=e[o+1];if(o===0)n+=`M${a.x},${a.y}`;else if(o===i-1)n+=`L${a.x},${a.y}`;else{const c=a.x-l.x,p=a.y-l.y,f=u.x-a.x,g=u.y-a.y,y=Math.hypot(c,p),b=Math.hypot(f,g);if(y<s||b<s){n+=`L${a.x},${a.y}`;continue}const _=c/y,C=p/y,w=f/b,k=g/b,j=_*w+C*k,N=Math.max(-1,Math.min(1,j)),O=Math.acos(N);if(O<s||Math.abs(Math.PI-O)<s){n+=`L${a.x},${a.y}`;continue}const E=Math.min(r/Math.sin(O/2),y/2,b/2),M=a.x-_*E,R=a.y-C*E,W=a.x+w*E,I=a.y+k*E;n+=`L${M},${R}`,n+=`Q${a.x},${a.y} ${W},${I}`}}return n}Y(Pie,"generateRoundedPath");function AO(e,r){if(!e||!r)return{angle:0,deltaX:0,deltaY:0};const n=r.x-e.x,i=r.y-e.y;return{angle:Math.atan2(i,n),deltaX:n,deltaY:i}}Y(AO,"calculateDeltaAndAngle");function Lie(e,r){const n=e.map(s=>({...s}));if(e.length>=2&&la[r.arrowTypeStart]){const s=la[r.arrowTypeStart],o=e[0],a=e[1],{angle:l}=AO(o,a),u=s*Math.cos(l),c=s*Math.sin(l);n[0].x=o.x+u,n[0].y=o.y+c}const i=e.length;if(i>=2&&la[r.arrowTypeEnd]){const s=la[r.arrowTypeEnd],o=e[i-1],a=e[i-2],{angle:l}=AO(a,o),u=s*Math.cos(l),c=s*Math.sin(l);n[i-1].x=o.x-u,n[i-1].y=o.y-c}return n}Y(Lie,"applyMarkerOffsetsToPoints");var mUe=Y((e,r,n,i)=>{r.forEach(s=>{AUe[s](e,n,i)})},"insertMarkers"),gUe=Y((e,r,n)=>{yt.trace("Making markers for ",n),e.append("defs").append("marker").attr("id",n+"_"+r+"-extensionStart").attr("class","marker extension "+r).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",n+"_"+r+"-extensionEnd").attr("class","marker extension "+r).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"),yUe=Y((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-compositionStart").attr("class","marker composition "+r).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",n+"_"+r+"-compositionEnd").attr("class","marker composition "+r).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"),vUe=Y((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-aggregationStart").attr("class","marker aggregation "+r).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",n+"_"+r+"-aggregationEnd").attr("class","marker aggregation "+r).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"),xUe=Y((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-dependencyStart").attr("class","marker dependency "+r).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",n+"_"+r+"-dependencyEnd").attr("class","marker dependency "+r).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"),bUe=Y((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-lollipopStart").attr("class","marker lollipop "+r).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",n+"_"+r+"-lollipopEnd").attr("class","marker lollipop "+r).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"),_Ue=Y((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-pointEnd").attr("class","marker "+r).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",n+"_"+r+"-pointStart").attr("class","marker "+r).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"),wUe=Y((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-circleEnd").attr("class","marker "+r).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",n+"_"+r+"-circleStart").attr("class","marker "+r).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"),SUe=Y((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-crossEnd").attr("class","marker cross "+r).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",n+"_"+r+"-crossStart").attr("class","marker cross "+r).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"),CUe=Y((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-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"),kUe=Y((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-onlyOneStart").attr("class","marker onlyOne "+r).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",n+"_"+r+"-onlyOneEnd").attr("class","marker onlyOne "+r).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"),jUe=Y((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrOneStart").attr("class","marker zeroOrOne "+r).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",n+"_"+r+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+r).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"),TUe=Y((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-oneOrMoreStart").attr("class","marker oneOrMore "+r).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",n+"_"+r+"-oneOrMoreEnd").attr("class","marker oneOrMore "+r).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"),EUe=Y((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+r).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",n+"_"+r+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+r).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"),NUe=Y((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
|
|
1057
1057
|
L20,10
|
|
1058
1058
|
M20,10
|
|
1059
|
-
L0,20`)},"requirement_arrow"),OUe=Y((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-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"),AUe={extension:gUe,composition:yUe,aggregation:vUe,dependency:xUe,lollipop:bUe,point:_Ue,circle:wUe,cross:SUe,barb:CUe,only_one:kUe,zero_or_one:jUe,one_or_more:TUe,zero_or_more:EUe,requirement_arrow:NUe,requirement_contains:OUe},MUe=mUe,RUe={common:Yw,getConfig:ga,insertCluster:BWe,insertEdge:pUe,insertEdgeLabel:lUe,insertMarkers:MUe,insertNode:Mie,interpolateToCurve:FM,labelHelper:Ir,log:yt,positionEdgeLabel:cUe},v2={},$ie=Y(e=>{for(const r of e)v2[r.name]=r},"registerLayoutLoaders"),PUe=Y(()=>{$ie([{name:"dagre",loader:Y(async()=>await qe(()=>import("./dagre-KLK3FWXG-
|
|
1060
|
-
`);const i=rIe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),EQ(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 ${n}`)},"draw"),ese={draw:aqe},lqe=ese,cqe={db:{},renderer:ese,parser:{parse:Y(()=>{},"parse")}},uqe=cqe,tse="flowchart-elk",hqe=Y((e,r={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(r.layout="elk",!0):!1},"detector"),dqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-
|
|
1059
|
+
L0,20`)},"requirement_arrow"),OUe=Y((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-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"),AUe={extension:gUe,composition:yUe,aggregation:vUe,dependency:xUe,lollipop:bUe,point:_Ue,circle:wUe,cross:SUe,barb:CUe,only_one:kUe,zero_or_one:jUe,one_or_more:TUe,zero_or_more:EUe,requirement_arrow:NUe,requirement_contains:OUe},MUe=mUe,RUe={common:Yw,getConfig:ga,insertCluster:BWe,insertEdge:pUe,insertEdgeLabel:lUe,insertMarkers:MUe,insertNode:Mie,interpolateToCurve:FM,labelHelper:Ir,log:yt,positionEdgeLabel:cUe},v2={},$ie=Y(e=>{for(const r of e)v2[r.name]=r},"registerLayoutLoaders"),PUe=Y(()=>{$ie([{name:"dagre",loader:Y(async()=>await qe(()=>import("./dagre-KLK3FWXG-BxgiL9pM.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:Y(async()=>await qe(()=>import("./cose-bilkent-S5V4N54A-C6g4l6Ql.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");PUe();var Iyt=Y(async(e,r)=>{if(!(e.layoutAlgorithm in v2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=v2[e.layoutAlgorithm];return(await n.loader()).render(e,r,RUe,{algorithm:n.algorithm})},"render"),Byt=Y((e="",{fallback:r="dagre"}={})=>{if(e in v2)return e;if(r in v2)return yt.warn(`Layout algorithm ${e} is not registered. Using ${r} as fallback.`),r;throw new Error(`Both layout algorithms ${e} and ${r} are not registered.`)},"getRegisteredLayoutAlgorithm"),LUe=dre(Object.keys,Object),$Ue=Object.prototype,DUe=$Ue.hasOwnProperty;function IUe(e){if(!lj(e))return LUe(e);var r=[];for(var n in Object(e))DUe.call(e,n)&&n!="constructor"&&r.push(n);return r}var MO=k0(bh,"DataView"),RO=k0(bh,"Promise"),PO=k0(bh,"Set"),LO=k0(bh,"WeakMap"),rF="[object Map]",BUe="[object Object]",nF="[object Promise]",iF="[object Set]",sF="[object WeakMap]",oF="[object DataView]",zUe=C0(MO),FUe=C0(g2),HUe=C0(RO),WUe=C0(PO),UUe=C0(LO),Sg=S0;(MO&&Sg(new MO(new ArrayBuffer(1)))!=oF||g2&&Sg(new g2)!=rF||RO&&Sg(RO.resolve())!=nF||PO&&Sg(new PO)!=iF||LO&&Sg(new LO)!=sF)&&(Sg=function(e){var r=S0(e),n=r==BUe?e.constructor:void 0,i=n?C0(n):"";if(i)switch(i){case zUe:return oF;case FUe:return rF;case HUe:return nF;case WUe:return iF;case UUe:return sF}return r});var VUe="[object Map]",qUe="[object Set]",GUe=Object.prototype,KUe=GUe.hasOwnProperty;function aF(e){if(e==null)return!0;if(cj(e)&&(o5(e)||typeof e=="string"||typeof e.splice=="function"||BM(e)||zM(e)||s5(e)))return!e.length;var r=Sg(e);if(r==VUe||r==qUe)return!e.size;if(lj(e))return!IUe(e).length;for(var n in e)if(KUe.call(e,n))return!1;return!0}var Die="c4",YUe=Y(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),XUe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-MJZoA94O.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:Die,diagram:e}},"loader"),ZUe={id:Die,detector:YUe,loader:XUe},JUe=ZUe,Iie="flowchart",QUe=Y((e,r)=>{var n,i;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"||((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),eVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-OQ5bom4C.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Iie,diagram:e}},"loader"),tVe={id:Iie,detector:QUe,loader:eVe},rVe=tVe,Bie="flowchart-v2",nVe=Y((e,r)=>{var n,i,s;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-d3"?!1:(((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(r.layout="elk"),/^\s*graph/.test(e)&&((s=r==null?void 0:r.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),iVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-OQ5bom4C.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Bie,diagram:e}},"loader"),sVe={id:Bie,detector:nVe,loader:iVe},oVe=sVe,zie="er",aVe=Y(e=>/^\s*erDiagram/.test(e),"detector"),lVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-BInCXgkf.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:zie,diagram:e}},"loader"),cVe={id:zie,detector:aVe,loader:lVe},uVe=cVe,Fie="gitGraph",hVe=Y(e=>/^\s*gitGraph/.test(e),"detector"),dVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-DMwkkIrk.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:Fie,diagram:e}},"loader"),fVe={id:Fie,detector:hVe,loader:dVe},pVe=fVe,Hie="gantt",mVe=Y(e=>/^\s*gantt/.test(e),"detector"),gVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-QHxjp7V_.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:Hie,diagram:e}},"loader"),yVe={id:Hie,detector:mVe,loader:gVe},vVe=yVe,Wie="info",xVe=Y(e=>/^\s*info/.test(e),"detector"),bVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-Cw8LQL1O.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:Wie,diagram:e}},"loader"),_Ve={id:Wie,detector:xVe,loader:bVe},Uie="pie",wVe=Y(e=>/^\s*pie/.test(e),"detector"),SVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-CTcbBuFU.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:Uie,diagram:e}},"loader"),CVe={id:Uie,detector:wVe,loader:SVe},Vie="quadrantChart",kVe=Y(e=>/^\s*quadrantChart/.test(e),"detector"),jVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-Bg0mh1ui.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:Vie,diagram:e}},"loader"),TVe={id:Vie,detector:kVe,loader:jVe},EVe=TVe,qie="xychart",NVe=Y(e=>/^\s*xychart(-beta)?/.test(e),"detector"),OVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-DrCgL1xX.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:qie,diagram:e}},"loader"),AVe={id:qie,detector:NVe,loader:OVe},MVe=AVe,Gie="requirement",RVe=Y(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),PVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-DHg6iIYI.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:Gie,diagram:e}},"loader"),LVe={id:Gie,detector:RVe,loader:PVe},$Ve=LVe,Kie="sequence",DVe=Y(e=>/^\s*sequenceDiagram/.test(e),"detector"),IVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-BRpg0rQN.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:Kie,diagram:e}},"loader"),BVe={id:Kie,detector:DVe,loader:IVe},zVe=BVe,Yie="class",FVe=Y((e,r)=>{var n;return((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),HVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-C2mVFiAh.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:Yie,diagram:e}},"loader"),WVe={id:Yie,detector:FVe,loader:HVe},UVe=WVe,Xie="classDiagram",VVe=Y((e,r)=>{var n;return/^\s*classDiagram/.test(e)&&((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),qVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-C2mVFiAh.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:Xie,diagram:e}},"loader"),GVe={id:Xie,detector:VVe,loader:qVe},KVe=GVe,Zie="state",YVe=Y((e,r)=>{var n;return((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),XVe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-DHJ8iYcQ.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:Zie,diagram:e}},"loader"),ZVe={id:Zie,detector:YVe,loader:XVe},JVe=ZVe,Jie="stateDiagram",QVe=Y((e,r)=>{var n;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper")},"detector"),eqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-_nxUW_Jf.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:Jie,diagram:e}},"loader"),tqe={id:Jie,detector:QVe,loader:eqe},rqe=tqe,Qie="journey",nqe=Y(e=>/^\s*journey/.test(e),"detector"),iqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-DK9eccjh.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:Qie,diagram:e}},"loader"),sqe={id:Qie,detector:nqe,loader:iqe},oqe=sqe,aqe=Y((e,r,n)=>{yt.debug(`rendering svg for syntax error
|
|
1060
|
+
`);const i=rIe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),EQ(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 ${n}`)},"draw"),ese={draw:aqe},lqe=ese,cqe={db:{},renderer:ese,parser:{parse:Y(()=>{},"parse")}},uqe=cqe,tse="flowchart-elk",hqe=Y((e,r={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(r.layout="elk",!0):!1},"detector"),dqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-OQ5bom4C.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:tse,diagram:e}},"loader"),fqe={id:tse,detector:hqe,loader:dqe},pqe=fqe,rse="timeline",mqe=Y(e=>/^\s*timeline/.test(e),"detector"),gqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-DXlStXKl.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:rse,diagram:e}},"loader"),yqe={id:rse,detector:mqe,loader:gqe},vqe=yqe,nse="mindmap",xqe=Y(e=>/^\s*mindmap/.test(e),"detector"),bqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-rgBIkFrT.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:nse,diagram:e}},"loader"),_qe={id:nse,detector:xqe,loader:bqe},wqe=_qe,ise="kanban",Sqe=Y(e=>/^\s*kanban/.test(e),"detector"),Cqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-E-VBNMAP.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:ise,diagram:e}},"loader"),kqe={id:ise,detector:Sqe,loader:Cqe},jqe=kqe,sse="sankey",Tqe=Y(e=>/^\s*sankey(-beta)?/.test(e),"detector"),Eqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-DxI3ew3V.js");return{diagram:r}},[],import.meta.url);return{id:sse,diagram:e}},"loader"),Nqe={id:sse,detector:Tqe,loader:Eqe},Oqe=Nqe,ose="packet",Aqe=Y(e=>/^\s*packet(-beta)?/.test(e),"detector"),Mqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-Cc32T5x0.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:ose,diagram:e}},"loader"),Rqe={id:ose,detector:Aqe,loader:Mqe},ase="radar",Pqe=Y(e=>/^\s*radar-beta/.test(e),"detector"),Lqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-BTA1xdpL.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:ase,diagram:e}},"loader"),$qe={id:ase,detector:Pqe,loader:Lqe},lse="block",Dqe=Y(e=>/^\s*block(-beta)?/.test(e),"detector"),Iqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-DYH8NE9b.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:lse,diagram:e}},"loader"),Bqe={id:lse,detector:Dqe,loader:Iqe},zqe=Bqe,cse="architecture",Fqe=Y(e=>/^\s*architecture/.test(e),"detector"),Hqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-BIRHVOVy.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:cse,diagram:e}},"loader"),Wqe={id:cse,detector:Fqe,loader:Hqe},Uqe=Wqe,use="ishikawa",Vqe=Y(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),qqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-OcfxZEH2.js");return{diagram:r}},[],import.meta.url);return{id:use,diagram:e}},"loader"),Gqe={id:use,detector:Vqe,loader:qqe},hse="venn",Kqe=Y(e=>/^\s*venn-beta/.test(e),"detector"),Yqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-DKJjZGOv.js");return{diagram:r}},[],import.meta.url);return{id:hse,diagram:e}},"loader"),Xqe={id:hse,detector:Kqe,loader:Yqe},Zqe=Xqe,dse="treemap",Jqe=Y(e=>/^\s*treemap/.test(e),"detector"),Qqe=Y(async()=>{const{diagram:e}=await qe(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-JYAhICIm.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:dse,diagram:e}},"loader"),eGe={id:dse,detector:Jqe,loader:Qqe},lF=!1,yj=Y(()=>{lF||(lF=!0,Fk("error",uqe,e=>e.toLowerCase().trim()==="error"),Fk("---",{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("---")),H8(pqe,wqe,Uqe),H8(JUe,jqe,KVe,UVe,uVe,vVe,_Ve,CVe,$Ve,zVe,oVe,rVe,vqe,pVe,rqe,JVe,oqe,EVe,Oqe,Rqe,MVe,zqe,$qe,Gqe,eGe,Zqe))},"addDiagrams"),tGe=Y(async()=>{yt.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(e0).map(async([n,{detector:i,loader:s}])=>{if(s)try{q8(n)}catch{try{const{diagram:o,id:a}=await s();Fk(a,o,i)}catch(o){throw yt.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete e0[n],o}}}))).filter(n=>n.status==="rejected");if(r.length>0){yt.error(`Failed to load ${r.length} external diagrams`);for(const n of r)yt.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),rGe="graphics-document document";function fse(e,r){e.attr("role",rGe),r!==""&&e.attr("aria-roledescription",r)}Y(fse,"setA11yDiagramInfo");function pse(e,r,n,i){if(e.insert!==void 0){if(n){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(n)}if(r){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(r)}}}Y(pse,"addSVGa11yTitleDescription");var Vg,$O=(Vg=class{constructor(r,n,i,s,o){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=o}static async fromText(r,n={}){var c,p;const i=ga(),s=lM(r,i);r=sHe(r)+`
|
|
1061
1061
|
`;try{q8(s)}catch{const f=GMe(s);if(!f)throw new pQ(`Diagram ${s} not found.`);const{id:g,diagram:y}=await f();Fk(g,y)}const{db:o,parser:a,renderer:l,init:u}=q8(s);return a.parser&&(a.parser.yy=o),(c=o.clear)==null||c.call(o),u==null||u(i),n.title&&((p=o.setDiagramTitle)==null||p.call(o,n.title)),await a.parse(r),new Vg(s,r,o,a,l)}async render(r,n){await this.renderer.draw(this.text,r,n,this)}getParser(){return this.parser}getType(){return this.type}},Y(Vg,"Diagram"),Vg),cF=[],nGe=Y(()=>{cF.forEach(e=>{e()}),cF=[]},"attachFunctions"),iGe=Y(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function mse(e){const r=e.match(fQ);if(!r)return{text:e,metadata:{}};let n=cBe(r[1],{schema:lBe})??{};n=typeof n=="object"&&!Array.isArray(n)?n:{};const i={};return n.displayMode&&(i.displayMode=n.displayMode.toString()),n.title&&(i.title=n.title.toString()),n.config&&(i.config=n.config),{text:e.slice(r[0].length),metadata:i}}Y(mse,"extractFrontMatter");var sGe=Y(e=>e.replace(/\r\n?/g,`
|
|
1062
1062
|
`).replace(/<(\w+)([^>]*)>/g,(r,n,i)=>"<"+n+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),oGe=Y(e=>{const{text:r,metadata:n}=mse(e),{displayMode:i,title:s,config:o={}}=n;return i&&(o.gantt||(o.gantt={}),o.gantt.displayMode=i),{title:s,config:o,text:r}},"processFrontmatter"),aGe=Y(e=>{const r=Qu.detectInit(e)??{},n=Qu.detectDirective(e,"wrap");return Array.isArray(n)?r.wrap=n.some(({type:i})=>i==="wrap"):(n==null?void 0:n.type)==="wrap"&&(r.wrap=!0),{text:qFe(e),directive:r}},"processDirectives");function lR(e){const r=sGe(e),n=oGe(r),i=aGe(n.text),s=qM(n.config,i.directive);return e=iGe(i.text),{code:e,title:n.title,config:s}}Y(lR,"preprocessDiagram");function gse(e){const r=new TextEncoder().encode(e),n=Array.from(r,i=>String.fromCodePoint(i)).join("");return btoa(n)}Y(gse,"toBase64");var lGe=5e4,cGe="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",uGe="sandbox",hGe="loose",dGe="http://www.w3.org/2000/svg",fGe="http://www.w3.org/1999/xlink",pGe="http://www.w3.org/1999/xhtml",mGe="100%",gGe="100%",yGe="border:0;margin:0;",vGe="margin:0",xGe="allow-top-navigation-by-user-activation allow-popups",bGe='The "iframe" tag is not supported by your browser.',_Ge=["foreignobject"],wGe=["dominant-baseline"];function cR(e){const r=lR(e);return Bk(),cRe(r.config??{}),r}Y(cR,"processAndSetConfigs");async function yse(e,r){yj();try{const{code:n,config:i}=cR(e);return{diagramType:(await xse(n)).type,config:i}}catch(n){if(r!=null&&r.suppressErrors)return!1;throw n}}Y(yse,"parse");var uF=Y((e,r,n=[])=>`
|
|
1063
1063
|
.${e} ${r} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),SGe=Y((e,r=new Map)=>{let n="";if(e.themeCSS!==void 0&&(n+=`
|
|
@@ -1386,4 +1386,4 @@ ${on.content.slice(0,2e3)}
|
|
|
1386
1386
|
|
|
1387
1387
|
`:""}${Rr.join(`
|
|
1388
1388
|
|
|
1389
|
-
`)}`:Se,displayContent:Se,referencedFiles:Be.length>0?Be:void 0,displaySegments:ue,attachments:tr.size>0?[...tr]:void 0}},[is]),F0=v.useCallback(async(U,Q,fe)=>{const ue=await Hc(e,U,fe);if(!ue)return;const Se=aq(ue.displaySegments,Q);Ao({content:ue.promptWithReferences,displayContent:ue.displayContent||ue.promptWithReferences,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,responseStyle:Sr,model:Xt??void 0,referencedFiles:ue.referencedFiles,displaySegments:Se,attachments:Q}),r(""),i(void 0)},[Je,xt,Yt,Sr,Xt,Ao,e,Hc]),sg=v.useCallback(async(U,Q)=>{if(!$0t(Tc==null?void 0:Tc.name))return;const fe=FN(Q);!fe||fe==="New Chat"||await Gm(U,fe)},[Tc==null?void 0:Tc.name,Gm]),Ms=async(U,Q,fe)=>{if(jt==="manager"||Vt==="thread")return Ji(U,fe);const ue=await Hc(e,U,fe);if(!ue&&(!Q||Q.length===0))return;if(!St){o(!0);return}const Se=(ue==null?void 0:ue.promptWithReferences)??e.trim(),Be=aq(ue==null?void 0:ue.displaySegments,Q),gt=FN((ue==null?void 0:ue.displayContent)||Se);let ft=lt;if(!ft){if(!Cn){Ws();return}const Ot=await Oa(void 0,gt);ft=(Ot==null?void 0:Ot.id)??null}if(ft){if(await sg(ft,(ue==null?void 0:ue.displayContent)||Se),ai||pn.length>0){Ao({content:Se,displayContent:(ue==null?void 0:ue.displayContent)||Se,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,responseStyle:Sr,model:Xt??void 0,referencedFiles:ue==null?void 0:ue.referencedFiles,displaySegments:Be,attachments:Q}),r(""),i(void 0);return}hl(Se,{token:St,sessionId:ft,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,responseStyle:Sr,model:Xt??void 0,onLoginRequired:()=>o(!0),attachments:Q,...ue!=null&&ue.displayContent?{displayContent:ue.displayContent||Se}:{},...ue!=null&&ue.referencedFiles?{referencedFiles:ue.referencedFiles}:{},...Be!=null&&Be.length?{displaySegments:Be}:{}}),r(""),i(void 0)}},Ji=async(U,Q)=>{const fe=await Hc(e,U,Q);!fe||Fs||(r(""),i(void 0),await Ne.handleSend(fe.promptWithReferences,xt,xt!=="jait"?Yt:void 0,Xt??void 0,{displayContent:fe.displayContent||fe.promptWithReferences,referencedFiles:fe.referencedFiles,displaySegments:fe.displaySegments,attachments:fe.attachments}))},mp=v.useRef(!1);v.useEffect(()=>{var Q,fe,ue;if(jt==="manager"||Vt==="thread"||!St||!lt||ai||ul||mp.current)return;const[U]=pn;U&&(mp.current=!0,pl(U.id),Promise.resolve(hl(U.content,{token:St,sessionId:lt,mode:U.mode,provider:U.provider,runtimeMode:U.runtimeMode,responseStyle:U.responseStyle,model:U.model,onLoginRequired:()=>o(!0),...(Q=U.attachments)!=null&&Q.length?{attachments:U.attachments}:{},...U.displayContent?{displayContent:U.displayContent}:{},...(fe=U.referencedFiles)!=null&&fe.length?{referencedFiles:U.referencedFiles}:{},...(ue=U.displaySegments)!=null&&ue.length?{displaySegments:U.displaySegments}:{}})).catch(Se=>{Ao({content:U.content,displayContent:U.displayContent,mode:U.mode,provider:U.provider,runtimeMode:U.runtimeMode,responseStyle:U.responseStyle,model:U.model,referencedFiles:U.referencedFiles,displaySegments:U.displaySegments,attachments:U.attachments}),ni.error(cq(Se instanceof Error?Se.message:null,"Failed to send queued message"))}).finally(()=>{mp.current=!1}))},[lt,pl,Ao,ai,ul,pn,hl,Vt,St,jt]);const Rh=v.useCallback((U,Q)=>{Xi(fe=>({...fe,[U]:[...fe[U]??[],Q]}))},[]),gp=v.useCallback((U,Q)=>{Xi(fe=>{const ue=fe[U]??[],Se=ue.filter(Be=>Be.id!==Q);if(Se.length===ue.length)return fe;if(Se.length===0){const{[U]:Be,...gt}=fe;return gt}return{...fe,[U]:Se}})},[]),Dv=v.useCallback((U,Q,fe)=>{const ue=fe.trim();ue&&Xi(Se=>{const Be=Se[U]??[];return Be.length===0?Se:{...Se,[U]:Be.map(gt=>gt.id===Q?{...gt,content:ue,displayContent:ue,fullContent:ue,referencedFiles:void 0,displaySegments:void 0,attachments:void 0}:gt)}})},[]),$u=v.useCallback((U,Q,fe,ue)=>{Xi(Se=>{const Be=Se[U]??[];if(Be.length===0)return Se;const gt=Be.findIndex(tr=>tr.id===Q);if(gt<0)return Se;const ft=[...Be],[Ot]=ft.splice(gt,1);if(!Ot)return Se;if(fe==null)ft.push(Ot);else{const tr=ft.findIndex(Rr=>Rr.id===fe);if(tr<0)return Se;ft.splice(tr+(ue==="after"?1:0),0,Ot)}return ft===Be?Se:{...Se,[U]:ft}})},[]),H0=v.useCallback(U=>{var Se;const Q=Ne.selectedThread,fe=Ne.selectedRepo;if(!Q||!fe)return;const ue=(Se=so[Q.id])==null?void 0:Se.find(Be=>Be.id===U);ue&&(gp(Q.id,U),(async()=>{const Be=`jait/${Math.random().toString(16).slice(2,10)}`;let gt;try{gt=(await Uo.createWorktree(fe.localPath,fe.defaultBranch,Be)).path}catch{try{await Uo.createBranch(fe.localPath,Be,fe.defaultBranch)}catch{}}const ft=await Qr.createThread({title:`[${fe.name}] Generating title…`,providerId:ue.providerId,runtimeMode:ue.runtimeMode,...ue.model?{model:ue.model}:{},kind:"delivery",workingDirectory:gt??fe.localPath,branch:Be});await Qr.startThread(ft.id,{message:ue.fullContent,titlePrefix:`[${fe.name}] `,...ue.displayContent?{displayContent:ue.displayContent}:{},...ue.referencedFiles?{referencedFiles:ue.referencedFiles}:{},...ue.attachments?{attachments:ue.attachments}:{}})})())},[Ne.selectedThread,Ne.selectedRepo,so,gp]),Iv=v.useCallback(async(U,Q,fe)=>{const ue=Ne.selectedThread;if(!ue)return;const Se=await Hc(e,U,fe);Se&&(Rh(ue.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:Se.displayContent||Se.promptWithReferences,displayContent:Se.displayContent||Se.promptWithReferences,fullContent:Se.promptWithReferences,referencedFiles:Se.referencedFiles,displaySegments:Se.displaySegments,attachments:Se.attachments,providerId:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,queuedAt:Date.now()}),r(""),i(void 0))},[Ne.selectedThread,xt,Yt,Xt,Rh,e,Hc]);v.useEffect(()=>{for(const[U,Q]of Object.entries(so)){if(Q.length===0||ql.current.has(U))continue;const fe=Ne.threads.find(Se=>Se.id===U);if(!fe){Xi(Se=>{if(!(U in Se))return Se;const{[U]:Be,...gt}=Se;return gt});continue}if(fe.status==="running")continue;const[ue]=Q;ue&&(ql.current.add(U),Xi(Se=>{const Be=Se[U]??[],[,...gt]=Be;if(gt.length===0){const{[U]:ft,...Ot}=Se;return Ot}return{...Se,[U]:gt}}),Ne.handleSendToThread(U,ue.fullContent,ue.providerId,ue.runtimeMode,ue.model,{displayContent:ue.displayContent??ue.content,referencedFiles:ue.referencedFiles,attachments:ue.attachments}).catch(Se=>{Xi(Be=>({...Be,[U]:[ue,...Be[U]??[]]})),Ne.setError(Se instanceof Error?Se.message:"Failed to process queued thread message")}).finally(()=>{ql.current.delete(U)}))}},[Ne.handleSendToThread,Ne.setError,Ne.threads,so]);const Ph=v.useCallback(async()=>{const U=Ne.selectedRepo;if(U)try{await Qr.updateRepo(U.id,{deviceId:""}),await Ne.refresh()}catch{Ne.setError("Failed to move repository to gateway")}},[Ne.selectedRepo,Ne.refresh,Ne.setError]),W0=async U=>{if(!St){o(!0);return}let Q=lt;if(!Q){if(!Cn){Ws();return}const fe=await Oa();Q=(fe==null?void 0:fe.id)??null}if(Q){if(U==="Generate architecture diagram"){Kt(!0),ge(!0),hl("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.",{token:St,sessionId:Q,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,onLoginRequired:()=>o(!0)});return}hl(U,{token:St,sessionId:Q,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,onLoginRequired:()=>o(!0)})}},xS=v.useCallback(async(U,Q,fe,ue,Se)=>{if(!lt||!St)return;const Be=await Hc(Q,Se==null?void 0:Se.referencedFiles,Se==null?void 0:Se.displaySegments);Be&&await dl(U,Be.promptWithReferences,fe,ue,{token:St,sessionId:lt,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,displayContent:Be.displayContent,referencedFiles:Be.referencedFiles,displaySegments:Be.displaySegments,onLoginRequired:()=>o(!0)})},[lt,dl,St,Je,xt,Yt,Xt,Hc]),Bv=async U=>{if(U.preventDefault(),!tt){l(null),ht(!0);try{await A0(ps,mr),o(!1),Ar(""),c("chat")}catch(Q){l(Q instanceof Error?Q.message:"Login failed")}finally{ht(!1)}}},zv=async U=>{if(U.preventDefault(),!tt){if(l(null),!un||!pi){l("Username and password are required");return}if(pi!==ms){l("Passwords do not match");return}ht(!0);try{await yu(un,pi),o(!1),wa(""),be(""),c("chat"),requestAnimationFrame(()=>{os("workspace"),ss(!0)})}catch(Q){l(Q instanceof Error?Q.message:"Registration failed")}finally{ht(!1)}}},Fv=v.useCallback(async U=>{U.preventDefault();const Q=si.trim();if(!Q){js("Please enter a gateway URL");return}Xf(!0),js(null);try{const fe=Q.replace(/\/+$/,""),ue=await fetch(`${fe}/health`,{signal:AbortSignal.timeout(5e3)});if(!ue.ok)throw new Error(`Server returned ${ue.status}`);const Se=On();if(VJ(fe),fe!==Se){window.location.reload();return}Sa("auth")}catch(fe){js(fe instanceof Error?fe.name==="TimeoutError"||fe.name==="AbortError"?"Connection timed out":fe.message:"Failed to connect")}finally{Xf(!1)}},[si]),bS=()=>{Wm(),fl(),c("chat"),o(!0)},U0=v.useCallback(()=>{if(fl(),!Cn){Ws();return}Oa()},[Cn,fl,Oa,Ws]),_S=async U=>{const Q=Object.fromEntries(Object.entries(U).map(([fe,ue])=>[fe,ue.trim()]).filter(([,fe])=>fe.length>0));await cl({api_keys:Q})},Lj=async()=>{const U=await _h();return await Go(),U.removed},wS=async()=>{const U=await $d();return await Go(),U},SS=async U=>{const Q=await br(U);return Q&&await Go(),Q},CS=v.useCallback(async()=>{if(lt)try{await fetch(`${bs}/api/consent/pending/${lt}/approve-all`,{method:"DELETE"}),kt(!1)}catch{}},[lt]),Hv=v.useCallback(async U=>{const Q=Pue(U);if(!Q)return;if(jt==="manager"||Vt==="thread"){const Se=Ne.selectedThread;if((Se==null?void 0:Se.status)==="running"){Rh(Se.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:Q,displayContent:Q,fullContent:Q,referencedFiles:void 0,attachments:void 0,providerId:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,queuedAt:Date.now()});return}await Ne.handleSend(Q,xt,xt!=="jait"?Yt:void 0,Xt??void 0);return}const fe=FN(Q);let ue=lt;if(!ue){if(!Cn){Ws();return}const Se=await Oa(void 0,fe);ue=(Se==null?void 0:Se.id)??null}if(!(!ue||!St)){if(await sg(ue,Q),ai||pn.length>0){Ao({content:Q,displayContent:Q,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0});return}hl(Q,{token:St,sessionId:ue,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,onLoginRequired:()=>o(!0)})}},[lt,Cn,Ne.handleSend,Ne.selectedThread,Je,xt,Yt,Xt,Oa,Rh,Ao,sg,ai,pn.length,Ws,hl,Vt,St,jt]),[Lh,Wv]=v.useState(!1),[Zd,Uv]=v.useState(!1),[Jd,kS]=v.useState(()=>HN()),og=v.useRef(null),Du=v.useRef([]),Qd=v.useRef(null),$h=v.useRef(HN()),yp=v.useRef(null),V0=v.useRef(null),ag=v.useRef(null),Vv=v.useRef(null),lg=v.useRef(null),cg=v.useCallback(()=>{const U=HN();$h.current=U,kS(U)},[]),Dh=v.useCallback(()=>{var Q;lg.current!==null&&(cancelAnimationFrame(lg.current),lg.current=null),(Q=V0.current)==null||Q.disconnect(),V0.current=null,ag.current=null,Vv.current=null;const U=yp.current;yp.current=null,U&&U.state!=="closed"&&U.close().catch(()=>{}),cg()},[cg]),qv=v.useCallback(U=>{Dh();try{const Q=new AudioContext,fe=Q.createAnalyser();fe.fftSize=256,fe.smoothingTimeConstant=.58;const ue=Q.createMediaStreamSource(U);ue.connect(fe);const Se=new Uint8Array(new ArrayBuffer(fe.frequencyBinCount));yp.current=Q,V0.current=ue,ag.current=fe,Vv.current=Se;const Be=()=>{const gt=ag.current,ft=Vv.current;if(!gt||!ft)return;gt.getByteTimeDomainData(ft);let Ot=0;for(let on=0;on<ft.length;on++)Ot+=Math.abs((ft[on]-128)/128);const tr=ft.length>0?Ot/ft.length:0,Rr=Math.pow(Math.min(1,tr*6.8),.78),Hn=Math.min(1,Math.max(M7,Rr)),Zn=($h.current[$h.current.length-1]??M7)*.2+Hn*.8,vs=[...$h.current.slice(-(Rue-1)),Zn];$h.current=vs,kS(vs),lg.current=requestAnimationFrame(Be)};Be()}catch(Q){console.warn("Voice visualizer unavailable:",Q),cg()}},[cg,Dh]),Gv=v.useCallback(U=>{const fe=U.sampleRate,ue=U.getChannelData(0),Se=new ArrayBuffer(44+ue.length*2),Be=new DataView(Se),gt=(Ot,tr)=>{for(let Rr=0;Rr<tr.length;Rr++)Be.setUint8(Ot+Rr,tr.charCodeAt(Rr))};gt(0,"RIFF"),Be.setUint32(4,36+ue.length*2,!0),gt(8,"WAVE"),gt(12,"fmt "),Be.setUint32(16,16,!0),Be.setUint16(20,1,!0),Be.setUint16(22,1,!0),Be.setUint32(24,fe,!0),Be.setUint32(28,fe*1*2,!0),Be.setUint16(32,2,!0),Be.setUint16(34,16,!0),gt(36,"data"),Be.setUint32(40,ue.length*2,!0);let ft=44;for(let Ot=0;Ot<ue.length;Ot++){const tr=Math.max(-1,Math.min(1,ue[Ot]));Be.setInt16(ft,tr<0?tr*32768:tr*32767,!0),ft+=2}return new Blob([Se],{type:"audio/wav"})},[]),Ih=v.useCallback(async()=>{var fe,ue;Wv(!1),Dh();const U=og.current;if(!U||U.state==="inactive"){(fe=Qd.current)==null||fe.getTracks().forEach(Se=>Se.stop()),Qd.current=null,og.current=null;return}const Q=await new Promise(Se=>{U.ondataavailable=Be=>{Be.data.size>0&&Du.current.push(Be.data)},U.onstop=()=>{Se(new Blob(Du.current,{type:U.mimeType}))},U.stop()});if((ue=Qd.current)==null||ue.getTracks().forEach(Se=>Se.stop()),Qd.current=null,og.current=null,Q.size!==0&&(Ns.stt_provider==="wyoming"||Ns.stt_provider==="whisper")){Uv(!0);try{const Se=await Q.arrayBuffer(),Be=new AudioContext({sampleRate:16e3}),gt=await Be.decodeAudioData(Se),ft=Gv(gt);await Be.close();const Ot=await ft.arrayBuffer(),tr=new Uint8Array(Ot);let Rr="";for(let vs=0;vs<tr.length;vs++)Rr+=String.fromCharCode(tr[vs]);const Hn=btoa(Rr),Zn=await(await fetch(`${bs}/api/voice/transcribe-audio`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${St}`},body:JSON.stringify({audioBase64:Hn,sessionId:lt??"voice-input",provider:Ns.stt_provider})})).json();Zn.text?r(vs=>D0t(vs,Zn.text??"")):console.warn("Transcription failed:",Zn.details??Zn.error)}catch(Se){console.error("Transcription error:",Se)}finally{Uv(!1)}}},[lt,Gv,Ns.stt_provider,St]),ef=v.useCallback(async()=>{if(!St){o(!0);return}try{const U=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});Qd.current=U,Du.current=[],qv(U);const Q=new MediaRecorder(U);og.current=Q,Q.ondataavailable=fe=>{fe.data.size>0&&Du.current.push(fe.data)},Q.start(),Wv(!0)}catch(U){Dh(),console.error("Microphone access denied:",U),window.alert("Microphone access is required for push-to-talk.")}},[lt,Ns.stt_provider,qv,Dh,Hv,St]),[Iu,Kv]=v.useState(()=>{try{return localStorage.getItem("jait:wake-word")==="true"}catch{return!1}}),Yv=v.useCallback(()=>{Kv(U=>{const Q=!U;try{localStorage.setItem("jait:wake-word",String(Q))}catch{}return Q})},[]),[wl,ug]=v.useState(!1),Ba=ept({authToken:St,onError:U=>{console.warn("[voice] error:",U)},onDisconnected:()=>{ug(!1)}}),Xv=v.useCallback(()=>{ug(!0),Ba.connect()},[Ba]),Bu=qft({enabled:Iu&&kc&&!Lh&&!wl,lang:navigator.language,onCommand:()=>{Xv()},onWakeWordDetected:()=>{Xv()}});v.useEffect(()=>()=>{var U;Dh(),(U=Qd.current)==null||U.getTracks().forEach(Q=>Q.stop())},[Dh]);const q0=Yo==="limit_reached",vp=!Na&&!kc,jS=jt==="developer"&&u==="chat"&&!vp&&(Na||Pd||!!lt&&(ul||up||Eh||Ic||V)),$j=Vl.length>0||ul,Zv=v.useMemo(()=>Mue({showWorkspace:E,showTerminal:b,showWorkspaceTree:oe,showWorkspaceEditor:le,treeTab:pe}),[pe,b,E,le,oe]),Jv=zt&&Sn&&Zv!==null&&Zv!=="terminal",xp=zt&&u==="chat"&&jt==="developer"&&Zv==="terminal",bp=v.useMemo(()=>({showWorkspace:E,showTerminal:b,showWorkspaceTree:oe,showWorkspaceEditor:le,treeTab:pe}),[pe,b,E,le,oe]),G0=((K0=(rx=Ea==null?void 0:Ea.username)==null?void 0:rx[0])==null?void 0:K0.toUpperCase())??"?",Qv=v.useCallback(()=>{Ih()},[Ih]),ex=v.useCallback(()=>{Ne.setFolderPickerOpen(!0)},[Ne.setFolderPickerOpen]),_p=v.useMemo(()=>{if(Vt==="thread")return h.jsx(fC,{repositories:Ne.repositories,selectedRepo:Ne.selectedRepo,disabled:Ne.creating,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:ex})},[Vt,Ne.repositories,Ne.selectedRepo,Ne.creating,Ne.getRuntimeInfoForRepository,Ne.setSelectedRepoId,ex]),TS=v.useMemo(()=>({onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:Qv,mode:Je,onModeChange:Mt,sendTarget:Vt,onSendTargetChange:Bt,provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:Vt==="thread"?ao:null,onMoveToGateway:Vt==="thread"?Ph:void 0,footerLeadingContent:_p,availableFiles:Eo,onSearchFiles:ig,workspaceOpen:E,sessionInfo:Ec,workspaceNodeId:ie==null?void 0:ie.nodeId}),[ef,Lh,Jd,Zd,Qv,Je,Mt,Vt,Bt,xt,Ou,Yt,Au,Xt,Gd,ao,Ph,_p,Eo,ig,E,Ec,ie==null?void 0:ie.nodeId]),tx=[...Vl.slice(-10).map(U=>YU({id:`msg-${U.id}`,source:"chat",title:`Message: ${U.role}`,detail:U.content.slice(0,120)||"(empty message)"})),...yl.map(U=>YU({id:`term-${U.id}`,source:"terminal",title:"Terminal session",detail:`${U.id} (${U.state})`}))];return h.jsx(PY,{children:h.jsxs("div",{className:"fixed inset-0 flex flex-col overflow-hidden safe-top safe-bottom safe-left safe-right",children:[!vp&&h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`relative flex items-center gap-1 border-b bg-background px-2 sm:gap-2 sm:px-5 shrink-0 ${Ci?"h-10 !pl-[0.8rem]":"h-14"}`,style:Ci?{WebkitAppRegion:"drag",paddingLeft:Sc==="darwin"?70:void 0,paddingRight:Sc==="win32"?140:void 0}:void 0,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:[h.jsx(Boe,{size:20,className:"shrink-0"}),Bu.isSupported&&h.jsx("button",{className:`md:hidden flex items-center justify-center h-8 w-8 rounded-lg shrink-0 transition-colors ${wl?"text-green-400 bg-green-500/10":Iu?Bu.isListening?"text-green-400 bg-green-500/10":"text-blue-400 bg-blue-500/10":"text-muted-foreground hover:bg-accent"}`,onClick:wl?()=>{Ba.disconnect(),ug(!1)}:Yv,"aria-label":wl?"Disconnect voice":Iu?"Disable wake word":"Enable wake word",children:wl?h.jsx(Ay,{className:"h-4 w-4 animate-pulse"}):Iu?h.jsx(Ay,{className:`h-4 w-4 ${Bu.isListening?"animate-pulse":""}`}):h.jsx(yC,{className:"h-4 w-4"})})]}),h.jsxs("nav",{className:"hidden md:flex items-center gap-1 min-w-0 overflow-x-auto scrollbar-none",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:[h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:u==="chat"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>c("chat"),"aria-label":"Chat",children:[h.jsx(sk,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"Chat"})]})}),h.jsx(Yn,{side:"bottom",children:"Chat"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:u==="jobs"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>c("jobs"),"aria-label":"Jobs",children:[h.jsx(ik,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"Jobs"})]})}),h.jsx(Yn,{side:"bottom",children:"Jobs"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:u==="network"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>c("network"),"aria-label":"Network",children:[h.jsx(b_,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"Network"})]})}),h.jsx(Yn,{side:"bottom",children:"Network"})]}),jt==="developer"&&!zt&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:se?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>se?Qm():Mu(),"aria-label":"Screen sharing",children:[h.jsx(Hy,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"Screen Share"})]})}),h.jsx(Yn,{side:"bottom",children:"Screen sharing"})]})]}),wl?h.jsxs("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 flex items-center gap-1.5 rounded-full border border-border/60 bg-background/80 backdrop-blur-sm px-1.5 py-1",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:[h.jsx("button",{onClick:Ba.toggleMic,className:`flex items-center justify-center h-7 w-7 rounded-full transition-colors ${Ba.micActive?"bg-muted hover:bg-muted/80 text-foreground":"bg-destructive/15 text-destructive hover:bg-destructive/25"}`,"aria-label":Ba.micActive?"Mute":"Unmute",children:Ba.micActive?h.jsx(Ay,{className:"h-3.5 w-3.5"}):h.jsx(yC,{className:"h-3.5 w-3.5"})}),h.jsx(T0t,{state:Ba.assistantSpeaking?"speaking":Ba.status,size:"sm",lineWidth:2,className:"!aspect-auto !h-7 w-24 sm:w-36"}),h.jsx("button",{onClick:()=>{Ba.disconnect(),ug(!1)},className:"flex items-center justify-center h-7 w-7 rounded-full bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors","aria-label":"End call",children:h.jsx(k0e,{className:"h-3.5 w-3.5"})})]}):u==="chat"?h.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:h.jsx(Wft,{mode:jt,onChange:vr,compact:zt})}):null,h.jsx("div",{className:"flex-1 min-w-0"}),h.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 shrink-0",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:[u==="chat"&&lo.length>0&&h.jsx(G0t,{threads:lo,getRepositoryForThread:Ne.getRepositoryForThread,threadPrStates:Ne.threadPrStates,ghAvailable:Ne.ghAvailable,onOpenThread:U=>{c("chat"),Ne.setSelectedThreadId(U),Bt("thread")},onStopThread:U=>Ne.handleStop(U)}),h.jsxs("div",{className:"hidden md:flex items-center gap-1 sm:gap-1.5",children:[Wd.isActive&&h.jsxs("span",{className:"ui-pill shrink-0",children:[h.jsx(Hy,{className:"h-3 w-3 text-green-500 animate-pulse"}),h.jsx("span",{className:"hidden sm:inline",children:"Sharing"})]}),Bu.isSupported&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs("button",{onClick:wl?()=>{Ba.disconnect(),ug(!1)}:Yv,className:`ui-pill shrink-0 cursor-pointer transition-colors ${wl?"text-green-400 animate-pulse":Iu?Bu.isListening?"text-green-400":"text-blue-400":"text-muted-foreground opacity-50"}`,children:[wl?h.jsx(Ay,{className:"h-3 w-3 animate-pulse"}):Iu?h.jsx(Ay,{className:`h-3 w-3 ${Bu.isListening?"animate-pulse":""}`}):h.jsx(yC,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline text-xs",children:wl?"Voice active":Bu.isListening?"Listening...":Iu?"Hey Jait":"Wake word"})]})}),h.jsx(Yn,{side:"bottom",children:wl?"Voice assistant active — click to disconnect":Iu?Bu.isListening?"Listening for your command...":'Say "Hey Jait" to start voice assistant — click to disable':'Click to enable always-on "Hey Jait" wake word'})]}),h.jsx(XYe,{usage:Ym}),(()=>{const U=xt==="codex"?"openai":xt==="claude-code"?"anthropic":ap??"ollama",Q=xt==="codex"?Xt??"Codex":xt==="claude-code"?Xt??"Claude Code":Ro?Fet(Ro):null,fe=xt==="codex"?`OpenAI Codex CLI${Xt?` · ${Xt}`:""}`:xt==="claude-code"?`Anthropic Claude Code CLI${Xt?` · ${Xt}`:""}`:Ro??"";return Q?h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs("div",{className:"ui-pill cursor-default sm:mr-2",children:[h.jsx(w5,{provider:U,model:xt==="codex"?"codex":xt==="claude-code"?"claude-3":Ro??void 0,size:16}),h.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:Q})]})}),h.jsx(Yn,{side:"bottom",children:fe})]}):null})(),wh!==null&&wh<=5&&h.jsxs("span",{className:"text-xs text-muted-foreground mr-1 sm:mr-2 hidden sm:inline",children:[wh," remaining"]})]}),(Br==null?void 0:Br.hasUpdate)&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{onClick:async()=>{if(ys==="web")c("settings");else if(ys==="electron"){const U=window.jaitDesktop;ni.info("Downloading update...");const Q=await U.downloadUpdate();Q!=null&&Q.ok?(ni.success("Update downloaded. Restarting..."),await U.installUpdate()):ni.error("Download failed")}else window.open("https://github.com/Widev-e-U/Jait/releases/latest","_blank")},variant:"outline",size:"sm",className:"h-8 shrink-0 border-amber-500/30 bg-amber-500/10 px-2 text-amber-700 hover:bg-amber-500/15 hover:text-amber-800 dark:text-amber-300",children:[h.jsx(xG,{className:"h-3.5 w-3.5"}),h.jsxs("span",{className:"hidden sm:inline",children:["v",Br.latestVersion]})]})}),h.jsxs(Yn,{side:"bottom",children:["Update available — v",Br.latestVersion]})]}),h.jsx("div",{className:"md:hidden shrink-0",children:h.jsxs(yd,{children:[h.jsx(vd,{asChild:!0,children:h.jsx(Ae,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0",children:h.jsx(YN,{className:"h-4 w-4"})})}),h.jsxs(mh,{align:"end",children:[h.jsx(k_,{children:"Navigate"}),h.jsxs(_o,{onSelect:()=>c("chat"),children:[h.jsx(sk,{className:"h-4 w-4 mr-2"}),"Chat"]}),h.jsxs(_o,{onSelect:()=>c("jobs"),children:[h.jsx(ik,{className:"h-4 w-4 mr-2"}),"Jobs"]}),h.jsxs(_o,{onSelect:()=>c("network"),children:[h.jsx(b_,{className:"h-4 w-4 mr-2"}),"Network"]}),jt==="developer"&&h.jsxs(_o,{onSelect:()=>se?Qm():Mu(),children:[h.jsx(Hy,{className:"h-4 w-4 mr-2"}),se?"Hide Share":"Screen Share"]}),h.jsx(Og,{}),h.jsxs(_o,{onSelect:()=>c("settings"),children:[h.jsx($$,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]})}),kc?h.jsxs(yd,{children:[h.jsx(vd,{asChild:!0,children:h.jsx("button",{className:"rounded-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:h.jsx(FG,{className:"h-7 w-7",children:h.jsx(HG,{className:"text-[11px]",children:G0})})})}),h.jsxs(mh,{align:"end",children:[h.jsx(k_,{children:Ea==null?void 0:Ea.username}),h.jsx(Og,{}),h.jsxs(_o,{onSelect:()=>c("settings"),children:[h.jsx($$,{className:"h-4 w-4 mr-2"}),"Settings"]}),h.jsx(Og,{}),h.jsxs("div",{className:"px-2 py-1.5",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),h.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",nye],["system",ma],["dark",g0e]].map(([U,Q])=>h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx("button",{onClick:()=>{Da(U)},className:`relative flex items-center justify-center h-6 w-6 rounded-full transition-colors ${p===U?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:h.jsx(Q,{className:"h-3.5 w-3.5"})})}),h.jsx(Yn,{side:"bottom",children:U.charAt(0).toUpperCase()+U.slice(1)})]},U))})]}),h.jsx(Og,{}),h.jsxs(_o,{onSelect:bS,children:[h.jsx(t0e,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):h.jsx(Ae,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>o(!0),children:"Sign in"}),Ci&&Sc==="linux"&&h.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[h.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:h.jsx(vC,{className:"h-4 w-4"})}),h.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:al?h.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:h.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):h.jsx(y1,{className:"h-3 w-3"})}),h.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:h.jsx(ii,{className:"h-4 w-4"})})]})]})]}),u==="chat"&&h.jsxs("div",{className:`flex border-b bg-muted/30 px-2 sm:px-5 shrink-0 ${ku?"min-h-[35px] flex-wrap items-start gap-2 py-1.5":"h-11 md:h-[35px] items-center gap-1 overflow-x-auto overflow-y-visible scrollbar-none"}`,children:[jt==="developer"&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:g?"secondary":"ghost",size:"sm",className:zt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>y(U=>!U),"aria-label":"Toggle workspaces sidebar",children:[g?h.jsx(A$,{className:`h-3 w-3${zt?" rotate-90":" mr-1"}`}):h.jsx(M$,{className:`h-3 w-3${zt?" rotate-90":" mr-1"}`}),!zt&&"Workspaces"]})}),h.jsx(Yn,{side:"bottom",children:"Toggle workspaces sidebar"})]}),(jt==="developer"||jt==="manager"&&Ne.selectedThread)&&h.jsxs(h.Fragment,{children:[jt==="developer"&&!zt&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:b?"secondary":"ghost",size:"sm",className:"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>{rg()},children:[h.jsx(Of,{className:"h-3 w-3 mr-1"}),"Terminal"]})}),h.jsx(Yn,{side:"bottom",children:"Toggle terminal panel"})]}),h.jsx("div",{className:`flex items-center shrink-0 ${zt?"gap-1":""}`,children:zt?h.jsxs(h.Fragment,{children:[h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx(Ae,{variant:wb(bp,"files")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Files",onClick:()=>{Ri("files")},children:h.jsx(ou,{className:"h-4 w-4"})})}),h.jsx(Yn,{side:"bottom",children:"Files"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:wb(bp,"git")?"secondary":"ghost",size:"sm",className:"relative h-9 w-9 rounded-md p-0","aria-label":"Changes",onClick:()=>{Ri("git")},children:[h.jsx(Ng,{className:"h-4 w-4"}),io.length>0&&h.jsx("span",{className:"absolute -right-1 -top-1 z-10 min-w-[14px] rounded-full bg-primary px-1 text-[8px] font-bold leading-[14px] text-primary-foreground",children:io.length>99?"99+":io.length})]})}),h.jsx(Yn,{side:"bottom",children:"Changes"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx(Ae,{variant:wb(bp,"editor")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Editor",onClick:()=>{Ri("editor")},children:h.jsx(KN,{className:"h-4 w-4"})})}),h.jsx(Yn,{side:"bottom",children:"Editor"})]}),jt==="developer"&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx(Ae,{variant:wb(bp,"terminal")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Terminal",onClick:()=>{Ri("terminal")},children:h.jsx(Of,{className:"h-4 w-4"})})}),h.jsx(Yn,{side:"bottom",children:"Terminal"})]})]}):h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:E?"secondary":"ghost",size:"sm",className:"h-7 rounded-md px-2 text-xs",onClick:()=>{B0()},children:[h.jsx(KN,{className:"h-3 w-3 mr-1"}),"Editor",E&&h.jsx(ii,{className:"h-3 w-3 ml-1"})]})}),h.jsx(Yn,{side:"bottom",children:E?"Hide editor":"Show editor"})]})}),jt==="developer"&&E&&ie&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:Bc?"secondary":"ghost",size:"sm",className:zt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":Bc?"Close preview":"Open preview",onClick:()=>{var U,Q;if(Bc)J.open?(U=Es.current)==null||U.closePreviewTarget():Ov();else{const fe=J.target??(P==null?void 0:P.trim())??((Q=li==null?void 0:li.target)==null?void 0:Q.trim())??null;if(vt(fe,(ie==null?void 0:ie.workspaceRoot)??null))return;I0()}},children:[h.jsx(Ii,{className:`h-3 w-3${zt?"":" mr-1"}`}),!zt&&"Preview",!zt&&Bc&&h.jsx(ii,{className:"h-3 wer-3 ml-1"})]})}),h.jsx(Yn,{side:"bottom",children:Bc?"Close preview":"Open dev preview"})]})]}),jt==="developer"&&E&&ie&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:we?"secondary":"ghost",size:"sm",className:zt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":we?"Close architecture":"Open architecture",onClick:()=>{var U;we?((U=Es.current)==null||U.closeArchitectureTab(),ge(!1)):(ge(!0),ll())},children:[h.jsx(nk,{className:`h-3 w-3${zt?"":" mr-1"}`}),!zt&&"Architecture",!zt&&we&&h.jsx(ii,{className:"h-3 w-3 ml-1"})]})}),h.jsx(Yn,{side:"bottom",children:"Software architecture diagram"})]}),jt==="developer"&&E&&ie&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx(Ae,{variant:Ue?"secondary":"ghost",size:"sm",className:"ml-auto h-6 w-6 shrink-0 p-0",onClick:()=>Te(U=>!U),children:h.jsx(Hme,{className:"h-3 w-3"})})}),h.jsx(Yn,{side:"bottom",children:"SSE debug stream"})]}),jt==="manager"&&h.jsxs(h.Fragment,{children:[Ne.selectedThread?h.jsxs(Ae,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>{Ne.setSelectedThreadId(null),r("")},children:[h.jsx(gG,{className:"h-3 w-3 mr-1"}),"Back"]}):h.jsxs(h.Fragment,{children:[h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:C?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>w(U=>!U),children:[C?h.jsx(A$,{className:`h-3 w-3 mr-1${zt?" rotate-90":""}`}):h.jsx(M$,{className:`h-3 w-3 mr-1${zt?" rotate-90":""}`}),"Repositories"]})}),h.jsx(Yn,{side:"bottom",children:"Toggle repositories panel"})]}),Ne.selectedRepo&&Ne.selectedRepo.source==="local"&&h.jsxs(h.Fragment,{children:[h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>j(Ne.selectedRepo),children:[h.jsx(EG,{className:"h-3 w-3 mr-1"}),"Strategy"]})}),h.jsx(Yn,{side:"bottom",children:"Open repository strategy"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>O(Ne.selectedRepo),children:[h.jsx(CG,{className:"h-3 w-3 mr-1"}),"Todos"]})}),h.jsx(Yn,{side:"bottom",children:"Open todo plan"})]})]})]}),h.jsx("div",{className:"flex-1"}),Ne.selectedThread?h.jsxs("div",{className:zt?"flex min-w-0 basis-full items-start gap-1.5":"flex min-w-0 items-center gap-2 shrink-0",children:[h.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2",children:[h.jsx(mP,{status:Ne.selectedThread.status}),h.jsxs("div",{className:`min-w-0 ${zt?"flex-1":"flex items-center gap-2"}`,children:[pP(Ne.selectedThread.title)?h.jsx(Lue,{className:"text-[11px] h-3.5 w-28"}):h.jsx("span",{className:`text-[10px] text-muted-foreground truncate sm:text-[11px] ${zt?"block leading-tight":"max-w-[200px]"}`,children:Ne.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),h.jsx(Due,{kind:Ne.selectedThread.kind}),(Ne.selectedRepo||zt&&Ne.selectedThread.branch)&&h.jsxs("span",{className:`text-[10px] text-muted-foreground truncate ${zt?"mt-0.5 block leading-tight":"max-w-[160px]"}`,children:[Ne.selectedRepo?`${Ne.selectedRepo.name} · ${Ne.selectedRepo.defaultBranch}`:"",zt&&Ne.selectedThread.branch?`${Ne.selectedRepo?" · ":""}${Ne.selectedThread.branch}`:""]})]})]}),h.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[!zt&&Ne.selectedThread.branch&&h.jsx(Vr,{variant:"outline",className:"text-[9px] px-1 py-0 font-mono",children:Ne.selectedThread.branch}),fP(Ne.selectedThread)&&h.jsx(Ae,{variant:"ghost",size:"icon",className:"h-[18px] w-[18px] sm:h-5 sm:w-5",onClick:()=>void Ne.handleStop(Ne.selectedThread.id),title:Ne.selectedThread.kind==="delegation"?"End helper thread":"Stop thread",children:h.jsx(y1,{className:"h-2.5 w-2.5"})}),Ne.showGitActions&&Ne.selectedRepo&&h.jsx("div",{className:zt?"shrink-0":"ml-2 shrink-0",children:h.jsx(SR,{threadId:Ne.selectedThread.id,cwd:Ne.selectedThread.workingDirectory??Ne.selectedRepo.localPath,branch:Ne.selectedThread.branch,baseBranch:Ne.selectedRepo.defaultBranch,threadTitle:Ne.selectedThread.title,threadStatus:Ne.selectedThread.status,threadKind:Ne.selectedThread.kind,prUrl:Ne.selectedThread.prUrl,prState:Ne.selectedThread.id in Ne.threadPrStates?Ne.threadPrStates[Ne.selectedThread.id]:Ne.selectedThread.prState,ghAvailable:Ne.ghAvailable,showStatusBadge:!zt})})]})]}):null]})]}),u==="jobs"?h.jsx("div",{className:"flex-1 overflow-y-auto",children:h.jsx($tt,{})}):u==="network"?h.jsx("div",{className:"flex-1 overflow-y-auto",children:h.jsx(gdt,{token:St,sessionId:lt??"default"})}):u==="settings"?h.jsx("div",{className:"flex-1 overflow-y-auto",children:h.jsx(sst,{username:(Ea==null?void 0:Ea.username)??"",token:St,apiKeys:Ns.api_keys,onSaveApiKeys:_S,sttProvider:Ns.stt_provider,onSttProviderChange:async U=>{await cl({stt_provider:U})},jaitBackend:Ns.jait_backend??"openai",onJaitBackendChange:async U=>{await cl({jait_backend:U})},onClearArchive:Lj,onClearArchivedWorkspaces:wS,onFetchArchivedWorkspaces:Dd,onRestoreWorkspace:SS,activityEvents:tx,updateInfo:Br,updateChecking:Gi,onCheckUpdate:()=>{no()},onApplyUpdate:()=>{jv()},updateApplying:ks,platform:ys})}):h.jsxs("div",{className:`flex flex-1 min-h-0 overflow-hidden ${zt?"flex-col":""}`,children:[h.jsxs("div",{className:zt?"contents":`relative flex min-h-0 ${W?"flex-1 min-w-0":"shrink-0"}`,children:[jt==="developer"&&g&&h.jsx("aside",{className:`overflow-hidden ${zt?"h-52 border-b shrink-0":"w-64 border-r shrink-0"}`,children:h.jsx(LYe,{workspaces:zs,activeWorkspaceId:Cn,loading:Pd,hasMoreWorkspaces:Qf,showFewerWorkspaces:zs.length>Km,onSelectWorkspace:Rv,onCreateWorkspace:Pv,onRemoveWorkspace:U=>{ip(U)},onChangeDirectory:rp,onShowMore:xu,onShowFewer:ep,sessionInfo:Ec,nodes:to})}),(jt==="developer"&&u==="chat"&&(ro||b)||jt==="manager"&&Ne.selectedThread&&ro)&&h.jsxs("div",{className:`flex min-h-0 flex-col ${W?"flex-1 min-w-0":"shrink-0"}`,style:!ro&&b?{width:480,maxWidth:"70vw"}:void 0,children:[(jt==="developer"||jt==="manager"&&Ne.selectedThread)&&ro&&h.jsx("div",{className:"flex min-h-0 flex-1",children:h.jsx(RF,{ref:Es,autoOpenRemotePath:(ie==null?void 0:ie.workspaceRoot)??null,surfaceId:(ie==null?void 0:ie.surfaceId)??null,files:is,activeFileId:Ca,onActiveFileChange:Ki,onFileDrop:U=>{$v(U)},onReferenceFile:eg,onReferenceSelection:Yd,onReferencePreviewElement:tg,onAvailableFilesChange:gu,showTree:oe,showEditor:le,onToggleTree:fp,onToggleEditor:Av,changedPaths:Lu,fsWatcherVersion:Wl,sourceControlRefreshSignal:jh,savedTabsState:ne,stateReady:ce,previewRequest:z,onTabsStateChange:qn,onPreviewOpenChange:Ru,previewSessionId:lt,previewToken:St,previewWorkspaceRoot:(ie==null?void 0:ie.workspaceRoot)??null,previewInitialTarget:P,previewBrowserSessionId:B,browserSessions:Ai.sessions,browserInterventions:Ai.interventions,onTakeBrowserControl:Ai.takeControl,onReturnBrowserControl:Ai.returnControl,onResumeBrowserSession:Ai.resume,onResolveBrowserIntervention:Ai.resolveIntervention,architectureDiagram:at,architectureGenerating:Ft,architectureRequest:ar,onArchitectureOpenChange:ge,onArchitectureRenderResult:Hr,onGenerateArchitecture:()=>{Kt(!0),W0("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.")},onApplyDiff:Lv,provider:xt,cliModel:Xt,onCollapsedChange:G,onMaxCollapsedChange:I,restoreRef:F})}),jt==="developer"&&b&&!zt&&u==="chat"&&h.jsxs("div",{className:"flex min-h-0 shrink-0 flex-col border-r border-t bg-background",style:{height:ke},children:[h.jsx("div",{onMouseDown:Zi,className:"h-1 cursor-row-resize hover:bg-primary/30 transition-colors shrink-0"}),h.jsxs("div",{className:"relative",children:[h.jsx(VU,{terminals:Ia,activeTerminalId:Ma,onSelect:vl,onCreate:()=>Xo(lt??"default",$o??void 0),onKill:Xd}),h.jsx("button",{onClick:Xl,className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:h.jsx(ii,{className:"h-3.5 w-3.5"})})]}),Ma?h.jsx(n7,{terminalId:Ma,className:"flex-1 min-h-0",token:St,workspaceRoot:$o??void 0,onReferenceSelection:Mh}):h.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:h.jsx("button",{onClick:()=>Xo(lt??"default",$o??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]})]})]}),xp&&h.jsxs("section",{className:"flex flex-1 min-h-0 flex-col border-b bg-background overflow-hidden",children:[h.jsxs("div",{className:"relative shrink-0 border-b",children:[h.jsx(VU,{terminals:Ia,activeTerminalId:Ma,onSelect:vl,onCreate:()=>Xo(lt??"default",$o??void 0),onKill:Xd}),h.jsx("button",{onClick:Xl,className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:h.jsx(ii,{className:"h-3.5 w-3.5"})})]}),Ma?h.jsx(n7,{terminalId:Ma,className:"flex-1 min-h-0",token:St,workspaceRoot:$o??void 0,onReferenceSelection:Mh}):h.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:h.jsx("button",{onClick:()=>Xo(lt??"default",$o??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]}),(jt==="developer"||jt==="manager"&&Ne.selectedThread)&&Jv&&h.jsx("section",{className:"flex-1 min-h-0 border-b bg-background overflow-hidden",children:h.jsx(RF,{ref:Es,autoOpenRemotePath:(ie==null?void 0:ie.workspaceRoot)??null,surfaceId:(ie==null?void 0:ie.surfaceId)??null,files:is,activeFileId:Ca,onActiveFileChange:Ki,onFileDrop:U=>{$v(U)},onReferenceFile:eg,onReferenceSelection:Yd,onReferencePreviewElement:tg,onAvailableFilesChange:gu,showTree:oe,showEditor:le,onToggleTree:fp,onToggleEditor:Av,treeTab:pe,onTreeTabChange:_e,changedPaths:Lu,sourceControlRefreshSignal:jh,isMobile:!0,savedTabsState:ne,stateReady:ce,previewRequest:z,onTabsStateChange:qn,onPreviewOpenChange:Ru,previewSessionId:lt,previewToken:St,previewWorkspaceRoot:(ie==null?void 0:ie.workspaceRoot)??null,previewInitialTarget:P,previewBrowserSessionId:B,browserSessions:Ai.sessions,browserInterventions:Ai.interventions,onTakeBrowserControl:Ai.takeControl,onReturnBrowserControl:Ai.returnControl,onResumeBrowserSession:Ai.resume,onResolveBrowserIntervention:Ai.resolveIntervention,architectureDiagram:at,architectureGenerating:Ft,architectureRequest:ar,onArchitectureOpenChange:ge,onArchitectureRenderResult:Hr,onGenerateArchitecture:()=>{Kt(!0),W0("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.")},onApplyDiff:Lv,provider:xt,cliModel:Xt})}),!Jv&&!xp&&(jt==="manager"?h.jsx("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:Ne.selectedThread?h.jsxs(h.Fragment,{children:[h.jsxs(eT,{className:"min-h-0 flex-1 border-b",loading:Ne.loadingActivities,loadingLabel:"Loading activity",messageContents:oo.map(U=>U.content),children:[oo.length===0&&!Ne.loadingActivities&&h.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No activity yet"}),oo.map((U,Q)=>{var fe,ue;return h.jsx(eA,{messageId:U.id,messageIndex:Q,messageFromEnd:oo.length-1-Q,role:U.role,content:U.content,toolCalls:U.toolCalls,segments:U.segments,isStreaming:((fe=Ne.selectedThread)==null?void 0:fe.status)==="running"&&Q===oo.length-1,compact:!0,preferLlmUi:!1,provider:(ue=Ne.selectedThread)==null?void 0:ue.providerId,onOpenPath:z0,onOpenDiff:ng},U.id)})]},((Y0=Ne.selectedThread)==null?void 0:Y0.id)??"manager-empty"),h.jsx("div",{className:"shrink-0 py-3 px-4",children:h.jsxs("div",{className:"mx-auto max-w-3xl",children:[Ne.error&&h.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-2",children:[h.jsx(Xb,{className:"h-4 w-4 shrink-0"}),h.jsx("span",{className:"min-w-0 break-words",children:Ne.error})]}),Ac.length>0&&Ne.selectedThread&&h.jsx(qF,{items:Ac,onRemove:U=>gp(Ne.selectedThread.id,U),onEdit:(U,Q)=>Dv(Ne.selectedThread.id,U,Q),onReorder:(U,Q,fe)=>$u(Ne.selectedThread.id,U,Q,fe),onSendToParallelThread:H0,className:"mb-2"}),h.jsx(jb,{ref:gi,draftStateKey:`manager:${((nx=Ne.selectedThread)==null?void 0:nx.id)??"new-thread"}`,value:e,onChange:r,onSubmit:Ms,onQueue:Iv,onStop:()=>{Ne.selectedThread&&Ne.handleStop(Ne.selectedThread.id)},isLoading:((ix=Ne.selectedThread)==null?void 0:ix.status)==="running",disabled:Ne.creating,placeholder:(Bh=Ne.selectedThread)!=null&&Bh.providerSessionId||((sx=Ne.selectedThread)==null?void 0:sx.status)==="running"?"Send a follow-up message...":"Describe what you want to do...",onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:()=>{Ih()},provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:Cu,onMoveToGateway:Ph,availableFiles:Eo,onSearchFiles:ig,workspaceOpen:E}),h.jsxs("div",{className:"flex items-center gap-2 px-1 mt-1.5",children:[Cu&&h.jsx(Y5,{runtime:Cu}),Ne.selectedThread&&Ne.selectedThread.status!=="running"&&!Ne.selectedThread.providerSessionId&&h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:"Thread finished — start a new one"})]})]})})]}):h.jsxs("div",{className:`flex flex-1 min-h-0 ${zt?"flex-col":""}`,children:[C&&h.jsx("div",{className:`overflow-hidden ${zt?"h-52 shrink-0 border-b":"w-56 shrink-0 border-r"}`,children:h.jsx(V0t,{repositories:Ne.repositories,selectedRepoId:((ox=Ne.selectedRepo)==null?void 0:ox.id)??null,isMobile:zt,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:()=>Ne.setFolderPickerOpen(!0),onRemoveRepository:U=>{Ne.removeRepository(U)},onOpenStrategy:U=>j(U),onOpenPlan:U=>O(U)})}),h.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-y-auto",children:[h.jsx("div",{className:"relative z-10 flex flex-col items-center px-3 pb-1.5 pt-3 sm:px-4 sm:pb-2 sm:pt-4",children:h.jsxs("div",{className:"w-full max-w-3xl",children:[h.jsx("h1",{className:"mb-3 text-center text-xl font-semibold tracking-tight sm:mb-4 sm:text-2xl",children:"What do you want to build?"}),Ne.error&&h.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-3",children:[h.jsx(Xb,{className:"h-4 w-4 shrink-0"}),h.jsx("span",{className:"min-w-0 break-words",children:Ne.error})]}),h.jsx(jb,{ref:gi,draftStateKey:`manager:${((ax=Ne.selectedRepo)==null?void 0:ax.id)??"repo-draft"}`,value:e,onChange:r,onSubmit:Ms,disabled:Fs,controlsDisabled:Ne.creating||co,placeholder:Po,onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:()=>{Ih()},provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:ao,onMoveToGateway:Ph,footerLeadingContent:h.jsx(fC,{repositories:Ne.repositories,selectedRepo:Ne.selectedRepo,disabled:Ne.creating,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:()=>Ne.setFolderPickerOpen(!0)})}),ao&&h.jsx(Y5,{runtime:ao,className:"mt-1 px-1"})]})}),h.jsx("div",{className:"flex-1 overflow-y-auto",children:h.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[h.jsxs("div",{className:"flex h-[35px] items-center justify-between border-b px-2.5 sm:px-3",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{className:"text-sm font-medium",children:"Threads"}),h.jsx(Vr,{variant:"secondary",className:"h-5 rounded-md px-1.5 text-[10px]",children:Gl.length})]}),h.jsx(Ae,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>void Ne.refresh(),children:h.jsx(Ua,{className:`h-3.5 w-3.5 ${Ne.loading?"animate-spin":""}`})})]}),Gl.length===0?h.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground sm:py-12",children:"No threads yet"}):h.jsxs("div",{className:"flex flex-col",children:[Gl.map(U=>{const Q=Ne.getRepositoryForThread(U),fe=(Q==null?void 0:Q.name)??Rj(U)??"Unknown repo";return h.jsx(q0t,{thread:U,repo:Q,repoName:fe,prState:U.id in Ne.threadPrStates?Ne.threadPrStates[U.id]:U.prState,ghAvailable:Ne.ghAvailable,onOpen:()=>Ne.setSelectedThreadId(U.id),onStop:()=>{Ne.handleStop(U.id)},onDelete:()=>Ne.handleDelete(U.id)},U.id)}),Ne.hasMoreThreads&&h.jsx("button",{className:"px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground sm:px-4 sm:py-2",onClick:Ne.showMoreThreads,children:"Show more threads"}),Gl.length>Ne.threadListLimit&&h.jsx("button",{className:"px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground sm:px-4 sm:py-2",onClick:Ne.showFewerThreads,children:"Show less"})]})]})})]})]})}):jS?h.jsx("div",{className:"flex flex-col min-h-0 min-w-0 overflow-hidden",style:{flex:W?"0 0 0px":"1 1 0%",width:W?0:void 0,minWidth:W?0:void 0,visibility:W?"hidden":void 0},children:!W&&h.jsx(eT,{className:"min-h-0 flex-1 border-b",compact:ro,loading:!0,loadingLabel:"Loading chat",messageContents:[],children:null},lt??"developer-loading")}):$j?h.jsx("div",{className:"flex flex-col min-h-0 min-w-0 overflow-hidden",style:{flex:W?"0 0 0px":"1 1 0%",width:W?0:void 0,minWidth:W?0:void 0,visibility:W?"hidden":void 0},children:!W&&h.jsxs(h.Fragment,{children:[h.jsxs(eT,{className:"min-h-0 flex-1 border-b",compact:ro,loading:ul,loadingLabel:"Loading chat",messageContents:Vl.map(U=>U.content),children:[Vl.map((U,Q)=>h.jsx(eA,{messageId:U.id,messageIndex:Q,messageFromEnd:Vl.length-1-Q,role:U.role,content:U.content,displayContent:U.displayContent,referencedFiles:U.referencedFiles,displaySegments:U.displaySegments,attachments:U.attachments,thinking:U.thinking,thinkingDuration:U.thinkingDuration,toolCalls:U.toolCalls,segments:U.segments,isStreaming:ai&&U===Vl[Vl.length-1],compact:E||se||Bc,preferLlmUi:!0,provider:xt,onOpenTerminal:Gn,onEditMessage:xS,editComposer:TS,onOpenPath:z0,onOpenDiff:ng},U.id)),pn.length>0&&h.jsx(qF,{items:pn,onRemove:pl,onEdit:P0,onReorder:ml})]},lt??"developer-empty"),h.jsx("div",{className:`shrink-0 py-3 ${ro?"px-3":"px-4"}`,children:h.jsxs("div",{className:"mx-auto w-full max-w-3xl space-y-1.5",children:[Sh.length>0&&h.jsx(VYe,{items:Sh}),Yo&&Yo!=="login_required"&&Yo!=="limit_reached"&&!ai&&h.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 dark:text-red-400 dark:border-red-400/40 dark:bg-red-400/10",children:[h.jsx(Xb,{className:"h-4 w-4 shrink-0"}),h.jsx("span",{className:"min-w-0 break-words",children:Yo})]}),R0&&!ai&&h.jsxs("div",{className:"flex items-center justify-center gap-2 py-1.5",children:[h.jsxs("button",{onClick:()=>sp({token:St,sessionId:lt}),className:"inline-flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 text-xs font-medium text-foreground shadow-sm hover:bg-accent transition-colors",children:[h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Continue"]}),h.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Agent stopped — hit the tool execution limit"})]}),h.jsx(nXe,{compact:!0,sessionId:lt,onApproveAllEnabled:()=>kt(!0)}),as&&h.jsx(WYe,{plan:as,onApprove:bu,onReject:Nc,isExecuting:ai}),q0&&h.jsx("p",{className:"text-center text-sm text-destructive",children:"Daily limit reached. Come back tomorrow."}),io.length>0&&h.jsx(qYe,{files:io,onAccept:Oc,onReject:L0,onAcceptAll:$0,onRejectAll:D0,onFileClick:ng}),h.jsx(jb,{ref:gi,draftStateKey:`developer:${lt??"new-chat"}`,value:e,segments:n,onChange:r,onSubmit:Ms,onStop:ju,onQueue:F0,isLoading:ai,disabled:q0,placeholder:xl,onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:()=>{Ih()},mode:Je,onModeChange:Mt,responseStyle:Sr,onResponseStyleChange:dp,sendTarget:Vt,onSendTargetChange:Bt,showSendTargetSelector:!1,provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:Vt==="thread"?ao:null,onMoveToGateway:Vt==="thread"?Ph:void 0,footerLeadingContent:Vt==="thread"?h.jsx(fC,{repositories:Ne.repositories,selectedRepo:Ne.selectedRepo,disabled:Ne.creating,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:()=>Ne.setFolderPickerOpen(!0)}):void 0,availableFiles:Eo,onSearchFiles:ig,workspaceOpen:E,sessionInfo:Ec,workspaceNodeId:ie==null?void 0:ie.nodeId}),h.jsx("div",{className:"overflow-x-auto px-1",children:h.jsxs("div",{className:"grid min-w-max grid-cols-[1fr_auto_1fr] items-center gap-3 whitespace-nowrap",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[jt==="developer"&&h.jsx(WF,{sessions:qr,activeSessionId:lt,workspaceTitle:(rn==null?void 0:rn.title)??null,onSelectSession:U=>{Cn&&vu(Cn,U)},onNewSession:()=>{Oa()},onOpenChange:ta,showTitle:!1,triggerLabel:"History"}),jt==="developer"&&h.jsx("button",{onClick:U0,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New chat"}),Gt&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-[11px] text-green-600 dark:text-green-400 truncate",children:"Approved all commands for this session"}),h.jsx("button",{onClick:CS,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"Clear approve all"})]})]}),h.jsx("div",{className:"justify-self-center",children:jt==="developer"&&h.jsx(VF,{target:Vt,onChange:Bt,disabled:ai})}),h.jsxs("div",{className:"flex shrink-0 items-center justify-self-end gap-2",children:[jt==="manager"&&h.jsx("button",{onClick:()=>Ne.setSelectedThreadId(null),className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New thread"}),wh!==null&&h.jsxs("span",{className:"text-[11px] text-muted-foreground shrink-0",children:[wh," remaining"]})]})]})})]})})]})}):h.jsxs("div",{className:`flex-1 min-w-0 flex flex-col items-center justify-center overflow-hidden ${W?"":"px-4"}`,style:{flex:W?"0 0 0px":void 0,width:W?0:void 0,minWidth:W?0:void 0,visibility:W?"hidden":void 0},children:[" ",h.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[h.jsxs("div",{className:"text-center",children:[h.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Jait"}),h.jsx("p",{className:"text-base text-muted-foreground mt-1",children:"Just Another Intelligent Tool"})]}),!Pd&&zs.length===0?h.jsxs("div",{className:"text-center space-y-3",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a workspace folder to start chatting with your code."}),h.jsxs(Ae,{variant:"default",size:"lg",onClick:()=>{os("workspace"),ss(!0)},children:[h.jsx(ou,{className:"h-4 w-4 mr-2"}),"Add Workspace"]})]}):h.jsx(DYe,{suggestions:E&&ie?H0t:F0t,onSelect:W0}),h.jsx(jb,{ref:gi,draftStateKey:`developer:${lt??"new-chat"}`,value:e,segments:n,onChange:r,onSubmit:Ms,onStop:ju,onQueue:F0,isLoading:ai,placeholder:xl,onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:()=>{Ih()},mode:Je,onModeChange:Mt,responseStyle:Sr,onResponseStyleChange:dp,sendTarget:Vt,onSendTargetChange:Bt,showSendTargetSelector:!1,provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:Vt==="thread"?ao:null,onMoveToGateway:Vt==="thread"?Ph:void 0,footerLeadingContent:Vt==="thread"?h.jsx(fC,{repositories:Ne.repositories,selectedRepo:Ne.selectedRepo,disabled:Ne.creating,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:()=>Ne.setFolderPickerOpen(!0)}):void 0,availableFiles:Eo,onSearchFiles:ig,workspaceOpen:E,sessionInfo:Ec,workspaceNodeId:ie==null?void 0:ie.nodeId}),jt==="developer"&&h.jsx("div",{className:"overflow-x-auto px-1",children:h.jsxs("div",{className:"grid min-w-max grid-cols-[1fr_auto_1fr] items-center gap-2 whitespace-nowrap",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[h.jsx(WF,{sessions:qr,activeSessionId:lt,workspaceTitle:(rn==null?void 0:rn.title)??null,onSelectSession:U=>{Cn&&vu(Cn,U)},onNewSession:()=>{Oa()},onOpenChange:ta,showTitle:!1,triggerLabel:"History"}),h.jsx("button",{onClick:U0,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New chat"})]}),h.jsx(VF,{target:Vt,onChange:Bt,disabled:ai,className:"justify-self-center"}),h.jsx("div",{})]})})]})]}))]}),jt==="developer"&&Ue&&h.jsx("div",{className:"fixed top-14 right-0 bottom-0 w-[420px] border-l z-50 shadow-xl",children:h.jsx(lXe,{onClose:()=>Te(!1)})})]}),vp&&Ci&&h.jsx("div",{className:"fixed top-0 left-0 right-0 h-10 z-[60]",style:{WebkitAppRegion:"drag"}}),vp&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(220,17%,10%)]",children:h.jsx("div",{className:"w-full max-w-md border bg-background p-6 shadow-sm rounded-lg",children:Oi==="url"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[h.jsxs("h2",{className:"text-lg font-semibold leading-none tracking-tight flex items-center gap-2",children:[h.jsx(ua,{className:"h-5 w-5"}),"Connect to Gateway"]}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Jait gateway URL to get started."})]}),h.jsxs("form",{onSubmit:Fv,className:"space-y-4 pt-2",children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),h.jsx(Un,{id:"gateway-url",placeholder:"https://jait.example.com",value:si,onChange:U=>{mi(U.target.value),js(null)},autoFocus:!0})]}),To&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[h.jsx(gd,{className:"h-4 w-4 shrink-0"}),To]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:Cc,children:Cc?h.jsxs(h.Fragment,{children:[h.jsx(rr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[h.jsx("h2",{className:"text-lg font-semibold leading-none tracking-tight",children:Et===!1?"Welcome to Jait":"Account"}),h.jsx("div",{className:"text-sm text-muted-foreground",children:ns?h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsx(ua,{className:"h-3 w-3 text-green-500"}),h.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:bs}),h.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Sa("url"),children:"Change"})]}):Et===!1?h.jsx("p",{children:"Create your account to get started."}):h.jsx("p",{children:"Sign in with a username and password."})})]}),h.jsxs(x1,{value:ae,onValueChange:U=>Ie(U),children:[h.jsxs(Kg,{className:"grid grid-cols-2 w-full",children:[h.jsx(Ho,{value:"login",children:"Login"}),h.jsx(Ho,{value:"register",children:"Register"})]}),h.jsx(Wo,{value:"login",className:"pt-4",children:h.jsxs("form",{className:"space-y-4",onSubmit:Bv,children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"login-username",children:"Username"}),h.jsx(Un,{id:"login-username",value:ps,onChange:U=>$t(U.target.value),autoComplete:"username",required:!0})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"login-password",children:"Password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"login-password",type:nr?"text":"password",value:mr,onChange:U=>Ar(U.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>Tt(!nr),tabIndex:-1,children:nr?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:tt,children:tt?"Signing in…":"Login"})]})}),h.jsx(Wo,{value:"register",className:"pt-4",children:h.jsxs("form",{className:"space-y-4",onSubmit:zv,children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-username",children:"Username"}),h.jsx(Un,{id:"register-username",value:un,onChange:U=>qi(U.target.value),autoComplete:"username",required:!0})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-password",children:"Password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"register-password",type:hr?"text":"password",value:pi,onChange:U=>wa(U.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>qt(!hr),tabIndex:-1,children:hr?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"register-password-confirm",type:Jt?"text":"password",value:ms,onChange:U=>be(U.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>kr(!Jt),tabIndex:-1,children:Jt?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:tt,children:tt?"Creating account…":Et===!1?"Get Started":"Create account"})]})})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a})]})})}),h.jsx(v0,{open:s&&!vp,onOpenChange:U=>{o(U)},children:h.jsx(Pm,{className:"sm:max-w-md",children:Oi==="url"?h.jsxs(h.Fragment,{children:[h.jsxs(vm,{children:[h.jsxs(xm,{className:"flex items-center gap-2",children:[h.jsx(ua,{className:"h-5 w-5"}),"Connect to Gateway"]}),h.jsx(__,{children:"Enter your Jait gateway URL to get started."})]}),h.jsxs("form",{onSubmit:Fv,className:"space-y-4 pt-2",children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),h.jsx(Un,{id:"gateway-url",placeholder:"https://jait.example.com",value:si,onChange:U=>{mi(U.target.value),js(null)},autoFocus:!0})]}),To&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[h.jsx(gd,{className:"h-4 w-4 shrink-0"}),To]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:Cc,children:Cc?h.jsxs(h.Fragment,{children:[h.jsx(rr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs(vm,{children:[h.jsx(xm,{children:Et===!1?"Welcome to Jait":"Account"}),h.jsx(__,{asChild:!0,children:ns?h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsx(ua,{className:"h-3 w-3 text-green-500"}),h.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:bs}),h.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Sa("url"),children:"Change"})]}):Et===!1?h.jsx("p",{children:"Create your account to get started."}):h.jsx("p",{children:"Sign in with a username and password."})})]}),h.jsxs(x1,{value:ae,onValueChange:U=>Ie(U),children:[h.jsxs(Kg,{className:"grid grid-cols-2 w-full",children:[h.jsx(Ho,{value:"login",children:"Login"}),h.jsx(Ho,{value:"register",children:"Register"})]}),h.jsx(Wo,{value:"login",className:"pt-4",children:h.jsxs("form",{className:"space-y-4",onSubmit:Bv,children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"login-username",children:"Username"}),h.jsx(Un,{id:"login-username",value:ps,onChange:U=>$t(U.target.value),autoComplete:"username",required:!0})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"login-password",children:"Password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"login-password",type:nr?"text":"password",value:mr,onChange:U=>Ar(U.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>Tt(!nr),tabIndex:-1,children:nr?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:tt,children:tt?"Signing in…":"Login"})]})}),h.jsx(Wo,{value:"register",className:"pt-4",children:h.jsxs("form",{className:"space-y-4",onSubmit:zv,children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-username",children:"Username"}),h.jsx(Un,{id:"register-username",value:un,onChange:U=>qi(U.target.value),autoComplete:"username",required:!0})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-password",children:"Password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"register-password",type:hr?"text":"password",value:pi,onChange:U=>wa(U.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>qt(!hr),tabIndex:-1,children:hr?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"register-password-confirm",type:Jt?"text":"password",value:ms,onChange:U=>be(U.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>kr(!Jt),tabIndex:-1,children:Jt?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:tt,children:tt?"Creating account…":Et===!1?"Get Started":"Create account"})]})})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a})]})})}),h.jsx(KU,{open:jn,onOpenChange:U=>{ss(U),U||ka(null)},initialPath:Ns.workspace_picker_path,initialNodeId:Ns.workspace_picker_node_id,onSelect:(U,Q)=>{Zl(U,Q).catch(fe=>{console.error("Failed to select workspace:",fe),ni.error(`Failed to select workspace: ${fe instanceof Error?fe.message:"Unknown error"}`)})}}),h.jsx(KU,{open:Ne.folderPickerOpen,onOpenChange:Ne.setFolderPickerOpen,onSelect:(U,Q)=>{Ne.handleFolderSelected(U,Q)}}),k&&h.jsx(ztt,{open:!!k,onOpenChange:U=>{U||j(null)},repoId:k.id,repoName:k.name}),N&&h.jsx(Wtt,{open:!!N,onOpenChange:U=>{U||O(null)},repoId:N.id,repoName:N.name,defaultBranch:N.defaultBranch,repoLocalPath:N.localPath,provider:xt,model:Xt,onStartThread:(U,Q,fe)=>{(async()=>{const ue=N,Se=`jait/${Math.random().toString(16).slice(2,10)}`;let Be;try{Be=(await Uo.createWorktree(ue.localPath,ue.defaultBranch,Se)).path}catch{try{await Uo.createBranch(ue.localPath,Se,ue.defaultBranch)}catch{}}const gt=await Qr.createThread({title:`[${ue.name}] ${U.title}`,providerId:xt,runtimeMode:xt!=="jait"?Yt:void 0,kind:"delivery",workingDirectory:Be??ue.localPath,branch:Se});await Qr.startThread(gt.id,{message:U.description||U.title,titleTask:U.title,titlePrefix:`[${ue.name}] `});const ft=Q.tasks.map(Ot=>Ot.id===U.id?{...Ot,status:"running",threadId:gt.id}:Ot);await Qr.updatePlan(Q.id,{tasks:ft})})()}}),se&&h.jsxs("div",{className:"fixed z-50 bg-background border rounded-lg shadow-2xl overflow-hidden flex flex-col",style:{left:Ce.x<0?void 0:Ce.x,top:Ce.y<0?void 0:Ce.y,right:Ce.x<0?16:void 0,bottom:Ce.y<0?16:void 0,width:Ye.w,height:Ye.h},children:[h.jsxs("div",{className:"flex items-center justify-between h-8 px-3 border-b bg-muted/30 shrink-0 cursor-move select-none",onPointerDown:kv,style:{touchAction:"none"},children:[h.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[h.jsx(Hy,{className:"h-3 w-3"})," Screen Share"]}),h.jsx(Ae,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onPointerDown:U=>U.stopPropagation(),onClick:Qm,children:h.jsx(ii,{className:"h-3 w-3"})})]}),h.jsx(xdt,{screenShare:Wd}),h.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize opacity-50 hover:opacity-100",onPointerDown:Md,style:{touchAction:"none"},children:h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-muted-foreground",children:h.jsx("path",{d:"M10 2L2 10M10 6L6 10M10 10L10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),h.jsx(M0t,{sessions:Ai.sessions,interventions:Ai.interventions,loading:Ai.loading,previewState:J.open?J:li,onRefresh:Ai.refresh,onOpenLiveSession:vt,onResolveIntervention:Ai.resolveIntervention})]})})}function Y0t(){const[e,r]=wt.useState(()=>document.documentElement.classList.contains("dark")?"dark":"light");wt.useEffect(()=>{const i=document.documentElement,s=()=>r(i.classList.contains("dark")?"dark":"light");s();const o=new MutationObserver(s);return o.observe(i,{attributes:!0,attributeFilter:["class"]}),()=>o.disconnect()},[]);const n=!!window.jaitDesktop&&navigator.userAgent.includes("Windows");return h.jsx(Cde,{position:"top-right",theme:e,closeButton:!0,gap:8,visibleToasts:4,offset:n?44:void 0})}Zhe.createRoot(document.getElementById("root")).render(h.jsx(wt.StrictMode,{children:h.jsx(Sye,{children:h.jsxs(wye,{children:[h.jsx(K0t,{}),h.jsx(Y0t,{})]})})}));export{gyt as $,NRe as A,oyt as B,n_ as C,bd as D,yMe as E,DRe as F,qM as G,vQ as H,ga as I,lBe as J,ZFe as K,rIe as L,$De as M,lz as N,az as O,myt as P,uyt as Q,fyt as R,dyt as S,lyt as T,Ur as U,SM as V,pyt as W,cyt as X,vy as Y,yyt as Z,Y as _,ARe as a,xre as a$,hyt as a0,QMe as a1,s2 as a2,iyt as a3,uj as a4,HFe as a5,yRe as a6,TQ as a7,LB as a8,zDe as a9,Dyt as aA,Ryt as aB,yr as aC,Pyt as aD,pUe as aE,cUe as aF,lUe as aG,see as aH,RDe as aI,pWe as aJ,lQ as aK,DDe as aL,nyt as aM,p0 as aN,rS as aO,dWe as aP,hWe as aQ,PDe as aR,pW as aS,BFe as aT,bre as aU,sj as aV,cj as aW,o5 as aX,jst as aY,wre as aZ,yh as a_,nO as aa,XFe as ab,kRe as ac,Gw as ad,sr as ae,Er as af,NQ as ag,BWe as ah,Mie as ai,$yt as aj,uBe as ak,xa as al,qf as am,Gx as an,GM as ao,Ere as ap,sv as aq,Mre as ar,ur as as,IFe as at,Oze as au,AFe as av,DM as aw,aF as ax,MUe as ay,Lyt as az,ORe as b,mFe as b0,yM as b1,Zp as b2,c2 as b3,JB as b4,KLe as b5,pr as b6,Rre as b7,Il as b8,FLe as b9,wze as bA,BM as bB,xze as bC,kze as bD,nv as bE,Bm as bF,Cz as bG,zM as bH,mre as bI,PO as bJ,zFe as bK,lj as bL,S0 as bM,Z0t as bN,qe as bO,gM as ba,UQ as bb,Jw as bc,GQ as bd,ayt as be,FB as bf,zB as bg,mNe as bh,DFe as bi,OFe as bj,yze as bk,IM as bl,hFe as bm,FFe as bn,n5 as bo,wFe as bp,IUe as bq,eS as br,s5 as bs,gFe as bt,fre as bu,bze as bv,_ze as bw,iv as bx,Sg as by,Nz as bz,Vn as c,Lr as d,EQ as e,Zs as f,RRe as g,zf as h,gh as i,fBe as j,Yw as k,yt as l,Ore as m,Kw as n,syt as o,Byt as p,PRe as q,Iyt as r,MRe as s,LRe as t,Qu as u,cBe as v,eHe as w,iUe as x,vyt as y,O1 as z};
|
|
1389
|
+
`)}`:Se,displayContent:Se,referencedFiles:Be.length>0?Be:void 0,displaySegments:ue,attachments:tr.size>0?[...tr]:void 0}},[is]),F0=v.useCallback(async(U,Q,fe)=>{const ue=await Hc(e,U,fe);if(!ue)return;const Se=aq(ue.displaySegments,Q);Ao({content:ue.promptWithReferences,displayContent:ue.displayContent||ue.promptWithReferences,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,responseStyle:Sr,model:Xt??void 0,referencedFiles:ue.referencedFiles,displaySegments:Se,attachments:Q}),r(""),i(void 0)},[Je,xt,Yt,Sr,Xt,Ao,e,Hc]),sg=v.useCallback(async(U,Q)=>{if(!$0t(Tc==null?void 0:Tc.name))return;const fe=FN(Q);!fe||fe==="New Chat"||await Gm(U,fe)},[Tc==null?void 0:Tc.name,Gm]),Ms=async(U,Q,fe)=>{if(jt==="manager"||Vt==="thread")return Ji(U,fe);const ue=await Hc(e,U,fe);if(!ue&&(!Q||Q.length===0))return;if(!St){o(!0);return}const Se=(ue==null?void 0:ue.promptWithReferences)??e.trim(),Be=aq(ue==null?void 0:ue.displaySegments,Q),gt=FN((ue==null?void 0:ue.displayContent)||Se);let ft=lt;if(!ft){if(!Cn){Ws();return}const Ot=await Oa(void 0,gt);ft=(Ot==null?void 0:Ot.id)??null}if(ft){if(await sg(ft,(ue==null?void 0:ue.displayContent)||Se),ai||pn.length>0){Ao({content:Se,displayContent:(ue==null?void 0:ue.displayContent)||Se,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,responseStyle:Sr,model:Xt??void 0,referencedFiles:ue==null?void 0:ue.referencedFiles,displaySegments:Be,attachments:Q}),r(""),i(void 0);return}hl(Se,{token:St,sessionId:ft,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,responseStyle:Sr,model:Xt??void 0,onLoginRequired:()=>o(!0),attachments:Q,...ue!=null&&ue.displayContent?{displayContent:ue.displayContent||Se}:{},...ue!=null&&ue.referencedFiles?{referencedFiles:ue.referencedFiles}:{},...Be!=null&&Be.length?{displaySegments:Be}:{}}),r(""),i(void 0)}},Ji=async(U,Q)=>{const fe=await Hc(e,U,Q);!fe||Fs||(r(""),i(void 0),await Ne.handleSend(fe.promptWithReferences,xt,xt!=="jait"?Yt:void 0,Xt??void 0,{displayContent:fe.displayContent||fe.promptWithReferences,referencedFiles:fe.referencedFiles,displaySegments:fe.displaySegments,attachments:fe.attachments}))},mp=v.useRef(!1);v.useEffect(()=>{var Q,fe,ue;if(jt==="manager"||Vt==="thread"||!St||!lt||ai||ul||mp.current)return;const[U]=pn;U&&(mp.current=!0,pl(U.id),Promise.resolve(hl(U.content,{token:St,sessionId:lt,mode:U.mode,provider:U.provider,runtimeMode:U.runtimeMode,responseStyle:U.responseStyle,model:U.model,onLoginRequired:()=>o(!0),...(Q=U.attachments)!=null&&Q.length?{attachments:U.attachments}:{},...U.displayContent?{displayContent:U.displayContent}:{},...(fe=U.referencedFiles)!=null&&fe.length?{referencedFiles:U.referencedFiles}:{},...(ue=U.displaySegments)!=null&&ue.length?{displaySegments:U.displaySegments}:{}})).catch(Se=>{Ao({content:U.content,displayContent:U.displayContent,mode:U.mode,provider:U.provider,runtimeMode:U.runtimeMode,responseStyle:U.responseStyle,model:U.model,referencedFiles:U.referencedFiles,displaySegments:U.displaySegments,attachments:U.attachments}),ni.error(cq(Se instanceof Error?Se.message:null,"Failed to send queued message"))}).finally(()=>{mp.current=!1}))},[lt,pl,Ao,ai,ul,pn,hl,Vt,St,jt]);const Rh=v.useCallback((U,Q)=>{Xi(fe=>({...fe,[U]:[...fe[U]??[],Q]}))},[]),gp=v.useCallback((U,Q)=>{Xi(fe=>{const ue=fe[U]??[],Se=ue.filter(Be=>Be.id!==Q);if(Se.length===ue.length)return fe;if(Se.length===0){const{[U]:Be,...gt}=fe;return gt}return{...fe,[U]:Se}})},[]),Dv=v.useCallback((U,Q,fe)=>{const ue=fe.trim();ue&&Xi(Se=>{const Be=Se[U]??[];return Be.length===0?Se:{...Se,[U]:Be.map(gt=>gt.id===Q?{...gt,content:ue,displayContent:ue,fullContent:ue,referencedFiles:void 0,displaySegments:void 0,attachments:void 0}:gt)}})},[]),$u=v.useCallback((U,Q,fe,ue)=>{Xi(Se=>{const Be=Se[U]??[];if(Be.length===0)return Se;const gt=Be.findIndex(tr=>tr.id===Q);if(gt<0)return Se;const ft=[...Be],[Ot]=ft.splice(gt,1);if(!Ot)return Se;if(fe==null)ft.push(Ot);else{const tr=ft.findIndex(Rr=>Rr.id===fe);if(tr<0)return Se;ft.splice(tr+(ue==="after"?1:0),0,Ot)}return ft===Be?Se:{...Se,[U]:ft}})},[]),H0=v.useCallback(U=>{var Se;const Q=Ne.selectedThread,fe=Ne.selectedRepo;if(!Q||!fe)return;const ue=(Se=so[Q.id])==null?void 0:Se.find(Be=>Be.id===U);ue&&(gp(Q.id,U),(async()=>{const Be=`jait/${Math.random().toString(16).slice(2,10)}`;let gt;try{gt=(await Uo.createWorktree(fe.localPath,fe.defaultBranch,Be)).path}catch{try{await Uo.createBranch(fe.localPath,Be,fe.defaultBranch)}catch{}}const ft=await Qr.createThread({title:`[${fe.name}] Generating title…`,providerId:ue.providerId,runtimeMode:ue.runtimeMode,...ue.model?{model:ue.model}:{},kind:"delivery",workingDirectory:gt??fe.localPath,branch:Be});await Qr.startThread(ft.id,{message:ue.fullContent,titlePrefix:`[${fe.name}] `,...ue.displayContent?{displayContent:ue.displayContent}:{},...ue.referencedFiles?{referencedFiles:ue.referencedFiles}:{},...ue.attachments?{attachments:ue.attachments}:{}})})())},[Ne.selectedThread,Ne.selectedRepo,so,gp]),Iv=v.useCallback(async(U,Q,fe)=>{const ue=Ne.selectedThread;if(!ue)return;const Se=await Hc(e,U,fe);Se&&(Rh(ue.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:Se.displayContent||Se.promptWithReferences,displayContent:Se.displayContent||Se.promptWithReferences,fullContent:Se.promptWithReferences,referencedFiles:Se.referencedFiles,displaySegments:Se.displaySegments,attachments:Se.attachments,providerId:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,queuedAt:Date.now()}),r(""),i(void 0))},[Ne.selectedThread,xt,Yt,Xt,Rh,e,Hc]);v.useEffect(()=>{for(const[U,Q]of Object.entries(so)){if(Q.length===0||ql.current.has(U))continue;const fe=Ne.threads.find(Se=>Se.id===U);if(!fe){Xi(Se=>{if(!(U in Se))return Se;const{[U]:Be,...gt}=Se;return gt});continue}if(fe.status==="running")continue;const[ue]=Q;ue&&(ql.current.add(U),Xi(Se=>{const Be=Se[U]??[],[,...gt]=Be;if(gt.length===0){const{[U]:ft,...Ot}=Se;return Ot}return{...Se,[U]:gt}}),Ne.handleSendToThread(U,ue.fullContent,ue.providerId,ue.runtimeMode,ue.model,{displayContent:ue.displayContent??ue.content,referencedFiles:ue.referencedFiles,attachments:ue.attachments}).catch(Se=>{Xi(Be=>({...Be,[U]:[ue,...Be[U]??[]]})),Ne.setError(Se instanceof Error?Se.message:"Failed to process queued thread message")}).finally(()=>{ql.current.delete(U)}))}},[Ne.handleSendToThread,Ne.setError,Ne.threads,so]);const Ph=v.useCallback(async()=>{const U=Ne.selectedRepo;if(U)try{await Qr.updateRepo(U.id,{deviceId:""}),await Ne.refresh()}catch{Ne.setError("Failed to move repository to gateway")}},[Ne.selectedRepo,Ne.refresh,Ne.setError]),W0=async U=>{if(!St){o(!0);return}let Q=lt;if(!Q){if(!Cn){Ws();return}const fe=await Oa();Q=(fe==null?void 0:fe.id)??null}if(Q){if(U==="Generate architecture diagram"){Kt(!0),ge(!0),hl("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.",{token:St,sessionId:Q,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,onLoginRequired:()=>o(!0)});return}hl(U,{token:St,sessionId:Q,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,onLoginRequired:()=>o(!0)})}},xS=v.useCallback(async(U,Q,fe,ue,Se)=>{if(!lt||!St)return;const Be=await Hc(Q,Se==null?void 0:Se.referencedFiles,Se==null?void 0:Se.displaySegments);Be&&await dl(U,Be.promptWithReferences,fe,ue,{token:St,sessionId:lt,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,displayContent:Be.displayContent,referencedFiles:Be.referencedFiles,displaySegments:Be.displaySegments,onLoginRequired:()=>o(!0)})},[lt,dl,St,Je,xt,Yt,Xt,Hc]),Bv=async U=>{if(U.preventDefault(),!tt){l(null),ht(!0);try{await A0(ps,mr),o(!1),Ar(""),c("chat")}catch(Q){l(Q instanceof Error?Q.message:"Login failed")}finally{ht(!1)}}},zv=async U=>{if(U.preventDefault(),!tt){if(l(null),!un||!pi){l("Username and password are required");return}if(pi!==ms){l("Passwords do not match");return}ht(!0);try{await yu(un,pi),o(!1),wa(""),be(""),c("chat"),requestAnimationFrame(()=>{os("workspace"),ss(!0)})}catch(Q){l(Q instanceof Error?Q.message:"Registration failed")}finally{ht(!1)}}},Fv=v.useCallback(async U=>{U.preventDefault();const Q=si.trim();if(!Q){js("Please enter a gateway URL");return}Xf(!0),js(null);try{const fe=Q.replace(/\/+$/,""),ue=await fetch(`${fe}/health`,{signal:AbortSignal.timeout(5e3)});if(!ue.ok)throw new Error(`Server returned ${ue.status}`);const Se=On();if(VJ(fe),fe!==Se){window.location.reload();return}Sa("auth")}catch(fe){js(fe instanceof Error?fe.name==="TimeoutError"||fe.name==="AbortError"?"Connection timed out":fe.message:"Failed to connect")}finally{Xf(!1)}},[si]),bS=()=>{Wm(),fl(),c("chat"),o(!0)},U0=v.useCallback(()=>{if(fl(),!Cn){Ws();return}Oa()},[Cn,fl,Oa,Ws]),_S=async U=>{const Q=Object.fromEntries(Object.entries(U).map(([fe,ue])=>[fe,ue.trim()]).filter(([,fe])=>fe.length>0));await cl({api_keys:Q})},Lj=async()=>{const U=await _h();return await Go(),U.removed},wS=async()=>{const U=await $d();return await Go(),U},SS=async U=>{const Q=await br(U);return Q&&await Go(),Q},CS=v.useCallback(async()=>{if(lt)try{await fetch(`${bs}/api/consent/pending/${lt}/approve-all`,{method:"DELETE"}),kt(!1)}catch{}},[lt]),Hv=v.useCallback(async U=>{const Q=Pue(U);if(!Q)return;if(jt==="manager"||Vt==="thread"){const Se=Ne.selectedThread;if((Se==null?void 0:Se.status)==="running"){Rh(Se.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:Q,displayContent:Q,fullContent:Q,referencedFiles:void 0,attachments:void 0,providerId:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,queuedAt:Date.now()});return}await Ne.handleSend(Q,xt,xt!=="jait"?Yt:void 0,Xt??void 0);return}const fe=FN(Q);let ue=lt;if(!ue){if(!Cn){Ws();return}const Se=await Oa(void 0,fe);ue=(Se==null?void 0:Se.id)??null}if(!(!ue||!St)){if(await sg(ue,Q),ai||pn.length>0){Ao({content:Q,displayContent:Q,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0});return}hl(Q,{token:St,sessionId:ue,mode:Je,provider:xt,runtimeMode:xt!=="jait"?Yt:void 0,model:Xt??void 0,onLoginRequired:()=>o(!0)})}},[lt,Cn,Ne.handleSend,Ne.selectedThread,Je,xt,Yt,Xt,Oa,Rh,Ao,sg,ai,pn.length,Ws,hl,Vt,St,jt]),[Lh,Wv]=v.useState(!1),[Zd,Uv]=v.useState(!1),[Jd,kS]=v.useState(()=>HN()),og=v.useRef(null),Du=v.useRef([]),Qd=v.useRef(null),$h=v.useRef(HN()),yp=v.useRef(null),V0=v.useRef(null),ag=v.useRef(null),Vv=v.useRef(null),lg=v.useRef(null),cg=v.useCallback(()=>{const U=HN();$h.current=U,kS(U)},[]),Dh=v.useCallback(()=>{var Q;lg.current!==null&&(cancelAnimationFrame(lg.current),lg.current=null),(Q=V0.current)==null||Q.disconnect(),V0.current=null,ag.current=null,Vv.current=null;const U=yp.current;yp.current=null,U&&U.state!=="closed"&&U.close().catch(()=>{}),cg()},[cg]),qv=v.useCallback(U=>{Dh();try{const Q=new AudioContext,fe=Q.createAnalyser();fe.fftSize=256,fe.smoothingTimeConstant=.58;const ue=Q.createMediaStreamSource(U);ue.connect(fe);const Se=new Uint8Array(new ArrayBuffer(fe.frequencyBinCount));yp.current=Q,V0.current=ue,ag.current=fe,Vv.current=Se;const Be=()=>{const gt=ag.current,ft=Vv.current;if(!gt||!ft)return;gt.getByteTimeDomainData(ft);let Ot=0;for(let on=0;on<ft.length;on++)Ot+=Math.abs((ft[on]-128)/128);const tr=ft.length>0?Ot/ft.length:0,Rr=Math.pow(Math.min(1,tr*6.8),.78),Hn=Math.min(1,Math.max(M7,Rr)),Zn=($h.current[$h.current.length-1]??M7)*.2+Hn*.8,vs=[...$h.current.slice(-(Rue-1)),Zn];$h.current=vs,kS(vs),lg.current=requestAnimationFrame(Be)};Be()}catch(Q){console.warn("Voice visualizer unavailable:",Q),cg()}},[cg,Dh]),Gv=v.useCallback(U=>{const fe=U.sampleRate,ue=U.getChannelData(0),Se=new ArrayBuffer(44+ue.length*2),Be=new DataView(Se),gt=(Ot,tr)=>{for(let Rr=0;Rr<tr.length;Rr++)Be.setUint8(Ot+Rr,tr.charCodeAt(Rr))};gt(0,"RIFF"),Be.setUint32(4,36+ue.length*2,!0),gt(8,"WAVE"),gt(12,"fmt "),Be.setUint32(16,16,!0),Be.setUint16(20,1,!0),Be.setUint16(22,1,!0),Be.setUint32(24,fe,!0),Be.setUint32(28,fe*1*2,!0),Be.setUint16(32,2,!0),Be.setUint16(34,16,!0),gt(36,"data"),Be.setUint32(40,ue.length*2,!0);let ft=44;for(let Ot=0;Ot<ue.length;Ot++){const tr=Math.max(-1,Math.min(1,ue[Ot]));Be.setInt16(ft,tr<0?tr*32768:tr*32767,!0),ft+=2}return new Blob([Se],{type:"audio/wav"})},[]),Ih=v.useCallback(async()=>{var fe,ue;Wv(!1),Dh();const U=og.current;if(!U||U.state==="inactive"){(fe=Qd.current)==null||fe.getTracks().forEach(Se=>Se.stop()),Qd.current=null,og.current=null;return}const Q=await new Promise(Se=>{U.ondataavailable=Be=>{Be.data.size>0&&Du.current.push(Be.data)},U.onstop=()=>{Se(new Blob(Du.current,{type:U.mimeType}))},U.stop()});if((ue=Qd.current)==null||ue.getTracks().forEach(Se=>Se.stop()),Qd.current=null,og.current=null,Q.size!==0&&(Ns.stt_provider==="wyoming"||Ns.stt_provider==="whisper")){Uv(!0);try{const Se=await Q.arrayBuffer(),Be=new AudioContext({sampleRate:16e3}),gt=await Be.decodeAudioData(Se),ft=Gv(gt);await Be.close();const Ot=await ft.arrayBuffer(),tr=new Uint8Array(Ot);let Rr="";for(let vs=0;vs<tr.length;vs++)Rr+=String.fromCharCode(tr[vs]);const Hn=btoa(Rr),Zn=await(await fetch(`${bs}/api/voice/transcribe-audio`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${St}`},body:JSON.stringify({audioBase64:Hn,sessionId:lt??"voice-input",provider:Ns.stt_provider})})).json();Zn.text?r(vs=>D0t(vs,Zn.text??"")):console.warn("Transcription failed:",Zn.details??Zn.error)}catch(Se){console.error("Transcription error:",Se)}finally{Uv(!1)}}},[lt,Gv,Ns.stt_provider,St]),ef=v.useCallback(async()=>{if(!St){o(!0);return}try{const U=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});Qd.current=U,Du.current=[],qv(U);const Q=new MediaRecorder(U);og.current=Q,Q.ondataavailable=fe=>{fe.data.size>0&&Du.current.push(fe.data)},Q.start(),Wv(!0)}catch(U){Dh(),console.error("Microphone access denied:",U),window.alert("Microphone access is required for push-to-talk.")}},[lt,Ns.stt_provider,qv,Dh,Hv,St]),[Iu,Kv]=v.useState(()=>{try{return localStorage.getItem("jait:wake-word")==="true"}catch{return!1}}),Yv=v.useCallback(()=>{Kv(U=>{const Q=!U;try{localStorage.setItem("jait:wake-word",String(Q))}catch{}return Q})},[]),[wl,ug]=v.useState(!1),Ba=ept({authToken:St,onError:U=>{console.warn("[voice] error:",U)},onDisconnected:()=>{ug(!1)}}),Xv=v.useCallback(()=>{ug(!0),Ba.connect()},[Ba]),Bu=qft({enabled:Iu&&kc&&!Lh&&!wl,lang:navigator.language,onCommand:()=>{Xv()},onWakeWordDetected:()=>{Xv()}});v.useEffect(()=>()=>{var U;Dh(),(U=Qd.current)==null||U.getTracks().forEach(Q=>Q.stop())},[Dh]);const q0=Yo==="limit_reached",vp=!Na&&!kc,jS=jt==="developer"&&u==="chat"&&!vp&&(Na||Pd||!!lt&&(ul||up||Eh||Ic||V)),$j=Vl.length>0||ul,Zv=v.useMemo(()=>Mue({showWorkspace:E,showTerminal:b,showWorkspaceTree:oe,showWorkspaceEditor:le,treeTab:pe}),[pe,b,E,le,oe]),Jv=zt&&Sn&&Zv!==null&&Zv!=="terminal",xp=zt&&u==="chat"&&jt==="developer"&&Zv==="terminal",bp=v.useMemo(()=>({showWorkspace:E,showTerminal:b,showWorkspaceTree:oe,showWorkspaceEditor:le,treeTab:pe}),[pe,b,E,le,oe]),G0=((K0=(rx=Ea==null?void 0:Ea.username)==null?void 0:rx[0])==null?void 0:K0.toUpperCase())??"?",Qv=v.useCallback(()=>{Ih()},[Ih]),ex=v.useCallback(()=>{Ne.setFolderPickerOpen(!0)},[Ne.setFolderPickerOpen]),_p=v.useMemo(()=>{if(Vt==="thread")return h.jsx(fC,{repositories:Ne.repositories,selectedRepo:Ne.selectedRepo,disabled:Ne.creating,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:ex})},[Vt,Ne.repositories,Ne.selectedRepo,Ne.creating,Ne.getRuntimeInfoForRepository,Ne.setSelectedRepoId,ex]),TS=v.useMemo(()=>({onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:Qv,mode:Je,onModeChange:Mt,sendTarget:Vt,onSendTargetChange:Bt,provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:Vt==="thread"?ao:null,onMoveToGateway:Vt==="thread"?Ph:void 0,footerLeadingContent:_p,availableFiles:Eo,onSearchFiles:ig,workspaceOpen:E,sessionInfo:Ec,workspaceNodeId:ie==null?void 0:ie.nodeId}),[ef,Lh,Jd,Zd,Qv,Je,Mt,Vt,Bt,xt,Ou,Yt,Au,Xt,Gd,ao,Ph,_p,Eo,ig,E,Ec,ie==null?void 0:ie.nodeId]),tx=[...Vl.slice(-10).map(U=>YU({id:`msg-${U.id}`,source:"chat",title:`Message: ${U.role}`,detail:U.content.slice(0,120)||"(empty message)"})),...yl.map(U=>YU({id:`term-${U.id}`,source:"terminal",title:"Terminal session",detail:`${U.id} (${U.state})`}))];return h.jsx(PY,{children:h.jsxs("div",{className:"fixed inset-0 flex flex-col overflow-hidden safe-top safe-bottom safe-left safe-right",children:[!vp&&h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`relative flex items-center gap-1 border-b bg-background px-2 sm:gap-2 sm:px-5 shrink-0 ${Ci?"h-10 !pl-[0.8rem]":"h-14"}`,style:Ci?{WebkitAppRegion:"drag",paddingLeft:Sc==="darwin"?70:void 0,paddingRight:Sc==="win32"?140:void 0}:void 0,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:[h.jsx(Boe,{size:20,className:"shrink-0"}),Bu.isSupported&&h.jsx("button",{className:`md:hidden flex items-center justify-center h-8 w-8 rounded-lg shrink-0 transition-colors ${wl?"text-green-400 bg-green-500/10":Iu?Bu.isListening?"text-green-400 bg-green-500/10":"text-blue-400 bg-blue-500/10":"text-muted-foreground hover:bg-accent"}`,onClick:wl?()=>{Ba.disconnect(),ug(!1)}:Yv,"aria-label":wl?"Disconnect voice":Iu?"Disable wake word":"Enable wake word",children:wl?h.jsx(Ay,{className:"h-4 w-4 animate-pulse"}):Iu?h.jsx(Ay,{className:`h-4 w-4 ${Bu.isListening?"animate-pulse":""}`}):h.jsx(yC,{className:"h-4 w-4"})})]}),h.jsxs("nav",{className:"hidden md:flex items-center gap-1 min-w-0 overflow-x-auto scrollbar-none",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:[h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:u==="chat"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>c("chat"),"aria-label":"Chat",children:[h.jsx(sk,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"Chat"})]})}),h.jsx(Yn,{side:"bottom",children:"Chat"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:u==="jobs"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>c("jobs"),"aria-label":"Jobs",children:[h.jsx(ik,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"Jobs"})]})}),h.jsx(Yn,{side:"bottom",children:"Jobs"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:u==="network"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>c("network"),"aria-label":"Network",children:[h.jsx(b_,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"Network"})]})}),h.jsx(Yn,{side:"bottom",children:"Network"})]}),jt==="developer"&&!zt&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:se?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>se?Qm():Mu(),"aria-label":"Screen sharing",children:[h.jsx(Hy,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"Screen Share"})]})}),h.jsx(Yn,{side:"bottom",children:"Screen sharing"})]})]}),wl?h.jsxs("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 flex items-center gap-1.5 rounded-full border border-border/60 bg-background/80 backdrop-blur-sm px-1.5 py-1",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:[h.jsx("button",{onClick:Ba.toggleMic,className:`flex items-center justify-center h-7 w-7 rounded-full transition-colors ${Ba.micActive?"bg-muted hover:bg-muted/80 text-foreground":"bg-destructive/15 text-destructive hover:bg-destructive/25"}`,"aria-label":Ba.micActive?"Mute":"Unmute",children:Ba.micActive?h.jsx(Ay,{className:"h-3.5 w-3.5"}):h.jsx(yC,{className:"h-3.5 w-3.5"})}),h.jsx(T0t,{state:Ba.assistantSpeaking?"speaking":Ba.status,size:"sm",lineWidth:2,className:"!aspect-auto !h-7 w-24 sm:w-36"}),h.jsx("button",{onClick:()=>{Ba.disconnect(),ug(!1)},className:"flex items-center justify-center h-7 w-7 rounded-full bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors","aria-label":"End call",children:h.jsx(k0e,{className:"h-3.5 w-3.5"})})]}):u==="chat"?h.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:h.jsx(Wft,{mode:jt,onChange:vr,compact:zt})}):null,h.jsx("div",{className:"flex-1 min-w-0"}),h.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 shrink-0",style:Ci?{WebkitAppRegion:"no-drag"}:void 0,children:[u==="chat"&&lo.length>0&&h.jsx(G0t,{threads:lo,getRepositoryForThread:Ne.getRepositoryForThread,threadPrStates:Ne.threadPrStates,ghAvailable:Ne.ghAvailable,onOpenThread:U=>{c("chat"),Ne.setSelectedThreadId(U),Bt("thread")},onStopThread:U=>Ne.handleStop(U)}),h.jsxs("div",{className:"hidden md:flex items-center gap-1 sm:gap-1.5",children:[Wd.isActive&&h.jsxs("span",{className:"ui-pill shrink-0",children:[h.jsx(Hy,{className:"h-3 w-3 text-green-500 animate-pulse"}),h.jsx("span",{className:"hidden sm:inline",children:"Sharing"})]}),Bu.isSupported&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs("button",{onClick:wl?()=>{Ba.disconnect(),ug(!1)}:Yv,className:`ui-pill shrink-0 cursor-pointer transition-colors ${wl?"text-green-400 animate-pulse":Iu?Bu.isListening?"text-green-400":"text-blue-400":"text-muted-foreground opacity-50"}`,children:[wl?h.jsx(Ay,{className:"h-3 w-3 animate-pulse"}):Iu?h.jsx(Ay,{className:`h-3 w-3 ${Bu.isListening?"animate-pulse":""}`}):h.jsx(yC,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline text-xs",children:wl?"Voice active":Bu.isListening?"Listening...":Iu?"Hey Jait":"Wake word"})]})}),h.jsx(Yn,{side:"bottom",children:wl?"Voice assistant active — click to disconnect":Iu?Bu.isListening?"Listening for your command...":'Say "Hey Jait" to start voice assistant — click to disable':'Click to enable always-on "Hey Jait" wake word'})]}),h.jsx(XYe,{usage:Ym}),(()=>{const U=xt==="codex"?"openai":xt==="claude-code"?"anthropic":ap??"ollama",Q=xt==="codex"?Xt??"Codex":xt==="claude-code"?Xt??"Claude Code":Ro?Fet(Ro):null,fe=xt==="codex"?`OpenAI Codex CLI${Xt?` · ${Xt}`:""}`:xt==="claude-code"?`Anthropic Claude Code CLI${Xt?` · ${Xt}`:""}`:Ro??"";return Q?h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs("div",{className:"ui-pill cursor-default sm:mr-2",children:[h.jsx(w5,{provider:U,model:xt==="codex"?"codex":xt==="claude-code"?"claude-3":Ro??void 0,size:16}),h.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:Q})]})}),h.jsx(Yn,{side:"bottom",children:fe})]}):null})(),wh!==null&&wh<=5&&h.jsxs("span",{className:"text-xs text-muted-foreground mr-1 sm:mr-2 hidden sm:inline",children:[wh," remaining"]})]}),(Br==null?void 0:Br.hasUpdate)&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{onClick:async()=>{if(ys==="web")c("settings");else if(ys==="electron"){const U=window.jaitDesktop;ni.info("Downloading update...");const Q=await U.downloadUpdate();Q!=null&&Q.ok?(ni.success("Update downloaded. Restarting..."),await U.installUpdate()):ni.error("Download failed")}else window.open("https://github.com/Widev-e-U/Jait/releases/latest","_blank")},variant:"outline",size:"sm",className:"h-8 shrink-0 border-amber-500/30 bg-amber-500/10 px-2 text-amber-700 hover:bg-amber-500/15 hover:text-amber-800 dark:text-amber-300",children:[h.jsx(xG,{className:"h-3.5 w-3.5"}),h.jsxs("span",{className:"hidden sm:inline",children:["v",Br.latestVersion]})]})}),h.jsxs(Yn,{side:"bottom",children:["Update available — v",Br.latestVersion]})]}),h.jsx("div",{className:"md:hidden shrink-0",children:h.jsxs(yd,{children:[h.jsx(vd,{asChild:!0,children:h.jsx(Ae,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0",children:h.jsx(YN,{className:"h-4 w-4"})})}),h.jsxs(mh,{align:"end",children:[h.jsx(k_,{children:"Navigate"}),h.jsxs(_o,{onSelect:()=>c("chat"),children:[h.jsx(sk,{className:"h-4 w-4 mr-2"}),"Chat"]}),h.jsxs(_o,{onSelect:()=>c("jobs"),children:[h.jsx(ik,{className:"h-4 w-4 mr-2"}),"Jobs"]}),h.jsxs(_o,{onSelect:()=>c("network"),children:[h.jsx(b_,{className:"h-4 w-4 mr-2"}),"Network"]}),jt==="developer"&&h.jsxs(_o,{onSelect:()=>se?Qm():Mu(),children:[h.jsx(Hy,{className:"h-4 w-4 mr-2"}),se?"Hide Share":"Screen Share"]}),h.jsx(Og,{}),h.jsxs(_o,{onSelect:()=>c("settings"),children:[h.jsx($$,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]})}),kc?h.jsxs(yd,{children:[h.jsx(vd,{asChild:!0,children:h.jsx("button",{className:"rounded-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:h.jsx(FG,{className:"h-7 w-7",children:h.jsx(HG,{className:"text-[11px]",children:G0})})})}),h.jsxs(mh,{align:"end",children:[h.jsx(k_,{children:Ea==null?void 0:Ea.username}),h.jsx(Og,{}),h.jsxs(_o,{onSelect:()=>c("settings"),children:[h.jsx($$,{className:"h-4 w-4 mr-2"}),"Settings"]}),h.jsx(Og,{}),h.jsxs("div",{className:"px-2 py-1.5",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),h.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",nye],["system",ma],["dark",g0e]].map(([U,Q])=>h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx("button",{onClick:()=>{Da(U)},className:`relative flex items-center justify-center h-6 w-6 rounded-full transition-colors ${p===U?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:h.jsx(Q,{className:"h-3.5 w-3.5"})})}),h.jsx(Yn,{side:"bottom",children:U.charAt(0).toUpperCase()+U.slice(1)})]},U))})]}),h.jsx(Og,{}),h.jsxs(_o,{onSelect:bS,children:[h.jsx(t0e,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):h.jsx(Ae,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>o(!0),children:"Sign in"}),Ci&&Sc==="linux"&&h.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[h.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:h.jsx(vC,{className:"h-4 w-4"})}),h.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:al?h.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:h.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):h.jsx(y1,{className:"h-3 w-3"})}),h.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:h.jsx(ii,{className:"h-4 w-4"})})]})]})]}),u==="chat"&&h.jsxs("div",{className:`flex border-b bg-muted/30 px-2 sm:px-5 shrink-0 ${ku?"min-h-[35px] flex-wrap items-start gap-2 py-1.5":"h-11 md:h-[35px] items-center gap-1 overflow-x-auto overflow-y-visible scrollbar-none"}`,children:[jt==="developer"&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:g?"secondary":"ghost",size:"sm",className:zt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>y(U=>!U),"aria-label":"Toggle workspaces sidebar",children:[g?h.jsx(A$,{className:`h-3 w-3${zt?" rotate-90":" mr-1"}`}):h.jsx(M$,{className:`h-3 w-3${zt?" rotate-90":" mr-1"}`}),!zt&&"Workspaces"]})}),h.jsx(Yn,{side:"bottom",children:"Toggle workspaces sidebar"})]}),(jt==="developer"||jt==="manager"&&Ne.selectedThread)&&h.jsxs(h.Fragment,{children:[jt==="developer"&&!zt&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:b?"secondary":"ghost",size:"sm",className:"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>{rg()},children:[h.jsx(Of,{className:"h-3 w-3 mr-1"}),"Terminal"]})}),h.jsx(Yn,{side:"bottom",children:"Toggle terminal panel"})]}),h.jsx("div",{className:`flex items-center shrink-0 ${zt?"gap-1":""}`,children:zt?h.jsxs(h.Fragment,{children:[h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx(Ae,{variant:wb(bp,"files")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Files",onClick:()=>{Ri("files")},children:h.jsx(ou,{className:"h-4 w-4"})})}),h.jsx(Yn,{side:"bottom",children:"Files"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:wb(bp,"git")?"secondary":"ghost",size:"sm",className:"relative h-9 w-9 rounded-md p-0","aria-label":"Changes",onClick:()=>{Ri("git")},children:[h.jsx(Ng,{className:"h-4 w-4"}),io.length>0&&h.jsx("span",{className:"absolute -right-1 -top-1 z-10 min-w-[14px] rounded-full bg-primary px-1 text-[8px] font-bold leading-[14px] text-primary-foreground",children:io.length>99?"99+":io.length})]})}),h.jsx(Yn,{side:"bottom",children:"Changes"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx(Ae,{variant:wb(bp,"editor")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Editor",onClick:()=>{Ri("editor")},children:h.jsx(KN,{className:"h-4 w-4"})})}),h.jsx(Yn,{side:"bottom",children:"Editor"})]}),jt==="developer"&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx(Ae,{variant:wb(bp,"terminal")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Terminal",onClick:()=>{Ri("terminal")},children:h.jsx(Of,{className:"h-4 w-4"})})}),h.jsx(Yn,{side:"bottom",children:"Terminal"})]})]}):h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:E?"secondary":"ghost",size:"sm",className:"h-7 rounded-md px-2 text-xs",onClick:()=>{B0()},children:[h.jsx(KN,{className:"h-3 w-3 mr-1"}),"Editor",E&&h.jsx(ii,{className:"h-3 w-3 ml-1"})]})}),h.jsx(Yn,{side:"bottom",children:E?"Hide editor":"Show editor"})]})}),jt==="developer"&&E&&ie&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:Bc?"secondary":"ghost",size:"sm",className:zt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":Bc?"Close preview":"Open preview",onClick:()=>{var U,Q;if(Bc)J.open?(U=Es.current)==null||U.closePreviewTarget():Ov();else{const fe=J.target??(P==null?void 0:P.trim())??((Q=li==null?void 0:li.target)==null?void 0:Q.trim())??null;if(vt(fe,(ie==null?void 0:ie.workspaceRoot)??null))return;I0()}},children:[h.jsx(Ii,{className:`h-3 w-3${zt?"":" mr-1"}`}),!zt&&"Preview",!zt&&Bc&&h.jsx(ii,{className:"h-3 wer-3 ml-1"})]})}),h.jsx(Yn,{side:"bottom",children:Bc?"Close preview":"Open dev preview"})]})]}),jt==="developer"&&E&&ie&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:we?"secondary":"ghost",size:"sm",className:zt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":we?"Close architecture":"Open architecture",onClick:()=>{var U;we?((U=Es.current)==null||U.closeArchitectureTab(),ge(!1)):(ge(!0),ll())},children:[h.jsx(nk,{className:`h-3 w-3${zt?"":" mr-1"}`}),!zt&&"Architecture",!zt&&we&&h.jsx(ii,{className:"h-3 w-3 ml-1"})]})}),h.jsx(Yn,{side:"bottom",children:"Software architecture diagram"})]}),jt==="developer"&&E&&ie&&h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsx(Ae,{variant:Ue?"secondary":"ghost",size:"sm",className:"ml-auto h-6 w-6 shrink-0 p-0",onClick:()=>Te(U=>!U),children:h.jsx(Hme,{className:"h-3 w-3"})})}),h.jsx(Yn,{side:"bottom",children:"SSE debug stream"})]}),jt==="manager"&&h.jsxs(h.Fragment,{children:[Ne.selectedThread?h.jsxs(Ae,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>{Ne.setSelectedThreadId(null),r("")},children:[h.jsx(gG,{className:"h-3 w-3 mr-1"}),"Back"]}):h.jsxs(h.Fragment,{children:[h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:C?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>w(U=>!U),children:[C?h.jsx(A$,{className:`h-3 w-3 mr-1${zt?" rotate-90":""}`}):h.jsx(M$,{className:`h-3 w-3 mr-1${zt?" rotate-90":""}`}),"Repositories"]})}),h.jsx(Yn,{side:"bottom",children:"Toggle repositories panel"})]}),Ne.selectedRepo&&Ne.selectedRepo.source==="local"&&h.jsxs(h.Fragment,{children:[h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>j(Ne.selectedRepo),children:[h.jsx(EG,{className:"h-3 w-3 mr-1"}),"Strategy"]})}),h.jsx(Yn,{side:"bottom",children:"Open repository strategy"})]}),h.jsxs(ti,{children:[h.jsx(ri,{asChild:!0,children:h.jsxs(Ae,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>O(Ne.selectedRepo),children:[h.jsx(CG,{className:"h-3 w-3 mr-1"}),"Todos"]})}),h.jsx(Yn,{side:"bottom",children:"Open todo plan"})]})]})]}),h.jsx("div",{className:"flex-1"}),Ne.selectedThread?h.jsxs("div",{className:zt?"flex min-w-0 basis-full items-start gap-1.5":"flex min-w-0 items-center gap-2 shrink-0",children:[h.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2",children:[h.jsx(mP,{status:Ne.selectedThread.status}),h.jsxs("div",{className:`min-w-0 ${zt?"flex-1":"flex items-center gap-2"}`,children:[pP(Ne.selectedThread.title)?h.jsx(Lue,{className:"text-[11px] h-3.5 w-28"}):h.jsx("span",{className:`text-[10px] text-muted-foreground truncate sm:text-[11px] ${zt?"block leading-tight":"max-w-[200px]"}`,children:Ne.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),h.jsx(Due,{kind:Ne.selectedThread.kind}),(Ne.selectedRepo||zt&&Ne.selectedThread.branch)&&h.jsxs("span",{className:`text-[10px] text-muted-foreground truncate ${zt?"mt-0.5 block leading-tight":"max-w-[160px]"}`,children:[Ne.selectedRepo?`${Ne.selectedRepo.name} · ${Ne.selectedRepo.defaultBranch}`:"",zt&&Ne.selectedThread.branch?`${Ne.selectedRepo?" · ":""}${Ne.selectedThread.branch}`:""]})]})]}),h.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[!zt&&Ne.selectedThread.branch&&h.jsx(Vr,{variant:"outline",className:"text-[9px] px-1 py-0 font-mono",children:Ne.selectedThread.branch}),fP(Ne.selectedThread)&&h.jsx(Ae,{variant:"ghost",size:"icon",className:"h-[18px] w-[18px] sm:h-5 sm:w-5",onClick:()=>void Ne.handleStop(Ne.selectedThread.id),title:Ne.selectedThread.kind==="delegation"?"End helper thread":"Stop thread",children:h.jsx(y1,{className:"h-2.5 w-2.5"})}),Ne.showGitActions&&Ne.selectedRepo&&h.jsx("div",{className:zt?"shrink-0":"ml-2 shrink-0",children:h.jsx(SR,{threadId:Ne.selectedThread.id,cwd:Ne.selectedThread.workingDirectory??Ne.selectedRepo.localPath,branch:Ne.selectedThread.branch,baseBranch:Ne.selectedRepo.defaultBranch,threadTitle:Ne.selectedThread.title,threadStatus:Ne.selectedThread.status,threadKind:Ne.selectedThread.kind,prUrl:Ne.selectedThread.prUrl,prState:Ne.selectedThread.id in Ne.threadPrStates?Ne.threadPrStates[Ne.selectedThread.id]:Ne.selectedThread.prState,ghAvailable:Ne.ghAvailable,showStatusBadge:!zt})})]})]}):null]})]}),u==="jobs"?h.jsx("div",{className:"flex-1 overflow-y-auto",children:h.jsx($tt,{})}):u==="network"?h.jsx("div",{className:"flex-1 overflow-y-auto",children:h.jsx(gdt,{token:St,sessionId:lt??"default"})}):u==="settings"?h.jsx("div",{className:"flex-1 overflow-y-auto",children:h.jsx(sst,{username:(Ea==null?void 0:Ea.username)??"",token:St,apiKeys:Ns.api_keys,onSaveApiKeys:_S,sttProvider:Ns.stt_provider,onSttProviderChange:async U=>{await cl({stt_provider:U})},jaitBackend:Ns.jait_backend??"openai",onJaitBackendChange:async U=>{await cl({jait_backend:U})},onClearArchive:Lj,onClearArchivedWorkspaces:wS,onFetchArchivedWorkspaces:Dd,onRestoreWorkspace:SS,activityEvents:tx,updateInfo:Br,updateChecking:Gi,onCheckUpdate:()=>{no()},onApplyUpdate:()=>{jv()},updateApplying:ks,platform:ys})}):h.jsxs("div",{className:`flex flex-1 min-h-0 overflow-hidden ${zt?"flex-col":""}`,children:[h.jsxs("div",{className:zt?"contents":`relative flex min-h-0 ${W?"flex-1 min-w-0":"shrink-0"}`,children:[jt==="developer"&&g&&h.jsx("aside",{className:`overflow-hidden ${zt?"h-52 border-b shrink-0":"w-64 border-r shrink-0"}`,children:h.jsx(LYe,{workspaces:zs,activeWorkspaceId:Cn,loading:Pd,hasMoreWorkspaces:Qf,showFewerWorkspaces:zs.length>Km,onSelectWorkspace:Rv,onCreateWorkspace:Pv,onRemoveWorkspace:U=>{ip(U)},onChangeDirectory:rp,onShowMore:xu,onShowFewer:ep,sessionInfo:Ec,nodes:to})}),(jt==="developer"&&u==="chat"&&(ro||b)||jt==="manager"&&Ne.selectedThread&&ro)&&h.jsxs("div",{className:`flex min-h-0 flex-col ${W?"flex-1 min-w-0":"shrink-0"}`,style:!ro&&b?{width:480,maxWidth:"70vw"}:void 0,children:[(jt==="developer"||jt==="manager"&&Ne.selectedThread)&&ro&&h.jsx("div",{className:"flex min-h-0 flex-1",children:h.jsx(RF,{ref:Es,autoOpenRemotePath:(ie==null?void 0:ie.workspaceRoot)??null,surfaceId:(ie==null?void 0:ie.surfaceId)??null,files:is,activeFileId:Ca,onActiveFileChange:Ki,onFileDrop:U=>{$v(U)},onReferenceFile:eg,onReferenceSelection:Yd,onReferencePreviewElement:tg,onAvailableFilesChange:gu,showTree:oe,showEditor:le,onToggleTree:fp,onToggleEditor:Av,changedPaths:Lu,fsWatcherVersion:Wl,sourceControlRefreshSignal:jh,savedTabsState:ne,stateReady:ce,previewRequest:z,onTabsStateChange:qn,onPreviewOpenChange:Ru,previewSessionId:lt,previewToken:St,previewWorkspaceRoot:(ie==null?void 0:ie.workspaceRoot)??null,previewInitialTarget:P,previewBrowserSessionId:B,browserSessions:Ai.sessions,browserInterventions:Ai.interventions,onTakeBrowserControl:Ai.takeControl,onReturnBrowserControl:Ai.returnControl,onResumeBrowserSession:Ai.resume,onResolveBrowserIntervention:Ai.resolveIntervention,architectureDiagram:at,architectureGenerating:Ft,architectureRequest:ar,onArchitectureOpenChange:ge,onArchitectureRenderResult:Hr,onGenerateArchitecture:()=>{Kt(!0),W0("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.")},onApplyDiff:Lv,provider:xt,cliModel:Xt,onCollapsedChange:G,onMaxCollapsedChange:I,restoreRef:F})}),jt==="developer"&&b&&!zt&&u==="chat"&&h.jsxs("div",{className:"flex min-h-0 shrink-0 flex-col border-r border-t bg-background",style:{height:ke},children:[h.jsx("div",{onMouseDown:Zi,className:"h-1 cursor-row-resize hover:bg-primary/30 transition-colors shrink-0"}),h.jsxs("div",{className:"relative",children:[h.jsx(VU,{terminals:Ia,activeTerminalId:Ma,onSelect:vl,onCreate:()=>Xo(lt??"default",$o??void 0),onKill:Xd}),h.jsx("button",{onClick:Xl,className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:h.jsx(ii,{className:"h-3.5 w-3.5"})})]}),Ma?h.jsx(n7,{terminalId:Ma,className:"flex-1 min-h-0",token:St,workspaceRoot:$o??void 0,onReferenceSelection:Mh}):h.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:h.jsx("button",{onClick:()=>Xo(lt??"default",$o??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]})]})]}),xp&&h.jsxs("section",{className:"flex flex-1 min-h-0 flex-col border-b bg-background overflow-hidden",children:[h.jsxs("div",{className:"relative shrink-0 border-b",children:[h.jsx(VU,{terminals:Ia,activeTerminalId:Ma,onSelect:vl,onCreate:()=>Xo(lt??"default",$o??void 0),onKill:Xd}),h.jsx("button",{onClick:Xl,className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:h.jsx(ii,{className:"h-3.5 w-3.5"})})]}),Ma?h.jsx(n7,{terminalId:Ma,className:"flex-1 min-h-0",token:St,workspaceRoot:$o??void 0,onReferenceSelection:Mh}):h.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:h.jsx("button",{onClick:()=>Xo(lt??"default",$o??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]}),(jt==="developer"||jt==="manager"&&Ne.selectedThread)&&Jv&&h.jsx("section",{className:"flex-1 min-h-0 border-b bg-background overflow-hidden",children:h.jsx(RF,{ref:Es,autoOpenRemotePath:(ie==null?void 0:ie.workspaceRoot)??null,surfaceId:(ie==null?void 0:ie.surfaceId)??null,files:is,activeFileId:Ca,onActiveFileChange:Ki,onFileDrop:U=>{$v(U)},onReferenceFile:eg,onReferenceSelection:Yd,onReferencePreviewElement:tg,onAvailableFilesChange:gu,showTree:oe,showEditor:le,onToggleTree:fp,onToggleEditor:Av,treeTab:pe,onTreeTabChange:_e,changedPaths:Lu,sourceControlRefreshSignal:jh,isMobile:!0,savedTabsState:ne,stateReady:ce,previewRequest:z,onTabsStateChange:qn,onPreviewOpenChange:Ru,previewSessionId:lt,previewToken:St,previewWorkspaceRoot:(ie==null?void 0:ie.workspaceRoot)??null,previewInitialTarget:P,previewBrowserSessionId:B,browserSessions:Ai.sessions,browserInterventions:Ai.interventions,onTakeBrowserControl:Ai.takeControl,onReturnBrowserControl:Ai.returnControl,onResumeBrowserSession:Ai.resume,onResolveBrowserIntervention:Ai.resolveIntervention,architectureDiagram:at,architectureGenerating:Ft,architectureRequest:ar,onArchitectureOpenChange:ge,onArchitectureRenderResult:Hr,onGenerateArchitecture:()=>{Kt(!0),W0("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.")},onApplyDiff:Lv,provider:xt,cliModel:Xt})}),!Jv&&!xp&&(jt==="manager"?h.jsx("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:Ne.selectedThread?h.jsxs(h.Fragment,{children:[h.jsxs(eT,{className:"min-h-0 flex-1 border-b",loading:Ne.loadingActivities,loadingLabel:"Loading activity",messageContents:oo.map(U=>U.content),children:[oo.length===0&&!Ne.loadingActivities&&h.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No activity yet"}),oo.map((U,Q)=>{var fe,ue;return h.jsx(eA,{messageId:U.id,messageIndex:Q,messageFromEnd:oo.length-1-Q,role:U.role,content:U.content,toolCalls:U.toolCalls,segments:U.segments,isStreaming:((fe=Ne.selectedThread)==null?void 0:fe.status)==="running"&&Q===oo.length-1,compact:!0,preferLlmUi:!1,provider:(ue=Ne.selectedThread)==null?void 0:ue.providerId,onOpenPath:z0,onOpenDiff:ng},U.id)})]},((Y0=Ne.selectedThread)==null?void 0:Y0.id)??"manager-empty"),h.jsx("div",{className:"shrink-0 py-3 px-4",children:h.jsxs("div",{className:"mx-auto max-w-3xl",children:[Ne.error&&h.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-2",children:[h.jsx(Xb,{className:"h-4 w-4 shrink-0"}),h.jsx("span",{className:"min-w-0 break-words",children:Ne.error})]}),Ac.length>0&&Ne.selectedThread&&h.jsx(qF,{items:Ac,onRemove:U=>gp(Ne.selectedThread.id,U),onEdit:(U,Q)=>Dv(Ne.selectedThread.id,U,Q),onReorder:(U,Q,fe)=>$u(Ne.selectedThread.id,U,Q,fe),onSendToParallelThread:H0,className:"mb-2"}),h.jsx(jb,{ref:gi,draftStateKey:`manager:${((nx=Ne.selectedThread)==null?void 0:nx.id)??"new-thread"}`,value:e,onChange:r,onSubmit:Ms,onQueue:Iv,onStop:()=>{Ne.selectedThread&&Ne.handleStop(Ne.selectedThread.id)},isLoading:((ix=Ne.selectedThread)==null?void 0:ix.status)==="running",disabled:Ne.creating,placeholder:(Bh=Ne.selectedThread)!=null&&Bh.providerSessionId||((sx=Ne.selectedThread)==null?void 0:sx.status)==="running"?"Send a follow-up message...":"Describe what you want to do...",onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:()=>{Ih()},provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:Cu,onMoveToGateway:Ph,availableFiles:Eo,onSearchFiles:ig,workspaceOpen:E}),h.jsxs("div",{className:"flex items-center gap-2 px-1 mt-1.5",children:[Cu&&h.jsx(Y5,{runtime:Cu}),Ne.selectedThread&&Ne.selectedThread.status!=="running"&&!Ne.selectedThread.providerSessionId&&h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:"Thread finished — start a new one"})]})]})})]}):h.jsxs("div",{className:`flex flex-1 min-h-0 ${zt?"flex-col":""}`,children:[C&&h.jsx("div",{className:`overflow-hidden ${zt?"h-52 shrink-0 border-b":"w-56 shrink-0 border-r"}`,children:h.jsx(V0t,{repositories:Ne.repositories,selectedRepoId:((ox=Ne.selectedRepo)==null?void 0:ox.id)??null,isMobile:zt,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:()=>Ne.setFolderPickerOpen(!0),onRemoveRepository:U=>{Ne.removeRepository(U)},onOpenStrategy:U=>j(U),onOpenPlan:U=>O(U)})}),h.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-y-auto",children:[h.jsx("div",{className:"relative z-10 flex flex-col items-center px-3 pb-1.5 pt-3 sm:px-4 sm:pb-2 sm:pt-4",children:h.jsxs("div",{className:"w-full max-w-3xl",children:[h.jsx("h1",{className:"mb-3 text-center text-xl font-semibold tracking-tight sm:mb-4 sm:text-2xl",children:"What do you want to build?"}),Ne.error&&h.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-3",children:[h.jsx(Xb,{className:"h-4 w-4 shrink-0"}),h.jsx("span",{className:"min-w-0 break-words",children:Ne.error})]}),h.jsx(jb,{ref:gi,draftStateKey:`manager:${((ax=Ne.selectedRepo)==null?void 0:ax.id)??"repo-draft"}`,value:e,onChange:r,onSubmit:Ms,disabled:Fs,controlsDisabled:Ne.creating||co,placeholder:Po,onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:()=>{Ih()},provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:ao,onMoveToGateway:Ph,footerLeadingContent:h.jsx(fC,{repositories:Ne.repositories,selectedRepo:Ne.selectedRepo,disabled:Ne.creating,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:()=>Ne.setFolderPickerOpen(!0)})}),ao&&h.jsx(Y5,{runtime:ao,className:"mt-1 px-1"})]})}),h.jsx("div",{className:"flex-1 overflow-y-auto",children:h.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[h.jsxs("div",{className:"flex h-[35px] items-center justify-between border-b px-2.5 sm:px-3",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{className:"text-sm font-medium",children:"Threads"}),h.jsx(Vr,{variant:"secondary",className:"h-5 rounded-md px-1.5 text-[10px]",children:Gl.length})]}),h.jsx(Ae,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>void Ne.refresh(),children:h.jsx(Ua,{className:`h-3.5 w-3.5 ${Ne.loading?"animate-spin":""}`})})]}),Gl.length===0?h.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground sm:py-12",children:"No threads yet"}):h.jsxs("div",{className:"flex flex-col",children:[Gl.map(U=>{const Q=Ne.getRepositoryForThread(U),fe=(Q==null?void 0:Q.name)??Rj(U)??"Unknown repo";return h.jsx(q0t,{thread:U,repo:Q,repoName:fe,prState:U.id in Ne.threadPrStates?Ne.threadPrStates[U.id]:U.prState,ghAvailable:Ne.ghAvailable,onOpen:()=>Ne.setSelectedThreadId(U.id),onStop:()=>{Ne.handleStop(U.id)},onDelete:()=>Ne.handleDelete(U.id)},U.id)}),Ne.hasMoreThreads&&h.jsx("button",{className:"px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground sm:px-4 sm:py-2",onClick:Ne.showMoreThreads,children:"Show more threads"}),Gl.length>Ne.threadListLimit&&h.jsx("button",{className:"px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground sm:px-4 sm:py-2",onClick:Ne.showFewerThreads,children:"Show less"})]})]})})]})]})}):jS?h.jsx("div",{className:"flex flex-col min-h-0 min-w-0 overflow-hidden",style:{flex:W?"0 0 0px":"1 1 0%",width:W?0:void 0,minWidth:W?0:void 0,visibility:W?"hidden":void 0},children:!W&&h.jsx(eT,{className:"min-h-0 flex-1 border-b",compact:ro,loading:!0,loadingLabel:"Loading chat",messageContents:[],children:null},lt??"developer-loading")}):$j?h.jsx("div",{className:"flex flex-col min-h-0 min-w-0 overflow-hidden",style:{flex:W?"0 0 0px":"1 1 0%",width:W?0:void 0,minWidth:W?0:void 0,visibility:W?"hidden":void 0},children:!W&&h.jsxs(h.Fragment,{children:[h.jsxs(eT,{className:"min-h-0 flex-1 border-b",compact:ro,loading:ul,loadingLabel:"Loading chat",messageContents:Vl.map(U=>U.content),children:[Vl.map((U,Q)=>h.jsx(eA,{messageId:U.id,messageIndex:Q,messageFromEnd:Vl.length-1-Q,role:U.role,content:U.content,displayContent:U.displayContent,referencedFiles:U.referencedFiles,displaySegments:U.displaySegments,attachments:U.attachments,thinking:U.thinking,thinkingDuration:U.thinkingDuration,toolCalls:U.toolCalls,segments:U.segments,isStreaming:ai&&U===Vl[Vl.length-1],compact:E||se||Bc,preferLlmUi:!0,provider:xt,onOpenTerminal:Gn,onEditMessage:xS,editComposer:TS,onOpenPath:z0,onOpenDiff:ng},U.id)),pn.length>0&&h.jsx(qF,{items:pn,onRemove:pl,onEdit:P0,onReorder:ml})]},lt??"developer-empty"),h.jsx("div",{className:`shrink-0 py-3 ${ro?"px-3":"px-4"}`,children:h.jsxs("div",{className:"mx-auto w-full max-w-3xl space-y-1.5",children:[Sh.length>0&&h.jsx(VYe,{items:Sh}),Yo&&Yo!=="login_required"&&Yo!=="limit_reached"&&!ai&&h.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 dark:text-red-400 dark:border-red-400/40 dark:bg-red-400/10",children:[h.jsx(Xb,{className:"h-4 w-4 shrink-0"}),h.jsx("span",{className:"min-w-0 break-words",children:Yo})]}),R0&&!ai&&h.jsxs("div",{className:"flex items-center justify-center gap-2 py-1.5",children:[h.jsxs("button",{onClick:()=>sp({token:St,sessionId:lt}),className:"inline-flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 text-xs font-medium text-foreground shadow-sm hover:bg-accent transition-colors",children:[h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Continue"]}),h.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Agent stopped — hit the tool execution limit"})]}),h.jsx(nXe,{compact:!0,sessionId:lt,onApproveAllEnabled:()=>kt(!0)}),as&&h.jsx(WYe,{plan:as,onApprove:bu,onReject:Nc,isExecuting:ai}),q0&&h.jsx("p",{className:"text-center text-sm text-destructive",children:"Daily limit reached. Come back tomorrow."}),io.length>0&&h.jsx(qYe,{files:io,onAccept:Oc,onReject:L0,onAcceptAll:$0,onRejectAll:D0,onFileClick:ng}),h.jsx(jb,{ref:gi,draftStateKey:`developer:${lt??"new-chat"}`,value:e,segments:n,onChange:r,onSubmit:Ms,onStop:ju,onQueue:F0,isLoading:ai,disabled:q0,placeholder:xl,onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:()=>{Ih()},mode:Je,onModeChange:Mt,responseStyle:Sr,onResponseStyleChange:dp,sendTarget:Vt,onSendTargetChange:Bt,showSendTargetSelector:!1,provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:Vt==="thread"?ao:null,onMoveToGateway:Vt==="thread"?Ph:void 0,footerLeadingContent:Vt==="thread"?h.jsx(fC,{repositories:Ne.repositories,selectedRepo:Ne.selectedRepo,disabled:Ne.creating,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:()=>Ne.setFolderPickerOpen(!0)}):void 0,availableFiles:Eo,onSearchFiles:ig,workspaceOpen:E,sessionInfo:Ec,workspaceNodeId:ie==null?void 0:ie.nodeId}),h.jsx("div",{className:"overflow-x-auto px-1",children:h.jsxs("div",{className:"grid min-w-max grid-cols-[1fr_auto_1fr] items-center gap-3 whitespace-nowrap",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[jt==="developer"&&h.jsx(WF,{sessions:qr,activeSessionId:lt,workspaceTitle:(rn==null?void 0:rn.title)??null,onSelectSession:U=>{Cn&&vu(Cn,U)},onNewSession:()=>{Oa()},onOpenChange:ta,showTitle:!1,triggerLabel:"History"}),Gt&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-[11px] text-green-600 dark:text-green-400 truncate",children:"Approved all commands for this session"}),h.jsx("button",{onClick:CS,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"Clear approve all"})]})]}),h.jsx("div",{className:"justify-self-center",children:jt==="developer"&&h.jsx(VF,{target:Vt,onChange:Bt,disabled:ai})}),h.jsxs("div",{className:"flex shrink-0 items-center justify-self-end gap-2",children:[jt==="developer"&&h.jsx("button",{onClick:U0,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New chat"}),jt==="manager"&&h.jsx("button",{onClick:()=>Ne.setSelectedThreadId(null),className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New thread"}),wh!==null&&h.jsxs("span",{className:"text-[11px] text-muted-foreground shrink-0",children:[wh," remaining"]})]})]})})]})})]})}):h.jsxs("div",{className:`flex-1 min-w-0 flex flex-col items-center justify-center overflow-hidden ${W?"":"px-4"}`,style:{flex:W?"0 0 0px":void 0,width:W?0:void 0,minWidth:W?0:void 0,visibility:W?"hidden":void 0},children:[" ",h.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[h.jsxs("div",{className:"text-center",children:[h.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Jait"}),h.jsx("p",{className:"text-base text-muted-foreground mt-1",children:"Just Another Intelligent Tool"})]}),!Pd&&zs.length===0?h.jsxs("div",{className:"text-center space-y-3",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a workspace folder to start chatting with your code."}),h.jsxs(Ae,{variant:"default",size:"lg",onClick:()=>{os("workspace"),ss(!0)},children:[h.jsx(ou,{className:"h-4 w-4 mr-2"}),"Add Workspace"]})]}):h.jsx(DYe,{suggestions:E&&ie?H0t:F0t,onSelect:W0}),h.jsx(jb,{ref:gi,draftStateKey:`developer:${lt??"new-chat"}`,value:e,segments:n,onChange:r,onSubmit:Ms,onStop:ju,onQueue:F0,isLoading:ai,placeholder:xl,onVoiceInput:ef,voiceRecording:Lh,voiceLevels:Jd,voiceTranscribing:Zd,onVoiceStop:()=>{Ih()},mode:Je,onModeChange:Mt,responseStyle:Sr,onResponseStyleChange:dp,sendTarget:Vt,onSendTargetChange:Bt,showSendTargetSelector:!1,provider:xt,onProviderChange:Ou,providerRuntimeMode:Yt,onProviderRuntimeModeChange:Au,cliModel:Xt,onCliModelChange:Gd,repoRuntime:Vt==="thread"?ao:null,onMoveToGateway:Vt==="thread"?Ph:void 0,footerLeadingContent:Vt==="thread"?h.jsx(fC,{repositories:Ne.repositories,selectedRepo:Ne.selectedRepo,disabled:Ne.creating,getRuntimeInfo:Ne.getRuntimeInfoForRepository,onSelect:Ne.setSelectedRepoId,onAddRepository:()=>Ne.setFolderPickerOpen(!0)}):void 0,availableFiles:Eo,onSearchFiles:ig,workspaceOpen:E,sessionInfo:Ec,workspaceNodeId:ie==null?void 0:ie.nodeId}),jt==="developer"&&h.jsx("div",{className:"overflow-x-auto px-1",children:h.jsxs("div",{className:"grid min-w-max grid-cols-[1fr_auto_1fr] items-center gap-2 whitespace-nowrap",children:[h.jsx("div",{className:"flex min-w-0 items-center gap-2",children:h.jsx(WF,{sessions:qr,activeSessionId:lt,workspaceTitle:(rn==null?void 0:rn.title)??null,onSelectSession:U=>{Cn&&vu(Cn,U)},onNewSession:()=>{Oa()},onOpenChange:ta,showTitle:!1,triggerLabel:"History"})}),h.jsx(VF,{target:Vt,onChange:Bt,disabled:ai,className:"justify-self-center"}),h.jsx("div",{className:"flex shrink-0 items-center justify-self-end gap-2",children:h.jsx("button",{onClick:U0,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New chat"})})]})})]})]}))]}),jt==="developer"&&Ue&&h.jsx("div",{className:"fixed top-14 right-0 bottom-0 w-[420px] border-l z-50 shadow-xl",children:h.jsx(lXe,{onClose:()=>Te(!1)})})]}),vp&&Ci&&h.jsx("div",{className:"fixed top-0 left-0 right-0 h-10 z-[60]",style:{WebkitAppRegion:"drag"}}),vp&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(220,17%,10%)]",children:h.jsx("div",{className:"w-full max-w-md border bg-background p-6 shadow-sm rounded-lg",children:Oi==="url"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[h.jsxs("h2",{className:"text-lg font-semibold leading-none tracking-tight flex items-center gap-2",children:[h.jsx(ua,{className:"h-5 w-5"}),"Connect to Gateway"]}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Jait gateway URL to get started."})]}),h.jsxs("form",{onSubmit:Fv,className:"space-y-4 pt-2",children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),h.jsx(Un,{id:"gateway-url",placeholder:"https://jait.example.com",value:si,onChange:U=>{mi(U.target.value),js(null)},autoFocus:!0})]}),To&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[h.jsx(gd,{className:"h-4 w-4 shrink-0"}),To]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:Cc,children:Cc?h.jsxs(h.Fragment,{children:[h.jsx(rr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[h.jsx("h2",{className:"text-lg font-semibold leading-none tracking-tight",children:Et===!1?"Welcome to Jait":"Account"}),h.jsx("div",{className:"text-sm text-muted-foreground",children:ns?h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsx(ua,{className:"h-3 w-3 text-green-500"}),h.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:bs}),h.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Sa("url"),children:"Change"})]}):Et===!1?h.jsx("p",{children:"Create your account to get started."}):h.jsx("p",{children:"Sign in with a username and password."})})]}),h.jsxs(x1,{value:ae,onValueChange:U=>Ie(U),children:[h.jsxs(Kg,{className:"grid grid-cols-2 w-full",children:[h.jsx(Ho,{value:"login",children:"Login"}),h.jsx(Ho,{value:"register",children:"Register"})]}),h.jsx(Wo,{value:"login",className:"pt-4",children:h.jsxs("form",{className:"space-y-4",onSubmit:Bv,children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"login-username",children:"Username"}),h.jsx(Un,{id:"login-username",value:ps,onChange:U=>$t(U.target.value),autoComplete:"username",required:!0})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"login-password",children:"Password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"login-password",type:nr?"text":"password",value:mr,onChange:U=>Ar(U.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>Tt(!nr),tabIndex:-1,children:nr?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:tt,children:tt?"Signing in…":"Login"})]})}),h.jsx(Wo,{value:"register",className:"pt-4",children:h.jsxs("form",{className:"space-y-4",onSubmit:zv,children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-username",children:"Username"}),h.jsx(Un,{id:"register-username",value:un,onChange:U=>qi(U.target.value),autoComplete:"username",required:!0})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-password",children:"Password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"register-password",type:hr?"text":"password",value:pi,onChange:U=>wa(U.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>qt(!hr),tabIndex:-1,children:hr?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"register-password-confirm",type:Jt?"text":"password",value:ms,onChange:U=>be(U.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>kr(!Jt),tabIndex:-1,children:Jt?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:tt,children:tt?"Creating account…":Et===!1?"Get Started":"Create account"})]})})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a})]})})}),h.jsx(v0,{open:s&&!vp,onOpenChange:U=>{o(U)},children:h.jsx(Pm,{className:"sm:max-w-md",children:Oi==="url"?h.jsxs(h.Fragment,{children:[h.jsxs(vm,{children:[h.jsxs(xm,{className:"flex items-center gap-2",children:[h.jsx(ua,{className:"h-5 w-5"}),"Connect to Gateway"]}),h.jsx(__,{children:"Enter your Jait gateway URL to get started."})]}),h.jsxs("form",{onSubmit:Fv,className:"space-y-4 pt-2",children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),h.jsx(Un,{id:"gateway-url",placeholder:"https://jait.example.com",value:si,onChange:U=>{mi(U.target.value),js(null)},autoFocus:!0})]}),To&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[h.jsx(gd,{className:"h-4 w-4 shrink-0"}),To]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:Cc,children:Cc?h.jsxs(h.Fragment,{children:[h.jsx(rr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs(vm,{children:[h.jsx(xm,{children:Et===!1?"Welcome to Jait":"Account"}),h.jsx(__,{asChild:!0,children:ns?h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsx(ua,{className:"h-3 w-3 text-green-500"}),h.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:bs}),h.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Sa("url"),children:"Change"})]}):Et===!1?h.jsx("p",{children:"Create your account to get started."}):h.jsx("p",{children:"Sign in with a username and password."})})]}),h.jsxs(x1,{value:ae,onValueChange:U=>Ie(U),children:[h.jsxs(Kg,{className:"grid grid-cols-2 w-full",children:[h.jsx(Ho,{value:"login",children:"Login"}),h.jsx(Ho,{value:"register",children:"Register"})]}),h.jsx(Wo,{value:"login",className:"pt-4",children:h.jsxs("form",{className:"space-y-4",onSubmit:Bv,children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"login-username",children:"Username"}),h.jsx(Un,{id:"login-username",value:ps,onChange:U=>$t(U.target.value),autoComplete:"username",required:!0})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"login-password",children:"Password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"login-password",type:nr?"text":"password",value:mr,onChange:U=>Ar(U.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>Tt(!nr),tabIndex:-1,children:nr?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:tt,children:tt?"Signing in…":"Login"})]})}),h.jsx(Wo,{value:"register",className:"pt-4",children:h.jsxs("form",{className:"space-y-4",onSubmit:zv,children:[h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-username",children:"Username"}),h.jsx(Un,{id:"register-username",value:un,onChange:U=>qi(U.target.value),autoComplete:"username",required:!0})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-password",children:"Password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"register-password",type:hr?"text":"password",value:pi,onChange:U=>wa(U.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>qt(!hr),tabIndex:-1,children:hr?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),h.jsxs("div",{className:"group/pw relative",children:[h.jsx(Un,{id:"register-password-confirm",type:Jt?"text":"password",value:ms,onChange:U=>be(U.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),h.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>kr(!Jt),tabIndex:-1,children:Jt?h.jsx(nd,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(id,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Ae,{type:"submit",className:"w-full",disabled:tt,children:tt?"Creating account…":Et===!1?"Get Started":"Create account"})]})})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a})]})})}),h.jsx(KU,{open:jn,onOpenChange:U=>{ss(U),U||ka(null)},initialPath:Ns.workspace_picker_path,initialNodeId:Ns.workspace_picker_node_id,onSelect:(U,Q)=>{Zl(U,Q).catch(fe=>{console.error("Failed to select workspace:",fe),ni.error(`Failed to select workspace: ${fe instanceof Error?fe.message:"Unknown error"}`)})}}),h.jsx(KU,{open:Ne.folderPickerOpen,onOpenChange:Ne.setFolderPickerOpen,onSelect:(U,Q)=>{Ne.handleFolderSelected(U,Q)}}),k&&h.jsx(ztt,{open:!!k,onOpenChange:U=>{U||j(null)},repoId:k.id,repoName:k.name}),N&&h.jsx(Wtt,{open:!!N,onOpenChange:U=>{U||O(null)},repoId:N.id,repoName:N.name,defaultBranch:N.defaultBranch,repoLocalPath:N.localPath,provider:xt,model:Xt,onStartThread:(U,Q,fe)=>{(async()=>{const ue=N,Se=`jait/${Math.random().toString(16).slice(2,10)}`;let Be;try{Be=(await Uo.createWorktree(ue.localPath,ue.defaultBranch,Se)).path}catch{try{await Uo.createBranch(ue.localPath,Se,ue.defaultBranch)}catch{}}const gt=await Qr.createThread({title:`[${ue.name}] ${U.title}`,providerId:xt,runtimeMode:xt!=="jait"?Yt:void 0,kind:"delivery",workingDirectory:Be??ue.localPath,branch:Se});await Qr.startThread(gt.id,{message:U.description||U.title,titleTask:U.title,titlePrefix:`[${ue.name}] `});const ft=Q.tasks.map(Ot=>Ot.id===U.id?{...Ot,status:"running",threadId:gt.id}:Ot);await Qr.updatePlan(Q.id,{tasks:ft})})()}}),se&&h.jsxs("div",{className:"fixed z-50 bg-background border rounded-lg shadow-2xl overflow-hidden flex flex-col",style:{left:Ce.x<0?void 0:Ce.x,top:Ce.y<0?void 0:Ce.y,right:Ce.x<0?16:void 0,bottom:Ce.y<0?16:void 0,width:Ye.w,height:Ye.h},children:[h.jsxs("div",{className:"flex items-center justify-between h-8 px-3 border-b bg-muted/30 shrink-0 cursor-move select-none",onPointerDown:kv,style:{touchAction:"none"},children:[h.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[h.jsx(Hy,{className:"h-3 w-3"})," Screen Share"]}),h.jsx(Ae,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onPointerDown:U=>U.stopPropagation(),onClick:Qm,children:h.jsx(ii,{className:"h-3 w-3"})})]}),h.jsx(xdt,{screenShare:Wd}),h.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize opacity-50 hover:opacity-100",onPointerDown:Md,style:{touchAction:"none"},children:h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-muted-foreground",children:h.jsx("path",{d:"M10 2L2 10M10 6L6 10M10 10L10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),h.jsx(M0t,{sessions:Ai.sessions,interventions:Ai.interventions,loading:Ai.loading,previewState:J.open?J:li,onRefresh:Ai.refresh,onOpenLiveSession:vt,onResolveIntervention:Ai.resolveIntervention})]})})}function Y0t(){const[e,r]=wt.useState(()=>document.documentElement.classList.contains("dark")?"dark":"light");wt.useEffect(()=>{const i=document.documentElement,s=()=>r(i.classList.contains("dark")?"dark":"light");s();const o=new MutationObserver(s);return o.observe(i,{attributes:!0,attributeFilter:["class"]}),()=>o.disconnect()},[]);const n=!!window.jaitDesktop&&navigator.userAgent.includes("Windows");return h.jsx(Cde,{position:"top-right",theme:e,closeButton:!0,gap:8,visibleToasts:4,offset:n?44:void 0})}Zhe.createRoot(document.getElementById("root")).render(h.jsx(wt.StrictMode,{children:h.jsx(Sye,{children:h.jsxs(wye,{children:[h.jsx(K0t,{}),h.jsx(Y0t,{})]})})}));export{gyt as $,NRe as A,oyt as B,n_ as C,bd as D,yMe as E,DRe as F,qM as G,vQ as H,ga as I,lBe as J,ZFe as K,rIe as L,$De as M,lz as N,az as O,myt as P,uyt as Q,fyt as R,dyt as S,lyt as T,Ur as U,SM as V,pyt as W,cyt as X,vy as Y,yyt as Z,Y as _,ARe as a,xre as a$,hyt as a0,QMe as a1,s2 as a2,iyt as a3,uj as a4,HFe as a5,yRe as a6,TQ as a7,LB as a8,zDe as a9,Dyt as aA,Ryt as aB,yr as aC,Pyt as aD,pUe as aE,cUe as aF,lUe as aG,see as aH,RDe as aI,pWe as aJ,lQ as aK,DDe as aL,nyt as aM,p0 as aN,rS as aO,dWe as aP,hWe as aQ,PDe as aR,pW as aS,BFe as aT,bre as aU,sj as aV,cj as aW,o5 as aX,jst as aY,wre as aZ,yh as a_,nO as aa,XFe as ab,kRe as ac,Gw as ad,sr as ae,Er as af,NQ as ag,BWe as ah,Mie as ai,$yt as aj,uBe as ak,xa as al,qf as am,Gx as an,GM as ao,Ere as ap,sv as aq,Mre as ar,ur as as,IFe as at,Oze as au,AFe as av,DM as aw,aF as ax,MUe as ay,Lyt as az,ORe as b,mFe as b0,yM as b1,Zp as b2,c2 as b3,JB as b4,KLe as b5,pr as b6,Rre as b7,Il as b8,FLe as b9,wze as bA,BM as bB,xze as bC,kze as bD,nv as bE,Bm as bF,Cz as bG,zM as bH,mre as bI,PO as bJ,zFe as bK,lj as bL,S0 as bM,Z0t as bN,qe as bO,gM as ba,UQ as bb,Jw as bc,GQ as bd,ayt as be,FB as bf,zB as bg,mNe as bh,DFe as bi,OFe as bj,yze as bk,IM as bl,hFe as bm,FFe as bn,n5 as bo,wFe as bp,IUe as bq,eS as br,s5 as bs,gFe as bt,fre as bu,bze as bv,_ze as bw,iv as bx,Sg as by,Nz as bz,Vn as c,Lr as d,EQ as e,Zs as f,RRe as g,zf as h,gh as i,fBe as j,Yw as k,yt as l,Ore as m,Kw as n,syt as o,Byt as p,PRe as q,Iyt as r,MRe as s,LRe as t,Qu as u,cBe as v,eHe as w,iUe as x,vyt as y,O1 as z};
|
package/web-dist/assets/{infoDiagram-LFFYTUFH-D4ia-2pB.js → infoDiagram-LFFYTUFH-Cw8LQL1O.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as a,l as s,L as n,e as i}from"./index-
|
|
1
|
+
import{_ as a,l as s,L as n,e as i}from"./index-Dq41yItG.js";import{p}from"./treemap-KZPCXAKY-8EgFmnrX.js";import"./_baseUniq-DwbJum7y.js";import"./_basePickBy-BgC2rNUG.js";import"./clone-CIbo0o1s.js";var g={parse:a(async r=>{const e=await p("info",r);s.debug(e)},"parse")},v={version:"11.13.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,o)=>{s.debug(`rendering info diagram
|
|
2
2
|
`+r);const t=n(e);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)},"draw"),l={draw:c},y={parser:g,db:m,renderer:l};export{y as diagram};
|