tarsk 0.4.26 → 0.4.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/index.js +634 -198
  2. package/dist/public/assets/account-view-DcpSNB3N.js +1 -0
  3. package/dist/public/assets/alert-dialog-CQRWdGnn.js +1 -0
  4. package/dist/public/assets/api-CH5gAPs5.js +1 -0
  5. package/dist/public/assets/{browser-tab-BNkQAd5u.js → browser-tab-CiAz6nc1.js} +1 -1
  6. package/dist/public/assets/chat-input-container-C6U_WFFu.js +21 -0
  7. package/dist/public/assets/context-menu-A9p22S7d.js +1 -0
  8. package/dist/public/assets/conversation-history-view-CD_uVRNY.js +1 -0
  9. package/dist/public/assets/{dialogs-config-BEsTbY1C.js → dialogs-config-vkfELnGl.js} +3 -3
  10. package/dist/public/assets/diff-view-CjbcDB6m.js +3 -0
  11. package/dist/public/assets/explorer-tab-view-BfycKUUW.js +2 -0
  12. package/dist/public/assets/explorer-tree-DTFYhczJ.js +1 -0
  13. package/dist/public/assets/explorer-view-C0KcZ8NQ.js +1 -0
  14. package/dist/public/assets/history-view-Dn0hQIKU.js +1 -0
  15. package/dist/public/assets/index-Bdde81Uo.css +1 -0
  16. package/dist/public/assets/index-DKQVo4Vz.js +29 -0
  17. package/dist/public/assets/markdown-renderer-CNuyXHcy.js +10 -0
  18. package/dist/public/assets/mcp-server-card-DBEBe3Qh.js +1 -0
  19. package/dist/public/assets/onboarding-DslO5AS6.js +1 -0
  20. package/dist/public/assets/onboarding-dialog-CE-GhoDt.js +1 -0
  21. package/dist/public/assets/{page-toolbar-DM-x5q1_.js → page-toolbar-CloU_Kvo.js} +1 -1
  22. package/dist/public/assets/{project-settings-view-wkrbmymL.js → project-settings-view-CxD9JZoB.js} +1 -1
  23. package/dist/public/assets/providers-list-view-CNxVBJlM.js +1 -0
  24. package/dist/public/assets/radio-group-Co0Lg6se.js +1 -0
  25. package/dist/public/assets/react-vendor-DyE9sO8V.js +22 -0
  26. package/dist/public/assets/resizable-dToeUeVD.js +1 -0
  27. package/dist/public/assets/{run-stop-button-CZ62jJDn.js → run-stop-button-DZ4JFwdL.js} +2 -2
  28. package/dist/public/assets/settings-instructions-view-DWzAH2yN.js +1 -0
  29. package/dist/public/assets/settings-mcp-servers-view-q6gGMMVX.js +5 -0
  30. package/dist/public/assets/settings-models-view-BDDFQWWC.js +1 -0
  31. package/dist/public/assets/settings-rules-view-DsEwgDFr.js +8 -0
  32. package/dist/public/assets/settings-skills-view-DV40_L1o.js +2 -0
  33. package/dist/public/assets/settings-slash-commands-view-BEk3BgOY.js +1 -0
  34. package/dist/public/assets/settings-subagents-view-d3P4ylDX.js +2 -0
  35. package/dist/public/assets/settings-view-ClTMPafQ.js +2 -0
  36. package/dist/public/assets/{side-panel-container-DVnN8vFb.js → side-panel-container-BAYoMt7B.js} +2 -2
  37. package/dist/public/assets/skeleton-DveUQR4w.js +1 -0
  38. package/dist/public/assets/standard-list-item-BLlgm1qW.js +1 -0
  39. package/dist/public/assets/store-BcwWHqYr.js +4 -0
  40. package/dist/public/assets/{tab-context-DBrXMyNd.js → tab-context-DWD20a4z.js} +1 -1
  41. package/dist/public/assets/tabs-CgvpwOBj.js +1 -0
  42. package/dist/public/assets/{terminal-panel-COYGYBV5.js → terminal-panel-CkIe2d2K.js} +2 -2
  43. package/dist/public/assets/textarea-C2UIAa7y.js +1 -0
  44. package/dist/public/assets/todos-view-C-awG1dZ.js +1 -0
  45. package/dist/public/assets/{use-toast-BqYP6xbg.js → use-toast-yY7qQuQP.js} +1 -1
  46. package/dist/public/assets/{utils-BavofGRh.js → utils-BKss67Vg.js} +1 -1
  47. package/dist/public/assets/whisper-wasm-B7iuRPFr.js +2 -0
  48. package/dist/public/ide/antigravity.svg +1 -0
  49. package/dist/public/ide/devin.svg +1 -0
  50. package/dist/public/index.html +22 -20
  51. package/dist/public/wasm/libmain-CWYJvMY5.js +3318 -0
  52. package/dist/public/wasm/libmain-D9-QM3iM.mjs +3301 -0
  53. package/package.json +4 -3
  54. package/dist/public/assets/account-view-g3bIVa-z.js +0 -1
  55. package/dist/public/assets/alert-dialog-DXEB8gMn.js +0 -1
  56. package/dist/public/assets/api-DQLZE-zX.js +0 -1
  57. package/dist/public/assets/chat-input-container-C8o4YcJZ.js +0 -1
  58. package/dist/public/assets/context-menu-CThafUml.js +0 -1
  59. package/dist/public/assets/conversation-history-view-64T6FDPb.js +0 -1
  60. package/dist/public/assets/diff-view-DgR-WEkB.js +0 -3
  61. package/dist/public/assets/explorer-tab-view-B53xe5xM.js +0 -2
  62. package/dist/public/assets/explorer-tree-KuYjR6r9.js +0 -1
  63. package/dist/public/assets/explorer-view-Cj6fyxMP.js +0 -1
  64. package/dist/public/assets/history-view-_L50vkTM.js +0 -1
  65. package/dist/public/assets/index-CAoVFXj2.css +0 -1
  66. package/dist/public/assets/index-Q5OqmtNF.js +0 -50
  67. package/dist/public/assets/onboarding-C_q_uRK0.js +0 -1
  68. package/dist/public/assets/onboarding-dialog-Cum5S2wE.js +0 -1
  69. package/dist/public/assets/provider-details-view-jc3yYdzr.js +0 -1
  70. package/dist/public/assets/providers-sidebar-B796hXzU.js +0 -1
  71. package/dist/public/assets/react-vendor-QkuITxN7.js +0 -17
  72. package/dist/public/assets/resizable-GT3fWOfA.js +0 -1
  73. package/dist/public/assets/settings-view-BbL7i34u.js +0 -2
  74. package/dist/public/assets/standard-list-item-ByRgCvKd.js +0 -1
  75. package/dist/public/assets/store-Dyy2UFdD.js +0 -2
  76. package/dist/public/assets/tabs-DxQZhlZp.js +0 -1
  77. package/dist/public/assets/textarea-CUYwgm5q.js +0 -1
  78. package/dist/public/assets/todos-view-DB99PEKH.js +0 -1
  79. /package/dist/public/assets/{dist-CIGnaqp2.js → dist-Bjt_i1zi.js} +0 -0
  80. /package/dist/public/assets/{monaco-c-HyCuEi.js → monaco-SWcefg0q.js} +0 -0
@@ -0,0 +1,29 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-settings-view-CxD9JZoB.js","assets/rolldown-runtime-B1FJdls4.js","assets/react-vendor-DyE9sO8V.js","assets/history-view-Dn0hQIKU.js","assets/dialogs-config-vkfELnGl.js","assets/monaco-SWcefg0q.js","assets/textarea-C2UIAa7y.js","assets/use-toast-yY7qQuQP.js","assets/diff-view-CjbcDB6m.js","assets/chat-input-container-C6U_WFFu.js","assets/onboarding-DslO5AS6.js","assets/alert-dialog-CQRWdGnn.js","assets/store-BcwWHqYr.js","assets/tab-context-DWD20a4z.js","assets/whisper-wasm-B7iuRPFr.js","assets/utils-BKss67Vg.js","assets/page-toolbar-CloU_Kvo.js","assets/context-menu-A9p22S7d.js","assets/resizable-dToeUeVD.js","assets/standard-list-item-BLlgm1qW.js","assets/terminal-panel-CkIe2d2K.js","assets/explorer-tab-view-BfycKUUW.js","assets/browser-tab-CiAz6nc1.js","assets/run-stop-button-DZ4JFwdL.js","assets/onboarding-dialog-CE-GhoDt.js","assets/settings-view-ClTMPafQ.js","assets/side-panel-container-BAYoMt7B.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,$n as n,$t as r,A as i,An as a,Ar as o,Bi as s,Bn as c,Br as l,Bt as u,C as d,Cn as f,En as p,Fi as m,Fn as h,Fr as g,Gn as _,Gr as v,H as y,Hi as b,Hr as x,Ii as S,Ir as C,Ji as w,Jn as T,Jt as E,Ki as D,Kn as O,Kr as k,Kt as A,L as j,Lr as M,M as N,Mn as P,Nn as F,O as I,On as L,P as R,Pr as z,Qi as B,Qr as ee,Qt as V,Ri as te,Rn as H,Rt as U,Sa as W,Si as ne,Ti as re,Tt as ie,Un as ae,Ut as oe,Vi as se,Vn as G,Vr as ce,Vt as le,Wr as ue,Wt as de,Xn as K,Xt as fe,Yi as pe,Yn as q,Yt as me,Z as he,Zn as J,Zr as ge,Zt as _e,_ as ve,_n as ye,aa as be,an as xe,b as Se,ba as Ce,ca as we,ci as Te,da as Ee,di as De,dn as Oe,dt as ke,ea as Ae,ei as je,er as Me,f as Ne,fa as Pe,fi as Fe,fn as Ie,g as Le,ga as Re,gi as ze,gn as Be,h as Ve,ha as He,hi as Ue,ht as We,ia as Ge,ii as Ke,in as qe,j as Je,ji as Ye,jn as Xe,jt as Ze,ki as Qe,kn as $e,li as et,lt as tt,ma as nt,mi as rt,mt as it,na as at,nn as ot,o as st,oa as ct,oi as lt,on as ut,p as dt,pi as ft,qn as pt,ra as mt,ri as ht,rt as gt,sa as _t,ta as vt,ti as yt,tr as bt,ua as xt,ut as St,v as Ct,va as wt,w as Tt,wi as Et,wn as Dt,wt as Ot,xn as kt,xt as At,y as jt,z as Mt,zi as Nt,zt as Pt}from"./dialogs-config-vkfELnGl.js";import{A as Ft,D as It,E as Lt,O as Rt,St as zt,T as Bt,_t as Vt,at as Ht,gt as Ut,ht as Wt,it as Gt,k as Kt,nt as qt,rt as Jt,tt as Yt,vt as Xt,w as Zt,xt as Qt,yt as $t}from"./react-vendor-DyE9sO8V.js";import{a as en,c as tn,d as nn,f as rn,i as an,m as on,n as sn,o as cn,p as ln,r as un,t as Y}from"./store-BcwWHqYr.js";import{t as dn}from"./textarea-C2UIAa7y.js";import{c as fn,l as pn,s as mn,u as hn}from"./history-view-Dn0hQIKU.js";import{_ as gn,a as _n,c as vn,d as yn,f as bn,g as xn,h as Sn,i as Cn,l as wn,m as Tn,n as En,o as Dn,p as On,r as kn,s as An,t as jn,u as Mn}from"./chat-input-container-C6U_WFFu.js";import{n as Nn,t as X}from"./use-toast-yY7qQuQP.js";import{t as Pn}from"./standard-list-item-BLlgm1qW.js";import{a as Fn,c as In,i as Ln,n as Rn,o as zn,r as Bn,s as Vn,t as Hn}from"./alert-dialog-CQRWdGnn.js";import{t as Un}from"./side-panel-container-BAYoMt7B.js";import{t as Wn}from"./markdown-renderer-CNuyXHcy.js";import{n as Gn,t as Kn}from"./tab-context-DWD20a4z.js";import{o as qn,s as Jn}from"./onboarding-DslO5AS6.js";import{n as Yn,t as Xn}from"./run-stop-button-DZ4JFwdL.js";import{n as Zn,t as Qn}from"./utils-BKss67Vg.js";import{i as $n,n as er,r as tr,t as nr}from"./tabs-CgvpwOBj.js";import{t as rr}from"./page-toolbar-CloU_Kvo.js";import{n as ir,r as ar,t as or}from"./resizable-dToeUeVD.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Z=e(W(),1),sr=zt(),Q=Ce(),cr=1e10,lr=1e3;function ur(e,t){let n=e.map(e=>`"${e}"`).join(`, `);return Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function dr(e={}){let t={},n={},r;function i(e){n.unregisterHandler&&n.unregisterHandler(),n=e,n.registerHandler?.(x)}function a(e){if(typeof e==`function`){r=e;return}r=(t,n)=>{let r=e[t];if(r)return r(n);let i=e._;if(!i)throw Error(`The requested method has no handler: ${String(t)}`);return i(t,n)}}let{maxRequestTime:o=lr}=e;e.transport&&i(e.transport),e.requestHandler&&a(e.requestHandler),e._debugHooks&&(t=e._debugHooks);let s=0;function c(){return s<=cr?++s:s=0}let l=new Map,u=new Map;function d(e,...r){let i=r[0];return new Promise((r,a)=>{if(!n.send)throw ur([`send`],`make requests`);let s=c(),d={type:`request`,id:s,method:e,params:i};l.set(s,{resolve:r,reject:a}),o!==1/0&&u.set(s,setTimeout(()=>{u.delete(s),l.delete(s),a(Error(`RPC request timed out.`))},o)),t.onSend?.(d),n.send(d)})}let f=new Proxy(d,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>d(t,e)}),p=f;function m(e,...r){let i=r[0];if(!n.send)throw ur([`send`],`send messages`);let a={type:`message`,id:e,payload:i};t.onSend?.(a),n.send(a)}let h=new Proxy(m,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>m(t,e)}),g=h,_=new Map,v=new Set;function y(e,t){if(!n.registerHandler)throw ur([`registerHandler`],`register message listeners`);if(e===`*`){v.add(t);return}_.has(e)||_.set(e,new Set),_.get(e).add(t)}function b(e,t){if(e===`*`){v.delete(t);return}_.get(e)?.delete(t),_.get(e)?.size===0&&_.delete(e)}async function x(e){if(t.onReceive?.(e),!(`type`in e))throw Error(`Message does not contain a type.`);if(e.type===`request`){if(!n.send||!r)throw ur([`send`,`requestHandler`],`handle requests`);let{id:i,method:a,params:o}=e,s;try{s={type:`response`,id:i,success:!0,payload:await r(a,o)}}catch(e){if(!(e instanceof Error))throw e;s={type:`response`,id:i,success:!1,error:e.message}}t.onSend?.(s),n.send(s);return}if(e.type===`response`){let t=u.get(e.id);t!=null&&clearTimeout(t),u.delete(e.id);let{resolve:n,reject:r}=l.get(e.id)??{};l.delete(e.id),e.success?n?.(e.payload):r?.(Error(e.error));return}if(e.type===`message`){for(let t of v)t(e.id,e.payload);let t=_.get(e.id);if(!t)return;for(let n of t)n(e.payload);return}throw Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:i,setRequestHandler:a,request:f,requestProxy:p,send:h,sendProxy:g,addMessageListener:y,removeMessageListener:b,proxy:{send:g,request:p}}}function fr(e,t){let n=dr({maxRequestTime:t.maxRequestTime,requestHandler:{...t.handlers.requests,...t.extraRequestHandlers},transport:{registerHandler:()=>{}}}),r=t.handlers.messages;return r&&n.addMessageListener(`*`,((e,t)=>{let n=r[`*`];n&&n(e,t);let i=r[e];i&&i(t)})),n}var pr=window.__electrobunWebviewId,mr=window.__electrobunRpcSocketPort,hr=class{bunSocket;rpc;rpcHandler;constructor(e){this.rpc=e.rpc,this.init()}init(){this.initSocketToBun(),window.__electrobun.receiveMessageFromBun=this.receiveMessageFromBun.bind(this),this.rpc&&this.rpc.setTransport(this.createTransport())}initSocketToBun(){let e=new WebSocket(`ws://localhost:${mr}/socket?webviewId=${pr}`);this.bunSocket=e,e.addEventListener(`open`,()=>{}),e.addEventListener(`message`,async e=>{let t=e.data;if(typeof t==`string`)try{let e=JSON.parse(t),n=await window.__electrobun_decrypt(e.encryptedData,e.iv,e.tag);this.rpcHandler?.(JSON.parse(n))}catch(e){console.error(`Error parsing bun message:`,e)}else t instanceof Blob||console.error(`UNKNOWN DATA TYPE RECEIVED:`,e.data)}),e.addEventListener(`error`,e=>{console.error(`Socket error:`,e)}),e.addEventListener(`close`,e=>{})}createTransport(){let e=this;return{send(t){try{let n=JSON.stringify(t);e.bunBridge(n)}catch(e){console.error(`bun: failed to serialize message to webview`,e)}},registerHandler(t){e.rpcHandler=t}}}async bunBridge(e){if(this.bunSocket?.readyState===WebSocket.OPEN)try{let{encryptedData:t,iv:n,tag:r}=await window.__electrobun_encrypt(e),i=JSON.stringify({encryptedData:t,iv:n,tag:r});this.bunSocket.send(i);return}catch(e){console.error(`Error sending message to bun via socket:`,e)}window.__electrobunBunBridge?.postMessage(e)}receiveMessageFromBun(e){this.rpcHandler&&this.rpcHandler(e)}static defineRPC(e){return fr(`webview`,{...e,extraRequestHandlers:{evaluateJavascriptWithResponse:({script:e})=>new Promise(t=>{try{let n=Function(e)();n instanceof Promise?n.then(e=>{t(e)}).catch(e=>{console.error(`bun: async script execution failed`,e),t(String(e))}):t(n)}catch(e){console.error(`bun: failed to eval script`,e),t(String(e))}})}})}},$=o();function gr(e){let t=(0,Q.c)(47),{open:n,onOpenChange:r,feedbackName:i,onFeedbackNameChange:a,feedbackEmail:o,onFeedbackEmailChange:s,feedbackText:l,onFeedbackTextChange:u,loadingFeedbackUser:d,submittingFeedback:f,onSubmit:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsxs)(q,{children:[(0,$.jsx)(K,{children:`Send Feedback`}),(0,$.jsx)(pt,{children:`Share feedback about Tarsk.`})]}),t[0]=m):m=t[0];let h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(H,{htmlFor:`feedback-name`,children:`Name`}),t[1]=h):h=t[1];let g;t[2]===a?g=t[3]:(g=e=>a(e.target.value),t[2]=a,t[3]=g);let v=f||d,y;t[4]!==i||t[5]!==g||t[6]!==v?(y=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[h,(0,$.jsx)(c,{id:`feedback-name`,value:i,onChange:g,placeholder:`Your name`,disabled:v})]}),t[4]=i,t[5]=g,t[6]=v,t[7]=y):y=t[7];let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(H,{htmlFor:`feedback-email`,children:`Email`}),t[8]=b):b=t[8];let x;t[9]===s?x=t[10]:(x=e=>s(e.target.value),t[9]=s,t[10]=x);let S=f||d,C;t[11]!==o||t[12]!==x||t[13]!==S?(C=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[b,(0,$.jsx)(c,{id:`feedback-email`,type:`email`,value:o,onChange:x,placeholder:`you@example.com`,disabled:S})]}),t[11]=o,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(H,{htmlFor:`feedback-text`,children:`Feedback`}),t[15]=w):w=t[15];let E;t[16]===u?E=t[17]:(E=e=>u(e.target.value),t[16]=u,t[17]=E);let D;t[18]!==l||t[19]!==f||t[20]!==E?(D=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[w,(0,$.jsx)(dn,{id:`feedback-text`,value:l,onChange:E,placeholder:`Tell us what you think...`,className:`min-h-32`,disabled:f})]}),t[18]=l,t[19]=f,t[20]=E,t[21]=D):D=t[21];let k;t[22]!==D||t[23]!==y||t[24]!==C?(k=(0,$.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[y,C,D]}),t[22]=D,t[23]=y,t[24]=C,t[25]=k):k=t[25];let A;t[26]===r?A=t[27]:(A=()=>r(!1),t[26]=r,t[27]=A);let j;t[28]!==f||t[29]!==A?(j=(0,$.jsx)(G,{variant:`outline`,onClick:A,disabled:f,children:`Cancel`}),t[28]=f,t[29]=A,t[30]=j):j=t[30];let M;t[31]===f?M=t[32]:(M=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{className:`mr-2 h-4 w-4 animate-spin`}),`Sending...`]}):`Send Feedback`,t[31]=f,t[32]=M);let N;t[33]!==p||t[34]!==f||t[35]!==M?(N=(0,$.jsx)(G,{onClick:p,disabled:f,children:M}),t[33]=p,t[34]=f,t[35]=M,t[36]=N):N=t[36];let P;t[37]!==j||t[38]!==N?(P=(0,$.jsxs)(T,{children:[j,N]}),t[37]=j,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==k||t[41]!==P?(F=(0,$.jsxs)(O,{className:`max-w-xl`,children:[m,k,P]}),t[40]=k,t[41]=P,t[42]=F):F=t[42];let I;return t[43]!==r||t[44]!==n||t[45]!==F?(I=(0,$.jsx)(_,{open:n,onOpenChange:r,children:F}),t[43]=r,t[44]=n,t[45]=F,t[46]=I):I=t[46],I}function _r(){let[e,t]=(0,Z.useState)(!1),[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{if(!e)return;let t=!0;return l(!0),St().then(e=>{t&&(r(t=>t||e.name),a(t=>t||e.email))}).catch(()=>{t&&X({title:`Could not load git details`,description:`You can still submit feedback by entering your name and email manually.`,variant:`destructive`})}).finally(()=>{t&&l(!1)}),()=>{t=!1}},[e]),{showFeedback:e,feedbackName:n,setFeedbackName:r,feedbackEmail:i,setFeedbackEmail:a,feedbackText:o,setFeedbackText:s,loadingFeedbackUser:c,submittingFeedback:u,handleFeedbackDialogChange:e=>{t(e),e||s(``)},handleSubmitFeedback:async()=>{let e=o.trim();if(!e){X({title:`Feedback required`,description:`Please enter your feedback before submitting.`,variant:`destructive`});return}d(!0);try{await F(`api/feedback`,{name:n.trim(),email:i.trim(),feedback:e}),X({title:`Feedback sent`,description:`Thanks for sharing your feedback.`}),s(``),t(!1)}catch(e){X({title:`Failed to send feedback`,description:e instanceof Error?e.message:`Please try again.`,variant:`destructive`})}finally{d(!1)}}}}var vr=(0,Z.lazy)(()=>Qt(()=>import(`./project-settings-view-CxD9JZoB.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])));function yr(e){let t=(0,Q.c)(89),{projects:r,selectedThreadId:i,selectedProjectId:a,processingThreadIds:o,completedThreadIds:s,deletingThreadIds:c,deletingProjectIds:l,onSelectThread:u,onCreateProject:d,onCreateThread:f,onDeleteThread:p,onDeleteProject:m,onDeselect:g,collapsed:v,updateAvailable:y,updatingApp:b,onUpdateApp:x,onRefreshProjects:S,expandProjectId:C}=e,w=$t(),[T,E]=(0,Z.useState)(null),{showFeedback:D,feedbackName:k,setFeedbackName:A,feedbackEmail:j,setFeedbackEmail:M,feedbackText:N,setFeedbackText:P,loadingFeedbackUser:F,submittingFeedback:I,handleFeedbackDialogChange:L,handleSubmitFeedback:R}=_r(),z;t[0]===r?z=t[1]:(z=r.map(br),t[0]=r,t[1]=z);let B=z,ee;t[2]!==v||t[3]!==d?(ee=!v&&(0,$.jsxs)(G,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:d,children:[(0,$.jsx)(Te,{className:`h-4 w-4 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:`New Project`})]}),t[2]=v,t[3]=d,t[4]=ee):ee=t[4];let V;t[5]!==v||t[6]!==x||t[7]!==y||t[8]!==b?(V=y&&(0,$.jsxs)(G,{variant:`ghost`,size:`sm`,className:`w-full justify-start gap-2 text-emerald-600 dark:text-emerald-400`,onClick:x,disabled:b,children:[b?(0,$.jsx)(re,{className:`h-4 w-4 animate-spin`}):(0,$.jsx)(pe,{className:`h-4 w-4`}),!v&&(0,$.jsx)(`span`,{className:`truncate`,children:b?`Updating...`:`Update to Latest`})]}),t[5]=v,t[6]=x,t[7]=y,t[8]=b,t[9]=V):V=t[9];let te;t[10]===w?te=t[11]:(te=()=>void w(`/settings`),t[10]=w,t[11]=te);let H;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(je,{className:`h-4 w-4`}),t[12]=H):H=t[12];let U;t[13]===v?U=t[14]:(U=!v&&(0,$.jsx)(`span`,{className:`truncate`,children:`Settings`}),t[13]=v,t[14]=U);let W;t[15]!==te||t[16]!==U?(W=(0,$.jsxs)(G,{variant:`ghost`,size:`sm`,className:`flex-1 justify-start gap-2 text-sidebar-foreground`,onClick:te,children:[H,U]}),t[15]=te,t[16]=U,t[17]=W):W=t[17];let ie;t[18]===L?ie=t[19]:(ie=()=>L(!0),t[18]=L,t[19]=ie);let ae,oe;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(ne,{className:`h-4 w-4`}),ae=(0,$.jsx)(`span`,{className:`sr-only`,children:`Feedback`}),t[20]=ae,t[21]=oe):(ae=t[20],oe=t[21]);let se;t[22]===ie?se=t[23]:(se=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(G,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-background`,onClick:ie,children:[oe,ae]})}),t[22]=ie,t[23]=se);let ce;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(fn,{children:`Send feedback to the Tarsk team`}),t[24]=ce):ce=t[24];let le;t[25]===se?le=t[26]:(le=(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[se,ce]})}),t[25]=se,t[26]=le);let ue;t[27]!==le||t[28]!==W?(ue=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[W,le]}),t[27]=le,t[28]=W,t[29]=ue):ue=t[29];let de;t[30]!==ue||t[31]!==V?(de=(0,$.jsxs)(`div`,{className:`px-3 py-2 flex flex-col gap-1`,children:[V,ue]}),t[30]=ue,t[31]=V,t[32]=de):de=t[32];let K;t[33]===r.length?K=t[34]:(K=r.length===0&&(0,$.jsx)(`p`,{className:`px-3 py-6 text-center text-xs text-muted-foreground`,children:`No projects yet. Clone a repository to get started.`}),t[33]=r.length,t[34]=K);let fe;t[35]===C?fe=t[36]:(fe=C?[C]:void 0,t[35]=C,t[36]=fe);let q;t[37]!==s||t[38]!==l||t[39]!==c||t[40]!==f||t[41]!==m||t[42]!==p||t[43]!==u||t[44]!==o||t[45]!==r||t[46]!==a||t[47]!==i?(q=(e,t)=>{let{isOpen:d,toggle:h}=t;return e.kind===`project`?(0,$.jsx)(xr,{project:e.project,isOpen:d,onToggle:h,isDeletingProject:l.includes(e.project.projectId),isSelected:a?e.project.projectId===a:!1,onCreateThread:f,onDeleteProject:m,onProjectSettings:E,hasSelectedThread:e.project.threads.some(e=>e.threadId===i)}):(0,$.jsx)(Sr,{thread:e.thread,projectId:e.projectId,selectedThreadId:i,isProcessing:o.includes(e.thread.threadId),isDeleting:c.includes(e.thread.threadId),isCompleted:s.includes(e.thread.threadId),projectTitlePrefix:`${n(r.find(t=>t.projectId===e.projectId))} - `,onSelectThread:u,onDeleteThread:p})},t[37]=s,t[38]=l,t[39]=c,t[40]=f,t[41]=m,t[42]=p,t[43]=u,t[44]=o,t[45]=r,t[46]=a,t[47]=i,t[48]=q):q=t[48];let me;t[49]!==B||t[50]!==fe||t[51]!==q?(me=(0,$.jsx)(gn,{nodes:B,defaultOpen:!0,forceOpenIds:fe,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:q}),t[49]=B,t[50]=fe,t[51]=q,t[52]=me):me=t[52];let he;t[53]!==K||t[54]!==me?(he=(0,$.jsx)(h,{className:`flex-1 w-full`,children:(0,$.jsxs)(`div`,{className:`px-2 py-2 w-full max-w-full overflow-hidden`,children:[K,me]})}),t[53]=K,t[54]=me,t[55]=he):he=t[55];let J;t[56]!==v||t[57]!==g||t[58]!==de||t[59]!==ee||t[60]!==he?(J=(0,$.jsx)(Un,{collapsed:v,onLogoClick:g,headerAction:ee,footer:de,children:he}),t[56]=v,t[57]=g,t[58]=de,t[59]=ee,t[60]=he,t[61]=J):J=t[61];let ge=T!==null,_e;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>!e&&E(null),t[62]=_e):_e=t[62];let ve;t[63]===S?ve=t[64]:(ve=()=>{S?.(),E(null)},t[63]=S,t[64]=ve);let ye;t[65]!==T||t[66]!==ve?(ye=(0,$.jsx)(O,{className:`max-w-2xl p-0 overflow-auto max-h-[90vh]`,children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(vr,{projectId:T,onProjectUpdated:ve})})}),t[65]=T,t[66]=ve,t[67]=ye):ye=t[67];let be;t[68]!==ge||t[69]!==ye?(be=(0,$.jsx)(_,{open:ge,onOpenChange:_e,children:ye}),t[68]=ge,t[69]=ye,t[70]=be):be=t[70];let xe;t[71]===R?xe=t[72]:(xe=()=>void R(),t[71]=R,t[72]=xe);let Se;t[73]!==j||t[74]!==k||t[75]!==N||t[76]!==L||t[77]!==F||t[78]!==M||t[79]!==A||t[80]!==P||t[81]!==D||t[82]!==I||t[83]!==xe?(Se=(0,$.jsx)(gr,{open:D,onOpenChange:L,feedbackName:k,onFeedbackNameChange:A,feedbackEmail:j,onFeedbackEmailChange:M,feedbackText:N,onFeedbackTextChange:P,loadingFeedbackUser:F,submittingFeedback:I,onSubmit:xe}),t[73]=j,t[74]=k,t[75]=N,t[76]=L,t[77]=F,t[78]=M,t[79]=A,t[80]=P,t[81]=D,t[82]=I,t[83]=xe,t[84]=Se):Se=t[84];let Ce;return t[85]!==J||t[86]!==be||t[87]!==Se?(Ce=(0,$.jsxs)($.Fragment,{children:[J,be,Se]}),t[85]=J,t[86]=be,t[87]=Se,t[88]=Ce):Ce=t[88],Ce}function br(e,t){return{id:e.projectId||e.gitUrl||`project-${t}`,kind:`project`,project:e,children:e.threads.map((t,n)=>({id:t.threadId||`${e.projectId}-${t.title||n}`,kind:`thread`,thread:t,projectId:e.projectId}))}}function xr(e){let t=(0,Q.c)(29),{project:r,isOpen:i,onToggle:a,isDeletingProject:o,hasSelectedThread:c,isSelected:l,onCreateThread:u,onDeleteProject:d,onProjectSettings:f}=e,p;t[0]===r?p=t[1]:(p=n(r),t[0]=r,t[1]=p);let m=p,h=c||l,g=i&&`rotate-90`,_;t[2]===g?_=t[3]:(_=J(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,g),t[2]=g,t[3]=_);let v;t[4]===_?v=t[5]:(v=(0,$.jsx)(we,{className:_}),t[4]=_,t[5]=v);let y;t[6]===r.gitUrl?y=t[7]:(y=r.gitUrl?(0,$.jsx)(b,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,$.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),t[6]=r.gitUrl,t[7]=y);let x=(c||l)&&`font-bold text-foreground`,S;t[8]===x?S=t[9]:(S=J(`min-w-0 truncate transition-all block`,x),t[8]=x,t[9]=S);let C;t[10]!==m||t[11]!==S?(C=(0,$.jsx)(`span`,{className:S,children:m}),t[10]=m,t[11]=S,t[12]=C):C=t[12];let w;t[13]!==v||t[14]!==y||t[15]!==C?(w=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 w-0`,children:[v,y,C]}),t[13]=v,t[14]=y,t[15]=C,t[16]=w):w=t[16];let T;t[17]!==o||t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==r.projectId||t[22]!==r.threads?(T=(0,$.jsx)(`div`,{className:`flex shrink-0 items-center ml-auto`,children:o?(0,$.jsx)(re,{className:`h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground mr-1`}):(0,$.jsxs)(pn,{children:[(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(G,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 hidden group-hover:flex items-center justify-center`,onClick:e=>{e.stopPropagation(),f(r.projectId)},children:[(0,$.jsx)(je,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Project settings`})]})}),(0,$.jsx)(fn,{side:`right`,children:`Project settings`})]}),(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(G,{variant:`action`,size:`icon-sm`,className:`shrink-0 hidden group-hover:flex items-center justify-center`,onClick:e=>{e.stopPropagation(),u(r.projectId)},children:[(0,$.jsx)(Te,{}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Add thread`})]})}),(0,$.jsx)(fn,{side:`right`,children:`Add thread`})]}),r.threads.length===0&&(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(G,{variant:`ghost`,size:`icon-sm`,className:`shrink-0 hidden group-hover:flex items-center justify-center text-muted-foreground hover:bg-destructive hover:text-destructive-foreground transition-colors`,onClick:e=>{e.stopPropagation(),d(r.projectId)},children:[(0,$.jsx)(ue,{}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Delete project`})]})}),(0,$.jsx)(fn,{side:`right`,children:`Delete project`})]})]})}),t[17]=o,t[18]=u,t[19]=d,t[20]=f,t[21]=r.projectId,t[22]=r.threads,t[23]=T):T=t[23];let E;return t[24]!==a||t[25]!==w||t[26]!==T||t[27]!==h?(E=(0,$.jsxs)(Pn,{selected:h,noBackground:!0,className:`mb-1 h-9`,onClick:a,children:[w,T]}),t[24]=a,t[25]=w,t[26]=T,t[27]=h,t[28]=E):E=t[28],E}function Sr(e){let t=(0,Q.c)(50),{thread:n,projectId:r,selectedThreadId:i,isProcessing:a,isDeleting:o,isCompleted:s,projectTitlePrefix:c,onSelectThread:l,onDeleteThread:u}=e,[d,f]=(0,Z.useState)(!1),p=(0,Z.useRef)(null),m=n.threadId===i,h,g;t[0]===a?(h=t[1],g=t[2]):(h=()=>{a&&p.current&&p.current.scrollIntoView({behavior:`smooth`,block:`nearest`})},g=[a],t[0]=a,t[1]=h,t[2]=g),(0,Z.useEffect)(h,g);let _;t[3]!==u||t[4]!==r||t[5]!==n.gitStatusDot||t[6]!==n.threadId?(_=e=>{e.stopPropagation(),n.gitStatusDot?f(!0):u(r,n.threadId)},t[3]=u,t[4]=r,t[5]=n.gitStatusDot,t[6]=n.threadId,t[7]=_):_=t[7];let v=_,y;t[8]!==c||t[9]!==n.threadId||t[10]!==n.title?(y=n.title?.startsWith(c)?n.title.slice(c.length):n.title??n.threadId,t[8]=c,t[9]=n.threadId,t[10]=n.title,t[11]=y):y=t[11];let b=y,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(In,{children:`Delete Thread`}),t[12]=x):x=t[12];let S;t[13]===b?S=t[14]:(S=(0,$.jsxs)(Fn,{children:[`Are you sure you want to delete "`,b,`" and all its files? This action cannot be undone.`]}),t[13]=b,t[14]=S);let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(Bn,{children:`Cancel`}),t[15]=C):C=t[15];let w;t[16]!==u||t[17]!==r||t[18]!==n.threadId?(w=(0,$.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[C,(0,$.jsx)(Rn,{onClick:()=>{f(!1),u(r,n.threadId)},className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Delete`})]}),t[16]=u,t[17]=r,t[18]=n.threadId,t[19]=w):w=t[19];let T;t[20]!==S||t[21]!==w?(T=(0,$.jsxs)(Ln,{children:[x,S,w]}),t[20]=S,t[21]=w,t[22]=T):T=t[22];let E;t[23]!==d||t[24]!==T?(E=(0,$.jsx)(Hn,{open:d,onOpenChange:f,children:T}),t[23]=d,t[24]=T,t[25]=E):E=t[25];let D,O;t[26]!==l||t[27]!==r||t[28]!==n.threadId?(D=()=>l(r,n.threadId),O=e=>{(e.key===`Enter`||e.key===` `)&&l(r,n.threadId)},t[26]=l,t[27]=r,t[28]=n.threadId,t[29]=D,t[30]=O):(D=t[29],O=t[30]);let k;t[31]===n.gitStatusDot?k=t[32]:(k=n.gitStatusDot?(0,$.jsx)(`svg`,{className:`h-3 w-3 shrink-0`,viewBox:`0 0 12 12`,fill:`hsl(var(--brand))`,xmlns:`http://www.w3.org/2000/svg`,children:(0,$.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})}):(0,$.jsx)(`svg`,{className:`h-3 w-3 shrink-0 text-muted-foreground`,viewBox:`0 0 12 12`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.0`,xmlns:`http://www.w3.org/2000/svg`,children:(0,$.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.5`})}),t[31]=n.gitStatusDot,t[32]=k);let A;t[33]===b?A=t[34]:(A=(0,$.jsx)(`div`,{className:`flex-1 min-w-0 w-0`,children:(0,$.jsx)(`span`,{className:`text-sm truncate block`,children:b})}),t[33]=b,t[34]=A);let j;t[35]!==v||t[36]!==s||t[37]!==o||t[38]!==a?(j=a||o?(0,$.jsx)(re,{className:`ml-auto h-3 w-3 shrink-0 animate-spin text-muted-foreground`}):s?(0,$.jsx)(Ee,{className:`ml-auto h-3 w-3 shrink-0 text-green-500`}):(0,$.jsx)(`div`,{className:`ml-auto flex items-center gap-1`,children:(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(G,{variant:`ghost`,size:`icon-sm`,className:`shrink-0 opacity-0 group-hover:opacity-100 flex items-center justify-center text-muted-foreground hover:bg-destructive hover:text-destructive-foreground transition-opacity transition-colors`,onClick:v,children:[(0,$.jsx)(ue,{}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Delete thread`})]})}),(0,$.jsx)(fn,{side:`right`,children:`Delete thread and files from the repo`})]})}),t[35]=v,t[36]=s,t[37]=o,t[38]=a,t[39]=j):j=t[39];let M;t[40]!==m||t[41]!==D||t[42]!==O||t[43]!==k||t[44]!==A||t[45]!==j?(M=(0,$.jsxs)(Pn,{ref:p,selected:m,onClick:D,onKeyDown:O,role:`button`,tabIndex:0,children:[k,A,j]}),t[40]=m,t[41]=D,t[42]=O,t[43]=k,t[44]=A,t[45]=j,t[46]=M):M=t[46];let N;return t[47]!==E||t[48]!==M?(N=(0,$.jsxs)($.Fragment,{children:[E,M]}),t[47]=E,t[48]=M,t[49]=N):N=t[49],N}var Cr=18,wr=4,Tr=(Cr+wr/2+2)*2,Er=2*Math.PI*Cr;function Dr(e){let t=(0,Q.c)(8),{eventCount:n}=e,r=Er*(1-(n===void 0?0:n)%360/360),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={width:Tr,height:Tr},t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={position:`absolute`,inset:0},o=(0,$.jsx)(`circle`,{cx:Tr/2,cy:Tr/2,r:Cr,fill:`none`,stroke:`hsl(var(--brand) / 0.2)`,strokeWidth:wr}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===r?s=t[4]:(s=(0,$.jsxs)(`svg`,{className:`animate-spin-slow animate-radial-pulse-brand rounded-full`,width:Tr,height:Tr,style:a,children:[o,(0,$.jsx)(`circle`,{cx:Tr/2,cy:Tr/2,r:Cr,fill:`none`,stroke:`hsl(var(--brand))`,strokeWidth:wr,strokeDasharray:Er,strokeDashoffset:r,strokeLinecap:`round`})]}),t[3]=r,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`div`,{className:`absolute flex items-center justify-center rounded-full bg-brand`,style:{inset:wr+2},children:(0,$.jsx)(nt,{className:`h-3.5 w-3.5 text-white`})}),t[5]=c):c=t[5];let l;return t[6]===s?l=t[7]:(l=(0,$.jsxs)(`div`,{className:`relative shrink-0 self-end`,style:i,children:[s,c]}),t[6]=s,t[7]=l),l}function Or(e){let t=e.toLowerCase();return t.includes(`read`)||t.includes(`file`)?He:t.includes(`create`)?Te:t.includes(`replace`)||t.includes(`edit`)?ge:t.includes(`delete`)?ct:t.includes(`terminal`)||t.includes(`bash`)||t.includes(`shell`)?k:t.includes(`run`)?g:t.includes(`git`)||t.includes(`branch`)?Nt:t.includes(`search`)||t.includes(`grep`)||t.includes(`find`)?ht:t.includes(`code`)||t.includes(`debug`)?vt:t.includes(`test`)?be:t.includes(`agent`)||t.includes(`subagent`)?ze:t.includes(`copy`)?Ae:t.includes(`dir`)||t.includes(`list`)||t.includes(`ls`)?Et:t.includes(`view`)||t.includes(`show`)?D:t.includes(`config`)||t.includes(`setting`)?je:t.includes(`image`)||t.includes(`generate_image`)?Qe:t.includes(`chat`)||t.includes(`message`)||t.includes(`ask`)?ne:M}function kr(e){let t=e.toLowerCase();return t.includes(`bash`)||t.includes(`terminal`)||t.includes(`shell`)?`Ran`:t.includes(`read`)||t.includes(`file`)?`Read`:t===`ast_grep`?`Code Search`:t===`agent`?`Subagent`:t===`generate_image`?`Make Image`:e}function Ar(e,t){if(!t||!e||typeof e!=`string`)return e;try{let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return e.replace(new RegExp(n,`g`),`.`)}catch{return e}}function jr(e){return typeof e==`string`?e:typeof e==`object`&&e?JSON.stringify(e,null,2):String(e)}function Mr(e){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`)||t.startsWith(`[`)&&t.endsWith(`]`))try{return JSON.parse(t)}catch{return e}return e}function Nr(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(Nr);let t={};for(let[n,r]of Object.entries(e))if(typeof r==`string`){let e=Mr(r);t[n]=typeof e==`object`?Nr(e):r}else t[n]=Nr(r);return t}function Pr(e){if(e==null||typeof e!=`string`)return``;let t=e;return t=t.replace(/\\\\n/g,`
3
+ `),t=t.replace(/\\\\"/g,`"`),t=t.replace(/\\n/g,`
4
+ `),t=t.replace(/\\"/g,`"`),t}function Fr(e){if(e==null)return``;let t=typeof e==`object`&&e?Nr(e):e;return Pr(typeof t==`string`?t:t==null?``:JSON.stringify(t,null,2))}function Ir(e,t){let n=e.name??`Unknown Tool`,r=e.id??`unknown`,i=e.input,a=i&&typeof i==`object`?i:null,o=i&&typeof i==`object`&&`description`in i,s=o?i.subagent_type:void 0,c=s==null?null:JSON.stringify(s),l=n===`agent`&&a&&typeof a.agentName==`string`?a.agentName:null,u=o?null:Ar(jr(i),t),d=Ar(o?String(i.prompt):null,t),f=Ar(a&&typeof a.command==`string`?a.command:null,t),p=a&&typeof a.pattern==`string`?a.pattern:null,m=a&&typeof a.lang==`string`?a.lang:null,h=n===`code_search`,g=h&&a&&typeof a.query==`string`?a.query:null,_=h&&a&&typeof a.filePath==`string`?a.filePath:null,v=h&&a&&typeof a.fileGlob==`string`?a.fileGlob:null,y=Ar(a&&typeof a.path==`string`?a.path:null,t),b=a&&typeof a.offset==`number`?a.offset:null,x=a&&typeof a.limit==`number`?a.limit:null,S=n.toLowerCase(),C=S.includes(`read`)||S.includes(`write`)||S.includes(`edit`),w=S.includes(`edit`),T=C&&a&&typeof a.path==`string`?a.path:null,E=T?T.split(`/`).pop()??T:null,D=w&&a&&typeof a.oldText==`string`?a.oldText:null,O=w&&a&&typeof a.newText==`string`?a.newText:null,k=D!==null&&O!==null,A=n===`generate_image`&&a&&typeof a.prompt==`string`?a.prompt:null,j=n===`todo`&&a?a.status:void 0,M=Or(n),N=(n===`todo`?j===`done`?be:j===`working`?Ge:mt:null)??M,P=n.charAt(0).toUpperCase()+n.slice(1);S===`bash`&&(P=`Ran`),S===`code_search`&&(P=`Code Search`),S===`generate_image`&&(P=`Make Image`),S.includes(`read`)&&(b!==null||x!==null)&&(b!==null&&x!==null?P+=` (lines ${b} to ${b+x})`:b===null?P+=` (${x} lines)`:P+=` (from line ${b})`);let F=`default`;return S===`bash`||S.includes(`terminal`)||S.includes(`shell`)?F=`bash`:C?F=`file`:h||S===`find`||S.includes(`search`)||S.includes(`grep`)?F=`search`:S===`agent`||S.includes(`subagent`)||o?F=`agent`:S===`todo`?F=`todo`:S===`generate_image`&&(F=`imageGen`),{toolType:F,toolName:n,toolId:r,displayName:P,icon:N,inputObj:a,toolInput:u,command:f,pattern:p,codeSearchQuery:g,codeSearchFilePath:_,codeSearchFileGlob:v,isFileTool:C,isEditTool:w,filePath:T,fileDisplayName:E,editOldText:D,editNewText:O,hasEditDiff:k,path:y,offset:b,limit:x,prompt:d,agentName:l,subagentType:c,lang:m,imageGenPrompt:A,todoStatus:j}}function Lr(e){let t=(0,Q.c)(11),{open:n,onOpenChange:r,title:i,content:a}=e,o;t[0]===i?o=t[1]:(o=(0,$.jsx)(q,{children:(0,$.jsx)(K,{children:(0,$.jsx)(`code`,{className:`text-sm font-mono`,children:i})})}),t[0]=i,t[1]=o);let s;t[2]===a?s=t[3]:(s=(0,$.jsx)(`pre`,{className:`text-xs bg-muted p-3 rounded font-mono whitespace-pre-wrap overflow-auto flex-1 text-foreground`,children:a}),t[2]=a,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,$.jsxs)(O,{className:`max-w-3xl h-[80vh] flex flex-col`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==r||t[8]!==n||t[9]!==c?(l=(0,$.jsx)(_,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l}function Rr(e){let t=(0,Q.c)(9),{oldText:n,newText:r}=e,i,a,o;if(t[0]!==r||t[1]!==n){let e=n.split(`
5
+ `),s=r.split(`
6
+ `);i=`text-xs font-mono whitespace-pre-wrap overflow-auto`,a=e.map(Br),o=s.map(zr),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o}else i=t[2],a=t[3],o=t[4];let s;return t[5]!==i||t[6]!==a||t[7]!==o?(s=(0,$.jsxs)(`pre`,{className:i,children:[a,o]}),t[5]=i,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function zr(e,t){return(0,$.jsxs)(`div`,{className:`bg-green-500/10 text-green-600 dark:text-green-400`,children:[(0,$.jsx)(`span`,{className:`select-none opacity-50 mr-2`,children:`+`}),e]},`new-${t}`)}function Br(e,t){return(0,$.jsxs)(`div`,{className:`bg-red-500/10 text-red-600 dark:text-red-400`,children:[(0,$.jsx)(`span`,{className:`select-none opacity-50 mr-2`,children:`-`}),e]},`old-${t}`)}function Vr(e){let t=(0,Q.c)(2),{name:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-mono`,children:n}),t[0]=n,t[1]=r),r}function Hr(e){let t=(0,Q.c)(2),{type:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground`,children:n}),t[0]=n,t[1]=r),r}function Ur(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`code`,{className:`text-xs font-mono text-muted-foreground break-all rounded bg-muted/60 px-1 py-0.5`,children:n}),t[0]=n,t[1]=r),r}function Wr(e){let t=(0,Q.c)(58),{data:n,inline:r,resultContent:i,isActive:a}=e,[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1);if(r){if(n.command!==null&&i){let e=`h-3.5 w-3.5 shrink-0 ${a?`text-brand`:`text-foreground`}`,r;t[0]!==n.icon||t[1]!==e?(r=(0,Z.createElement)(n.icon,{className:e}),t[0]=n.icon,t[1]=e,t[2]=r):r=t[2];let o;t[3]===n.displayName?o=t[4]:(o=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.displayName}),t[3]=n.displayName,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>l(!0),t[5]=s):s=t[5];let u;t[6]===n.command?u=t[7]:(u=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`text-xs font-mono text-muted-foreground hover:underline break-all cursor-pointer`,children:n.command})}),t[6]=n.command,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(fn,{children:`View output`}),t[8]=d):d=t[8];let f;t[9]===u?f=t[10]:(f=(0,$.jsxs)(mn,{children:[u,d]}),t[9]=u,t[10]=f);let p;t[11]!==r||t[12]!==o||t[13]!==f?(p=(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[r,o,f]}),t[11]=r,t[12]=o,t[13]=f,t[14]=p):p=t[14];let m;t[15]!==n.command||t[16]!==c||t[17]!==i?(m=(0,$.jsx)(Lr,{open:c,onOpenChange:l,title:n.command,content:i}),t[15]=n.command,t[16]=c,t[17]=i,t[18]=m):m=t[18];let h;return t[19]!==p||t[20]!==m?(h=(0,$.jsxs)($.Fragment,{children:[p,m]}),t[19]=p,t[20]=m,t[21]=h):h=t[21],h}let e=n.toolName,r=`h-3.5 w-3.5 shrink-0 ${a?`text-brand`:`text-foreground`}`,o;t[22]!==n.icon||t[23]!==r?(o=(0,Z.createElement)(n.icon,{className:r}),t[22]=n.icon,t[23]=r,t[24]=o):o=t[24];let s;t[25]===n.displayName?s=t[26]:(s=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.displayName}),t[25]=n.displayName,t[26]=s);let u;t[27]!==n.toolName||t[28]!==o||t[29]!==s?(u=(0,$.jsxs)(`span`,{title:e,className:`inline-flex items-center gap-1`,children:[o,s]}),t[27]=n.toolName,t[28]=o,t[29]=s,t[30]=u):u=t[30];let d;t[31]===n.command?d=t[32]:(d=n.command!==null&&(0,$.jsx)(`code`,{className:`text-xs font-mono text-muted-foreground break-all rounded bg-muted/60 px-1 py-0.5`,children:n.command}),t[31]=n.command,t[32]=d);let f;return t[33]!==u||t[34]!==d?(f=(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[u,d]}),t[33]=u,t[34]=d,t[35]=f):f=t[35],f}let u;t[36]===o?u=t[37]:(u=()=>s(!o),t[36]=o,t[37]=u);let d=n.toolName,f=`h-4 w-4 ${a?`text-brand`:`text-foreground`}`,p;t[38]!==n.icon||t[39]!==f?(p=(0,Z.createElement)(n.icon,{className:f}),t[38]=n.icon,t[39]=f,t[40]=p):p=t[40];let m;t[41]===n.displayName?m=t[42]:(m=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n.displayName}),t[41]=n.displayName,t[42]=m);let h;t[43]===o?h=t[44]:(h=o?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[43]=o,t[44]=h);let g;t[45]!==n.toolName||t[46]!==u||t[47]!==p||t[48]!==m||t[49]!==h?(g=(0,$.jsxs)(`button`,{onClick:u,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,title:d,children:[p,m,h]}),t[45]=n.toolName,t[46]=u,t[47]=p,t[48]=m,t[49]=h,t[50]=g):g=t[50];let _;t[51]!==n.toolId||t[52]!==n.toolInput||t[53]!==o?(_=o&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`ID: `,n.toolId]}),n.toolInput?(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null]}),t[51]=n.toolId,t[52]=n.toolInput,t[53]=o,t[54]=_):_=t[54];let v;return t[55]!==g||t[56]!==_?(v=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[g,_]}),t[55]=g,t[56]=_,t[57]=v):v=t[57],v}var Gr=Jt,Kr=Gt,qr=Z.forwardRef((e,t)=>{let n=(0,Q.c)(13),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,align:a,sideOffset:o,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=a===void 0?`center`:a,c=o===void 0?4:o,l;n[5]===r?l=n[6]:(l=J(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[5]=r,n[6]=l);let u;return n[7]!==s||n[8]!==i||n[9]!==t||n[10]!==c||n[11]!==l?(u=(0,$.jsx)(qt,{children:(0,$.jsx)(Yt,{ref:t,align:s,sideOffset:c,className:l,...i})}),n[7]=s,n[8]=i,n[9]=t,n[10]=c,n[11]=l,n[12]=u):u=n[12],u});qr.displayName=Yt.displayName;function Jr(e){let t=(0,Q.c)(47),{data:n,inline:r,rootPath:i,onOpenFile:a,isActive:o}=e,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d;t[0]!==n.filePath||t[1]!==a||t[2]!==i?(d=function(){!n.filePath||!a||a(i&&n.filePath.startsWith(i)?n.filePath.slice(i.length+1):n.filePath)},t[0]=n.filePath,t[1]=a,t[2]=i,t[3]=d):d=t[3];let f=d;if(r){let e=!!(n.toolInput&&!n.command&&!n.path&&!n.pattern&&!n.fileDisplayName),r;t[4]!==n.displayName||t[5]!==n.icon||t[6]!==n.toolId||t[7]!==n.toolInput||t[8]!==n.toolName||t[9]!==e||t[10]!==o?(r=e?(0,$.jsxs)(Gr,{children:[(0,$.jsx)(Kr,{asChild:!0,children:(0,$.jsx)(`span`,{title:n.toolName,className:`inline-flex`,children:(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 rounded p-0.5 text-muted-foreground hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Show tool details`,children:[(0,Z.createElement)(n.icon,{className:`h-3.5 w-3.5 ${o?`text-brand`:`text-foreground`}`}),(0,$.jsx)(`span`,{className:`text-xs`,children:n.displayName})]})})}),(0,$.jsx)(qr,{className:`w-80 max-h-80 overflow-auto`,align:`start`,children:(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2`,children:[(0,$.jsxs)(`div`,{className:`font-mono`,children:[`ID: `,n.toolId]}),(0,$.jsx)(`pre`,{className:`font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput})]})})]}):(0,$.jsxs)(`span`,{title:n.toolName,className:`inline-flex items-center gap-1`,children:[(0,Z.createElement)(n.icon,{className:`h-3.5 w-3.5 shrink-0 ${o?`text-brand`:`text-foreground`}`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.displayName})]}),t[4]=n.displayName,t[5]=n.icon,t[6]=n.toolId,t[7]=n.toolInput,t[8]=n.toolName,t[9]=e,t[10]=o,t[11]=r):r=t[11];let a;t[12]!==n.editNewText||t[13]!==n.editOldText||t[14]!==n.fileDisplayName||t[15]!==n.filePath||t[16]!==n.hasEditDiff||t[17]!==n.path||t[18]!==l||t[19]!==f||t[20]!==i?(a=n.fileDisplayName?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:n.hasEditDiff?()=>u(!0):f,className:J(`text-xs font-mono truncate max-w-[200px] sm:max-w-[320px] cursor-pointer`,`text-muted-foreground hover:underline`),children:n.fileDisplayName})}),(0,$.jsx)(fn,{children:n.hasEditDiff?`View diff`:n.filePath?Ar(n.filePath,i)??n.filePath:n.fileDisplayName})]}),n.hasEditDiff&&(0,$.jsx)(_,{open:l,onOpenChange:u,children:(0,$.jsxs)(O,{className:`max-w-2xl h-[80vh] flex flex-col`,children:[(0,$.jsx)(q,{children:(0,$.jsx)(K,{children:(0,$.jsx)(`code`,{className:`text-sm font-mono`,children:Ar(n.filePath,i)??n.filePath})})}),(0,$.jsx)(`div`,{className:`overflow-auto flex-1 rounded border border-border bg-muted/30 p-3`,children:(0,$.jsx)(Rr,{oldText:n.editOldText,newText:n.editNewText})})]})})]}):n.path===null?null:(0,$.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate max-w-[200px] sm:max-w-[320px]`,title:n.path,children:n.path}),t[12]=n.editNewText,t[13]=n.editOldText,t[14]=n.fileDisplayName,t[15]=n.filePath,t[16]=n.hasEditDiff,t[17]=n.path,t[18]=l,t[19]=f,t[20]=i,t[21]=a):a=t[21];let s;return t[22]!==r||t[23]!==a?(s=(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[r,a]}),t[22]=r,t[23]=a,t[24]=s):s=t[24],s}let p;t[25]===s?p=t[26]:(p=()=>c(!s),t[25]=s,t[26]=p);let m=n.toolName,h=`h-4 w-4 ${o?`text-brand`:`text-foreground`}`,g;t[27]!==n.icon||t[28]!==h?(g=(0,Z.createElement)(n.icon,{className:h}),t[27]=n.icon,t[28]=h,t[29]=g):g=t[29];let v;t[30]===n.displayName?v=t[31]:(v=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n.displayName}),t[30]=n.displayName,t[31]=v);let y;t[32]===s?y=t[33]:(y=s?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[32]=s,t[33]=y);let b;t[34]!==n.toolName||t[35]!==p||t[36]!==g||t[37]!==v||t[38]!==y?(b=(0,$.jsxs)(`button`,{onClick:p,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,title:m,children:[g,v,y]}),t[34]=n.toolName,t[35]=p,t[36]=g,t[37]=v,t[38]=y,t[39]=b):b=t[39];let x;t[40]!==n.toolId||t[41]!==n.toolInput||t[42]!==s?(x=s&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`ID: `,n.toolId]}),n.toolInput?(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null]}),t[40]=n.toolId,t[41]=n.toolInput,t[42]=s,t[43]=x):x=t[43];let S;return t[44]!==b||t[45]!==x?(S=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[b,x]}),t[44]=b,t[45]=x,t[46]=S):S=t[46],S}function Yr(e){let t=(0,Q.c)(8),{data:n}=e,r=n.toolName===`code_search`,i;t[0]!==n.codeSearchFileGlob||t[1]!==n.codeSearchFilePath||t[2]!==n.codeSearchQuery||t[3]!==n.pattern||t[4]!==r?(i=r?(0,$.jsxs)($.Fragment,{children:[n.codeSearchQuery!==null&&(0,$.jsx)(Ur,{children:n.codeSearchQuery}),n.pattern!==null&&(0,$.jsxs)(Ur,{children:[`/`,n.pattern,`/`]}),n.codeSearchFilePath!==null&&(0,$.jsx)(Ur,{children:n.codeSearchFilePath}),n.codeSearchFileGlob!==null&&(0,$.jsx)(Ur,{children:n.codeSearchFileGlob})]}):n.pattern!==null&&(0,$.jsx)(Ur,{children:n.pattern}),t[0]=n.codeSearchFileGlob,t[1]=n.codeSearchFilePath,t[2]=n.codeSearchQuery,t[3]=n.pattern,t[4]=r,t[5]=i):i=t[5];let a;return t[6]===i?a=t[7]:(a=(0,$.jsx)($.Fragment,{children:i}),t[6]=i,t[7]=a),a}function Xr(e){let t=(0,Q.c)(70),{data:n,inline:r,resultContent:i,isActive:a}=e,[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),u=n.toolName===`code_search`,d=n.codeSearchQuery??n.pattern??n.codeSearchFilePath??n.codeSearchFileGlob??`search`;if(r){if(i&&(u||n.toolName===`find`||n.pattern!==null)){let e=`h-3.5 w-3.5 shrink-0 ${a?`text-brand`:`text-foreground`}`,r;t[0]!==n.icon||t[1]!==e?(r=(0,Z.createElement)(n.icon,{className:e}),t[0]=n.icon,t[1]=e,t[2]=r):r=t[2];let o;t[3]===n.displayName?o=t[4]:(o=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.displayName}),t[3]=n.displayName,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>l(!0),t[5]=s):s=t[5];let u;t[6]===d?u=t[7]:(u=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`text-xs font-mono text-muted-foreground hover:underline break-all cursor-pointer`,children:d})}),t[6]=d,t[7]=u);let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(fn,{children:`View results`}),t[8]=f):f=t[8];let p;t[9]===u?p=t[10]:(p=(0,$.jsxs)(mn,{children:[u,f]}),t[9]=u,t[10]=p);let m;t[11]!==r||t[12]!==o||t[13]!==p?(m=(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[r,o,p]}),t[11]=r,t[12]=o,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==c||t[16]!==i||t[17]!==d?(h=(0,$.jsx)(Lr,{open:c,onOpenChange:l,title:d,content:i}),t[15]=c,t[16]=i,t[17]=d,t[18]=h):h=t[18];let g;return t[19]!==m||t[20]!==h?(g=(0,$.jsxs)($.Fragment,{children:[m,h]}),t[19]=m,t[20]=h,t[21]=g):g=t[21],g}let e=n.toolName,r=`h-3.5 w-3.5 shrink-0 ${a?`text-brand`:`text-foreground`}`,o;t[22]!==n.icon||t[23]!==r?(o=(0,Z.createElement)(n.icon,{className:r}),t[22]=n.icon,t[23]=r,t[24]=o):o=t[24];let s;t[25]===n.displayName?s=t[26]:(s=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.displayName}),t[25]=n.displayName,t[26]=s);let f;t[27]!==n.toolName||t[28]!==o||t[29]!==s?(f=(0,$.jsxs)(`span`,{title:e,className:`inline-flex items-center gap-1`,children:[o,s]}),t[27]=n.toolName,t[28]=o,t[29]=s,t[30]=f):f=t[30];let p;t[31]===n?p=t[32]:(p=(0,$.jsx)(Yr,{data:n}),t[31]=n,t[32]=p);let m;t[33]===n.lang?m=t[34]:(m=n.lang!==null&&(0,$.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:n.lang}),t[33]=n.lang,t[34]=m);let h;return t[35]!==f||t[36]!==p||t[37]!==m?(h=(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[f,p,m]}),t[35]=f,t[36]=p,t[37]=m,t[38]=h):h=t[38],h}let f;t[39]===o?f=t[40]:(f=()=>s(!o),t[39]=o,t[40]=f);let p=n.toolName,m=`h-4 w-4 ${a?`text-brand`:`text-foreground`}`,h;t[41]!==n.icon||t[42]!==m?(h=(0,Z.createElement)(n.icon,{className:m}),t[41]=n.icon,t[42]=m,t[43]=h):h=t[43];let g;t[44]===n.displayName?g=t[45]:(g=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n.displayName}),t[44]=n.displayName,t[45]=g);let _;t[46]!==n.codeSearchFileGlob||t[47]!==n.codeSearchFilePath||t[48]!==n.codeSearchQuery||t[49]!==n.pattern||t[50]!==u?(_=u&&(0,$.jsxs)($.Fragment,{children:[n.codeSearchQuery!==null&&(0,$.jsx)(`code`,{className:`text-xs font-mono bg-muted text-muted-foreground rounded px-1 py-0.5 truncate max-w-[150px]`,children:n.codeSearchQuery}),n.pattern!==null&&(0,$.jsxs)(`code`,{className:`text-xs font-mono bg-muted text-muted-foreground rounded px-1 py-0.5 truncate max-w-[150px]`,children:[`/`,n.pattern,`/`]}),n.codeSearchFilePath!==null&&(0,$.jsx)(`code`,{className:`text-xs font-mono bg-muted text-muted-foreground rounded px-1 py-0.5 truncate max-w-[150px]`,children:n.codeSearchFilePath}),n.codeSearchFileGlob!==null&&(0,$.jsx)(`code`,{className:`text-xs font-mono bg-muted text-muted-foreground rounded px-1 py-0.5 truncate max-w-[150px]`,children:n.codeSearchFileGlob})]}),t[46]=n.codeSearchFileGlob,t[47]=n.codeSearchFilePath,t[48]=n.codeSearchQuery,t[49]=n.pattern,t[50]=u,t[51]=_):_=t[51];let v;t[52]===o?v=t[53]:(v=o?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[52]=o,t[53]=v);let y;t[54]!==n.toolName||t[55]!==f||t[56]!==h||t[57]!==g||t[58]!==_||t[59]!==v?(y=(0,$.jsxs)(`button`,{onClick:f,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,title:p,children:[h,g,_,v]}),t[54]=n.toolName,t[55]=f,t[56]=h,t[57]=g,t[58]=_,t[59]=v,t[60]=y):y=t[60];let b;t[61]!==n.toolId||t[62]!==n.toolInput||t[63]!==o||t[64]!==u||t[65]!==i?(b=o&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`ID: `,n.toolId]}),n.toolInput?(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null,u&&i&&(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-64 mt-2`,children:i})]}),t[61]=n.toolId,t[62]=n.toolInput,t[63]=o,t[64]=u,t[65]=i,t[66]=b):b=t[66];let x;return t[67]!==y||t[68]!==b?(x=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[y,b]}),t[67]=y,t[68]=b,t[69]=x):x=t[69],x}function Zr(e){let t=(0,Q.c)(59),{data:n,inline:r,isActive:i}=e,[a,o]=(0,Z.useState)(!1);if(r){let e=n.toolName,r=`h-3.5 w-3.5 ${i?`text-brand`:`text-foreground`}`,a;t[0]!==n.icon||t[1]!==r?(a=(0,Z.createElement)(n.icon,{className:r}),t[0]=n.icon,t[1]=r,t[2]=a):a=t[2];let o;t[3]===n.displayName?o=t[4]:(o=(0,$.jsx)(`span`,{className:`text-xs`,children:n.displayName}),t[3]=n.displayName,t[4]=o);let s;t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 rounded p-0.5 text-muted-foreground hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Show tool details`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7];let c;t[8]!==n.toolName||t[9]!==s?(c=(0,$.jsx)(Kr,{asChild:!0,children:(0,$.jsx)(`span`,{title:e,className:`inline-flex`,children:s})}),t[8]=n.toolName,t[9]=s,t[10]=c):c=t[10];let l;t[11]===n.toolId?l=t[12]:(l=(0,$.jsxs)(`div`,{className:`font-mono`,children:[`ID: `,n.toolId]}),t[11]=n.toolId,t[12]=l);let u;t[13]!==n.prompt||t[14]!==n.toolInput?(u=n.prompt?(0,$.jsx)(`div`,{className:`whitespace-pre-wrap leading-relaxed`,children:n.prompt}):n.toolInput?(0,$.jsx)(`pre`,{className:`font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null,t[13]=n.prompt,t[14]=n.toolInput,t[15]=u):u=t[15];let d;t[16]!==l||t[17]!==u?(d=(0,$.jsx)(qr,{className:`w-80 max-h-80 overflow-auto`,align:`start`,children:(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2`,children:[l,u]})}),t[16]=l,t[17]=u,t[18]=d):d=t[18];let f;t[19]!==c||t[20]!==d?(f=(0,$.jsxs)(Gr,{children:[c,d]}),t[19]=c,t[20]=d,t[21]=f):f=t[21];let p;t[22]===n.agentName?p=t[23]:(p=n.agentName&&(0,$.jsx)(Vr,{name:n.agentName}),t[22]=n.agentName,t[23]=p);let m;t[24]===n.subagentType?m=t[25]:(m=n.subagentType&&(0,$.jsx)(Hr,{type:n.subagentType}),t[24]=n.subagentType,t[25]=m);let h;return t[26]!==f||t[27]!==p||t[28]!==m?(h=(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[f,p,m]}),t[26]=f,t[27]=p,t[28]=m,t[29]=h):h=t[29],h}let s;t[30]===a?s=t[31]:(s=()=>o(!a),t[30]=a,t[31]=s);let c=n.toolName,l=`h-4 w-4 ${i?`text-brand`:`text-foreground`}`,u;t[32]!==n.icon||t[33]!==l?(u=(0,Z.createElement)(n.icon,{className:l}),t[32]=n.icon,t[33]=l,t[34]=u):u=t[34];let d;t[35]===n.displayName?d=t[36]:(d=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n.displayName}),t[35]=n.displayName,t[36]=d);let f;t[37]===n.agentName?f=t[38]:(f=n.agentName&&(0,$.jsx)(Vr,{name:n.agentName}),t[37]=n.agentName,t[38]=f);let p;t[39]===n.subagentType?p=t[40]:(p=n.subagentType&&(0,$.jsx)(Hr,{type:n.subagentType}),t[39]=n.subagentType,t[40]=p);let m;t[41]===a?m=t[42]:(m=a?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[41]=a,t[42]=m);let h;t[43]!==n.toolName||t[44]!==s||t[45]!==u||t[46]!==d||t[47]!==f||t[48]!==p||t[49]!==m?(h=(0,$.jsxs)(`button`,{onClick:s,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,title:c,children:[u,d,f,p,m]}),t[43]=n.toolName,t[44]=s,t[45]=u,t[46]=d,t[47]=f,t[48]=p,t[49]=m,t[50]=h):h=t[50];let g;t[51]!==n.prompt||t[52]!==n.toolId||t[53]!==n.toolInput||t[54]!==a?(g=a&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`ID: `,n.toolId]}),n.prompt?(0,$.jsx)(`div`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-3 rounded whitespace-pre-wrap overflow-auto max-h-64 leading-relaxed`,children:n.prompt}):n.toolInput?(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null]}),t[51]=n.prompt,t[52]=n.toolId,t[53]=n.toolInput,t[54]=a,t[55]=g):g=t[55];let _;return t[56]!==g||t[57]!==h?(_=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[h,g]}),t[56]=g,t[57]=h,t[58]=_):_=t[58],_}function Qr(e){let t=(0,Q.c)(22),{data:n,inline:r,isActive:i}=e,[a,o]=(0,Z.useState)(!1);if(r)return null;let s;t[0]===a?s=t[1]:(s=()=>o(!a),t[0]=a,t[1]=s);let c=n.toolName,l=`h-4 w-4 ${i?`text-brand`:`text-foreground`}`,u;t[2]!==n.icon||t[3]!==l?(u=(0,Z.createElement)(n.icon,{className:l}),t[2]=n.icon,t[3]=l,t[4]=u):u=t[4];let d;t[5]===n.displayName?d=t[6]:(d=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n.displayName}),t[5]=n.displayName,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[7]=a,t[8]=f);let p;t[9]!==n.toolName||t[10]!==s||t[11]!==u||t[12]!==d||t[13]!==f?(p=(0,$.jsxs)(`button`,{onClick:s,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,title:c,children:[u,d,f]}),t[9]=n.toolName,t[10]=s,t[11]=u,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]!==n.toolId||t[16]!==n.toolInput||t[17]!==a?(m=a&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`ID: `,n.toolId]}),n.toolInput?(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null]}),t[15]=n.toolId,t[16]=n.toolInput,t[17]=a,t[18]=m):m=t[18];let h;return t[19]!==p||t[20]!==m?(h=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[p,m]}),t[19]=p,t[20]=m,t[21]=h):h=t[21],h}function $r(e){let t=(0,Q.c)(36),{data:n,inline:r,isActive:i}=e,[a,o]=(0,Z.useState)(!1);if(r){let e=n.toolName,r=`h-3.5 w-3.5 shrink-0 ${i?`text-brand`:`text-foreground`}`,a;t[0]!==n.icon||t[1]!==r?(a=(0,Z.createElement)(n.icon,{className:r}),t[0]=n.icon,t[1]=r,t[2]=a):a=t[2];let o;t[3]===n.displayName?o=t[4]:(o=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.displayName}),t[3]=n.displayName,t[4]=o);let s;t[5]!==n.toolName||t[6]!==a||t[7]!==o?(s=(0,$.jsxs)(`span`,{title:e,className:`inline-flex items-center gap-1`,children:[a,o]}),t[5]=n.toolName,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.imageGenPrompt?c=t[10]:(c=n.imageGenPrompt!==null&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground truncate max-w-[200px] sm:max-w-[320px]`,title:n.imageGenPrompt,children:n.imageGenPrompt}),t[9]=n.imageGenPrompt,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}let s;t[14]===a?s=t[15]:(s=()=>o(!a),t[14]=a,t[15]=s);let c=n.toolName,l=`h-4 w-4 ${i?`text-brand`:`text-foreground`}`,u;t[16]!==n.icon||t[17]!==l?(u=(0,Z.createElement)(n.icon,{className:l}),t[16]=n.icon,t[17]=l,t[18]=u):u=t[18];let d;t[19]===n.displayName?d=t[20]:(d=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n.displayName}),t[19]=n.displayName,t[20]=d);let f;t[21]===a?f=t[22]:(f=a?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[21]=a,t[22]=f);let p;t[23]!==n.toolName||t[24]!==s||t[25]!==u||t[26]!==d||t[27]!==f?(p=(0,$.jsxs)(`button`,{onClick:s,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,title:c,children:[u,d,f]}),t[23]=n.toolName,t[24]=s,t[25]=u,t[26]=d,t[27]=f,t[28]=p):p=t[28];let m;t[29]!==n.toolId||t[30]!==n.toolInput||t[31]!==a?(m=a&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`ID: `,n.toolId]}),n.toolInput?(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null]}),t[29]=n.toolId,t[30]=n.toolInput,t[31]=a,t[32]=m):m=t[32];let h;return t[33]!==p||t[34]!==m?(h=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[p,m]}),t[33]=p,t[34]=m,t[35]=h):h=t[35],h}function ei(e){let t=(0,Q.c)(37),{data:n,inline:r,isActive:i}=e,[a,o]=(0,Z.useState)(!1);if(r){let e=!!(n.prompt??(n.toolInput&&!n.command&&!n.path&&!n.pattern&&!n.fileDisplayName)),r;t[0]!==n.displayName||t[1]!==n.icon||t[2]!==n.prompt||t[3]!==n.toolId||t[4]!==n.toolInput||t[5]!==n.toolName||t[6]!==e||t[7]!==i?(r=e?(0,$.jsxs)(Gr,{children:[(0,$.jsx)(Kr,{asChild:!0,children:(0,$.jsx)(`span`,{title:n.toolName,className:`inline-flex`,children:(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 rounded p-0.5 text-muted-foreground hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Show tool details`,children:[(0,Z.createElement)(n.icon,{className:`h-3.5 w-3.5 ${i?`text-brand`:`text-foreground`}`}),(0,$.jsx)(`span`,{className:`text-xs`,children:n.displayName})]})})}),(0,$.jsx)(qr,{className:`w-80 max-h-80 overflow-auto`,align:`start`,children:(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2`,children:[(0,$.jsxs)(`div`,{className:`font-mono`,children:[`ID: `,n.toolId]}),n.prompt?(0,$.jsx)(`div`,{className:`whitespace-pre-wrap leading-relaxed`,children:n.prompt}):n.toolInput?(0,$.jsx)(`pre`,{className:`font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null]})})]}):(0,$.jsxs)(`span`,{title:n.toolName,className:`inline-flex items-center gap-1`,children:[(0,Z.createElement)(n.icon,{className:`h-3.5 w-3.5 shrink-0 ${i?`text-brand`:`text-foreground`}`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.displayName})]}),t[0]=n.displayName,t[1]=n.icon,t[2]=n.prompt,t[3]=n.toolId,t[4]=n.toolInput,t[5]=n.toolName,t[6]=e,t[7]=i,t[8]=r):r=t[8];let a;t[9]===n.path?a=t[10]:(a=n.path!==null&&(0,$.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate max-w-[200px] sm:max-w-[320px]`,title:n.path,children:n.path}),t[9]=n.path,t[10]=a);let o;return t[11]!==r||t[12]!==a?(o=(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[r,a]}),t[11]=r,t[12]=a,t[13]=o):o=t[13],o}let s;t[14]===a?s=t[15]:(s=()=>o(!a),t[14]=a,t[15]=s);let c=n.toolName,l=`h-4 w-4 ${i?`text-brand`:`text-foreground`}`,u;t[16]!==n.icon||t[17]!==l?(u=(0,Z.createElement)(n.icon,{className:l}),t[16]=n.icon,t[17]=l,t[18]=u):u=t[18];let d;t[19]===n.displayName?d=t[20]:(d=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n.displayName}),t[19]=n.displayName,t[20]=d);let f;t[21]===a?f=t[22]:(f=a?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[21]=a,t[22]=f);let p;t[23]!==n.toolName||t[24]!==s||t[25]!==u||t[26]!==d||t[27]!==f?(p=(0,$.jsxs)(`button`,{onClick:s,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,title:c,children:[u,d,f]}),t[23]=n.toolName,t[24]=s,t[25]=u,t[26]=d,t[27]=f,t[28]=p):p=t[28];let m;t[29]!==n.prompt||t[30]!==n.toolId||t[31]!==n.toolInput||t[32]!==a?(m=a&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`ID: `,n.toolId]}),n.prompt?(0,$.jsx)(`div`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-3 rounded whitespace-pre-wrap overflow-auto max-h-64 leading-relaxed`,children:n.prompt}):n.toolInput?(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48`,children:n.toolInput}):null]}),t[29]=n.prompt,t[30]=n.toolId,t[31]=n.toolInput,t[32]=a,t[33]=m):m=t[33];let h;return t[34]!==p||t[35]!==m?(h=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[p,m]}),t[34]=p,t[35]=m,t[36]=h):h=t[36],h}function ti(e){let t=(0,Q.c)(41),{block:n,inline:r,resultContent:i,isActive:a}=e,{state:o}=en(),{setPendingExplorerPath:s,setActiveMainTab:c}=Gn(),l;if(t[0]!==o.projects||t[1]!==o.selectedProjectId||t[2]!==o.selectedThreadId){let e;t[4]===o.selectedProjectId?e=t[5]:(e=e=>e.projectId===o.selectedProjectId,t[4]=o.selectedProjectId,t[5]=e),l=o.projects.find(e)?.threads.find(e=>e.threadId===o.selectedThreadId),t[0]=o.projects,t[1]=o.selectedProjectId,t[2]=o.selectedThreadId,t[3]=l}else l=t[3];let u=l?.path,d=Ir(n,u),f;t[6]!==c||t[7]!==s?(f=function(e){s(e),c(`explorer`)},t[6]=c,t[7]=s,t[8]=f):f=t[8];let p=f;switch(d.toolType){case`bash`:{let e;return t[9]!==d||t[10]!==r||t[11]!==a||t[12]!==i?(e=(0,$.jsx)(Wr,{data:d,inline:r,resultContent:i,isActive:a}),t[9]=d,t[10]=r,t[11]=a,t[12]=i,t[13]=e):e=t[13],e}case`file`:{let e;return t[14]!==d||t[15]!==p||t[16]!==r||t[17]!==a||t[18]!==u?(e=(0,$.jsx)(Jr,{data:d,inline:r,rootPath:u,onOpenFile:p,isActive:a}),t[14]=d,t[15]=p,t[16]=r,t[17]=a,t[18]=u,t[19]=e):e=t[19],e}case`search`:{let e;return t[20]!==d||t[21]!==r||t[22]!==a||t[23]!==i?(e=(0,$.jsx)(Xr,{data:d,inline:r,resultContent:i,isActive:a}),t[20]=d,t[21]=r,t[22]=a,t[23]=i,t[24]=e):e=t[24],e}case`agent`:{let e;return t[25]!==d||t[26]!==r||t[27]!==a?(e=(0,$.jsx)(Zr,{data:d,inline:r,isActive:a}),t[25]=d,t[26]=r,t[27]=a,t[28]=e):e=t[28],e}case`todo`:{let e;return t[29]!==d||t[30]!==r||t[31]!==a?(e=(0,$.jsx)(Qr,{data:d,inline:r,isActive:a}),t[29]=d,t[30]=r,t[31]=a,t[32]=e):e=t[32],e}case`imageGen`:{let e;return t[33]!==d||t[34]!==r||t[35]!==a?(e=(0,$.jsx)($r,{data:d,inline:r,isActive:a}),t[33]=d,t[34]=r,t[35]=a,t[36]=e):e=t[36],e}default:{let e;return t[37]!==d||t[38]!==r||t[39]!==a?(e=(0,$.jsx)(ei,{data:d,inline:r,isActive:a}),t[37]=d,t[38]=r,t[39]=a,t[40]=e):e=t[40],e}}}function ni(e){let t=[];if(typeof e==`string`)t.push(e);else if(Array.isArray(e))for(let n of e)typeof n==`object`&&n&&`text`in n&&typeof n.text==`string`&&t.push(n.text);for(let e of t){let t=e.trim();if(t.startsWith(`{`))try{let e=JSON.parse(t);if(e.imageUrl||e.imageData)return{imageUrl:e.imageUrl,imageData:e.imageData,model:e.model}}catch{}}return null}function ri(e){let t=(0,Q.c)(29),{imageUrl:n,imageData:r}=e,[i,a]=(0,Z.useState)(!1),o=r?`data:image/png;base64,${r}`:n??``,s;t[0]===o?s=t[1]:(s=async()=>{let e=`generated-image-${Date.now()}.png`,{path:t}=await ut(o.startsWith(`data:`)?{imageData:o.replace(/^data:[^;]+;base64,/,``),filename:e}:{imageUrl:o,filename:e});X({title:`Saved to downloads: ${t.split(`/`).pop()}`})},t[0]=o,t[1]=s);let c=s,l;t[2]===o?l=t[3]:(l=async()=>{await I(o.startsWith(`data:`)?{imageData:o.replace(/^data:[^;]+;base64,/,``)}:{imageUrl:o}),a(!0),setTimeout(()=>a(!1),2e3)},t[2]=o,t[3]=l);let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={maxHeight:`512px`},t[4]=d):d=t[4];let f;t[5]===o?f=t[6]:(f=(0,$.jsx)(`img`,{src:o,alt:`Generated image`,className:`max-w-full rounded-lg block`,style:d}),t[5]=o,t[6]=f);let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(pe,{className:`h-3.5 w-3.5`}),t[7]=p):p=t[7];let m;t[8]===c?m=t[9]:(m=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{onClick:c,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:p})}),t[8]=c,t[9]=m);let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(fn,{children:`Save image`}),t[10]=h):h=t[10];let g;t[11]===m?g=t[12]:(g=(0,$.jsxs)(mn,{children:[m,h]}),t[11]=m,t[12]=g);let _;t[13]===i?_=t[14]:(_=i?(0,$.jsx)(Ee,{className:`h-3.5 w-3.5 text-green-500`}):(0,$.jsx)(Ae,{className:`h-3.5 w-3.5`}),t[13]=i,t[14]=_);let v;t[15]!==u||t[16]!==_?(v=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{onClick:u,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:_})}),t[15]=u,t[16]=_,t[17]=v):v=t[17];let y=i?`Copied!`:`Copy to clipboard`,b;t[18]===y?b=t[19]:(b=(0,$.jsx)(fn,{children:y}),t[18]=y,t[19]=b);let x;t[20]!==v||t[21]!==b?(x=(0,$.jsxs)(mn,{children:[v,b]}),t[20]=v,t[21]=b,t[22]=x):x=t[22];let S;t[23]!==x||t[24]!==g?(S=(0,$.jsx)(`div`,{className:`absolute top-2 right-2 flex gap-1 opacity-0 group-hover/img:opacity-100 transition-opacity`,children:(0,$.jsxs)(pn,{children:[g,x]})}),t[23]=x,t[24]=g,t[25]=S):S=t[25];let C;return t[26]!==S||t[27]!==f?(C=(0,$.jsxs)(`div`,{className:`mb-3 relative group/img inline-block max-w-full`,children:[f,S]}),t[26]=S,t[27]=f,t[28]=C):C=t[28],C}function ii(e){let t=(0,Q.c)(72),{block:n,inline:r,sequence:i}=e,a=i===void 0?0:i,[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),{state:u}=en(),d=u.projects,f,p,m,h,g,v,y,b;if(t[0]!==n||t[1]!==r||t[2]!==a||t[3]!==u.projects||t[4]!==u.selectedProjectId||t[5]!==u.selectedThreadId){v=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[14]===u.selectedProjectId?e=t[15]:(e=e=>e.projectId===u.selectedProjectId,t[14]=u.selectedProjectId,t[15]=e);let i=d.find(e)?.threads.find(e=>e.threadId===u.selectedThreadId)?.path;b=n.toolName??`Unknown Tool`,y=n.toolCallId??`unknown`;let o=n,s=n.result??o.content,c;t[16]!==o||t[17]!==b?(c=b===`todo`?xn(o):null,t[16]=o,t[17]=b,t[18]=c):c=t[18];let l=c;if(m=Ar(Fr(s),i),!(m.length>0)&&l===null){v=null;break bb0}if(f=kr(b),typeof s==`object`&&s){let e=s,n=e.returnDisplay??e.return_display;if(typeof n==`string`&&n.trim()){let e;t[19]===n?e=t[20]:(e=n.trim(),t[19]=n,t[20]=e),f=e}else if(b===`read`||b===`file_read`){let n=e.filePath??e.file_path??e.path??``;if(n){let e;t[21]===n?e=t[22]:(e=n.split(`/`).pop()??n,t[21]=n,t[22]=e),f=`Completed ${e}`}}}else if(s==null){let e;t[23]===b?e=t[24]:(e=kr(b),t[23]=b,t[24]=e),f=`${e} (no result)`}if(f=Ar(f,i),l!==null){let e;t[25]!==a||t[26]!==l?(e=(0,$.jsx)(Tn,{todos:l,sequence:a}),t[25]=a,t[26]=l,t[27]=e):e=t[27],v=e;break bb0}if(b===`generate_image`){let e;t[28]===s?e=t[29]:(e=ni(s),t[28]=s,t[29]=e);let n=e;if(n&&(n.imageUrl||n.imageData)){let e;t[30]!==n.imageData||t[31]!==n.imageUrl?(e=(0,$.jsx)(ri,{imageUrl:n.imageUrl,imageData:n.imageData}),t[30]=n.imageData,t[31]=n.imageUrl,t[32]=e):e=t[32],v=e;break bb0}}if(r){v=null;break bb0}let _;t[33]===b?_=t[34]:(_=b.toLowerCase().includes(`bash`),t[33]=b,t[34]=_),p=_,h=m?m.split(`
7
+ `):[],g=p?h.slice(0,3).join(`
8
+ `):m}t[0]=n,t[1]=r,t[2]=a,t[3]=u.projects,t[4]=u.selectedProjectId,t[5]=u.selectedThreadId,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=b}else f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13];if(v!==Symbol.for(`react.early_return_sentinel`))return v;let x=g,S=p&&h.length>3;if(p){let e;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(be,{className:`h-4 w-4 shrink-0`}),t[35]=e):e=t[35];let n;t[36]===f?n=t[37]:(n=(0,$.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-2 text-sm font-medium text-foreground`,children:[e,(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:f})]}),t[36]=f,t[37]=n);let r;t[38]!==S||t[39]!==x||t[40]!==m||t[41]!==h?(r=m&&(0,$.jsxs)(`div`,{className:`px-3 pb-2 bg-background border-t border-border`,children:[(0,$.jsxs)(`pre`,{className:`text-xs bg-muted p-2 rounded font-mono whitespace-pre-wrap overflow-auto text-foreground text-left mt-2${S?` cursor-pointer hover:bg-muted/80`:``}`,onClick:S?()=>l(!0):void 0,title:S?`Click to see full output`:void 0,children:[x,S&&(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`
9
+ `,`...`]})]}),S&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>l(!0),className:`mt-1 text-xs text-brand hover:underline`,children:[`Show full output (`,h.length,` lines)`]})]}),t[38]=S,t[39]=x,t[40]=m,t[41]=h,t[42]=r):r=t[42];let i;t[43]!==n||t[44]!==r?(i=(0,$.jsxs)(`div`,{className:`mb-3 rounded-lg border border-border bg-muted/50 overflow-hidden`,children:[n,r]}),t[43]=n,t[44]=r,t[45]=i):i=t[45];let a;t[46]!==c||t[47]!==S||t[48]!==m?(a=S&&(0,$.jsx)(_,{open:c,onOpenChange:l,children:(0,$.jsxs)(O,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,$.jsx)(q,{children:(0,$.jsx)(K,{children:`Full Output`})}),(0,$.jsx)(`pre`,{className:`text-xs bg-muted p-3 rounded font-mono whitespace-pre-wrap overflow-auto flex-1 text-foreground`,children:m})]})}),t[46]=c,t[47]=S,t[48]=m,t[49]=a):a=t[49];let o;return t[50]!==i||t[51]!==a?(o=(0,$.jsxs)($.Fragment,{children:[i,a]}),t[50]=i,t[51]=a,t[52]=o):o=t[52],o}let C;t[53]===o?C=t[54]:(C=()=>s(!o),t[53]=o,t[54]=C);let w=`${b} result`,T;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(be,{className:`h-4 w-4 shrink-0`}),t[55]=T):T=t[55];let E;t[56]===f?E=t[57]:(E=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:f}),t[56]=f,t[57]=E);let D;t[58]===o?D=t[59]:(D=o?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[58]=o,t[59]=D);let k;t[60]!==C||t[61]!==w||t[62]!==E||t[63]!==D?(k=(0,$.jsxs)(`button`,{onClick:C,className:`w-full px-3 py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted transition-colors text-left`,title:w,children:[T,E,D]}),t[60]=C,t[61]=w,t[62]=E,t[63]=D,t[64]=k):k=t[64];let A;t[65]!==o||t[66]!==m||t[67]!==y?(A=o&&(0,$.jsxs)(`div`,{className:`px-3 py-2 bg-background border-t border-border`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`Call ID: `,y]}),m&&(0,$.jsx)(`pre`,{className:`text-xs bg-muted p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48 text-foreground text-left`,children:m})]}),t[65]=o,t[66]=m,t[67]=y,t[68]=A):A=t[68];let j;return t[69]!==k||t[70]!==A?(j=(0,$.jsxs)(`div`,{className:`mb-3 rounded-lg border border-border bg-muted/50 overflow-hidden`,children:[k,A]}),t[69]=k,t[70]=A,t[71]=j):j=t[71],j}function ai(e){let t=(0,Q.c)(37),{text:n,isStreaming:r}=e,i=n===void 0?``:n,a=r===void 0?!1:r,o=(0,Z.useRef)(null),[s,c]=(0,Z.useState)(a),l=(0,Z.useRef)(a),u,d;t[0]===a?(u=t[1],d=t[2]):(u=()=>{a?c(!0):l.current&&!a&&c(!1),l.current=a},d=[a],t[0]=a,t[1]=u,t[2]=d),(0,Z.useEffect)(u,d);let f;t[3]!==s||t[4]!==a?(f=()=>{s&&a&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},t[3]=s,t[4]=a,t[5]=f):f=t[5];let p;if(t[6]!==s||t[7]!==a||t[8]!==i?(p=[i,s,a],t[6]=s,t[7]=a,t[8]=i,t[9]=p):p=t[9],(0,Z.useEffect)(f,p),!i&&!a)return null;let m;t[10]===s?m=t[11]:(m=()=>c(!s),t[10]=s,t[11]=m);let h=a?`text-brand animate-pulse`:`text-muted-foreground`,g;t[12]===h?g=t[13]:(g=J(`h-3.5 w-3.5 shrink-0`,h),t[12]=h,t[13]=g);let _;t[14]===g?_=t[15]:(_=(0,$.jsx)(Pe,{className:g}),t[14]=g,t[15]=_);let v=a?`Thinking...`:`Thinking`,y;t[16]===v?y=t[17]:(y=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:v}),t[16]=v,t[17]=y);let b;t[18]===s?b=t[19]:(b=s?(0,$.jsx)(xt,{className:`h-3 w-3 text-muted-foreground shrink-0`}):(0,$.jsx)(we,{className:`h-3 w-3 text-muted-foreground shrink-0`}),t[18]=s,t[19]=b);let x;t[20]!==s||t[21]!==_||t[22]!==y||t[23]!==b||t[24]!==m?(x=(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 cursor-pointer select-none text-left w-full`,onClick:m,"aria-expanded":s,children:[_,y,b]}),t[20]=s,t[21]=_,t[22]=y,t[23]=b,t[24]=m,t[25]=x):x=t[25];let S=s?`grid-rows-[1fr]`:`grid-rows-[0fr]`,C;t[26]===S?C=t[27]:(C=J(`grid transition-[grid-template-rows] duration-200 ease-in-out`,S),t[26]=S,t[27]=C);let w;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(w={maxHeight:`7.5em`},t[28]=w):w=t[28];let T;t[29]===i?T=t[30]:(T=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsx)(`div`,{ref:o,className:`ml-5 text-xs text-muted-foreground/60 whitespace-pre-wrap overflow-y-auto`,style:w,children:i})}),t[29]=i,t[30]=T);let E;t[31]!==C||t[32]!==T?(E=(0,$.jsx)(`div`,{className:C,children:T}),t[31]=C,t[32]=T,t[33]=E):E=t[33];let D;return t[34]!==x||t[35]!==E?(D=(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[x,E]}),t[34]=x,t[35]=E,t[36]=D):D=t[36],D}function oi({toolCall:e,className:t}){let{state:n,dispatch:r}=en(),[i,a]=(0,Z.useState)(!1),o=n.toolCallProgress[e.id],s=Or(e.name),c=e.name===`bash`?`Ran`:e.name.charAt(0).toUpperCase()+e.name.slice(1);if(!(0,Z.useMemo)(()=>{if(!n.isStreaming)return{isActive:!1,isCompleted:!0};let t=!1,r=!1;for(let i of n.streamingSegments)if(i.type===`thinking`){for(let n of i.chunks)if(n.includes(e.id))try{let i=JSON.parse(n);if(Array.isArray(i))for(let n of i)n.type===`tool_use`&&n.id===e.id&&(t=!0),n.type===`tool-result`&&n.toolCallId===e.id&&(r=!0,t=!1)}catch{}}return t&&!n.isStreaming&&(r=!0,t=!1),{isActive:t,isCompleted:r}},[n.isStreaming,n.streamingSegments,e.id]).isActive)return null;let l=()=>{a(e=>!e)},u=()=>{r({type:Y.StopStream});let t={type:`tool-result`,toolCallId:e.id,toolName:e.name,result:`Tool execution was cancelled by the user. The command was taking too long or required user approval.`,isError:!0,content:`Tool execution was cancelled by the user. The command was taking too long or required user approval.`};r({type:Y.AppendStreamChunk,chunkType:`content`,content:JSON.stringify([t]),segments:n.streamingSegments})},d=e=>JSON.stringify(e,null,2),f=e.name===`bash`&&typeof e.input?.command==`string`?e.input.command:null,p=!f&&typeof e.input?.description==`string`?e.input.description:null;return(0,$.jsxs)(`div`,{className:J(`overflow-hidden mb-2`,t),children:[(0,$.jsxs)(`div`,{className:`py-0.5 flex items-center gap-2 flex-wrap`,children:[(0,$.jsxs)(`span`,{title:e.name,className:`inline-flex items-center gap-1`,children:[(0,Z.createElement)(s,{className:`h-3.5 w-3.5 shrink-0 text-brand animate-spin`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c})]}),f!==null&&(0,$.jsx)(`code`,{className:`text-xs font-mono text-muted-foreground break-all rounded bg-muted/60 px-1 py-0.5`,children:f}),p!==null&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:p}),!f&&!p&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`running`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 ml-auto shrink-0`,children:[(0,$.jsx)(`button`,{onClick:l,className:`p-1 hover:bg-muted/50 rounded transition-colors`,title:i?`Collapse`:`Expand`,children:i?(0,$.jsx)(_t,{className:`h-3 w-3`}):(0,$.jsx)(xt,{className:`h-3 w-3`})}),(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{onClick:u,className:`p-1 hover:bg-red-200 dark:hover:bg-red-800 rounded transition-colors text-red-600 dark:text-red-400`,children:(0,$.jsx)(C,{className:`h-3 w-3`})})}),(0,$.jsx)(fn,{className:`bg-red-600 text-white border-red-600`,children:`Stop this process`})]})]})]}),i&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border min-h-[8rem] overflow-auto`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-2 font-mono`,children:[`ID: `,e.id]}),(0,$.jsxs)(`div`,{className:`mb-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Input:`}),(0,$.jsx)(`pre`,{className:`text-xs bg-slate-100 dark:bg-slate-900 p-2 rounded font-mono whitespace-pre-wrap overflow-auto max-h-48 border border-slate-200 dark:border-slate-700`,children:d(e.input)})]}),o&&(0,$.jsxs)(`div`,{className:`mb-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Progress:`}),(0,$.jsxs)(`div`,{className:`text-xs bg-green-50 dark:bg-green-900/20 p-2 rounded border border-green-200 dark:border-green-800`,children:[(0,$.jsx)(`div`,{className:`text-green-700 dark:text-green-300 font-mono`,children:o.delta}),o.partial?.content?.[0]?.arguments&&typeof o.partial.content[0].arguments==`object`&&`content`in o.partial.content[0].arguments&&typeof o.partial.content[0].arguments.content==`string`&&(0,$.jsxs)(`div`,{className:`mt-1 text-green-600 dark:text-green-400 font-mono text-xs`,children:[`Building: `,o.partial.content[0].arguments.content.slice(-50),o.partial.content[0].arguments.content.length>50&&`...`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.createElement)(s,{className:`h-3 w-3 shrink-0 text-brand animate-pulse`}),`Executing`,o&&` with progress`,`...`]})]})]})}function si(e){let t=(0,Q.c)(51),{toolCallId:n,question:r,options:i,context:a,answeredText:o}=e,[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!!o),[d,f]=(0,Z.useState)(o??``),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),_;t[0]!==p||t[1]!==n?(_=async e=>{if(!(!e.trim()||p)){m(!0);try{await ye(n,e.trim()),f(e.trim()),u(!0)}catch(e){console.error(`Failed to submit answer:`,e),m(!1),g(null)}}},t[0]=p,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==p||t[5]!==l?(y=e=>{l||p||(g(e),v(e))},t[3]=v,t[4]=p,t[5]=l,t[6]=y):y=t[6];let b=y,x;t[7]!==s||t[8]!==v||t[9]!==p||t[10]!==l?(x=()=>{if(l||p)return;let e=s.trim();e&&v(e)},t[7]=s,t[8]=v,t[9]=p,t[10]=l,t[11]=x):x=t[11];let S=x,C;t[12]===S?C=t[13]:(C=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),S())},t[12]=S,t[13]=C);let w=C;if(l){let e,n;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ee,{className:`h-4 w-4`}),n=(0,$.jsx)(`span`,{className:`font-medium`,children:`Answered:`}),t[14]=e,t[15]=n):(e=t[14],n=t[15]);let r;return t[16]===d?r=t[17]:(r=(0,$.jsx)(`div`,{className:`rounded-lg p-3 my-2`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[e,n,(0,$.jsx)(`span`,{children:d})]})}),t[16]=d,t[17]=r),r}let T;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Ge,{className:`h-5 w-5 text-brand shrink-0 mt-0.5`}),t[18]=T):T=t[18];let E;t[19]===r?E=t[20]:(E=(0,$.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(Wn,{content:r})}),t[19]=r,t[20]=E);let D;t[21]===a?D=t[22]:(D=a&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:a}),t[21]=a,t[22]=D);let O;t[23]!==E||t[24]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-start gap-2 mb-3`,children:[T,(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[E,D]})]}),t[23]=E,t[24]=D,t[25]=O):O=t[25];let k;t[26]!==b||t[27]!==p||t[28]!==i||t[29]!==h?(k=i&&i.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-3`,children:i.map(e=>{let t=h===e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>b(e),disabled:p,className:J(`rounded-md border px-3 py-1.5 text-sm font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5`,t?`border-foreground/20 bg-accent text-accent-foreground`:`border-foreground/20 bg-background text-foreground hover:bg-accent hover:text-accent-foreground`),children:[t&&(0,$.jsx)(Ee,{className:`h-3.5 w-3.5 text-foreground`}),e]},e)})}),t[26]=b,t[27]=p,t[28]=i,t[29]=h,t[30]=k):k=t[30];let A;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>c(e.target.value),t[31]=A):A=t[31];let j=i?.length?`Or type a custom answer...`:`Type your answer...`,M;t[32]!==s||t[33]!==w||t[34]!==p||t[35]!==j?(M=(0,$.jsx)(`input`,{type:`text`,value:s,onChange:A,onKeyDown:w,placeholder:j,disabled:p,className:`flex-1 rounded-md border border-border bg-background px-3 py-1.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50`}),t[32]=s,t[33]=w,t[34]=p,t[35]=j,t[36]=M):M=t[36];let N;t[37]!==s||t[38]!==p?(N=p||!s.trim(),t[37]=s,t[38]=p,t[39]=N):N=t[39];let P;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(Re,{className:`h-3 w-3`}),t[40]=P):P=t[40];let F;t[41]!==S||t[42]!==N?(F=(0,$.jsx)(`button`,{type:`button`,onClick:S,disabled:N,className:`h-7 w-7 rounded-full bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center justify-center shrink-0`,children:P}),t[41]=S,t[42]=N,t[43]=F):F=t[43];let I;t[44]!==M||t[45]!==F?(I=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[M,F]}),t[44]=M,t[45]=F,t[46]=I):I=t[46];let L;return t[47]!==I||t[48]!==O||t[49]!==k?(L=(0,$.jsxs)(`div`,{className:`rounded-lg border-t border-border p-4 my-2`,children:[O,k,I]}),t[47]=I,t[48]=O,t[49]=k,t[50]=L):L=t[50],L}function ci(e){let t=(0,Q.c)(46),{toolCallId:n,intention:r,code:i}=e,{state:a}=en(),o=a.selectedThreadId,s;t[0]===n?s=t[1]:(s=bn(n),t[0]=n,t[1]=s);let c=s,[l,u]=(0,Z.useState)(c?.status??`running`),d;t[2]===c?d=t[3]:(d=()=>{if(!c||c.status!==`success`)return null;let e=c.result;return e==null?null:typeof e==`string`?e:JSON.stringify(e,null,2)},t[2]=c,t[3]=d);let[f,p]=(0,Z.useState)(d),[m,h]=(0,Z.useState)(c?.error??null),g,_;t[4]===n?(g=t[5],_=t[6]):(g=()=>On(n,()=>{let e=bn(n);if(e)if(u(e.status),e.status===`success`){let t=e.result;p(t==null?null:typeof t==`string`?t:JSON.stringify(t,null,2))}else e.status===`error`&&h(e.error??null)}),_=[n],t[4]=n,t[5]=g,t[6]=_),(0,Z.useEffect)(g,_);let v,y;t[7]!==i||t[8]!==o||t[9]!==n?(v=()=>{o&&yn(n,i,o)},y=[n,i,o],t[7]=i,t[8]=o,t[9]=n,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Z.useEffect)(v,y);let[b,x]=(0,Z.useState)(!1),S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>x(li),t[12]=S):S=t[12];let C=S;if(l===`running`){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(B,{className:`h-4 w-4 shrink-0 text-brand animate-pulse`}),t[13]=e):e=t[13];let n=r||`Executing Browser JS...`,i;return t[14]===n?i=t[15]:(i=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground`,children:[e,(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n})]})}),t[14]=n,t[15]=i),i}if(l===`success`){let e;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(B,{className:`h-4 w-4 shrink-0 text-brand`}),t[16]=e):e=t[16];let n=r||`Browser JS Executed Successfully`,a;t[17]===n?a=t[18]:(a=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:n}),t[17]=n,t[18]=a);let o;t[19]===b?o=t[20]:(o=b?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[19]=b,t[20]=o);let s;t[21]!==a||t[22]!==o?(s=(0,$.jsxs)(`button`,{onClick:C,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,children:[e,a,o]}),t[21]=a,t[22]=o,t[23]=s):s=t[23];let c;t[24]!==i||t[25]!==b||t[26]!==f?(c=b&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border flex flex-col gap-2`,children:[(0,$.jsx)(`pre`,{className:`text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap`,children:i}),f!=null&&(0,$.jsx)(`pre`,{className:`text-xs text-foreground leading-relaxed whitespace-pre-wrap border-t border-border pt-2`,children:f})]}),t[24]=i,t[25]=b,t[26]=f,t[27]=c):c=t[27];let l;return t[28]!==s||t[29]!==c?(l=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[s,c]}),t[28]=s,t[29]=c,t[30]=l):l=t[30],l}let w;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(B,{className:`h-4 w-4 shrink-0 text-destructive`}),t[31]=w):w=t[31];let T=r||`Browser JS Execution Failed`,E;t[32]===T?E=t[33]:(E=(0,$.jsx)(`span`,{className:`flex-1 text-left min-w-0 truncate`,children:T}),t[32]=T,t[33]=E);let D;t[34]===b?D=t[35]:(D=b?(0,$.jsx)(xt,{className:`h-4 w-4 shrink-0`}):(0,$.jsx)(we,{className:`h-4 w-4 shrink-0`}),t[34]=b,t[35]=D);let O;t[36]!==E||t[37]!==D?(O=(0,$.jsxs)(`button`,{onClick:C,className:`w-full py-2 flex items-center gap-2 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors text-left`,children:[w,E,D]}),t[36]=E,t[37]=D,t[38]=O):O=t[38];let k;t[39]!==i||t[40]!==m||t[41]!==b?(k=b&&(0,$.jsxs)(`div`,{className:`py-2 border-t border-border flex flex-col gap-2`,children:[(0,$.jsx)(`pre`,{className:`text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap`,children:m}),(0,$.jsx)(`pre`,{className:`text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap`,children:i})]}),t[39]=i,t[40]=m,t[41]=b,t[42]=k):k=t[42];let A;return t[43]!==O||t[44]!==k?(A=(0,$.jsxs)(`div`,{className:`overflow-hidden`,children:[O,k]}),t[43]=O,t[44]=k,t[45]=A):A=t[45],A}function li(e){return!e}function ui(e){let t=(0,Q.c)(29),{src:n}=e,[r,i]=(0,Z.useState)(!1),a;t[0]===n?a=t[1]:(a=async()=>{let e=`generated-image-${Date.now()}.png`,{path:t}=await ut(n.startsWith(`data:`)?{imageData:n.replace(/^data:[^;]+;base64,/,``),filename:e}:{imageUrl:n,filename:e});X({title:`Saved to downloads: ${t.split(`/`).pop()}`})},t[0]=n,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=async()=>{await I(n.startsWith(`data:`)?{imageData:n.replace(/^data:[^;]+;base64,/,``)}:{imageUrl:n}),i(!0),setTimeout(()=>i(!1),2e3)},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={maxHeight:`512px`},t[4]=l):l=t[4];let u;t[5]===n?u=t[6]:(u=(0,$.jsx)(`img`,{src:n,alt:`Generated image`,className:`max-w-full rounded-lg border border-border block`,style:l}),t[5]=n,t[6]=u);let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(pe,{className:`h-3.5 w-3.5`}),t[7]=d):d=t[7];let f;t[8]===o?f=t[9]:(f=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{onClick:o,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:d})}),t[8]=o,t[9]=f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(fn,{children:`Save image`}),t[10]=p):p=t[10];let m;t[11]===f?m=t[12]:(m=(0,$.jsxs)(mn,{children:[f,p]}),t[11]=f,t[12]=m);let h;t[13]===r?h=t[14]:(h=r?(0,$.jsx)(Ee,{className:`h-3.5 w-3.5 text-green-500`}):(0,$.jsx)(Ae,{className:`h-3.5 w-3.5`}),t[13]=r,t[14]=h);let g;t[15]!==c||t[16]!==h?(g=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{onClick:c,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:h})}),t[15]=c,t[16]=h,t[17]=g):g=t[17];let _=r?`Copied!`:`Copy to clipboard`,v;t[18]===_?v=t[19]:(v=(0,$.jsx)(fn,{children:_}),t[18]=_,t[19]=v);let y;t[20]!==g||t[21]!==v?(y=(0,$.jsxs)(mn,{children:[g,v]}),t[20]=g,t[21]=v,t[22]=y):y=t[22];let b;t[23]!==y||t[24]!==m?(b=(0,$.jsx)(`div`,{className:`absolute top-2 right-2 flex gap-1 opacity-0 group-hover/img:opacity-100 transition-opacity`,children:(0,$.jsxs)(pn,{children:[m,y]})}),t[23]=y,t[24]=m,t[25]=b):b=t[25];let x;return t[26]!==b||t[27]!==u?(x=(0,$.jsxs)(`div`,{className:`mt-2 relative group/img inline-block max-w-full`,children:[u,b]}),t[26]=b,t[27]=u,t[28]=x):x=t[28],x}function di(e,t){let n=e.find(e=>e.type===`tool-result`&&e.toolCallId===t);if(!n)return;let r=n,i=r.result??r.content;if(i!=null)return typeof i==`string`?i:JSON.stringify(i,null,2)}function fi(e,t,n,r){return e.name===`ask_user`?(0,$.jsx)(si,{toolCallId:e.id,question:JSON.stringify(e.input?.question??``),options:e.input?.options,context:e.input?.context,answeredText:r},t):e.name===`run_js`||e.name===`run_web_worker`?(0,$.jsx)(ci,{toolCallId:e.id,intention:e.input?.intention??``,code:e.input?.code??``},t):n?(0,$.jsxs)(`span`,{children:[(0,$.jsx)(oi,{toolCall:e}),(0,$.jsx)(ti,{inline:!0,block:e,resultContent:r,isActive:!0})]},t):(0,$.jsx)(ti,{inline:!0,block:e,resultContent:r,isActive:!1},t)}function pi({message:e,threadId:t,messageIndex:n=0}){let r=e.sender===`user`,i=r?null:ln(e.content),[a,o]=(0,Z.useState)(!1),s=e.timestamp?new Date(e.timestamp).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``;async function c(){if(!(!e.checkpointRef||!t||a)){o(!0);try{let n=await ot(t,e.checkpointRef);n.success?X({title:`Checkpoint restored`,description:`Working tree restored to before this agent run.`}):X({title:`Restore failed`,description:n.error??`Could not restore checkpoint.`,variant:`destructive`})}catch(e){X({title:`Restore failed`,description:e instanceof Error?e.message:`Unknown error`,variant:`destructive`})}finally{o(!1)}}}return(0,$.jsxs)(`div`,{className:J(`group flex gap-3 px-4 py-4`,r?`flex-row-reverse`:`flex-row`),children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-1 shrink-0`,children:[(0,$.jsx)(`div`,{className:J(`flex h-7 w-7 items-center justify-center rounded-full`,r?`bg-foreground`:`bg-muted`),children:r?(0,$.jsx)(l,{className:`h-3.5 w-3.5 text-background`}):(0,$.jsx)(nt,{className:`h-3.5 w-3.5 text-muted-foreground`})}),r&&e.checkpointRef&&(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(`button`,{onClick:c,disabled:a,className:`flex items-center justify-center h-5 w-5 rounded-md text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity hover:text-foreground hover:bg-muted disabled:opacity-50`,children:(0,$.jsx)(lt,{className:J(`h-3 w-3`,a&&`animate-spin`)})})}),(0,$.jsx)(fn,{side:`left`,children:`Restore checkpoint`})]})})]}),(0,$.jsxs)(`div`,{className:J(`flex flex-1 flex-col gap-1 min-w-0`,r&&`items-end`),children:[(0,$.jsxs)(`div`,{className:J(`flex items-center gap-2`,r&&`flex-row-reverse`),children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:r?`You`:`Agent`}),s&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,$.jsx)(at,{className:`h-2.5 w-2.5`}),s]}),e.model&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,$.jsx)(B,{className:`h-2.5 w-2.5`}),Jn(e.model)]}),e.metadata?.processingTimeMs&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,$.jsx)(v,{className:`h-2.5 w-2.5`}),e.metadata.processingTimeMs>=6e4?`${Math.floor(e.metadata.processingTimeMs/6e4)}m ${Math.round(e.metadata.processingTimeMs%6e4/1e3)}s`:`${Math.round(e.metadata.processingTimeMs/1e3)}s`]}),e.metadata?.tokenCount&&(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity`,children:[e.metadata.tokenCount.toLocaleString(),` tokens`]})]}),(0,$.jsx)(`div`,{className:J(`rounded-xl px-4 py-3 flex flex-col gap-0.5 min-w-0`,r?`bg-foreground text-background`:`bg-muted text-foreground`),children:e.isThinking?(()=>{let t=on(e.content);return t?.length?(0,$.jsx)($.Fragment,{children:nn(t,!1).map((e,n)=>{if(e.type===`thinking-group`)return(0,$.jsx)(ai,{text:e.text,isStreaming:!1},`tg-${n}`);let r=e;return r.type===`tool_use`?fi(r,n,!1,di(t,r.id)):r.type===`tool-result`?(0,$.jsx)(ii,{inline:!0,block:r},n):null})}):(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap`,children:(0,$.jsx)(Wn,{content:rn(e.content),enableMermaid:!0})})})():i?(()=>{let e=nn(i,!1),t=i.filter(e=>e.type===`tool_use`&&e.name===`ask_user`);return(0,$.jsxs)($.Fragment,{children:[e.map((e,t)=>{if(e.type===`thinking-group`)return(0,$.jsx)(ai,{text:e.text,isStreaming:!1},`tg-${t}`);let r=e;return r.type===`tool_use`&&r.name===`todo`||r.type===`tool-result`&&r.toolName===`todo`?r.type===`tool-result`?(0,$.jsx)(ii,{inline:!0,sequence:n,block:r},t):null:r.type===`tool_use`&&r.name===`ask_user`||r.type===`tool-result`&&r.toolName===`ask_user`?null:(0,$.jsx)(`div`,{children:r.type===`text`&&`text`in r?(0,$.jsx)(Wn,{content:rn(r.text),enableMermaid:!0}):r.type===`tool_use`?fi(r,void 0,!1,di(i,r.id)):r.type===`tool-result`?(0,$.jsx)(ii,{inline:!0,block:r}):null},t)}),t.map((e,t)=>(0,$.jsx)(si,{toolCallId:e.id,question:JSON.stringify(e.input?.question??``),options:e.input?.options,context:e.input?.context,answeredText:di(i,e.id)},`ask-${t}`))]})})():(0,$.jsx)(Wn,{content:rn(e.content),enableMermaid:!0})}),(e.generatedImageUrl||e.generatedImageData)&&(0,$.jsx)(ui,{src:e.generatedImageData?`data:image/png;base64,${e.generatedImageData}`:e.generatedImageUrl}),e.attachments&&e.attachments.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:e.attachments.map((e,t)=>(0,$.jsxs)(`span`,{className:`flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,$.jsx)(Fe,{className:`h-2.5 w-2.5`}),e.fileName]},t))})]})]})}function mi(e){let t=(0,Q.c)(26),{segments:n,model:r,isCreatingProject:i,isProcessingThread:a,totalMessages:o,eventCount:s}=e,c=o===void 0?0:o,l=s===void 0?0:s,u,d,f,p,m;if(t[0]!==l||t[1]!==i||t[2]!==a||t[3]!==r||t[4]!==n||t[5]!==c){let e=tn(n);p=`group flex gap-3 px-4 py-4`,t[11]===l?m=t[12]:(m=(0,$.jsx)(Dr,{eventCount:l}),t[11]=l,t[12]=m),u=`flex flex-1 flex-col gap-1 min-w-0`;let o;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:`Agent`}),t[13]=o):o=t[13];let s;t[14]===r?s=t[15]:(s=r&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,$.jsx)(B,{className:`h-2.5 w-2.5`}),Jn(r)]}),t[14]=r,t[15]=s),t[16]===s?d=t[17]:(d=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o,s]}),t[16]=s,t[17]=d),f=e.length>0?(()=>{let t=nn(e,!0),n=e.filter(hi);return(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted px-4 py-3 text-foreground flex flex-col gap-0.5 min-w-0`,children:[t.map((t,n)=>{if(t.type===`thinking-group`){let e=t;return(0,$.jsx)(ai,{text:e.text,isStreaming:e.isCurrentlyStreaming},`tg-${n}`)}let r=t;return r.type===`tool_use`&&r.name===`todo`||r.type===`tool-result`&&r.toolName===`todo`?r.type===`tool-result`?(0,$.jsx)(ii,{inline:!0,sequence:c,block:r},`b-${n}`):null:r.type===`tool_use`&&r.name===`ask_user`?null:(0,$.jsx)(`div`,{children:r.type===`text`&&`text`in r?(0,$.jsx)(Wn,{content:rn(r.text),enableMermaid:!0}):r.type===`tool_use`?fi(r,void 0,!0,di(e,r.id)):r.type===`tool-result`?(0,$.jsx)(ii,{inline:!0,block:r}):null},`b-${n}`)}),n.map((t,n)=>(0,$.jsx)(si,{toolCallId:t.id,question:JSON.stringify(t.input?.question??``),options:t.input?.options,context:t.input?.context,answeredText:di(e,t.id)},`ask-${n}`))]})})():i||a?(0,$.jsx)(`div`,{className:`rounded-xl bg-muted px-4 py-3 min-w-0 text-foreground`,children:(0,$.jsx)(ai,{isStreaming:!0})}):(0,$.jsx)(`div`,{className:`rounded-xl bg-muted px-4 py-3 min-w-0`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-1.5`,children:[(0,$.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-muted-foreground/40 animate-bounce [animation-delay:0ms]`}),(0,$.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-muted-foreground/40 animate-bounce [animation-delay:150ms]`}),(0,$.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-muted-foreground/40 animate-bounce [animation-delay:300ms]`})]})}),t[0]=l,t[1]=i,t[2]=a,t[3]=r,t[4]=n,t[5]=c,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m}else u=t[6],d=t[7],f=t[8],p=t[9],m=t[10];let h;t[18]!==u||t[19]!==d||t[20]!==f?(h=(0,$.jsxs)(`div`,{className:u,children:[d,f]}),t[18]=u,t[19]=d,t[20]=f,t[21]=h):h=t[21];let g;return t[22]!==p||t[23]!==m||t[24]!==h?(g=(0,$.jsxs)(`div`,{className:p,children:[m,h]}),t[22]=p,t[23]=m,t[24]=h,t[25]=g):g=t[25],g}function hi(e){return e.type===`tool_use`&&e.name===`ask_user`}var gi=(0,Z.memo)(mi,(e,t)=>{if(e.model!==t.model||e.segments.length!==t.segments.length)return!1;for(let n=0;n<e.segments.length;n++){if(e.segments[n].type!==t.segments[n].type||e.segments[n].chunks.length!==t.segments[n].chunks.length)return!1;for(let r=0;r<e.segments[n].chunks.length;r++)if(e.segments[n].chunks[r]!==t.segments[n].chunks[r])return!1}return!0});function _i(e){let t=(0,Q.c)(34),{projects:n,onSelectProject:r,onCreateThread:i,onConnectRepo:a,onNewApp:o,onOpenFolder:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`img`,{src:`/tarsk-color.svg`,alt:`Tarsk`,className:`h-16 w-16 rounded-lg`}),t[0]=c):c=t[0];let l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground text-balance`,children:`Let's build it!`}),t[1]=l):l=t[1];let u=n.length===0?`Start or connect your first project`:`Select a project to start coding`,d;t[2]===u?d=t[3]:(d=(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[c,(0,$.jsxs)(`div`,{className:`text-center`,children:[l,(0,$.jsx)(`p`,{className:`mt-1 text-base text-muted-foreground`,children:u})]})]}),t[2]=u,t[3]=d);let f;if(t[4]!==i||t[5]!==r||t[6]!==n){let e;t[8]!==i||t[9]!==r?(e=e=>(0,$.jsxs)(`button`,{type:`button`,className:`flex w-56 flex-col gap-2 rounded-xl border border-border bg-background p-4 text-left shadow-sm transition-colors hover:bg-muted`,onClick:()=>{e.threads.length===0?i(e.projectId):r(e.projectId,e.threads[0].threadId)},children:[(0,$.jsx)(b,{className:`h-5 w-5 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`text-sm text-foreground leading-snug font-medium`,children:e.name}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.threads.length,` thread`,e.threads.length===1?``:`s`]})]},e.projectId),t[8]=i,t[9]=r,t[10]=e):e=t[10],f=n.map(e),t[4]=i,t[5]=r,t[6]=n,t[7]=f}else f=t[7];let p,m,h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(Nt,{className:`h-5 w-5 text-muted-foreground`}),m=(0,$.jsx)(`span`,{className:`text-sm text-foreground leading-snug font-medium`,children:`Connect a repo`}),h=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Clone an existing repository`}),t[11]=p,t[12]=m,t[13]=h):(p=t[11],m=t[12],h=t[13]);let g;t[14]===a?g=t[15]:(g=(0,$.jsxs)(`button`,{type:`button`,className:`flex w-56 flex-col gap-2 rounded-xl border border-border bg-background p-4 text-left shadow-sm transition-colors hover:bg-muted`,onClick:a,children:[p,m,h]}),t[14]=a,t[15]=g);let _,v,y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(De,{className:`h-5 w-5 text-muted-foreground`}),v=(0,$.jsx)(`span`,{className:`text-sm text-foreground leading-snug font-medium`,children:`New App`}),y=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Create a new project from template`}),t[16]=_,t[17]=v,t[18]=y):(_=t[16],v=t[17],y=t[18]);let x;t[19]===o?x=t[20]:(x=(0,$.jsxs)(`button`,{type:`button`,className:`flex w-56 flex-col gap-2 rounded-xl border border-border bg-background p-4 text-left shadow-sm transition-colors hover:bg-muted`,onClick:o,children:[_,v,y]}),t[19]=o,t[20]=x);let S,C,w;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(se,{className:`h-5 w-5 text-muted-foreground`}),C=(0,$.jsx)(`span`,{className:`text-sm text-foreground leading-snug font-medium`,children:`Open Folder`}),w=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Use an existing local folder`}),t[21]=S,t[22]=C,t[23]=w):(S=t[21],C=t[22],w=t[23]);let T;t[24]===s?T=t[25]:(T=(0,$.jsxs)(`button`,{type:`button`,className:`flex w-56 flex-col gap-2 rounded-xl border border-border bg-background p-4 text-left shadow-sm transition-colors hover:bg-muted`,onClick:s,children:[S,C,w]}),t[24]=s,t[25]=T);let E;t[26]!==x||t[27]!==T||t[28]!==f||t[29]!==g?(E=(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-3`,children:[f,g,x,T]}),t[26]=x,t[27]=T,t[28]=f,t[29]=g,t[30]=E):E=t[30];let D;return t[31]!==E||t[32]!==d?(D=(0,$.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-1 flex-col items-center justify-center gap-8 px-4`,children:[d,E]}),t[31]=E,t[32]=d,t[33]=D):D=t[33],D}function vi(e){let t=[`What would you like to add to ${e}?`,`What should we build in ${e}?`,`What changes do you want to make to ${e}?`,`What feature should we add to ${e}?`,`What would you like to fix in ${e}?`,`What are we working on in ${e}?`,`What's next for ${e}?`,`What should we improve in ${e}?`,`How can we make ${e} better?`,`What would you like to change in ${e}?`,`What should we ship in ${e} next?`];return t[Math.floor(Math.random()*t.length)]}function yi(e){let t=(0,Q.c)(24),{project:n}=e,{setDevServerRunning:r}=Gn(),[i,a]=(0,Z.useState)(!1),{startServer:o}=Yn(),s;t[0]!==n||t[1]!==r?(s=()=>{if(!n?.projectId)return;let e=async()=>{try{let e=await me(n.projectId);a(e.isRunning),r(e.isRunning)}catch{a(!1),r(!1)}};e();let t=setInterval(e,2e3);return()=>clearInterval(t)},t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=n?.projectId,l;t[3]===c?l=t[4]:(l=[c],t[3]=c,t[4]=l),(0,Z.useEffect)(s,l),n?.name;let u=n?.name??`your project`,d;t[5]===u?d=t[6]:(d=vi(u),t[5]=u,t[6]=d);let f=d,p=!i&&n?.runCommand,m;t[7]!==n||t[8]!==o?(m=()=>{n&&o(n)},t[7]=n,t[8]=o,t[9]=m):m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(`img`,{src:`/tarsk-color.svg`,alt:`Tarsk`,className:`h-16 w-16 rounded-lg`}),t[10]=g):g=t[10];let _=n?.name??`Project`,v;t[11]===_?v=t[12]:(v=(0,$.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground text-balance`,children:_}),t[11]=_,t[12]=v);let y;t[13]===f?y=t[14]:(y=(0,$.jsx)(`p`,{className:`mt-2 text-base text-muted-foreground`,children:f}),t[13]=f,t[14]=y);let b;t[15]!==y||t[16]!==v?(b=(0,$.jsxs)(`div`,{className:`text-center`,children:[v,y]}),t[15]=y,t[16]=v,t[17]=b):b=t[17];let x;t[18]!==h||t[19]!==p?(x=p&&(0,$.jsx)(`button`,{type:`button`,onClick:h,className:`inline-flex items-center gap-2 rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors`,children:`Start App`}),t[18]=h,t[19]=p,t[20]=x):x=t[20];let S;return t[21]!==b||t[22]!==x?(S=(0,$.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-6 px-4`,children:[g,b,x]})}),t[21]=b,t[22]=x,t[23]=S):S=t[23],S}var bi=(0,Z.createContext)(null),xi=(0,Z.forwardRef)((e,t)=>{let n=(0,Q.c)(9),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({style:a,children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;return n[4]!==r||n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,$.jsx)(`div`,{ref:t,style:a,...i,className:`mx-auto max-w-3xl w-full min-w-0`,children:r}),n[4]=r,n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});xi.displayName=`MessageList`;function Si(){let e=(0,Q.c)(14),t=(0,Z.useContext)(bi);if(!t)return null;let{isStreaming:n,isCreatingProject:r,isProcessingThread:i,streamingSegments:a,streamingModel:o,streamingEventCount:s,totalMessages:c,error:l,onClearError:u}=t,d;e[0]!==r||e[1]!==i||e[2]!==n||e[3]!==s||e[4]!==o||e[5]!==a||e[6]!==c?(d=(n||r||i)&&(0,$.jsx)(gi,{segments:a,model:o,isCreatingProject:r,isProcessingThread:i,totalMessages:c,eventCount:s}),e[0]=r,e[1]=i,e[2]=n,e[3]=s,e[4]=o,e[5]=a,e[6]=c,e[7]=d):d=e[7];let f;e[8]!==l||e[9]!==u?(f=l&&(0,$.jsxs)(`div`,{className:`mx-4 my-2 rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:l}),(0,$.jsx)(`button`,{type:`button`,className:`mt-1 text-xs text-destructive underline underline-offset-2 hover:text-destructive/80`,onClick:u,children:`Dismiss`})]}),e[8]=l,e[9]=u,e[10]=f):f=e[10];let p;return e[11]!==d||e[12]!==f?(p=(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl w-full min-w-0 pb-48`,children:[d,f]}),e[11]=d,e[12]=f,e[13]=p):p=e[13],p}var Ci={List:xi,Footer:Si};function wi(e){let t=(0,Q.c)(60),{messages:n,isStreaming:r,streamingSegments:i,streamingModel:a,streamingEventCount:o,isCreatingProject:s,isProcessingThread:c,selectedThreadId:l,selectedProjectId:u,projects:d,projectsLoading:f,messagesLoaded:p,onSelectThread:m,onCreateThread:h,onConnectRepo:g,onNewApp:_,onOpenFolder:v,error:y,onClearError:b}=e,x=(0,Z.useRef)(null),S=(0,Z.useRef)(0),C=(0,Z.useRef)(!1),w=(0,Z.useRef)(!1),T;t[0]===l?T=t[1]:(T=()=>{l&&x.current?.getState(e=>{Se(l,e.scrollTop)})},t[0]=l,t[1]=T);let E=T,D,O;t[2]===E?(D=t[3],O=t[4]):(D=()=>{let e=()=>{E()};return window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`beforeunload`,e),E()}},O=[E],t[2]=E,t[3]=D,t[4]=O),(0,Z.useEffect)(D,O);let k,A;t[5]===E?(k=t[6],A=t[7]):(k=()=>{let e=setInterval(()=>{E()},5e3);return()=>clearInterval(e)},A=[E],t[5]=E,t[6]=k,t[7]=A),(0,Z.useEffect)(k,A);let j,M;t[8]!==n.length||t[9]!==p||t[10]!==l?(j=()=>{if(!l||!p||w.current||(w.current=!0,n.length===0))return;let e=Le(l);e!==null&&e>0&&requestAnimationFrame(()=>{x.current?.scrollTo({top:e})})},M=[l,p,n.length],t[8]=n.length,t[9]=p,t[10]=l,t[11]=j,t[12]=M):(j=t[11],M=t[12]),(0,Z.useEffect)(j,M);let N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{w.current=!1,S.current=0},t[13]=N):N=t[13];let P;t[14]===l?P=t[15]:(P=[l],t[14]=l,t[15]=P),(0,Z.useEffect)(N,P);let F;t[16]!==r||t[17]!==n.length?(F=()=>{if(!w.current)return;let e=n.length>S.current,t=C.current&&!r;(r||e||t)&&requestAnimationFrame(()=>{x.current?.scrollTo({top:2**53-1,behavior:`smooth`})}),S.current=n.length,C.current=r},t[16]=r,t[17]=n.length,t[18]=F):F=t[18];let I;t[19]!==r||t[20]!==n||t[21]!==i.length?(I=[r,n,i.length],t[19]=r,t[20]=n,t[21]=i.length,t[22]=I):I=t[22],(0,Z.useEffect)(F,I);let L=n.length===0&&!r&&!s&&!l,R=p&&n.length===0&&!r&&!s&&l,z;if(t[23]!==d||t[24]!==u){let e;t[26]===u?e=t[27]:(e=e=>e.projectId===u,t[26]=u,t[27]=e),z=d.find(e),t[23]=d,t[24]=u,t[25]=z}else z=t[25];let B=z;if(L){let e=`transition-opacity duration-500 ease-in-out ${f?`opacity-0`:`opacity-100`}`,n;t[28]!==g||t[29]!==h||t[30]!==_||t[31]!==v||t[32]!==m||t[33]!==d?(n=(0,$.jsx)(_i,{projects:d,onSelectProject:m,onCreateThread:h,onConnectRepo:g,onNewApp:_,onOpenFolder:v}),t[28]=g,t[29]=h,t[30]=_,t[31]=v,t[32]=m,t[33]=d,t[34]=n):n=t[34];let r;return t[35]!==e||t[36]!==n?(r=(0,$.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:(0,$.jsx)(`div`,{className:e,children:n})}),t[35]=e,t[36]=n,t[37]=r):r=t[37],r}if(R){let e;return t[38]===B?e=t[39]:(e=(0,$.jsx)(yi,{project:B}),t[38]=B,t[39]=e),e}let ee;t[40]!==y||t[41]!==s||t[42]!==c||t[43]!==r||t[44]!==n.length||t[45]!==b||t[46]!==o||t[47]!==a||t[48]!==i?(ee={isStreaming:r,isCreatingProject:s,isProcessingThread:c,streamingSegments:i,streamingModel:a,streamingEventCount:o,totalMessages:n.length,error:y,onClearError:b},t[40]=y,t[41]=s,t[42]=c,t[43]=r,t[44]=n.length,t[45]=b,t[46]=o,t[47]=a,t[48]=i,t[49]=ee):ee=t[49];let V=ee,te;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(te=J(`h-full overflow-hidden`),t[50]=te):te=t[50];let H;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H={height:`100%`},t[51]=H):H=t[51];let U;t[52]===l?U=t[53]:(U=(e,t)=>(0,$.jsx)(pi,{message:t,threadId:l,messageIndex:e}),t[52]=l,t[53]=U);let W;t[54]!==n||t[55]!==U?(W=(0,$.jsx)(Ht,{ref:x,style:H,data:n,itemContent:U,overscan:500,components:Ci}),t[54]=n,t[55]=U,t[56]=W):W=t[56];let ne;return t[57]!==V||t[58]!==W?(ne=(0,$.jsx)(`div`,{className:te,children:(0,$.jsx)(bi.Provider,{value:V,children:W})}),t[57]=V,t[58]=W,t[59]=ne):ne=t[59],ne}async function Ti(e){return a(`api/projects/${$e(e)}/todos`)}async function Ei(e,t){return F(`api/projects/${$e(e)}/todos`,{description:t})}async function Di(e,t,n){return P(`api/projects/${$e(e)}/todos/${$e(t)}`,n)}async function Oi(e,t){await L(`api/projects/${$e(e)}/todos/${$e(t)}`)}var ki={Ready:[{label:`Plan`,target:`Plan`},{label:`Build`,target:`Build`}],Plan:[{label:`Build`,target:`Build`}],Build:[{label:`Test`,target:`Test`},{label:`Review`,target:`Review`}],Test:[{label:`Review`,target:`Review`}],Review:[{label:`Done`,target:`Done`}],Done:[]};function Ai({todo:e,projectId:t,onUpdate:n,onEdit:r,onAction:i,onThreadSelect:a}){let[o,s]=(0,Z.useState)(!1),c=ki[e.status]??[];function l(t){t.stopPropagation(),e.threadId&&a&&a(e.threadId)}async function u(r,a){r.stopPropagation(),s(!0);try{i?await i(e,a):n(await Di(t,e.id,{status:a,working:a!==`Done`}))}finally{s(!1)}}return(0,$.jsxs)(`div`,{className:J(`rounded-lg border bg-card p-3 shadow-sm space-y-2 cursor-pointer hover:bg-accent/50 transition-colors`,e.working&&`border-primary/50 bg-primary/5`),onClick:t=>{t.stopPropagation(),r(e)},children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium leading-tight`,children:e.title}),e.working&&(0,$.jsx)(re,{className:`h-3 w-3 animate-spin text-primary shrink-0`})]}),(c.length>0||e.status!==`Ready`&&e.threadId&&a)&&(0,$.jsxs)(`div`,{className:`flex gap-1.5 flex-wrap items-center pt-1`,children:[c.map(t=>(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(G,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:e=>void u(e,t.target),disabled:o||e.working,children:t.label})}),(0,$.jsx)(fn,{side:`top`,children:e.status===`Ready`&&t.target===`Build`?`Implement this on a new branch of the project`:t.target===`Review`?`Review the code changes for this task`:t.target===`Done`?`Mark the task as done`:t.label})]},t.target)),e.status!==`Ready`&&e.threadId&&a&&(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(G,{size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0 group-hover:flex items-center justify-center`,onClick:l,children:[(0,$.jsx)(w,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Open thread`})]})}),(0,$.jsx)(fn,{side:`right`,children:`Open thread`})]})]})]})}var ji=`Please analyze this task and create a detailed implementation plan.
10
+
11
+ Task description:
12
+ {description}`,Mi="\nWrite your complete plan to the file `{todoId}-plan.md` in the current directory.",Ni=`Act as a Quality Assurance Manager. Rephrase the task into a rigorous test case: {description}`,Pi=`Code review: The systematic examination of code to find mistakes, ensure it follows best practices, and identify areas for improvement
13
+ Directions:
14
+ Carefully read through the list of code changes creating a todo list of code to review.
15
+ Analyze the code structure, variable names, functions, and logic flow
16
+ Look for any syntax errors, bugs, or inefficiencies
17
+ Consider best practices for the specific programming language used
18
+ Provide clear and constructive feedback on areas that could be improved
19
+ If applicable, include examples of how to refactor problematic code
20
+ Offer praise for portions of the code that are well-written and follow best practices
21
+
22
+ Task description:
23
+ {description}`,Fi={plan:ji,test:Ni,review:Pi},Ii={plan:`planPrompt`,test:`testPrompt`,review:`reviewPrompt`};function Li(e,t){let n=e?.[Ii[t]];return n&&n.trim()?n:Fi[t]}function Ri(e,t,n,r){let i=e.replace(/\{description\}/g,r);return t===`plan`&&(i+=Mi.replace(/\{todoId\}/g,n)),i}var zi=[`Ready`,`Plan`,`Build`,`Test`,`Review`,`Done`],Bi={Ready:`border-t-slate-400`,Plan:`border-t-blue-400`,Build:`border-t-orange-400`,Test:`border-t-yellow-400`,Review:`border-t-purple-400`,Done:`border-t-green-400`};async function Vi(e,t){let n=e.getReader(),r=new TextDecoder,i=``,a=null;try{for(;;){let{done:e,value:o}=await n.read();if(e)break;i+=r.decode(o,{stream:!0});let s=i.split(`
24
+ `);i=s.pop()??``;for(let e of s){let n=e.trim();if(n)try{let e=JSON.parse(n);e.type===`progress`&&typeof e.threadId==`string`&&!a&&(a=e.threadId,t(a))}catch{}}}}catch{}return a}async function Hi(e){let t=e.getReader();try{for(;;){let{done:e}=await t.read();if(e)break}}catch{}}async function Ui(e){let t=e.getReader(),n=new TextDecoder,r=``,i=``;try{for(;;){let{done:e,value:a}=await t.read();if(e)break;r+=n.decode(a,{stream:!0});let o=r.split(`
25
+ `);r=o.pop()??``;for(let e of o){let t=e.trim();if(t)try{let e=JSON.parse(t);e.type===`token`&&e.content?i+=e.content:e.type===`result`&&e.content&&(i=e.content)}catch{}}}}catch{}return i}function Wi({projectId:e,addOpen:t,onAddOpenChange:n,onThreadSelect:r}){let{state:i,dispatch:o}=en(),[s,c]=(0,Z.useState)([]),[l,u]=(0,Z.useState)(!0),[d,f]=(0,Z.useState)(null),[m,g]=(0,Z.useState)(``),[v,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(!1),N=(0,Z.useCallback)(async()=>{try{let t=await Ti(e),n=t.filter(e=>e.threadId&&e.status!==`Done`),r=[...t];await Promise.all(n.map(async t=>{try{await Ze(t.threadId)}catch(n){if(n instanceof Error&&n.message.includes(`not found`)){let n=await Di(e,t.id,{status:`Done`}),i=r.findIndex(e=>e.id===t.id);i!==-1&&(r[i]=n);return}}})),c(r)}catch(e){console.error(`Failed to fetch project todos:`,e)}finally{u(!1)}},[e]);(0,Z.useEffect)(()=>{N()},[N]),(0,Z.useEffect)(()=>{if(!s.some(e=>e.working))return;let t=setInterval(async()=>{try{let n=await Ti(e);c(n),n.some(e=>e.working)||clearInterval(t)}catch(e){console.error(`Failed to poll project todos:`,e)}},2e3);return()=>clearInterval(t)},[s,e]),(0,Z.useEffect)(()=>{t&&g(``)},[t]);function P(e){g(e.description),f({todo:e})}function F(){f(null),g(``)}async function I(){if(m.trim()){b(!0);try{let t=await Ei(e,m);c(e=>[...e,t]),n(!1),g(``)}finally{b(!1)}}}async function L(){if(!(!m.trim()||!d)){b(!0);try{let t=await Di(e,d.todo.id,{description:m});c(e=>e.map(e=>e.id===t.id?t:e)),F()}finally{b(!1)}}}async function z(){if(d){b(!0);try{await Oi(e,d.todo.id),c(e=>e.filter(e=>e.id!==d.todo.id)),F()}finally{b(!1)}}}function B(e){c(t=>t.map(t=>t.id===e.id?e:t))}async function ee(t){let n=i.selectedThreadId?i.projectModelSelections[i.selectedThreadId]:void 0,r=i.projects.find(t=>t.projectId===e),a=r?.threads.find(e=>e.threadId===i.selectedThreadId),s=n?.id??a?.model,c=n?.provider??a?.modelProvider;if(!s||!c)throw console.error(`No model or provider found for project`,e,a),Error(`No model configuration found. Please configure a model and provider for this project first.`);let l=await R(e);if(!l)return;let u=null,d=await Vi(l,n=>{Di(e,t.id,{status:`Plan`,working:!0,threadId:n}).then(e=>{u=e,B(e)})});if(!d)return;u||B(await Di(e,t.id,{status:`Plan`,working:!0,threadId:d}));let f=n??{id:s,provider:c,name:s,description:``};o({type:Y.SetProjectModel,threadId:d,model:f}),p(d,{model:s,modelProvider:c});let m=await Ie(d,Ri(Li(r,`plan`),`plan`,t.id,t.description),s,[],void 0,c);m&&Hi(m)}async function V(t){let n=await R(e);if(!n)return;let r=null,i=await Vi(n,n=>{Di(e,t.id,{status:`Build`,working:!0,threadId:n}).then(e=>{r=e,B(e)})});if(!i)return;r||B(await Di(e,t.id,{status:`Build`,working:!0,threadId:i}));let s=await Ze(i),c=s.model,l=s.modelProvider;if(!c||!l)try{let t=(await a(`api/threads?projectId=${encodeURIComponent(e)}`)||[]).map(e=>{let t=e;return{threadId:t.threadId??t.id,model:t.model??void 0,modelProvider:t.modelProvider??void 0}}).find(e=>e.model&&e.modelProvider);t&&(c=t.model,l=t.modelProvider)}catch(e){console.error(`Failed to get project threads:`,e)}if(!c||!l)throw Error(`No model configuration found. Please configure a model and provider for this project first.`);o({type:Y.SetProjectModel,threadId:i,model:{id:c,provider:l,name:c,description:``}}),p(i,{model:c,modelProvider:l}),console.log(`Sending chat message with provider:`,i,t.description,l);let u=await Ie(i,t.description,c,[],void 0,l);u&&Hi(u)}async function te(t){try{let n=await R(e);if(!n){S(!1),w(null);return}let r=null;if(r=await Vi(n,e=>{r=e}),!r){S(!1),w(null);return}let o=await Ze(r),s=o.model,c=o.modelProvider;if(!s||!c)try{let t=(await a(`api/threads?projectId=${encodeURIComponent(e)}`)||[]).map(e=>{let t=e;return{model:t.model??void 0,modelProvider:t.modelProvider??void 0}}).find(e=>e.model&&e.modelProvider);t&&(s=t.model,c=t.modelProvider)}catch(e){console.error(`Failed to get project threads:`,e)}if(!s||!c){y(e,r),S(!1),w(null);return}let l=Ri(Li(i.projects.find(t=>t.projectId===e),`test`),`test`,t.id,t.description),u=await Ie(r,l,s,[],void 0,c);u&&D(await Ui(u)),y(e,r)}catch(e){console.error(`Failed to generate test case:`,e),S(!1),w(null)}finally{A(!1)}}function H(e){w(e),D(``),A(!0),S(!0),te(e)}function U(){S(!1),w(null),D(``)}async function W(){if(!C||!E.trim())return;let t=C,n=E;U(),M(!0);try{let r=await R(e);if(!r)return;let i=null,s=await Vi(r,n=>{Di(e,t.id,{status:`Test`,working:!0,threadId:n}).then(e=>{i=e,B(e)})});if(!s)return;i||B(await Di(e,t.id,{status:`Test`,working:!0,threadId:s}));let c=await Ze(s),l=c.model,u=c.modelProvider;if(!l||!u)try{let t=(await a(`api/threads?projectId=${encodeURIComponent(e)}`)||[]).map(e=>{let t=e;return{model:t.model??void 0,modelProvider:t.modelProvider??void 0}}).find(e=>e.model&&e.modelProvider);t&&(l=t.model,u=t.modelProvider)}catch(e){console.error(`Failed to get project threads:`,e)}if(!l||!u)throw Error(`No model configuration found. Please configure a model and provider for this project first.`);o({type:Y.SetProjectModel,threadId:s,model:{id:l,provider:u,name:l,description:``}}),p(s,{model:l,modelProvider:u});let d=await Ie(s,n,l,[],void 0,u);d&&Hi(d)}finally{M(!1)}}async function ne(t){let n=await R(e);if(!n)return;let r=null,s=await Vi(n,n=>{Di(e,t.id,{status:`Review`,working:!0,threadId:n}).then(e=>{r=e,B(e)})});if(!s)return;r||B(await Di(e,t.id,{status:`Review`,working:!0,threadId:s}));let c=await Ze(s),l=c.model,u=c.modelProvider;if(!l||!u)try{let t=(await a(`api/threads?projectId=${encodeURIComponent(e)}`)||[]).map(e=>{let t=e;return{threadId:t.threadId??t.id,model:t.model??void 0,modelProvider:t.modelProvider??void 0}}).find(e=>e.model&&e.modelProvider);t&&(l=t.model,u=t.modelProvider)}catch(e){console.error(`Failed to get project threads:`,e)}if(!l||!u)throw Error(`No model configuration found. Please configure a model and provider for this project first.`);o({type:Y.SetProjectModel,threadId:s,model:{id:l,provider:u,name:l,description:``}}),p(s,{model:l,modelProvider:u});let d=await Ie(s,Ri(Li(i.projects.find(t=>t.projectId===e),`review`),`review`,t.id,t.description),l,[],void 0,u);d&&Hi(d)}async function ie(t,n){n===`Plan`?await ee(t):n===`Build`?await V(t):n===`Test`?H(t):n===`Review`?await ne(t):B(await Di(e,t.id,{status:n,working:n!==`Done`}))}return l?(0,$.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,$.jsx)(re,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):(0,$.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,$.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-8 flex-1 min-h-0`,children:zi.map(t=>{let i=s.filter(e=>e.status===t),a=t===`Ready`;return(0,$.jsxs)(`div`,{className:J(`flex flex-col rounded-lg border border-t-4 bg-muted/30 min-w-[200px] w-[200px] shrink-0`,Bi[t]),children:[(0,$.jsxs)(`div`,{className:`px-3 py-2 flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:t}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground bg-muted rounded-full px-1.5 py-0.5`,children:i.length})]}),(0,$.jsx)(h,{className:`flex-1 px-2 pb-2`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[a&&(0,$.jsxs)(G,{variant:`outline`,size:`sm`,className:`w-full h-8 border-dashed text-muted-foreground hover:text-foreground`,onClick:()=>n(!0),children:[(0,$.jsx)(Te,{className:`h-3 w-3 mr-1`}),`Add Task`]}),i.map(t=>(0,$.jsx)(Ai,{todo:t,projectId:e,onUpdate:B,onEdit:P,onAction:ie,onThreadSelect:r},t.id))]})})]},t)})}),(0,$.jsx)(_,{open:t,onOpenChange:n,children:(0,$.jsxs)(O,{className:`sm:max-w-2xl`,children:[(0,$.jsx)(q,{children:(0,$.jsx)(K,{children:`Add Task`})}),(0,$.jsxs)(`div`,{className:`py-2`,children:[(0,$.jsx)(dn,{placeholder:`Describe what needs to be done...`,value:m,onChange:e=>g(e.target.value),rows:12,className:`resize-none text-sm`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&I()}}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1.5`,children:`A title will be generated automatically from your description.`})]}),(0,$.jsx)(T,{children:(0,$.jsx)(G,{onClick:()=>void I(),disabled:v||!m.trim(),children:v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{className:`h-3 w-3 animate-spin mr-1`}),`Generating title...`]}):`Add`})})]})}),(0,$.jsx)(_,{open:x,onOpenChange:e=>!e&&U(),children:(0,$.jsxs)(O,{className:`sm:max-w-2xl`,children:[(0,$.jsx)(q,{children:(0,$.jsx)(K,{children:`Test Case`})}),(0,$.jsx)(`div`,{className:`py-2`,children:k?(0,$.jsxs)(`div`,{className:`flex items-center justify-center h-32 gap-2 text-muted-foreground`,children:[(0,$.jsx)(re,{className:`h-4 w-4 animate-spin`}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Generating test case...`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dn,{value:E,onChange:e=>D(e.target.value),rows:12,className:`resize-none text-sm`,autoFocus:!0}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1.5`,children:`Review or edit the test case before confirming.`})]})}),(0,$.jsxs)(T,{children:[(0,$.jsx)(G,{variant:`outline`,onClick:U,disabled:k,children:`Cancel`}),(0,$.jsx)(G,{onClick:()=>void W(),disabled:k||!E.trim()||j,children:j?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{className:`h-3 w-3 animate-spin mr-1`}),`Starting...`]}):`Confirm`})]})]})}),(0,$.jsx)(_,{open:d!==null,onOpenChange:e=>!e&&F(),children:(0,$.jsxs)(O,{className:`sm:max-w-2xl`,children:[(0,$.jsx)(q,{children:(0,$.jsx)(K,{children:`Edit Task`})}),(0,$.jsx)(`div`,{className:`py-2`,children:(0,$.jsx)(dn,{placeholder:`Describe what needs to be done...`,value:m,onChange:e=>g(e.target.value),rows:12,className:`resize-none text-sm`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&L()}})}),(0,$.jsxs)(T,{className:`gap-2 sm:gap-0`,children:[(0,$.jsx)(G,{variant:`destructive`,onClick:()=>void z(),disabled:v,className:`mr-auto`,children:`Delete`}),(0,$.jsx)(G,{onClick:()=>void L(),disabled:v||!m.trim(),children:v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{className:`h-3 w-3 animate-spin mr-1`}),`Saving...`]}):`Save`})]})]})})]})}var Gi=[{value:`plan`,label:`Plan`,field:`planPrompt`,defaultPrompt:ji},{value:`review`,label:`Code Review`,field:`reviewPrompt`,defaultPrompt:Pi},{value:`test`,label:`Test`,field:`testPrompt`,defaultPrompt:Ni}];function Ki({open:e,onOpenChange:t,projectId:n}){let{state:r}=en(),[i,a]=(0,Z.useState)({plan:``,review:``,test:``}),[o,s]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{if(!e)return;let t=r.projects.find(e=>e.projectId===n);a({plan:t?.planPrompt??``,review:t?.reviewPrompt??``,test:t?.testPrompt??``})},[e,n,r.projects]);async function c(){s(!0);try{await kt(n,{planPrompt:i.plan.trim()===ji?null:i.plan.trim()||null,testPrompt:i.test.trim()===Ni?null:i.test.trim()||null,reviewPrompt:i.review.trim()===Pi?null:i.review.trim()||null}),E(),X({title:`AI prompt settings saved`}),t(!1)}catch(e){X({title:`Error`,description:e instanceof Error?e.message:`Failed to save prompt settings`,variant:`destructive`})}finally{s(!1)}}function l(e,t){a(n=>({...n,[e]:t}))}return(0,$.jsx)(_,{open:e,onOpenChange:t,children:(0,$.jsxs)(O,{className:`max-w-2xl`,children:[(0,$.jsxs)(q,{children:[(0,$.jsx)(K,{children:`AI Prompt Settings`}),(0,$.jsx)(pt,{children:`Customize the prompts used when running Plan, Code Review, and Test actions from the task board. Leave empty to use the default prompt.`})]}),(0,$.jsxs)(nr,{defaultValue:`plan`,className:`w-full`,children:[(0,$.jsx)(tr,{className:`w-full`,children:Gi.map(e=>(0,$.jsx)($n,{value:e.value,className:`flex-1`,children:e.label},e.value))}),Gi.map(e=>(0,$.jsxs)(er,{value:e.value,children:[(0,$.jsx)(dn,{value:i[e.value]||e.defaultPrompt,onChange:t=>l(e.value,t.target.value),className:`min-h-[250px] font-mono text-sm resize-none`,placeholder:e.defaultPrompt,disabled:o}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1.5`,children:[`Use `,(0,$.jsx)(`code`,{className:`text-xs`,children:`{description}`}),` for the task description. Leave empty to use the default.`]})]},e.value))]}),(0,$.jsx)(T,{children:(0,$.jsx)(G,{onClick:()=>void c(),disabled:o,children:o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})})]})})}function qi({projectId:e}){let{state:t,dispatch:n}=en(),{projects:r}=t,[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=$t(),{setActiveMainTab:l}=Gn();async function u(i){if(r.find(t=>t.projectId===e)){c(`/`),l(`chat`);try{let{getProjects:r,invalidateProjectsCache:a}=await Qt(async()=>{let{getProjects:e,invalidateProjectsCache:t}=await import(`./dialogs-config-vkfELnGl.js`).then(e=>e.S);return{getProjects:e,invalidateProjectsCache:t}},__vite__mapDeps([4,1]));a();let o=await r();n({type:Y.SetProjects,projects:o.projects});let s=o.projects.find(t=>t.projectId===e);if(s&&s.threads.find(e=>e.threadId===i)){(t.selectedThreadId!==i||t.selectedProjectId!==e)&&n({type:Y.SelectThread,threadId:i,projectId:e});try{let e=await At();n({type:Y.SetProcessingThreads,threadIds:e})}catch(e){console.error(`Failed to fetch processing threads after thread selection:`,e)}}}catch(r){console.error(`Failed to refresh projects for thread selection:`,r),(t.selectedThreadId!==i||t.selectedProjectId!==e)&&n({type:Y.SelectThread,threadId:i,projectId:e});try{let e=await At();n({type:Y.SetProcessingThreads,threadIds:e})}catch(e){console.error(`Failed to fetch processing threads after fallback thread selection:`,e)}}}}return(0,$.jsxs)(`div`,{className:`relative flex h-full flex-col overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`flex-1 overflow-hidden pt-8 pl-4`,children:(0,$.jsx)(Wi,{projectId:e,addOpen:i,onAddOpenChange:a,onThreadSelect:u})}),(0,$.jsx)(G,{variant:`outline`,size:`icon`,className:`absolute bottom-8 right-4`,onClick:()=>s(!0),children:(0,$.jsx)(je,{className:`h-4 w-4`})}),(0,$.jsx)(Ki,{open:o,onOpenChange:s,projectId:e})]})}var Ji=(0,Z.lazy)(()=>Qt(()=>import(`./diff-view-CjbcDB6m.js`),__vite__mapDeps([8,1,2,3,4,5,9,10,11,7,12,13,14,15,16,17,18,19,6]))),Yi=(0,Z.lazy)(()=>Qt(()=>import(`./dialogs-config-vkfELnGl.js`).then(e=>e.t),__vite__mapDeps([4,1])));function Xi(e){let t=(0,Q.c)(54),{onCreateThread:n}=e,{state:r,dispatch:i}=en(),a=$t(),o=Xt(),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),{selectedThreadId:d,messages:f,isCreatingProject:p,processingThreadIds:m,projects:h,projectsLoading:g,messagesLoaded:_,isStreaming:v,streamingSegments:y,streamingModel:b,streamingEventCount:x}=r,S;t[0]!==m||t[1]!==d?(S=d&&m.includes(d),t[0]=m,t[1]=d,t[2]=S):S=t[2];let C=!!S,w;t[3]!==i||t[4]!==r.sidebarOpen?(w=()=>{r.sidebarOpen&&i({type:Y.ToggleSidebar})},t[3]=i,t[4]=r.sidebarOpen,t[5]=w):w=t[5];let T=w,E;t[6]===T?E=t[7]:(E=()=>{T(),u(`clone`),c(!0)},t[6]=T,t[7]=E);let D=E,O;t[8]===T?O=t[9]:(O=()=>{T(),u(`webapp`),c(!0)},t[8]=T,t[9]=O);let k=O,A;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=async(e,t)=>{try{await Je(e,t),c(!1),u(null)}catch(e){console.error(`Failed to clone repository:`,e)}},t[10]=A):A=t[10];let j=A,M;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(M=async(e,t,n)=>{try{await N(e,t,n),c(!1),u(null)}catch(e){console.error(`Failed to create project:`,e)}},t[11]=M):M=t[11];let P=M,F;t[12]===T?F=t[13]:(F=async()=>{T();try{await _e(),c(!1),u(null)}catch(e){console.error(`Failed to open folder:`,e)}},t[12]=T,t[13]=F);let I=F,L=o.pathname===`/review`,R=o.pathname===`/todos`,z;t[14]===a?z=t[15]:(z=()=>{a(`/`)},t[14]=a,t[15]=z);let B=z,{selectedProjectId:ee}=r,V;t[16]!==T||t[17]!==i||t[18]!==D||t[19]!==B||t[20]!==k||t[21]!==I||t[22]!==p||t[23]!==C||t[24]!==v||t[25]!==f||t[26]!==_||t[27]!==n||t[28]!==h||t[29]!==g||t[30]!==L||t[31]!==ee||t[32]!==d||t[33]!==x||t[34]!==b||t[35]!==y||t[36]!==R?(V=R&&ee?(0,$.jsx)(qi,{projectId:ee}):L&&d?(0,$.jsx)(Z.Suspense,{fallback:(0,$.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:`Loading diff view...`}),children:(0,$.jsx)(Ji,{threadId:d,onExit:B})}):(0,$.jsx)(wi,{messages:f,isStreaming:v,streamingSegments:y,streamingModel:b,streamingEventCount:x,isCreatingProject:p,isProcessingThread:C,selectedThreadId:d,selectedProjectId:ee,projects:h,projectsLoading:g,messagesLoaded:_,onSelectThread:(e,t)=>{T(),i({type:Y.SelectThread,projectId:e,threadId:t})},onCreateThread:n,onConnectRepo:D,onNewApp:k,onOpenFolder:I,error:null,onClearError:Zi}),t[16]=T,t[17]=i,t[18]=D,t[19]=B,t[20]=k,t[21]=I,t[22]=p,t[23]=C,t[24]=v,t[25]=f,t[26]=_,t[27]=n,t[28]=h,t[29]=g,t[30]=L,t[31]=ee,t[32]=d,t[33]=x,t[34]=b,t[35]=y,t[36]=R,t[37]=V):V=t[37];let te;t[38]!==f||t[39]!==L||t[40]!==d||t[41]!==R?(te=!L&&!R&&d&&(0,$.jsxs)(`div`,{className:`absolute bottom-0 left-0 right-0 z-10 pr-4`,children:[(0,$.jsx)(`div`,{className:`h-6 bg-gradient-to-t from-background to-transparent`}),(0,$.jsx)(`div`,{className:`h-8 bg-background`}),(0,$.jsx)(`div`,{className:`bg-background`,children:(0,$.jsx)(jn,{messages:f})})]}),t[38]=f,t[39]=L,t[40]=d,t[41]=R,t[42]=te):te=t[42];let H=l??void 0,U;t[43]!==s||t[44]!==I||t[45]!==H?(U=(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Yi,{open:s,onOpenChange:c,initialMode:H,onSubmitClone:j,onSubmitWebApp:P,onOpenFolder:I})}),t[43]=s,t[44]=I,t[45]=H,t[46]=U):U=t[46];let W;t[47]!==te||t[48]!==U||t[49]!==V?(W=(0,$.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[V,te,U]}),t[47]=te,t[48]=U,t[49]=V,t[50]=W):W=t[50];let ne;return t[51]!==d||t[52]!==W?(ne=(0,$.jsx)(Sn,{threadId:d,children:W}),t[51]=d,t[52]=W,t[53]=ne):ne=t[53],ne}function Zi(){}var Qi=`VS Code`,$i={"VS Code":`vscode`,Antigravity:`antigravity`,Cursor:`cursor`,"Devin Desktop":`devin`,Windsurf:`windsurf`,Xcode:`xcode`,"Android Studio":`android-studio`,Kiro:`kiro`,Terminal:`terminal`};function ea({projectId:e,threadId:t,openWith:n}){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)(n??Qi),[u,d]=(0,Z.useState)(!0);(0,Z.useEffect)(()=>{(async()=>{try{let e=await gt();s(e),!c&&e.length>0&&l(e[0])}catch(e){console.error(`Failed to fetch available programs:`,e),s([Qi])}finally{d(!1)}})()},[]),(0,Z.useEffect)(()=>{n&&o.includes(n)&&l(n)},[n,o,l]);let p=async n=>{try{a(!0),l(n),await f(e,n),t?await r(t,n):await V(e,n),X({title:`Success`,description:`Opened project in ${n}`})}catch(e){console.error(`Failed to open project in ${n}:`,e);let t=`Failed to open project in ${n}`;if(e instanceof Error){let n=e;t=n.details?n.details:e.message}X({title:`Error`,description:t,variant:`destructive`})}finally{a(!1)}};return u?(0,$.jsx)(G,{variant:`outline`,size:`sm`,className:`h-8`,disabled:!0,children:(0,$.jsx)(`div`,{className:`h-4 w-4 animate-pulse bg-muted rounded`})}):(0,$.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,$.jsx)(G,{variant:`outline`,size:`sm`,className:`h-8 rounded-r-none border-r-0 border-transparent`,disabled:i,onClick:async()=>{await p(c)},title:`Open in ${c}`,children:(0,$.jsx)(`img`,{src:`/ide/${$i[c]||$i[Qi]}.svg`,alt:c,className:`h-4 w-4`})}),(0,$.jsxs)(kn,{children:[(0,$.jsx)(Mn,{asChild:!0,children:(0,$.jsx)(G,{variant:`outline`,size:`sm`,className:`h-8 w-8 rounded-l-none px-1 border-transparent`,disabled:i,children:(0,$.jsx)(xt,{className:`h-3.5 w-3.5`})})}),(0,$.jsx)(Cn,{align:`end`,children:o.map(e=>(0,$.jsxs)(_n,{onClick:()=>p(e),disabled:i,className:`flex items-center gap-2`,children:[(0,$.jsx)(`img`,{src:`/ide/${$i[e]||$i[Qi]}.svg`,alt:e,className:`h-4 w-4`}),e]},e))})]})]})}function ta(e,t){return t?`Creating PR...`:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function na(e,t){return t?(0,$.jsx)(re,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,$.jsx)(wt,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,$.jsx)(te,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,$.jsx)(w,{className:`h-3.5 w-3.5`}):(0,$.jsx)(S,{className:`h-3.5 w-3.5`})}function ra(e){if(e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits){let t=e.defaultBranch??`main`;return e.currentBranch===e.defaultBranch?`Your branch is behind the remote. This will pull the latest changes from origin/${t}`:`Your branch "${e.currentBranch}" is behind "${t}". This will rebase and sync with the latest changes`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function ia(e,t,n=!1){return t||n?!0:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function aa(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}function oa(e){let t=(0,Q.c)(79),{branchStatus:n,remoteUrl:r,hasRemoteBranch:i,hasUnpushedCommits:a,canCreateRepo:o,repoUrl:s,isRefreshing:c,isBrandState:l,gitUser:u,isDirectCommitMode:d,isLoading:f,isLoadingHistory:p,onFetch:h,onPull:g,onPush:_,onOpenHistory:v,onCreatePR:y,onCreateRepo:b,onViewInGitHub:x}=e,C=`h-8 w-8 rounded-l-none px-1 border-transparent${l?` bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,T;t[0]===c?T=t[1]:(T=c?(0,$.jsx)(re,{className:`h-3.5 w-3.5 animate-spin`}):(0,$.jsx)(xt,{className:`h-3.5 w-3.5`}),t[0]=c,t[1]=T);let E;t[2]!==f||t[3]!==C||t[4]!==T?(E=(0,$.jsx)(Mn,{asChild:!0,children:(0,$.jsx)(G,{variant:`outline`,size:`sm`,className:C,disabled:f,children:T})}),t[2]=f,t[3]=C,t[4]=T,t[5]=E):E=t[5];let D;t[6]!==n||t[7]!==r?(D=n===`Behind`&&(0,$.jsxs)(`div`,{className:`px-2 py-1 text-xs text-amber-600`,children:[`Branch is behind `,r?`origin`:`remote`]}),t[6]=n,t[7]=r,t[8]=D):D=t[8];let O;t[9]===u?O=t[10]:(O=u&&(0,$.jsxs)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,u]}),t[9]=u,t[10]=O);let k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Dn,{}),t[11]=k):k=t[11];let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(pe,{className:`h-3.5 w-3.5 mr-2`}),t[12]=A):A=t[12];let j;t[13]!==f||t[14]!==h?(j=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(_n,{onClick:h,disabled:f,children:[A,`Fetch`]})}),t[13]=f,t[14]=h,t[15]=j):j=t[15];let M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(fn,{side:`right`,children:`Download latest information from remote without merging changes`}),t[16]=M):M=t[16];let N;t[17]===j?N=t[18]:(N=(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[j,M]})}),t[17]=j,t[18]=N);let P;t[19]!==i||t[20]!==f||t[21]!==g?(P=()=>{i&&!f&&g()},t[19]=i,t[20]=f,t[21]=g,t[22]=P):P=t[22];let F=!i||f?`opacity-50 cursor-not-allowed`:``,I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(wt,{className:`h-3.5 w-3.5 mr-2`}),t[23]=I):I=t[23];let L;t[24]!==P||t[25]!==F?(L=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(_n,{onClick:P,className:F,children:[I,`Pull`]})}),t[24]=P,t[25]=F,t[26]=L):L=t[26];let R=i?`Pull latest changes from remote`:`No remote branch to pull from`,z;t[27]===R?z=t[28]:(z=(0,$.jsx)(fn,{side:`right`,children:R}),t[27]=R,t[28]=z);let B;t[29]!==L||t[30]!==z?(B=(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[L,z]})}),t[29]=L,t[30]=z,t[31]=B):B=t[31];let ee;t[32]!==i||t[33]!==f||t[34]!==_?(ee=!i&&(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(_n,{onClick:_,disabled:f,children:[(0,$.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,$.jsx)(fn,{side:`right`,children:`Create remote branch and push local commits`})]})}),t[32]=i,t[33]=f,t[34]=_,t[35]=ee):ee=t[35];let V;t[36]!==a||t[37]!==f||t[38]!==_?(V=()=>{a&&!f&&_()},t[36]=a,t[37]=f,t[38]=_,t[39]=V):V=t[39];let te=!a||f?`opacity-50 cursor-not-allowed`:``,H;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),t[40]=H):H=t[40];let U;t[41]!==V||t[42]!==te?(U=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(_n,{onClick:V,className:te,children:[H,`Push Commits`]})}),t[41]=V,t[42]=te,t[43]=U):U=t[43];let W=a?f?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,ne;t[44]===W?ne=t[45]:(ne=(0,$.jsx)(fn,{side:`right`,children:W}),t[44]=W,t[45]=ne);let ie;t[46]!==U||t[47]!==ne?(ie=(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[U,ne]})}),t[46]=U,t[47]=ne,t[48]=ie):ie=t[48];let ae=f||p,oe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(Ye,{className:`h-3.5 w-3.5 mr-2`}),t[49]=oe):oe=t[49];let se;t[50]!==v||t[51]!==ae?(se=(0,$.jsxs)(_n,{onClick:v,disabled:ae,children:[oe,`History`]}),t[50]=v,t[51]=ae,t[52]=se):se=t[52];let le;t[53]!==d||t[54]!==f||t[55]!==y?(le=!d&&(0,$.jsxs)(_n,{onClick:y,disabled:f,children:[(0,$.jsx)(S,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),t[53]=d,t[54]=f,t[55]=y,t[56]=le):le=t[56];let ue;t[57]!==o||t[58]!==f||t[59]!==b?(ue=o&&(0,$.jsxs)(_n,{onClick:b,disabled:f,children:[(0,$.jsx)(m,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),t[57]=o,t[58]=f,t[59]=b,t[60]=ue):ue=t[60];let de;t[61]!==f||t[62]!==x||t[63]!==s?(de=s&&(0,$.jsxs)(_n,{onClick:x,disabled:f,children:[(0,$.jsx)(w,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),t[61]=f,t[62]=x,t[63]=s,t[64]=de):de=t[64];let K;t[65]!==N||t[66]!==B||t[67]!==ee||t[68]!==ie||t[69]!==se||t[70]!==le||t[71]!==ue||t[72]!==de||t[73]!==D||t[74]!==O?(K=(0,$.jsxs)(Cn,{align:`end`,children:[D,O,k,N,B,ee,ie,se,le,ue,de]}),t[65]=N,t[66]=B,t[67]=ee,t[68]=ie,t[69]=se,t[70]=le,t[71]=ue,t[72]=de,t[73]=D,t[74]=O,t[75]=K):K=t[75];let fe;return t[76]!==E||t[77]!==K?(fe=(0,$.jsxs)(kn,{children:[E,K]}),t[76]=E,t[77]=K,t[78]=fe):fe=t[78],fe}function sa(){return{autoGenerateCommitMessage:Ne(),autoGeneratePRInfo:dt(),privateRepositoryDefault:Ve()}}function ca(e){e.autoGenerateCommitMessage!==void 0&&ve(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&Ct(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&jt(e.privateRepositoryDefault)}function la(e){return e?!0:(X({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function ua(e){let t=(0,Q.c)(57),{open:n,onOpenChange:r,commitMessage:i,onCommitMessageChange:a,autoGenerateCommitMessage:o,onAutoGenerateChange:s,isGeneratingMessage:c,isLoading:l,onGenerateMessage:u,onCommit:d,currentBranch:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(K,{children:`Commit Changes`}),t[0]=p):p=t[0];let m;t[1]===f?m=t[2]:(m=(0,$.jsxs)(q,{children:[p,(0,$.jsxs)(pt,{children:[`Enter a commit message for your changes on branch `,f]})]}),t[1]=f,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(H,{htmlFor:`commit-message`,children:`Commit Message`}),t[3]=h):h=t[3];let g;t[4]===a?g=t[5]:(g=e=>a(e.target.value),t[4]=a,t[5]=g);let v;t[6]!==i||t[7]!==g?(v=(0,$.jsx)(dn,{id:`commit-message`,placeholder:`Enter commit message...`,value:i,onChange:g,rows:4,className:`pr-10`}),t[6]=i,t[7]=g,t[8]=v):v=t[8];let y=c||l,b;t[9]===c?b=t[10]:(b=c?(0,$.jsx)(re,{className:`h-3.5 w-3.5 animate-spin`}):(0,$.jsx)(ee,{className:`h-3.5 w-3.5`}),t[9]=c,t[10]=b);let x;t[11]!==u||t[12]!==y||t[13]!==b?(x=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:u,disabled:y,children:b})}),t[11]=u,t[12]=y,t[13]=b,t[14]=x):x=t[14];let S=c?`Generating commit message...`:`Generate commit message with AI`,C;t[15]===S?C=t[16]:(C=(0,$.jsx)(fn,{children:S}),t[15]=S,t[16]=C);let w;t[17]!==C||t[18]!==x?(w=(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[x,C]})}),t[17]=C,t[18]=x,t[19]=w):w=t[19];let E;t[20]!==w||t[21]!==v?(E=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[h,(0,$.jsxs)(`div`,{className:`relative`,children:[v,w]})]}),t[20]=w,t[21]=v,t[22]=E):E=t[22];let D;t[23]===s?D=t[24]:(D=e=>s(e===!0),t[23]=s,t[24]=D);let k;t[25]!==o||t[26]!==D?(k=(0,$.jsx)(qn,{id:`auto-generate`,checked:o,onCheckedChange:D}),t[25]=o,t[26]=D,t[27]=k):k=t[27];let A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(H,{htmlFor:`auto-generate`,className:`text-sm font-normal`,children:`Auto generate commit messages`}),t[28]=A):A=t[28];let j;t[29]===k?j=t[30]:(j=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,A]}),t[29]=k,t[30]=j);let M;t[31]!==E||t[32]!==j?(M=(0,$.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[E,j]}),t[31]=E,t[32]=j,t[33]=M):M=t[33];let N;t[34]===r?N=t[35]:(N=()=>r(!1),t[34]=r,t[35]=N);let P;t[36]!==l||t[37]!==N?(P=(0,$.jsx)(G,{variant:`outline`,onClick:N,disabled:l,children:`Cancel`}),t[36]=l,t[37]=N,t[38]=P):P=t[38];let F;t[39]!==i||t[40]!==l?(F=l||!i.trim(),t[39]=i,t[40]=l,t[41]=F):F=t[41];let I=l?`Committing...`:`Commit`,L;t[42]!==d||t[43]!==F||t[44]!==I?(L=(0,$.jsx)(G,{onClick:d,disabled:F,children:I}),t[42]=d,t[43]=F,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==P||t[47]!==L?(R=(0,$.jsxs)(T,{children:[P,L]}),t[46]=P,t[47]=L,t[48]=R):R=t[48];let z;t[49]!==M||t[50]!==m||t[51]!==R?(z=(0,$.jsxs)(O,{children:[m,M,R]}),t[49]=M,t[50]=m,t[51]=R,t[52]=z):z=t[52];let B;return t[53]!==r||t[54]!==n||t[55]!==z?(B=(0,$.jsx)(_,{open:n,onOpenChange:r,children:z}),t[53]=r,t[54]=n,t[55]=z,t[56]=B):B=t[56],B}function da(e){let t=(0,Q.c)(62),{open:n,onOpenChange:r,prTitle:i,onPrTitleChange:a,prDescription:o,onPrDescriptionChange:s,isGeneratingPRInfo:l,isLoading:u,onGeneratePRInfo:d,onCreatePR:f,currentBranch:p,autoGeneratePRInfo:m,onAutoGeneratePRInfoChange:h}=e,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(K,{children:`Create Pull Request`}),t[0]=g):g=t[0];let v;t[1]===p?v=t[2]:(v=(0,$.jsxs)(q,{children:[g,(0,$.jsxs)(pt,{children:[`Create a pull request for branch `,p]})]}),t[1]=p,t[2]=v);let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(H,{htmlFor:`pr-title`,children:`Title (optional)`}),t[3]=y):y=t[3];let b=p||`Enter PR title...`,x;t[4]===a?x=t[5]:(x=e=>a(e.target.value),t[4]=a,t[5]=x);let S;t[6]!==i||t[7]!==b||t[8]!==x?(S=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[y,(0,$.jsx)(c,{id:`pr-title`,placeholder:b,value:i,onChange:x})]}),t[6]=i,t[7]=b,t[8]=x,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(H,{htmlFor:`pr-description`,children:`Description (optional)`}),t[10]=C):C=t[10];let w;t[11]===s?w=t[12]:(w=e=>s(e.target.value),t[11]=s,t[12]=w);let E;t[13]!==o||t[14]!==w?(E=(0,$.jsx)(dn,{id:`pr-description`,placeholder:`Enter PR description...`,value:o,onChange:w,rows:4,className:`pr-10`}),t[13]=o,t[14]=w,t[15]=E):E=t[15];let D=l||u,k;t[16]===l?k=t[17]:(k=l?(0,$.jsx)(re,{className:`h-3.5 w-3.5 animate-spin`}):(0,$.jsx)(ee,{className:`h-3.5 w-3.5`}),t[16]=l,t[17]=k);let A;t[18]!==d||t[19]!==D||t[20]!==k?(A=(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:d,disabled:D,children:k})}),t[18]=d,t[19]=D,t[20]=k,t[21]=A):A=t[21];let j=l?`Generating PR description...`:`Generate PR title and description with AI`,M;t[22]===j?M=t[23]:(M=(0,$.jsx)(fn,{children:j}),t[22]=j,t[23]=M);let N;t[24]!==A||t[25]!==M?(N=(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[A,M]})}),t[24]=A,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==N||t[28]!==E?(P=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[C,(0,$.jsxs)(`div`,{className:`relative`,children:[E,N]})]}),t[27]=N,t[28]=E,t[29]=P):P=t[29];let F;t[30]===h?F=t[31]:(F=e=>h(e===!0),t[30]=h,t[31]=F);let I;t[32]!==m||t[33]!==F?(I=(0,$.jsx)(qn,{id:`auto-generate-pr`,checked:m,onCheckedChange:F}),t[32]=m,t[33]=F,t[34]=I):I=t[34];let L;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(H,{htmlFor:`auto-generate-pr`,className:`text-sm font-normal`,children:`Auto generate PR title and description`}),t[35]=L):L=t[35];let R;t[36]===I?R=t[37]:(R=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[I,L]}),t[36]=I,t[37]=R);let z;t[38]!==P||t[39]!==R||t[40]!==S?(z=(0,$.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[S,P,R]}),t[38]=P,t[39]=R,t[40]=S,t[41]=z):z=t[41];let B;t[42]===r?B=t[43]:(B=()=>r(!1),t[42]=r,t[43]=B);let V;t[44]!==u||t[45]!==B?(V=(0,$.jsx)(G,{variant:`outline`,onClick:B,disabled:u,children:`Cancel`}),t[44]=u,t[45]=B,t[46]=V):V=t[46];let te=u?`Creating...`:`Create PR`,U;t[47]!==u||t[48]!==f||t[49]!==te?(U=(0,$.jsx)(G,{onClick:f,disabled:u,children:te}),t[47]=u,t[48]=f,t[49]=te,t[50]=U):U=t[50];let W;t[51]!==V||t[52]!==U?(W=(0,$.jsxs)(T,{children:[V,U]}),t[51]=V,t[52]=U,t[53]=W):W=t[53];let ne;t[54]!==v||t[55]!==z||t[56]!==W?(ne=(0,$.jsxs)(O,{children:[v,z,W]}),t[54]=v,t[55]=z,t[56]=W,t[57]=ne):ne=t[57];let ie;return t[58]!==r||t[59]!==n||t[60]!==ne?(ie=(0,$.jsx)(_,{open:n,onOpenChange:r,children:ne}),t[58]=r,t[59]=n,t[60]=ne,t[61]=ie):ie=t[61],ie}function fa(e){let t=(0,Q.c)(48),{open:n,onOpenChange:r,repoName:i,onRepoNameChange:a,repoDescription:o,onRepoDescriptionChange:s,isPrivateRepo:l,onPrivateRepoChange:u,isLoading:d,onCreateRepo:f}=e,p;t[0]!==r||t[1]!==s||t[2]!==a?(p=e=>{e||(a(``),s(``)),r(e)},t[0]=r,t[1]=s,t[2]=a,t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsxs)(q,{children:[(0,$.jsx)(K,{children:`Create GitHub Repository`}),(0,$.jsx)(pt,{children:`Create a new GitHub repository and push your local repository`})]}),t[4]=m):m=t[4];let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(H,{htmlFor:`repo-name`,children:`Repository Name (optional)`}),t[5]=h):h=t[5];let g;t[6]===a?g=t[7]:(g=e=>a(e.target.value),t[6]=a,t[7]=g);let v;t[8]!==i||t[9]!==g?(v=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[h,(0,$.jsx)(c,{id:`repo-name`,placeholder:`Leave empty to use current folder name`,value:i,onChange:g})]}),t[8]=i,t[9]=g,t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(H,{htmlFor:`repo-description`,children:`Description (optional)`}),t[11]=y):y=t[11];let b;t[12]===s?b=t[13]:(b=e=>s(e.target.value),t[12]=s,t[13]=b);let x;t[14]!==o||t[15]!==b?(x=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[y,(0,$.jsx)(dn,{id:`repo-description`,placeholder:`Enter repository description...`,value:o,onChange:b,rows:3})]}),t[14]=o,t[15]=b,t[16]=x):x=t[16];let S;t[17]===u?S=t[18]:(S=e=>u(e===!0),t[17]=u,t[18]=S);let C;t[19]!==l||t[20]!==S?(C=(0,$.jsx)(qn,{id:`repo-private`,checked:l,onCheckedChange:S}),t[19]=l,t[20]=S,t[21]=C):C=t[21];let w;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(H,{htmlFor:`repo-private`,className:`text-sm font-normal`,children:`Private repository`}),t[22]=w):w=t[22];let E;t[23]===C?E=t[24]:(E=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,w]}),t[23]=C,t[24]=E);let D;t[25]!==E||t[26]!==v||t[27]!==x?(D=(0,$.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[v,x,E]}),t[25]=E,t[26]=v,t[27]=x,t[28]=D):D=t[28];let k;t[29]===r?k=t[30]:(k=()=>r(!1),t[29]=r,t[30]=k);let A;t[31]!==d||t[32]!==k?(A=(0,$.jsx)(G,{variant:`outline`,onClick:k,disabled:d,children:`Cancel`}),t[31]=d,t[32]=k,t[33]=A):A=t[33];let j=d?`Creating...`:`Create & Push`,M;t[34]!==d||t[35]!==f||t[36]!==j?(M=(0,$.jsx)(G,{onClick:f,disabled:d,children:j}),t[34]=d,t[35]=f,t[36]=j,t[37]=M):M=t[37];let N;t[38]!==A||t[39]!==M?(N=(0,$.jsxs)(T,{children:[A,M]}),t[38]=A,t[39]=M,t[40]=N):N=t[40];let P;t[41]!==D||t[42]!==N?(P=(0,$.jsxs)(O,{children:[m,D,N]}),t[41]=D,t[42]=N,t[43]=P):P=t[43];let F;return t[44]!==n||t[45]!==p||t[46]!==P?(F=(0,$.jsx)(_,{open:n,onOpenChange:p,children:P}),t[44]=n,t[45]=p,t[46]=P,t[47]=F):F=t[47],F}function pa(e){let t=(0,Q.c)(28),{open:n,onOpenChange:r,commits:i,displayedCommits:a,isLoadingMore:o,onScroll:s,currentBranch:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(K,{children:`Commit History`}),t[0]=l):l=t[0];let u;t[1]===c?u=t[2]:(u=(0,$.jsxs)(q,{children:[l,(0,$.jsxs)(pt,{children:[`Recent commits on branch `,c]})]}),t[1]=c,t[2]=u);let d;t[3]===a?d=t[4]:(d=a.length>0?a.map(ma):(0,$.jsx)(`p`,{className:`text-sm text-slate-500 text-center py-8`,children:`No commits found`}),t[3]=a,t[4]=d);let f;t[5]===o?f=t[6]:(f=o&&(0,$.jsx)(`div`,{className:`p-3 text-center`,children:(0,$.jsx)(re,{className:`h-4 w-4 animate-spin inline`})}),t[5]=o,t[6]=f);let p;t[7]!==i.length||t[8]!==a.length||t[9]!==o?(p=a.length<i.length&&!o&&(0,$.jsx)(`div`,{className:`p-3 text-center text-xs text-slate-500`,children:`Scroll to load more`}),t[7]=i.length,t[8]=a.length,t[9]=o,t[10]=p):p=t[10];let m;t[11]!==d||t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(`div`,{className:`divide-y`,children:[d,f,p]}),t[11]=d,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==s||t[16]!==m?(h=(0,$.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:s,children:m}),t[15]=s,t[16]=m,t[17]=h):h=t[17];let g;t[18]===r?g=t[19]:(g=(0,$.jsx)(T,{children:(0,$.jsx)(G,{onClick:()=>r(!1),children:`Close`})}),t[18]=r,t[19]=g);let v;t[20]!==u||t[21]!==h||t[22]!==g?(v=(0,$.jsxs)(O,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[u,h,g]}),t[20]=u,t[21]=h,t[22]=g,t[23]=v):v=t[23];let y;return t[24]!==r||t[25]!==n||t[26]!==v?(y=(0,$.jsx)(_,{open:n,onOpenChange:r,children:v}),t[24]=r,t[25]=n,t[26]=v,t[27]=y):y=t[27],y}function ma(e){return(0,$.jsxs)(`div`,{className:`p-3 hover:bg-slate-50 dark:hover:bg-slate-900 transition-colors`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium break-words`,children:e.message}),(0,$.jsxs)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400 mt-1`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}function ha(e){let t=(0,Q.c)(15),{open:n,onOpenChange:r,isLoading:i,onPushAndCreatePR:a,onCancel:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)(q,{children:[(0,$.jsx)(K,{children:`Push Branch First`}),(0,$.jsx)(pt,{children:`Your branch needs to be pushed to the remote before creating a pull request. Would you like to push it now?`})]}),t[0]=s):s=t[0];let c;t[1]!==i||t[2]!==o?(c=(0,$.jsx)(G,{variant:`outline`,onClick:o,disabled:i,children:`Cancel`}),t[1]=i,t[2]=o,t[3]=c):c=t[3];let l=i?`Pushing...`:`Push & Create PR`,u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,$.jsx)(G,{onClick:a,disabled:i,children:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]!==c||t[9]!==u?(d=(0,$.jsxs)(O,{children:[s,(0,$.jsxs)(T,{children:[c,u]})]}),t[8]=c,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==r||t[12]!==n||t[13]!==d?(f=(0,$.jsx)(_,{open:n,onOpenChange:r,children:d}),t[11]=r,t[12]=n,t[13]=d,t[14]=f):f=t[14],f}function ga(e){let t=(0,Q.c)(27),{open:n,onOpenChange:r,onCommitFirst:i,onStashAndPull:a,onCancel:o,isLoading:s}=e,c=s===void 0?!1:s,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsxs)(q,{children:[(0,$.jsxs)(K,{className:`flex items-center gap-2`,children:[(0,$.jsx)(x,{className:`h-5 w-5 text-amber-500`}),`Uncommitted Changes Detected`]}),(0,$.jsx)(pt,{children:`You have uncommitted changes. You need to handle them before pulling from the remote branch.`})]}),t[0]=l):l=t[0];let u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Choose how you want to proceed:`}),t[1]=u):u=t[1];let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(te,{className:`h-4 w-4 mr-2`}),t[2]=d):d=t[2];let f;t[3]!==c||t[4]!==i?(f=(0,$.jsxs)(G,{onClick:i,disabled:c,className:`w-full justify-start`,variant:`outline`,children:[d,`Commit changes first, then pull`]}),t[3]=c,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(Ue,{className:`h-4 w-4 mr-2`}),t[6]=p):p=t[6];let m;t[7]!==c||t[8]!==a?(m=(0,$.jsxs)(G,{onClick:a,disabled:c,className:`w-full justify-start`,variant:`outline`,children:[p,`Stash changes → Pull → Restore changes`]}),t[7]=c,t[8]=a,t[9]=m):m=t[9];let h;t[10]!==f||t[11]!==m?(h=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[f,m]}),t[10]=f,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(`strong`,{children:`Commit first:`}),t[13]=g):g=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-4`,children:[g,` Safe option, preserves changes in your commit history`,(0,$.jsx)(`br`,{}),(0,$.jsx)(`strong`,{children:`Stash and pull:`}),` Temporary option, changes will be restored after pulling`]}),t[14]=v):v=t[14];let y;t[15]===h?y=t[16]:(y=(0,$.jsx)(`div`,{className:`py-4`,children:(0,$.jsxs)(`div`,{className:`space-y-3`,children:[u,h,v]})}),t[15]=h,t[16]=y);let b;t[17]!==c||t[18]!==o?(b=(0,$.jsx)(T,{children:(0,$.jsx)(G,{variant:`ghost`,onClick:o,disabled:c,children:`Cancel`})}),t[17]=c,t[18]=o,t[19]=b):b=t[19];let S;t[20]!==y||t[21]!==b?(S=(0,$.jsxs)(O,{className:`sm:max-w-[425px]`,children:[l,y,b]}),t[20]=y,t[21]=b,t[22]=S):S=t[22];let C;return t[23]!==r||t[24]!==n||t[25]!==S?(C=(0,$.jsx)(_,{open:n,onOpenChange:r,children:S}),t[23]=r,t[24]=n,t[25]=S,t[26]=C):C=t[26],C}function _a(e){let t=(0,Q.c)(14),{open:n,onOpenChange:r,onNewBranch:i,onJustOpen:a,isLoading:o}=e,s=o===void 0?!1:o,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(q,{children:[(0,$.jsx)(K,{children:`Pull Request Merged`}),(0,$.jsx)(pt,{children:`As the pull request has been merged, a new branch will be created from the current checkout.`})]}),t[0]=c):c=t[0];let l;t[1]!==s||t[2]!==a?(l=(0,$.jsx)(G,{variant:`ghost`,onClick:a,disabled:s,children:`Just Open`}),t[1]=s,t[2]=a,t[3]=l):l=t[3];let u;t[4]!==s||t[5]!==i?(u=(0,$.jsx)(G,{onClick:i,disabled:s,children:`New Branch`}),t[4]=s,t[5]=i,t[6]=u):u=t[6];let d;t[7]!==l||t[8]!==u?(d=(0,$.jsxs)(O,{children:[c,(0,$.jsxs)(T,{children:[l,u]})]}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==r||t[11]!==n||t[12]!==d?(f=(0,$.jsx)(_,{open:n,onOpenChange:r,children:d}),t[10]=r,t[11]=n,t[12]=d,t[13]=f):f=t[13],f}function va(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function ya(e,n,r){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=()=>{let t=e?r[e]:void 0;return t?.id?t.provider?{provider:t.provider,model:t.id}:va(t.id):{provider:void 0,model:void 0}};return{isGeneratingMessage:i,isGeneratingPRInfo:o,generateCommitMessageWithAI:async()=>{if(!e)return null;try{a(!0);let{provider:t,model:n}=c();return await he(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),X({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{a(!1)}},generatePRInfoWithAI:async()=>{if(!e)return null;try{s(!0);let{provider:n,model:r}=c(),i=await t(e,r,n);return X({title:`Success`,description:`PR title and description generated`}),i}catch(e){return console.error(`Failed to generate PR info:`,e),X({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{s(!1)}}}}function ba({projectId:e,threadId:t}){let{state:n,dispatch:r}=en(),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),[l,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(null),w=(0,Z.useRef)(!1),T=(0,Z.useRef)(!1),[D,O]=(0,Z.useState)(!1),[k,j]=(0,Z.useState)([]),[M,N]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)([]),[I,L]=(0,Z.useState)(!1),[R,z]=(0,Z.useState)(!1),[B,ee]=(0,Z.useState)(``),[V,te]=(0,Z.useState)(``),[H,W]=(0,Z.useState)(``),[ne,re]=(0,Z.useState)(!1),[ae,se]=(0,Z.useState)(!1),[ce,ue]=(0,Z.useState)(!1),K=En(t),pe=ya(t,e,n.projectModelSelections);async function q(){E();let e=await ie();r({type:Y.SetProjects,projects:e.projects})}let[me,he]=(0,Z.useState)(()=>sa()),J=n.projects.find(t=>t.projectId===e),ge=J?.commitMethod===st.Direct;(0,Z.useEffect)(()=>{function e(){document.visibilityState===`visible`&&K.fetchUnifiedStatus(!0)}return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[K.fetchUnifiedStatus]),(0,Z.useEffect)(()=>{R&&J?.name&&!B&&ee(J.name)},[R,J?.name,B]),(0,Z.useEffect)(()=>{ca(me)},[me]),(0,Z.useEffect)(()=>{let e=!0;return ke().then(t=>{e&&W(t)}).catch(()=>{}),()=>{e=!1}},[]),(0,Z.useEffect)(()=>{if(!l){T.current=!1;return}if(l&&me.autoGenerateCommitMessage&&!m.trim()&&t&&!T.current){T.current=!0;async function e(){let e=await pe.generateCommitMessageWithAI();e&&h(e)}e()}},[l,me.autoGenerateCommitMessage,t,pe,m]),(0,Z.useEffect)(()=>{if(!f){w.current=!1;return}if(console.log(`[pr-auto-gen] useEffect triggered`,{isPRDialogOpen:f,autoGeneratePRInfo:me.autoGeneratePRInfo,prTitleEmpty:!g.trim(),prDescriptionEmpty:!v.trim(),threadId:t,hasThreadId:!!t,generationAlreadyStarted:w.current}),f&&me.autoGeneratePRInfo&&!g.trim()&&!v.trim()&&t&&!w.current){console.log(`[pr-auto-gen] Starting auto-generation...`),w.current=!0;async function e(){let e=await pe.generatePRInfoWithAI();e&&(console.log(`[pr-auto-gen] Setting PR info:`,e.title.substring(0,50)),_(e.title),y(e.description))}e()}else console.log(`[pr-auto-gen] Skipping auto-generation - conditions not met`)},[f,me.autoGeneratePRInfo,t,pe,g,v]),(0,Z.useEffect)(()=>{console.log(`Unified status changed:`,{prExists:K.prExists,prState:K.prState,threadId:t}),K.prExists&&K.prState===`MERGED`&&(console.log(`Merged PR detected, opening dialog`),ue(!0)),s&&K.prExists&&K.prState===`OPEN`&&(console.log(`[pr-creation] PR confirmed in status, clearing isCreatingPR`),c(!1))},[K.prExists,K.prState,t,s]),(0,Z.useEffect)(()=>{if(!s)return;let e=setTimeout(()=>{console.log(`[pr-creation] Safety timeout reached, clearing isCreatingPR`),c(!1)},15e3);return()=>clearTimeout(e)},[s]),(0,Z.useEffect)(()=>{!n.isStreaming&&n.completedThreadIds.includes(n.selectedThreadId??``)&&(K.fetchUnifiedStatus(!0),r({type:Y.ClearThreadCompleted,threadId:n.selectedThreadId??``}))},[n.isStreaming,n.completedThreadIds,n.selectedThreadId,K,r]);async function _e(){if(m.trim()&&la(t))try{o(!0),await U(t,m),h(``),d(!1),await K.fetchUnifiedStatus(!0),q(),X({title:`Changes committed successfully`,description:`Your changes have been committed to '${K.currentBranch}'.`}),ae&&(se(!1),await Ce())}catch(e){console.error(`Failed to commit:`,e),X({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{o(!1)}}async function ve(){if(K.status===`Behind`&&!K.hasChanges&&!K.hasUnpushedCommits){await De();return}if(K.hasChanges){d(!0);return}if(K.prExists&&K.prState===`OPEN`&&!K.hasChanges&&!K.hasUnpushedCommits){K.prUrl&&await fe(K.prUrl);return}if(K.commitsAheadOfDefault&&!K.prExists&&!K.hasChanges){p(!0);return}if(K.hasUnpushedCommits&&K.prExists){await xe();return}}async function ye(){let e=await pe.generateCommitMessageWithAI();e&&h(e)}async function be(){if(la(t))try{o(!0),await le(t),await K.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{o(!1)}}async function xe(){if(la(t))try{o(!0),await de(t),await K.fetchUnifiedStatus(!0),q(),K.hasRemoteBranch?X({title:`Branch pushed successfully`,description:`Your branch '${K.currentBranch}' has been pushed to the remote.`}):X({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),X({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{o(!1)}}async function Se(){if(la(t)){if(K.hasChanges){re(!0);return}await Ce()}}async function Ce(){try{o(!0),await oe(t),await K.fetchUnifiedStatus(!0),q(),X({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),X({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{o(!1)}}function we(){re(!1),se(!0),d(!0)}async function Te(){re(!1),await Ce()}async function Ee(){if(t)try{o(!0);let e=await Pt(t);E();let n=await ie();r({type:Y.SetProjects,projects:n.projects}),X({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),ue(!1),await K.fetchUnifiedStatus(!0),setTimeout(()=>void K.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),X({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{o(!1)}}async function De(){if(!la(t)){console.log(`[sync] Thread operation validation failed`);return}try{console.log(`[sync] Starting branch sync for thread: ${t}`),console.log(`[sync] Current branch: ${K.currentBranch}, Default branch: ${K.defaultBranch}`),o(!0),console.log(`[sync] Calling gitSyncBranch API...`);let e=await A(t);console.log(`[sync] ✓ gitSyncBranch API call successful`),console.log(`[sync] Result:`,e),console.log(`[sync] Refreshing git status...`),await K.fetchUnifiedStatus(!0),q(),console.log(`[sync] ✓ Git status refreshed`),X({title:`Branch synced successfully`,description:`Your branch '${K.currentBranch}' has been synced with the latest changes`}),console.log(`[sync] ✓ Sync operation completed successfully`)}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),X({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{o(!1)}}async function Oe(){if(la(t))try{o(!0),c(!0);let e=await u(t,g,v);e.prUrl&&await fe(e.prUrl),_(``),y(``),p(!1),await K.fetchUnifiedStatus(!0),q();let n=0,r=setInterval(async()=>{if(n++,n>=6){clearInterval(r);return}await K.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(p(!1),Me({title:g,description:v})):(c(!1),X({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{o(!1)}}async function Ae(){if(la(t))try{o(!0);let e=await i(t,B,V,me.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{fe(e.repoUrl)},3e3),ee(``),te(``),z(!1),await K.fetchUnifiedStatus(),q()}catch(e){console.error(`Failed to create repo:`,e)}finally{o(!1)}}async function je(){let e=await pe.generatePRInfoWithAI();e&&(_(e.title),y(e.description))}async function Me(e){let n=e??S;if(!(!t||!n))try{o(!0),c(!0);try{await de(t)}catch(e){let n=e?.message??``;if(n.includes(`non-fast-forward`)||n.includes(`Updates were rejected because the tip of your current branch is behind`)){console.log(`[push-and-pr] Non-fast-forward error detected, pulling first...`),X({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await A(t),console.log(`[push-and-pr] ✓ Pull completed, retrying push...`),await de(t),console.log(`[push-and-pr] ✓ Push succeeded after pull`)}catch(t){throw console.error(`[push-and-pr] Pull failed:`,t),e}}else throw e}let e=await u(t,n.title,n.description);e.prUrl&&await fe(e.prUrl),_(``),y(``),C(null),x(!1),await K.fetchUnifiedStatus(!0),q();let r=0,i=setInterval(async()=>{if(r++,r>=6){clearInterval(i);return}await K.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;c(!1),X({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{o(!1)}}async function Ne(){if(la(t))try{N(!0);let e=await tt(t,100);j(e),F(e.slice(0,10)),O(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{N(!1)}}function Pe(){I||(L(!0),setTimeout(()=>{let e=P.length+10;F(k.slice(0,e)),L(!1)},300))}function Fe(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&P.length<k.length&&!I&&Pe()}let Ie=aa(K);function Le(){K.repoUrl&&fe(K.repoUrl)}function Re(){x(!1),C(null)}function ze(){ue(!1),K.fetchUnifiedStatus(!0)}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsxs)(G,{variant:`outline`,size:`sm`,className:`h-8 rounded-r-none border-r-0 gap-1.5 border-transparent${Ie?` bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,disabled:ia(K,a,s),onClick:ve,children:[na(K,s),ta(K,s)]})}),(0,$.jsx)(fn,{children:ra(K)})]})}),(0,$.jsx)(oa,{branchStatus:K.status,remoteUrl:K.remoteUrl,hasRemoteBranch:K.hasRemoteBranch,hasUnpushedCommits:K.hasUnpushedCommits,canCreateRepo:K.canCreateRepo,repoUrl:K.repoUrl,isRefreshing:K.isRefreshing,isBrandState:Ie,gitUser:H,isDirectCommitMode:ge,isLoading:a||s,isLoadingHistory:M,onFetch:()=>void be(),onPull:()=>void Se(),onPush:()=>void xe(),onOpenHistory:()=>void Ne(),onCreatePR:()=>p(!0),onCreateRepo:()=>z(!0),onViewInGitHub:Le})]}),(0,$.jsx)(ua,{open:l,onOpenChange:d,commitMessage:m,onCommitMessageChange:h,autoGenerateCommitMessage:me.autoGenerateCommitMessage,onAutoGenerateChange:e=>he(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:pe.isGeneratingMessage,isLoading:a,onGenerateMessage:ye,onCommit:_e,currentBranch:K.currentBranch}),(0,$.jsx)(da,{open:f,onOpenChange:p,prTitle:g,onPrTitleChange:_,prDescription:v,onPrDescriptionChange:y,isGeneratingPRInfo:pe.isGeneratingPRInfo,isLoading:a,onGeneratePRInfo:je,onCreatePR:Oe,currentBranch:K.currentBranch,autoGeneratePRInfo:me.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>he(t=>({...t,autoGeneratePRInfo:e}))}),(0,$.jsx)(ha,{open:b,onOpenChange:x,isLoading:a,onPushAndCreatePR:Me,onCancel:Re}),(0,$.jsx)(fa,{open:R,onOpenChange:z,repoName:B,onRepoNameChange:ee,repoDescription:V,onRepoDescriptionChange:te,isPrivateRepo:me.privateRepositoryDefault,onPrivateRepoChange:e=>he(t=>({...t,privateRepositoryDefault:e})),isLoading:a,onCreateRepo:Ae}),(0,$.jsx)(pa,{open:D,onOpenChange:O,commits:k,displayedCommits:P,isLoadingMore:I,onScroll:Fe,currentBranch:K.currentBranch}),(0,$.jsx)(ga,{open:ne,onOpenChange:re,onCommitFirst:we,onStashAndPull:Te,onCancel:()=>re(!1),isLoading:a}),(0,$.jsx)(_a,{open:ce,onOpenChange:ue,onNewBranch:Ee,onJustOpen:ze,isLoading:a})]})}var xa=`Play.Square.RotateCcw.Terminal.Bug.TestTube.FlaskConical.Wrench.Hammer.Zap.Search.FileCode.Code2.History.Settings.Activity.Cpu.Server.Database.Package.Box.GitBranch.Layers.ExternalLink.Eye.Shield.Flag.Star.Monitor.Smartphone`.split(`.`);function Sa({open:e,onOpenChange:t,projectId:n,commands:r,onRefresh:i}){let[a,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)([]),[m,h]=(0,Z.useState)(0),[g,v]=(0,Z.useState)(!1),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x=()=>{o({id:crypto.randomUUID(),name:``,icon:`Play`,commandLine:``}),d(!1),p([])},S=e=>{o({...e}),d(!1),p([])},w=async()=>{try{v(!0);let e=await We(n);p(e.scripts),h(0),d(e.scripts.length>0)}catch(e){console.error(`Failed to load package scripts:`,e),X({title:`Error`,description:`Failed to load package scripts`,variant:`destructive`})}finally{v(!1)}},T=e=>{o(t=>t?{...t,name:e.name,commandLine:e.commandLine,relativeFolder:e.relativePath||``}:null),d(!1),p([]),y.current?.focus()},E=e=>{u&&(e.key===`ArrowDown`?(e.preventDefault(),h(e=>e<f.length-1?e+1:e)):e.key===`ArrowUp`?(e.preventDefault(),h(e=>e>0?e-1:0)):e.key===`Enter`?(e.preventDefault(),m<f.length&&T(f[m])):e.key===`Escape`&&(e.preventDefault(),d(!1),p([])))};(0,Z.useEffect)(()=>{let e=e=>{b.current&&!b.current.contains(e.target)&&(d(!1),p([]))};return u&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[u]);let D=async e=>{try{await j(n,e),X({title:`Success`,description:`Command deleted`}),i()}catch{X({title:`Error`,description:`Failed to delete command`,variant:`destructive`})}};return(0,$.jsx)(_,{open:e,onOpenChange:t,children:(0,$.jsxs)(O,{className:`sm:max-w-[500px]`,children:[(0,$.jsxs)(q,{children:[(0,$.jsx)(K,{children:`Project Commands`}),(0,$.jsx)(pt,{children:`Manage custom commands for this project.`})]}),(0,$.jsx)(`div`,{className:`py-4 flex flex-col gap-4`,children:a?(0,$.jsxs)(`div`,{className:`p-4 border rounded-lg bg-muted/30 flex flex-col gap-4 animate-in slide-in-from-top-2`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(H,{htmlFor:`name`,children:`Command Name`}),(0,$.jsx)(c,{id:`name`,value:a.name,onChange:e=>o({...a,name:e.target.value}),placeholder:`e.g. Run Tests`,autoComplete:`off`})]}),(0,$.jsxs)(`div`,{className:`grid gap-2 relative`,children:[(0,$.jsx)(H,{htmlFor:`commandLine`,children:`Command Line`}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(dn,{ref:y,id:`commandLine`,value:a.commandLine,onChange:e=>o({...a,commandLine:e.target.value}),onKeyDown:E,placeholder:`e.g. npm test`,className:`font-mono text-xs min-h-[100px] resize-none pr-10`}),(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute right-2 top-2 h-6 w-6 text-muted-foreground transition-colors`,onClick:()=>void w(),disabled:g,children:(0,$.jsx)(xt,{className:`h-4 w-4`})})}),(0,$.jsx)(fn,{children:(0,$.jsx)(`p`,{children:`Discover package scripts`})})]})})]}),u&&(0,$.jsx)(`div`,{ref:b,className:`absolute bottom-full left-0 right-0 mb-2 max-h-60 overflow-y-auto rounded-lg border border-border bg-popover shadow-lg z-50`,children:(0,$.jsxs)(`div`,{className:`p-2`,children:[(0,$.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b border-border/50 mb-1 flex items-center gap-2`,children:[(0,$.jsx)(xt,{className:`h-3 w-3`}),`Available Scripts `,g&&`(loading...)`]}),f.length>0?(()=>{let e={};f.forEach(t=>{e[t.relativePath]||(e[t.relativePath]=[]),e[t.relativePath].push(t)});let t=Object.keys(e).sort(),n=0;return t.map(t=>{let r=e[t].sort((e,t)=>e.name.localeCompare(t.name));return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`px-3 py-1.5 text-xs font-semibold text-muted-foreground/70 bg-muted/30`,children:t}),r.map(e=>{let t=n===m;return n++,(0,$.jsxs)(`button`,{type:`button`,className:J(`flex w-full flex-col gap-1 rounded-lg mx-1 px-3 py-2 text-left transition-colors`,t?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>T(e),onMouseEnter:()=>h(n-1),children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:e.commandLine})]},e.commandLine)})]},t)})})():(0,$.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:g?`Loading scripts...`:`No package scripts found`})]})})]}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(H,{htmlFor:`relativeFolder`,children:`Relative Folder`}),(0,$.jsx)(c,{id:`relativeFolder`,value:a.relativeFolder??``,onChange:e=>o({...a,relativeFolder:e.target.value}),placeholder:`e.g. frontend, packages/api (optional)`,autoComplete:`off`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Folder path relative to project root where the command will be executed. Leave empty to run from project root.`})]}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(H,{children:`Icon`}),(0,$.jsx)(`div`,{className:`grid grid-cols-10 gap-1 p-2 bg-background rounded-md border border-border`,children:xa.map(e=>{let t=z[e]||Ge;return(0,$.jsx)(G,{variant:a.icon===e?`default`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>o({...a,icon:e}),title:e,children:(0,$.jsx)(t,{className:`h-4 w-4`})},e)})})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 mt-2`,children:[(0,$.jsxs)(G,{variant:`ghost`,size:`sm`,onClick:()=>o(null),children:[(0,$.jsx)(C,{className:`h-4 w-4 mr-2`}),` Cancel`]}),(0,$.jsxs)(G,{size:`sm`,onClick:async()=>{if(!a?.name||!a?.commandLine){X({title:`Error`,description:`Name and Command Line are required`,variant:`destructive`});return}try{l(!0),await xe(n,a),X({title:`Success`,description:`Command saved`}),o(null),i()}catch{X({title:`Error`,description:`Failed to save command`,variant:`destructive`})}finally{l(!1)}},disabled:s,children:[(0,$.jsx)(Ee,{className:`h-4 w-4 mr-2`}),` `,s?`Saving...`:`Save Command`]})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 max-h-[400px] overflow-y-auto pr-2`,children:[r.length===0&&(0,$.jsx)(`div`,{className:`text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg`,children:`No commands defined yet.`}),r.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-md border border-border bg-card hover:bg-muted/50 cursor-pointer group transition-colors`,onClick:()=>S(e),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 bg-muted rounded`,children:(0,$.jsx)(z[e.icon]||et,{className:`h-4 w-4`})}),(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground line-clamp-1 font-mono`,children:e.commandLine})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,$.jsx)(G,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground hover:bg-destructive hover:text-destructive-foreground transition-colors`,onClick:t=>{t.stopPropagation(),D(e.id)},children:(0,$.jsx)(ue,{className:`h-4 w-4`})})})]},e.id))]}),(0,$.jsxs)(G,{variant:`outline`,className:`w-full border-dashed`,onClick:x,children:[(0,$.jsx)(Te,{className:`h-4 w-4 mr-2`}),` Add New Command`]})]})})]})})}function Ca(){let e=(0,Q.c)(27),{state:t}=en(),{selectedProjectId:n,selectedThreadId:r,projects:i}=t,{dispatch:a}=cn(r),[o,s]=(0,Z.useState)(!1),c,l,u,d,f;if(e[0]!==a||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==t.isRunningCommand){f=Symbol.for(`react.early_return_sentinel`);bb0:{let o;e[10]===n?o=e[11]:(o=e=>e.projectId===n,e[10]=n,e[11]=o),c=i.find(o)?.commands??[];let p;e[12]!==a||e[13]!==n||e[14]!==r?(p=e=>{!n||!r||a({type:Y.QueueTerminalCommand,threadId:r,command:e.commandLine,relativeFolder:e.relativeFolder})},e[12]=a,e[13]=n,e[14]=r,e[15]=p):p=e[15];let m=p,h;if(e[16]===a?h=e[17]:(h=async()=>{a({type:Y.ConfigUpdated})},e[16]=a,e[17]=h),l=h,!n){f=null;break bb0}u=`flex items-center gap-1`,d=c.length===0?(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(G,{variant:`action`,size:`icon-md`,onClick:()=>s(!0),children:(0,$.jsx)(yt,{})})}),(0,$.jsx)(fn,{children:`Manage commands`})]})}):(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(pn,{children:[c.map(e=>{let n=z[e.icon]||et;return(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(G,{variant:`action`,size:`icon-md`,onClick:()=>m({commandLine:e.commandLine,relativeFolder:e.relativeFolder}),disabled:t.isRunningCommand,children:(0,$.jsx)(n,{})})}),(0,$.jsx)(fn,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`text-[10px] opacity-70 font-mono whitespace-pre-wrap max-w-[300px] max-h-[100px] overflow-y-auto`,children:e.commandLine})]})})]},e.id)}),(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(G,{variant:`action`,size:`icon-md`,className:`ml-1`,onClick:()=>s(!0),children:(0,$.jsx)(yt,{})})}),(0,$.jsx)(fn,{children:`Manage commands`})]})]})})}e[0]=a,e[1]=i,e[2]=n,e[3]=r,e[4]=t.isRunningCommand,e[5]=c,e[6]=l,e[7]=u,e[8]=d,e[9]=f}else c=e[5],l=e[6],u=e[7],d=e[8],f=e[9];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;e[18]!==c||e[19]!==l||e[20]!==n||e[21]!==o?(p=(0,$.jsx)(Sa,{open:o,onOpenChange:s,projectId:n,commands:c,onRefresh:l}),e[18]=c,e[19]=l,e[20]=n,e[21]=o,e[22]=p):p=e[22];let m;return e[23]!==u||e[24]!==d||e[25]!==p?(m=(0,$.jsxs)(`div`,{className:u,children:[d,p]}),e[23]=u,e[24]=d,e[25]=p,e[26]=m):m=e[26],m}function wa(e){let t=(0,Q.c)(3),{children:n,className:r}=e,i=`flex items-center gap-2 rounded-full shadow-md ${r===void 0?``:r}`,a;return t[0]!==n||t[1]!==i?(a=(0,$.jsx)(`div`,{className:i,children:n}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function Ta({threadId:e}){let{dispatch:t}=en(),{setTerminalNotification:n}=Gn(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(new Set),s=(0,Z.useRef)(new Map);(0,Z.useEffect)(()=>((async()=>{try{let t=await Ot(e);if(t.length===0){i(null);return}i(t),o(new Set(t.filter(e=>e.isRunning).map(e=>e.name)))}catch{i(null)}})(),()=>{for(let e of s.current.values())e.abort();s.current.clear()}),[e]);let c=async r=>{if(a.has(r.name)){let n=s.current.get(r.name);n&&(n.abort(),s.current.delete(r.name));try{await Be(e,r.name)}catch{}t({type:Y.AppendTerminalLine,threadId:e,line:{type:`system`,content:`■ ${r.friendlyName} stopped`}}),o(e=>{let t=new Set(e);return t.delete(r.name),t})}else{let i=new AbortController;s.current.set(r.name,i),o(e=>new Set([...e,r.name])),n(!0),t({type:Y.AppendTerminalLine,threadId:e,line:{type:`system`,content:`▶ ${r.friendlyName}`}});try{let n=await qe(e,r.name,r.command,{signal:i.signal});if(n){let r=n.getReader(),i=new TextDecoder,a=``;try{for(;;){let{done:n,value:o}=await r.read();if(n)break;a+=i.decode(o,{stream:!0});let s=a.split(`
26
+ `);a=s.pop()??``;for(let n of s)if(n.trim())try{let r=JSON.parse(n);typeof r==`string`?t({type:Y.AppendTerminalLine,threadId:e,line:{type:`output`,content:r}}):r.type===`error`&&t({type:Y.AppendTerminalLine,threadId:e,line:{type:`error`,content:r.message}})}catch{t({type:Y.AppendTerminalLine,threadId:e,line:{type:`output`,content:n}})}}if(a.trim())try{let n=JSON.parse(a);typeof n==`string`?t({type:Y.AppendTerminalLine,threadId:e,line:{type:`output`,content:n}}):n.type===`error`&&t({type:Y.AppendTerminalLine,threadId:e,line:{type:`error`,content:n.message}})}catch{t({type:Y.AppendTerminalLine,threadId:e,line:{type:`output`,content:a}})}}finally{r.releaseLock()}}t({type:Y.AppendTerminalLine,threadId:e,line:{type:`system`,content:`✓ ${r.friendlyName} done`}})}catch{}finally{s.current.delete(r.name),o(e=>{let t=new Set(e);return t.delete(r.name),t})}}};if(!r)return null;let l=r.reduce((e,t)=>(e[t.workspace]||(e[t.workspace]=[]),e[t.workspace].push(t),e),{}),u=Object.entries(l).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,[...t].sort((e,t)=>e.friendlyName.localeCompare(t.friendlyName))]),d=u.length>1;return(0,$.jsxs)(kn,{children:[(0,$.jsx)(pn,{children:(0,$.jsxs)(mn,{children:[(0,$.jsx)(hn,{asChild:!0,children:(0,$.jsx)(Mn,{asChild:!0,children:(0,$.jsx)(G,{variant:`action`,size:`icon-md`,children:(0,$.jsx)(Ke,{})})})}),(0,$.jsx)(fn,{children:`Project Scripts`})]})}),(0,$.jsx)(Cn,{align:`end`,className:`min-w-[180px]`,children:d?u.map(([e,t])=>(0,$.jsxs)(An,{children:[(0,$.jsx)(wn,{children:e}),(0,$.jsx)(vn,{className:`max-h-[min(400px,80vh)] overflow-y-auto`,children:t.map(e=>(0,$.jsxs)(_n,{onClick:()=>{c(e)},className:`gap-2`,children:[a.has(e.name)?(0,$.jsx)(re,{className:`h-3 w-3 animate-spin shrink-0`}):(0,$.jsx)(`div`,{className:`h-3 w-3 shrink-0`}),e.friendlyName]},e.name))})]},e)):u[0]?.[1].map(e=>(0,$.jsxs)(_n,{onClick:()=>{c(e)},className:`gap-2`,children:[a.has(e.name)?(0,$.jsx)(re,{className:`h-3 w-3 animate-spin shrink-0`}):(0,$.jsx)(`div`,{className:`h-3 w-3 shrink-0`}),e.friendlyName]},e.name))})]})}function Ea(){let e=(0,Q.c)(44),{state:t,dispatch:n}=en(),{selectedThreadId:r,selectedProjectId:i,projects:a,sidebarOpen:o}=t,s;if(e[0]!==a||e[1]!==i){let t;e[3]===i?t=e[4]:(t=e=>e.projectId===i,e[3]=i,e[4]=t),s=a.find(t),e[0]=a,e[1]=i,e[2]=s}else s=e[2];let c=s,l=!o,u=l&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2`,d;e[5]===u?d=e[6]:(d=J(u),e[5]=u,e[6]=d);let f;e[7]===n?f=e[8]:(f=()=>n({type:Y.ToggleSidebar}),e[7]=n,e[8]=f);let p;e[9]===o?p=e[10]:(p=o?(0,$.jsx)(rt,{className:`h-4 w-4`}):(0,$.jsx)(ft,{className:`h-4 w-4`}),e[9]=o,e[10]=p);let m;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{className:`sr-only`,children:`Toggle sidebar`}),e[11]=m):m=e[11];let h;e[12]!==f||e[13]!==p?(h=(0,$.jsxs)(G,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0 electrobun-webkit-app-region-no-drag`,onClick:f,children:[p,m]}),e[12]=f,e[13]=p,e[14]=h):h=e[14];let g;e[15]!==a||e[16]!==i||e[17]!==r?(g=r&&(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:Me(a,i)}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:bt(a,r)})]}),e[15]=a,e[16]=i,e[17]=r,e[18]=g):g=e[18];let _;e[19]!==h||e[20]!==g?(_=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,g]}),e[19]=h,e[20]=g,e[21]=_):_=e[21];let v=l?`ml-0`:`ml-auto`,y;e[22]===v?y=e[23]:(y=J(`flex flex-wrap items-center justify-end gap-2`,v,`md:ml-auto`),e[22]=v,e[23]=y);let b;e[24]!==c?.runCommand||e[25]!==i||e[26]!==r?(b=i&&(0,$.jsxs)(wa,{className:`electrobun-webkit-app-region-no-drag`,children:[(0,$.jsx)(Xn,{projectId:i,runCommand:c?.runCommand}),r&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ta,{threadId:r}),(0,$.jsx)(Ca,{})]})]}),e[24]=c?.runCommand,e[25]=i,e[26]=r,e[27]=b):b=e[27];let x;e[28]!==i||e[29]!==r?(x=r&&i&&(0,$.jsx)(wa,{className:`electrobun-webkit-app-region-no-drag`,children:(0,$.jsx)(ba,{projectId:i,threadId:r})}),e[28]=i,e[29]=r,e[30]=x):x=e[30];let S;e[31]!==c?.openWith||e[32]!==i||e[33]!==r?(S=r&&i&&(0,$.jsx)(wa,{className:`electrobun-webkit-app-region-no-drag`,children:(0,$.jsx)(ea,{projectId:i,threadId:r,openWith:c?.openWith})}),e[31]=c?.openWith,e[32]=i,e[33]=r,e[34]=S):S=e[34];let C;e[35]!==y||e[36]!==b||e[37]!==x||e[38]!==S?(C=(0,$.jsxs)(`div`,{className:y,children:[b,x,S]}),e[35]=y,e[36]=b,e[37]=x,e[38]=S,e[39]=C):C=e[39];let w;return e[40]!==C||e[41]!==d||e[42]!==_?(w=(0,$.jsxs)(rr,{className:d,children:[_,C]}),e[40]=C,e[41]=d,e[42]=_,e[43]=w):w=e[43],w}function Da(e){let t=(0,Q.c)(13),{open:n,projectName:r,onOpenChange:i,onConfirm:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(In,{children:`Delete Project`}),t[0]=o):o=t[0];let s;t[1]===r?s=t[2]:(s=(0,$.jsxs)(Vn,{children:[o,(0,$.jsxs)(Fn,{children:[`Are you sure you want to delete`,` `,(0,$.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[`"`,r,`"`]}),`? This will remove the project and all its data. This action cannot be undone.`]})]}),t[1]=r,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(Bn,{children:`Cancel`}),t[3]=c):c=t[3];let l;t[4]===a?l=t[5]:(l=(0,$.jsxs)(zn,{children:[c,(0,$.jsx)(Rn,{onClick:a,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Delete`})]}),t[4]=a,t[5]=l);let u;t[6]!==s||t[7]!==l?(u=(0,$.jsxs)(Ln,{children:[s,l]}),t[6]=s,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==i||t[10]!==n||t[11]!==u?(d=(0,$.jsx)(Hn,{open:n,onOpenChange:i,children:u}),t[9]=i,t[10]=n,t[11]=u,t[12]=d):d=t[12],d}function Oa(e){let t=(0,Q.c)(28),{open:n,setupScripts:r,onConfirm:i}=e;if(r.length===0)return null;let a;t[0]===i?a=t[1]:(a=e=>{e||i(!1)},t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(In,{children:`Install dependencies?`}),t[2]=o):o=t[2];let s=r.length===1?``:`s`,c;t[3]!==r.length||t[4]!==s?(c=(0,$.jsxs)(Vn,{children:[o,(0,$.jsxs)(Fn,{children:[`Found `,r.length,` package`,s,` with dependencies to install:`]})]}),t[3]=r.length,t[4]=s,t[5]=c):c=t[5];let l;t[6]===r?l=t[7]:(l=r.map(ka),t[6]=r,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,$.jsx)(`div`,{className:`my-4 max-h-60 overflow-y-auto`,children:(0,$.jsx)(`div`,{className:`space-y-2`,children:l})}),t[8]=l,t[9]=u);let d;t[10]===i?d=t[11]:(d=(0,$.jsx)(Bn,{onClick:()=>i(!1),children:`No`}),t[10]=i,t[11]=d);let f;t[12]===i?f=t[13]:(f=()=>i(!0),t[12]=i,t[13]=f);let p;t[14]!==r.length||t[15]!==f?(p=(0,$.jsxs)(Rn,{onClick:f,children:[`Install All (`,r.length,`)`]}),t[14]=r.length,t[15]=f,t[16]=p):p=t[16];let m;t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(zn,{children:[d,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19];let h;t[20]!==m||t[21]!==c||t[22]!==u?(h=(0,$.jsxs)(Ln,{className:`max-w-2xl`,children:[c,u,m]}),t[20]=m,t[21]=c,t[22]=u,t[23]=h):h=t[23];let g;return t[24]!==n||t[25]!==a||t[26]!==h?(g=(0,$.jsx)(Hn,{open:n,onOpenChange:a,children:h}),t[24]=n,t[25]=a,t[26]=h,t[27]=g):g=t[27],g}function ka(e,t){let n=e.match(/^cd "([^"]+)" && (.+)$/),r=n?n[1]:`root`,i=n?n[2]:e;return(0,$.jsx)(`div`,{className:`flex items-center justify-between p-3 rounded-lg border bg-muted/50`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`font-medium text-sm`,children:r||`root`}),(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:i})]})]})},t)}function Aa(){let e=(0,Q.c)(6),[t,n]=(0,Z.useState)(!0),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=!0;return(async()=>{try{let t=await fetch(`${Xe()}/health`,{method:`GET`});e&&n(t.ok)}catch{e&&n(!1)}})(),()=>{e=!1}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Z.useEffect)(r,i);let a=ja;if(t)return null;let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=Xe(),e[2]=o):o=e[2];let s=o,c,l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(Vn,{children:[(0,$.jsx)(In,{children:`Service unavailable`}),(0,$.jsx)(Fn,{children:`Service is not currently up. Please ensure the backend is running at the address below, then retry.`})]}),l=(0,$.jsx)(`div`,{className:`rounded-md bg-muted px-3 py-2 text-xs font-mono text-muted-foreground`,children:s}),e[3]=c,e[4]=l):(c=e[3],l=e[4]);let u;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(Hn,{open:!0,children:(0,$.jsxs)(Ln,{children:[c,l,(0,$.jsx)(zn,{children:(0,$.jsx)(G,{onClick:a,children:`Retry`})})]})}),e[5]=u):u=e[5],u}function ja(){window.location.assign(window.location.href)}var Ma=It,Na=Z.forwardRef((e,t)=>{let n=(0,Q.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=J(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,$.jsx)(Ft,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Na.displayName=Ft.displayName;var Pa=ae(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),Fa=Z.forwardRef((e,t)=>{let n=(0,Q.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,variant:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]!==r||n[5]!==a?(o=J(Pa({variant:a}),r),n[4]=r,n[5]=a,n[6]=o):o=n[6];let s;return n[7]!==i||n[8]!==t||n[9]!==o?(s=(0,$.jsx)(Rt,{ref:t,className:o,...i}),n[7]=i,n[8]=t,n[9]=o,n[10]=s):s=n[10],s});Fa.displayName=Rt.displayName;var Ia=Z.forwardRef((e,t)=>{let n=(0,Q.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=J(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,$.jsx)(Zt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ia.displayName=Zt.displayName;var La=Z.forwardRef((e,t)=>{let n=(0,Q.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=J(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(C,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,$.jsx)(Bt,{ref:t,className:a,"toast-close":``,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});La.displayName=Bt.displayName;var Ra=Z.forwardRef((e,t)=>{let n=(0,Q.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=J(`text-sm font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,$.jsx)(Kt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ra.displayName=Kt.displayName;var za=Z.forwardRef((e,t)=>{let n=(0,Q.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=J(`text-sm opacity-90`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,$.jsx)(Lt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});za.displayName=Lt.displayName;function Ba(){let e=(0,Q.c)(5),{toasts:t}=Nn(),n;e[0]===t?n=e[1]:(n=t.map(Va),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Na,{}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,$.jsxs)(Ma,{children:[n,r]}),e[3]=n,e[4]=i),i}function Va(e){let{id:t,title:n,description:r,action:i,...a}=e;return(0,$.jsxs)(Fa,{...a,children:[(0,$.jsxs)(`div`,{className:`grid gap-1`,children:[n&&(0,$.jsx)(Ra,{children:n}),r&&(0,$.jsx)(za,{children:r})]}),i,(0,$.jsx)(La,{})]},t)}function Ha(){let e=(0,Q.c)(4),{resolvedTheme:t,theme:n}=Zn(),r,i;return e[0]!==t||e[1]!==n?(r=()=>{if(window.tarsk?.setNativeTheme){let e=n===`system`?`system`:t||`system`;window.tarsk.setNativeTheme(e)}},i=[t,n],e[0]=t,e[1]=n,e[2]=r,e[3]=i):(r=e[2],i=e[3]),(0,Z.useEffect)(r,i),null}function Ua(e){let t=(0,Q.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(Ha,{}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,$.jsxs)(Qn,{...r,children:[i,n]}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function Wa(e){let{state:t,dispatch:n}=en(),{toast:r}=Nn(),i=cn(`project-creation`).dispatch,[a,o]=(0,Z.useState)(null),s=(0,Z.useCallback)(async()=>{try{n({type:Y.SetProjectsLoading,projectsLoading:!0});let e=await ie();n({type:Y.SetProjects,projects:e.projects})}catch(e){console.error(`Failed to refresh projects:`,e)}finally{n({type:Y.SetProjectsLoading,projectsLoading:!1})}},[n]),c=(0,Z.useCallback)(async(e,r)=>{try{await Oe(e,r)}catch(e){console.error(`Failed to select thread:`,e)}(t.selectedThreadId!==r||t.selectedProjectId!==e)&&n({type:Y.SelectThread,threadId:r,projectId:e})},[n,t.selectedThreadId,t.selectedProjectId]),l=(0,Z.useCallback)(async t=>{n({type:Y.SetCreatingProject,isCreating:!0});try{let r=await t.apiCall();if(!r){n({type:Y.SetCreatingProject,isCreating:!1}),await s();return}let a=t.useTerminalDispatch?i:n;a({type:Y.ClearTerminalOutput}),a({type:Y.SetTerminalOpen,open:!0}),a({type:Y.AppendTerminalLine,line:{type:`system`,content:t.initialMessage}});let c=r.getReader(),l=new TextDecoder,u=``,d=null,f=!1,p=null,m=null;for(;;){let{done:e,value:r}=await c.read();if(e)break;u+=l.decode(r,{stream:!0});let i=u.split(`
27
+ `);u=i.pop()??``;for(let e of i){let r=e.trim();if(r)try{let e=JSON.parse(r);if(e.type===`progress`)!f&&e.threadId&&e.projectId&&(f=!0,p=e.projectId,m=e.threadId,n({type:Y.AddCreatingProject,projectId:e.projectId,threadId:e.threadId,projectName:t.optimisticProjectName,gitUrl:t.gitUrl??``}),n({type:Y.AddProcessingThread,threadId:e.threadId})),n({type:Y.AppendTerminalLine,...t.useTerminalDispatch?{threadId:m??`project-creation`}:{},line:{type:`output`,content:e.message}});else if(e.type===`complete`){if(e.project){d=e.project.id;let r=t.includeThreadPath&&e.project.threads?.length>0?`${e.project.path}/${e.project.threads[0]}`:e.project.path;a({type:Y.AppendTerminalLine,line:{type:`system`,content:`Project created successfully at: ${r}`}}),n({type:Y.SetTerminalOpen,open:!1}),t.handleSetupScript&&e.suggestedSetupScript&&o({projectId:e.project.id,command:e.suggestedSetupScript,remainingScripts:e.project.pendingSetupScripts??[]})}}else e.type===`error`&&(f&&p&&(n({type:Y.RemoveCreatingProject,projectId:p}),m&&n({type:Y.RemoveProcessingThread,threadId:m})),n({type:Y.AppendTerminalLine,...t.useTerminalDispatch?{threadId:m??`project-creation`}:{},line:{type:`error`,content:`Error: ${e.message}`}}))}catch(e){console.error(`Failed to parse ${t.logTag} event`,e)}}}n({type:Y.SetCreatingProject,isCreating:!1}),f&&m&&n({type:Y.RemoveProcessingThread,threadId:m}),E();let h=await ie();if(n({type:Y.SetProjects,projects:h.projects}),n({type:Y.SetProjectsLoading,projectsLoading:!1}),d){let t=h.projects.find(e=>e.projectId===d);if(t&&t.threads.length>0){let e=t.threads[0].threadId;n({type:Y.SelectThread,threadId:e,projectId:d,focusInput:!0})}e?.onProjectCreated?.(d)}}catch(e){console.error(`Failed to ${t.logTag}:`,e),n({type:Y.SetCreatingProject,isCreating:!1}),(t.useTerminalDispatch?i:n)({type:Y.AppendTerminalLine,line:{type:`error`,content:`${t.catchErrorPrefix}: ${e instanceof Error?e.message:`Unknown error`}`}})}},[n,s,i,e?.onProjectCreated]),u=(0,Z.useCallback)(async(e,t)=>{let n=e.split(`/`).pop()?.replace(`.git`,``)??`project`;await l({apiCall:()=>Je(e,t),initialMessage:`Cloning repository: ${e}...`,optimisticProjectName:n,gitUrl:e,useTerminalDispatch:!0,includeThreadPath:!0,handleSetupScript:!0,logTag:`create project`,catchErrorPrefix:`Failed to create project`})},[l]),d=(0,Z.useCallback)(async(e,t,n)=>{await l({apiCall:()=>N(e,t,n),initialMessage:`Creating app "${e}"...`,optimisticProjectName:e,useTerminalDispatch:!0,handleSetupScript:!1,logTag:`create web app`,catchErrorPrefix:`Failed to create web app`})},[l]),f=(0,Z.useCallback)(async(e,i)=>{try{let a=i??(()=>{let n=t.projects.find(t=>t.projectId===e)?.threads.map(e=>e.title)??[],r=/^thread-(\d+)$/i,i=0;for(let e of n){let t=e.match(r);t&&(i=Math.max(i,parseInt(t[1],10)))}return`thread-${i+1}`})(),o=await R(e,i);if(!o){await s();return}let c=o.getReader(),l=new TextDecoder,u=``,d=!1,f=null,p=!0,m=[{type:`system`,content:`Creating thread "${a}"...`}];try{for(;;){let{done:t,value:i}=await c.read();if(t)break;u+=l.decode(i,{stream:!0});let o=u.split(`
28
+ `);u=o.pop()??``;for(let t of o){let i=t.trim();if(i)try{let t=JSON.parse(i);if(t.type===`progress`){if(!d&&t.threadId){d=!0,f=t.threadId,n({type:Y.AddCreatingThread,projectId:e,threadId:t.threadId,title:a}),n({type:Y.AddProcessingThread,threadId:t.threadId}),n({type:Y.ClearTerminalOutput,threadId:f});for(let e of m)n({type:Y.AppendTerminalLine,threadId:f,line:e});m.length=0}let r={type:`output`,content:t.message};f?n({type:Y.AppendTerminalLine,threadId:f,line:r}):m.push(r)}else if(t.type===`error`){d&&f&&(n({type:Y.RemoveCreatingThread,projectId:e,threadId:f}),n({type:Y.RemoveProcessingThread,threadId:f}));let i={type:`error`,content:`Error: ${t.message}`};f?n({type:Y.AppendTerminalLine,threadId:f,line:i}):m.push(i),console.error(`Thread creation error:`,t.message),r({title:`Thread Creation Failed`,description:t.message,variant:`destructive`}),p=!1}}catch(e){console.error(`Failed to parse thread event`,e)}}}d&&f&&n({type:Y.RemoveProcessingThread,threadId:f}),E(),await s(),f&&p&&n({type:Y.SelectThread,threadId:f,projectId:e,focusInput:!0})}catch(t){throw d&&f&&(n({type:Y.RemoveCreatingThread,projectId:e,threadId:f}),n({type:Y.RemoveProcessingThread,threadId:f})),r({title:`Thread Creation Failed`,description:t instanceof Error?t.message:String(t),variant:`destructive`}),t}}catch(e){console.error(`Failed to create thread:`,e);let t=`Failed to create thread: ${e instanceof Error?e.message:`Unknown error`}`;throw n({type:Y.AppendTerminalLine,line:{type:`error`,content:t}}),r({variant:`destructive`,title:`Thread Creation Failed`,description:t}),e}},[s,n,t.projects,r]),p=(0,Z.useCallback)(async(e,r)=>{n({type:Y.AddDeletingThread,threadId:r}),n({type:Y.ClearChatInputDraft,threadId:r});try{await y(e,r),E(),await s(),t.selectedThreadId===r&&n({type:Y.SelectThread,threadId:``,projectId:``})}catch(e){console.error(`Failed to delete thread:`,e)}finally{n({type:Y.RemoveDeletingThread,threadId:r})}},[s,t.selectedThreadId,n]),m=(0,Z.useCallback)(async e=>{n({type:Y.AddDeletingProject,projectId:e});let r=t.projects.find(t=>t.projectId===e)?.threads.map(e=>e.threadId)??[];for(let e of r)n({type:Y.AddDeletingThread,threadId:e}),n({type:Y.ClearChatInputDraft,threadId:e});try{await Mt(e),await s(),t.selectedProjectId===e&&n({type:Y.SelectThread,threadId:``,projectId:``})}catch(e){console.error(`Failed to delete project:`,e)}finally{n({type:Y.RemoveDeletingProject,projectId:e});for(let e of r)n({type:Y.RemoveDeletingThread,threadId:e})}},[s,t.selectedProjectId,t.projects,n]),h=(0,Z.useCallback)(async e=>{let t=a;if(o(null),!t||!e)return;let{projectId:r,command:i,remainingScripts:c}=t,l=[i,...c||[]];try{n({type:Y.SetCreatingProject,isCreating:!0}),n({type:Y.SetTerminalOpen,open:!0}),n({type:Y.AppendTerminalLine,line:{type:`system`,content:`Installing dependencies for ${l.length} package${l.length===1?``:`s`}...`}});for(let e=0;e<l.length;e++){let t=l[e],i=t.match(/^cd "([^"]+)" && (.+)$/),a=i?i[1]:`root`;n({type:Y.AppendTerminalLine,line:{type:`system`,content:`Installing package ${e+1}/${l.length} in ${a}...`}}),n({type:Y.AppendTerminalLine,line:{type:`output`,content:`📦 Installing dependencies in ${a}: ${t}`}});let o=await Dt(r,t,!0);if(o){let e=o.getReader(),t=new TextDecoder,r=``;for(;;){let{done:i,value:a}=await e.read();if(i)break;r+=t.decode(a,{stream:!0});let o=r.split(`
29
+ `);r=o.pop()??``;for(let e of o)if(e.trim())try{let t=JSON.parse(e);typeof t==`string`?n({type:Y.AppendTerminalLine,line:{type:`output`,content:t}}):t.type===`error`&&n({type:Y.AppendTerminalLine,line:{type:`error`,content:t.message}})}catch{n({type:Y.AppendTerminalLine,line:{type:`output`,content:e}})}}if(r.trim())try{let e=JSON.parse(r);typeof e==`string`?n({type:Y.AppendTerminalLine,line:{type:`output`,content:e}}):e.type===`error`&&n({type:Y.AppendTerminalLine,line:{type:`error`,content:e.message}})}catch{n({type:Y.AppendTerminalLine,line:{type:`output`,content:r}})}}e<l.length-1&&(n({type:Y.AppendTerminalLine,line:{type:`system`,content:``}}),n({type:Y.AppendTerminalLine,line:{type:`system`,content:`---`}}),n({type:Y.AppendTerminalLine,line:{type:`system`,content:``}}))}n({type:Y.AppendTerminalLine,line:{type:`system`,content:`All dependencies installed successfully!`}}),n({type:Y.SetCreatingProject,isCreating:!1}),await s()}catch(e){n({type:Y.SetCreatingProject,isCreating:!1}),console.error(`Failed to run setup script:`,e),n({type:Y.AppendTerminalLine,line:{type:`error`,content:`Failed to run setup script: ${e instanceof Error?e.message:`Unknown error`}`}})}},[a,n,s]);(0,Z.useEffect)(()=>{let e=!0;async function r(){try{n({type:Y.SetProjectsLoading,projectsLoading:!0});let r=await ie();if(!e)return;if(n({type:Y.SetProjects,projects:r.projects}),!t.selectedThreadId)for(let e of r.projects){let t=e.threads.find(e=>e.isSelected);if(t){n({type:Y.SelectThread,threadId:t.threadId,projectId:e.projectId});break}}}catch(e){console.error(`Failed to load projects:`,e)}finally{e&&n({type:Y.SetProjectsLoading,projectsLoading:!1})}}return r(),()=>{e=!1}},[n,t.selectedThreadId,t.configUpdatedAt]);let g=(0,Z.useCallback)(async()=>{await l({apiCall:_e,initialMessage:`Opening folder...`,optimisticProjectName:`Opening folder...`,useTerminalDispatch:!0,handleSetupScript:!0,logTag:`open folder`,catchErrorPrefix:`Failed to open folder`})},[l]);return{projects:t.projects,selectedProjectId:t.selectedProjectId,selectedThreadId:t.selectedThreadId,refreshProjects:s,handleSelectThread:c,handleCreateProject:u,handleCreateWebApp:d,handleOpenFolder:g,handleCreateThread:f,handleDeleteThread:p,confirmDeleteProject:m,pendingSetupScriptConfirmation:a,resolveSetupScriptConfirmation:h}}function Ga(){let e=(0,Q.c)(2),[t,n]=(0,Z.useState)(Ka),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>n(!0),t=()=>n(!1);return window.addEventListener(`focus`,e),window.addEventListener(`blur`,t),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`blur`,t)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Z.useEffect)(r,i),t}function Ka(){return document.hasFocus()}var qa=null;function Ja(){qa??=new Audio(`/pop.wav`),qa.currentTime=0,qa.play().catch(e=>{console.debug(`Could not play completion sound:`,e)})}function Ya(){let{state:e,dispatch:t}=en(),n=Ga(),r=(0,Z.useRef)(null),i=(0,Z.useRef)(!1),a=(0,Z.useRef)([]),o=(0,Z.useRef)(e),s=(0,Z.useRef)(n);(0,Z.useEffect)(()=>{o.current=e},[e]),(0,Z.useEffect)(()=>{s.current=n},[n]);let c=(0,Z.useCallback)(async()=>{try{let e=await At(),n=a.current.filter(t=>!e.includes(t));for(let e of n)e!==o.current.selectedThreadId&&t({type:Y.MarkThreadCompleted,threadId:e});return n.length>0&&!s.current&&Ja(),a.current=e,t({type:Y.SetProcessingThreads,threadIds:e}),e}catch(e){return console.error(`Failed to fetch processing threads:`,e),[]}},[t]);(0,Z.useEffect)(()=>{let e=()=>{if(r.current||i.current)return;i.current=!0;let e=async()=>{(await c()).length>0||o.current.isStreaming||o.current.isCreatingProject?r.current=setTimeout(e,1e3):(r.current=null,i.current=!1)};e()},t=()=>{r.current&&=(clearTimeout(r.current),null),i.current=!1};return e(),()=>{t()}},[e.isStreaming,e.isCreatingProject,c]);let l=(0,Z.useCallback)(e=>{t({type:Y.ClearThreadCompleted,threadId:e})},[t]);return{processingThreadIds:e.processingThreadIds,completedThreadIds:e.completedThreadIds,isThreadProcessing:t=>e.processingThreadIds.includes(t),isThreadCompleted:t=>e.completedThreadIds.includes(t),clearCompleted:l}}var Xa=768;function Za(){let e=(0,Q.c)(2),[t,n]=Z.useState(void 0),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${Xa-1}px)`),t=()=>{n(window.innerWidth<Xa)};return e.addEventListener(`change`,t),n(window.innerWidth<Xa),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Z.useEffect(r,i),!!t}var Qa=(0,Z.lazy)(()=>Qt(()=>import(`./terminal-panel-CkIe2d2K.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([20,1,4,12,13]))),$a=(0,Z.lazy)(()=>Qt(()=>import(`./todos-view-C-awG1dZ.js`).then(e=>({default:e.TodosView})),[])),eo=(0,Z.lazy)(()=>Qt(()=>import(`./diff-view-CjbcDB6m.js`),__vite__mapDeps([8,1,2,3,4,5,9,10,11,7,12,13,14,15,16,17,18,19,6]))),to=(0,Z.lazy)(()=>Qt(()=>import(`./explorer-tab-view-BfycKUUW.js`),__vite__mapDeps([21,1,2,3,4,5,18,12,13]))),no=(0,Z.lazy)(()=>Qt(()=>import(`./browser-tab-CiAz6nc1.js`).then(e=>({default:e.BrowserTab})),__vite__mapDeps([22,1,4,23,3,7,12,13]))),ro=(0,Z.lazy)(()=>Qt(()=>import(`./dialogs-config-vkfELnGl.js`).then(e=>e.t),__vite__mapDeps([4,1]))),io=(0,Z.lazy)(()=>Qt(()=>import(`./onboarding-dialog-CE-GhoDt.js`),__vite__mapDeps([24,10,1,3,4]))),ao=(0,Z.lazy)(()=>Qt(()=>import(`./settings-view-ClTMPafQ.js`),__vite__mapDeps([25,1,2,3,4,5,26,18,19,12])));function oo(){let{state:e,dispatch:t}=en();(0,Z.useEffect)(()=>{window.__electrobunWebviewId&&new hr({})},[]);let r=$t(),i=Xt(),a=Za(),[o,s]=(0,Z.useState)(null),{projects:c,handleSelectThread:l,handleCreateProject:u,handleCreateWebApp:f,handleOpenFolder:p,handleCreateThread:m,handleDeleteThread:h,confirmDeleteProject:g,refreshProjects:_,pendingSetupScriptConfirmation:v,resolveSetupScriptConfirmation:y}=Wa({onProjectCreated:s}),{processingThreadIds:b,completedThreadIds:x,clearCompleted:S}=Ya(),[C,w]=(0,Z.useState)(`chat`),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(0),[L,R]=(0,Z.useState)(null),[z,B]=(0,Z.useState)(0),{terminalState:ee}=cn(e.selectedThreadId),V=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{ee.open&&e.selectedThreadId===V.current&&w(`terminal`),V.current=e.selectedThreadId},[ee.open,e.selectedThreadId]);let[te,H]=(0,Z.useState)(!1),[U,W]=(0,Z.useState)(!1),[ne,re]=(0,Z.useState)(!1),[ie,ae]=(0,Z.useState)(null),[oe,se]=(0,Z.useState)(!1),[G,ce]=(0,Z.useState)(!1),le=(0,Z.useRef)(null),ue=i.pathname.startsWith(`/settings`),de=i.pathname===`/review`,K=i.pathname===`/todos`;(0,Z.useEffect)(()=>{i.pathname===`/`&&C===`tasks`&&w(`chat`)},[i.pathname]);let fe=(0,Z.useRef)(C);(0,Z.useEffect)(()=>{ue&&fe.current!==C&&r(`/`),fe.current=C},[C,ue,r]);let pe=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let n=ue||de||K;if(n&&pe.current===null)pe.current=e.sidebarOpen,e.sidebarOpen&&t({type:Y.ToggleSidebar});else if(!n&&pe.current!==null){let n=pe.current;pe.current=null,n&&!e.sidebarOpen&&t({type:Y.ToggleSidebar})}},[ue,de,K]),(0,Z.useEffect)(()=>{(async()=>{try{(await Tt()).updateAvailable&&se(!0)}catch{}})()},[]);let q=(0,Z.useCallback)(async()=>{ce(!0);try{await d()}catch{ce(!1)}},[]);(0,Z.useEffect)(()=>{ne||(async()=>{try{(await it()).onboardingCompleted||W(!0)}catch(e){console.error(`Failed to check onboarding status:`,e)}finally{re(!0)}})()},[ne]),(0,Z.useEffect)(()=>{U||t({type:Y.ConfigUpdated})},[U,t]);let me=(0,Z.useCallback)(e=>{let t=c.find(t=>t.projectId===e);t&&ae({id:t.projectId,name:n(t)})},[c]),he=(0,Z.useCallback)(e=>{s(e),m(e,void 0)},[m]);(0,Z.useEffect)(()=>{o&&e.selectedProjectId===o&&e.selectedThreadId&&s(null)},[o,e.selectedProjectId,e.selectedThreadId]);let J=(0,Z.useCallback)(async(n,o)=>{s(null),S(o),i.pathname!==`/`&&r(`/`),w(`chat`),e.selectedThreadId!==o&&B(e=>e+1),await l(n,o),a&&e.sidebarOpen&&t({type:Y.ToggleSidebar})},[l,a,e.sidebarOpen,e.selectedThreadId,t,S,i.pathname,r]);(0,Z.useEffect)(()=>{e.sidebarOpen?le.current?.expand():le.current?.collapse()},[e.sidebarOpen]);let ge={activeMainTab:C,setActiveMainTab:w,devServerUrl:T,setDevServerUrl:E,devServerRunning:D,setDevServerRunning:O,devServerLoading:k,setDevServerLoading:A,terminalNotification:j,setTerminalNotification:M,pendingExplorerPath:N,setPendingExplorerPath:P,explorerRefreshTick:F,triggerExplorerRefresh:()=>I(e=>e+1),explorerClearPath:L,setExplorerClearPath:R,browserResetTrigger:z,triggerBrowserReset:()=>B(e=>e+1)};return(0,$.jsx)(Kn.Provider,{value:ge,children:(0,$.jsxs)(pn,{delayDuration:200,children:[(0,$.jsxs)(ar,{direction:`horizontal`,className:`h-screen bg-background`,children:[(0,$.jsx)(ir,{ref:le,defaultSize:a?100:25,minSize:a?50:12,maxSize:a?100:32,collapsible:!0,collapsedSize:0,className:`border-r border-transparent`,children:(0,$.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,$.jsx)(yr,{projects:c,selectedThreadId:e.selectedThreadId,selectedProjectId:e.selectedProjectId,processingThreadIds:b,completedThreadIds:x,deletingThreadIds:e.deletingThreadIds,deletingProjectIds:e.deletingProjectIds,onSelectThread:J,onCreateProject:()=>H(!0),onCreateThread:he,onDeleteThread:h,onDeleteProject:me,onDeselect:()=>t({type:Y.ClearSelection}),collapsed:!e.sidebarOpen,updateAvailable:oe,updatingApp:G,onUpdateApp:q,onRefreshProjects:_,expandProjectId:o})})}),!a&&(0,$.jsx)(or,{withHandle:!0,className:e.sidebarOpen?`ml-[-40px]`:``}),(0,$.jsx)(ir,{minSize:40,className:`overflow-hidden ${a&&e.sidebarOpen?`hidden`:``}`,children:(0,$.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[!de&&!ue&&!K&&(0,$.jsx)(Ea,{}),!de&&!ue&&!K&&e.selectedThreadId&&(0,$.jsx)(`div`,{className:`flex border-b border-border shrink-0`,children:[`Chat`,`Explorer`,`Review`,`Browser`,`Terminal`,`Tasks`].map(e=>{let t=e.toLowerCase();return(0,$.jsxs)(`button`,{onClick:()=>{w(t),t===`terminal`&&M(!1)},className:`relative px-4 py-2 text-sm font-medium transition-colors ${C===t?`border-b-2 border-primary text-foreground -mb-px`:`text-muted-foreground hover:text-foreground`}`,children:[e,t===`terminal`&&j&&C!==`terminal`&&(0,$.jsx)(`span`,{className:`absolute top-1.5 right-1 h-1.5 w-1.5 rounded-full bg-brand`})]},t)})}),(0,$.jsx)(`main`,{className:`flex-1 overflow-hidden${!de&&!ue&&!K&&C!==`chat`?` hidden`:``}`,children:(0,$.jsxs)(Vt,{children:[(0,$.jsx)(Ut,{path:`/settings/:tab?`,element:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(ao,{})})}),(0,$.jsx)(Ut,{path:`/settings/project/:projectId`,element:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(ao,{})})}),(0,$.jsx)(Ut,{path:`*`,element:(0,$.jsx)(Xi,{onCreateThread:he})})]})}),(0,$.jsx)(`div`,{className:`flex-1 overflow-hidden${C===`terminal`&&!de&&!ue&&!K?``:` hidden`}`,children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Qa,{})})}),(0,$.jsx)(`div`,{className:`flex-1 overflow-hidden${C===`browser`&&!de&&!ue&&!K?``:` hidden`}`,children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(no,{})})}),!de&&!ue&&!K&&C!==`chat`&&C!==`terminal`&&C!==`browser`&&(C===`explorer`?(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(to,{})}):C===`tasks`&&e.selectedProjectId?(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)($a,{projectId:e.selectedProjectId})}):C===`review`&&e.selectedThreadId?(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(eo,{threadId:e.selectedThreadId,onExit:()=>w(`chat`)})}):(0,$.jsx)(`div`,{className:`flex-1 overflow-hidden`}))]})}),(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(ro,{open:te,onOpenChange:H,onSubmitClone:u,onSubmitWebApp:f,onOpenFolder:p})}),(0,$.jsx)(Da,{open:ie!==null,projectName:ie?.name,onOpenChange:e=>!e&&ae(null),onConfirm:()=>{ie&&(g(ie.id),ae(null))}}),(0,$.jsx)(Oa,{open:v!==null,setupScripts:v?[v.command,...v.remainingScripts||[]]:[],onConfirm:y}),(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(io,{open:U,onOpenChange:W,onComplete:()=>{re(!0),_()}})}),(0,$.jsx)(Aa,{})]}),(0,$.jsx)(Ba,{})]})})}function so(){let e=(0,Q.c)(5),[t,n]=(0,Z.useReducer)(un,an),r;e[0]===t?r=e[1]:(r={state:t,dispatch:n},e[0]=t,e[1]=r);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(oo,{}),e[2]=i):i=e[2];let a;return e[3]===r?a=e[4]:(a=(0,$.jsx)(Ua,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,storageKey:`tarsk-theme`,children:(0,$.jsx)(sn.Provider,{value:r,children:i})}),e[3]=r,e[4]=a),a}var co=!1;window.addEventListener(`resize`,()=>{co||=(window.__electrobunWebviewId&&(document.body.style.height=`calc(100%)`),!0)}),(0,sr.createRoot)(document.getElementById(`root`)).render((0,$.jsx)(Z.StrictMode,{children:(0,$.jsx)(Wt,{children:(0,$.jsx)(so,{})})}));export{qi as t};
@@ -0,0 +1,10 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-Bjt_i1zi.js","assets/rolldown-runtime-B1FJdls4.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ar as t,Ci as n,Ir as r,Sa as i,Vn as a,Zn as o,ba as s,ci as c,da as l,ea as u,oi as d,xa as f,yi as p}from"./dialogs-config-vkfELnGl.js";import{xt as m}from"./react-vendor-DyE9sO8V.js";import{c as h,l as g,s as _,u as v}from"./history-view-Dn0hQIKU.js";var y=e(f(),1),b=s(),x=e(i(),1),S=.1,C=10,w=1.25,T=.001;function E(){let e=(0,b.c)(15),[t,n]=(0,x.useState)(1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={x:0,y:0},e[0]=r):r=e[0];let[i,a]=(0,x.useState)(r),[o,s]=(0,x.useState)(!1),c=(0,x.useRef)(null),l=D,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>n(e=>l(e*w)),e[1]=u):u=e[1];let d=u,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>n(e=>l(e/w)),e[2]=f):f=e[2];let p=f,m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{n(1),a({x:0,y:0})},e[3]=m):m=e[3];let h=m,g;e[4]===i?g=e[5]:(g=e=>{e.preventDefault(),s(!0),c.current={x:e.clientX,y:e.clientY,ox:i.x,oy:i.y}},e[4]=i,e[5]=g);let _=g,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{c.current&&a({x:c.current.ox+(e.clientX-c.current.x),y:c.current.oy+(e.clientY-c.current.y)})},e[6]=v):v=e[6];let y=v,S;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{s(!1),c.current=null},e[7]=S):S=e[7];let C=S,E=(0,x.useRef)(null),O,k;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{let e=E.current;if(!e)return;let t=function(e){e.preventDefault();let t=-e.deltaY*T;n(e=>l(e*(1+t)))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},k=[],e[8]=O,e[9]=k):(O=e[8],k=e[9]),(0,x.useEffect)(O,k);let A;return e[10]!==o||e[11]!==i||e[12]!==_||e[13]!==t?(A={scale:t,offset:i,isDragging:o,containerRef:E,zoomIn:d,zoomOut:p,reset:h,onMouseDown:_,onMouseMove:y,onMouseUp:C},e[10]=o,e[11]=i,e[12]=_,e[13]=t,e[14]=A):A=e[14],A}function D(e){return Math.min(Math.max(e,S),C)}var O=t();function k(){let e=(0,b.c)(2),[t,n]=(0,x.useState)(!1),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){n(document.documentElement.classList.contains(`dark`))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,x.useEffect)(r,i),t}function A(e,t){let[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{let n=!1;async function i(){try{let{renderMermaidSVG:i}=await m(async()=>{let{renderMermaidSVG:e}=await import(`./dist-Bjt_i1zi.js`);return{renderMermaidSVG:e}},__vite__mapDeps([0,1])),o=i(e,{bg:t?`#18181B`:`#FFFFFF`,fg:t?`#FAFAFA`:`#27272A`,transparent:!1,padding:32});n||(r(o),a(!1))}catch(e){console.error(`Mermaid render error:`,e),n||a(!0)}}return i(),()=>{n=!0}},[e,t]),{svgOutput:n,renderError:i}}function ee(e){let t=(0,b.c)(69),{svgOutput:n,onClose:i}=e,{scale:s,offset:l,isDragging:u,containerRef:f,zoomIn:m,zoomOut:S,reset:C,onMouseDown:w,onMouseMove:T,onMouseUp:D}=E(),k,A;t[0]===i?(k=t[1],A=t[2]):(k=()=>{let e=function(e){e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},A=[i],t[0]=i,t[1]=k,t[2]=A),(0,x.useEffect)(k,A);let ee;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ee=[],t[3]=ee):ee=t[3],(0,x.useEffect)(j,ee);let M;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,O.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground`,children:`mermaid diagram`}),t[4]=M):M=t[4];let N,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,O.jsx)(p,{className:`h-3.5 w-3.5`}),P=(0,O.jsx)(`span`,{className:`sr-only`,children:`Zoom out`}),t[5]=N,t[6]=P):(N=t[5],P=t[6]);let F;t[7]===S?F=t[8]:(F=(0,O.jsx)(v,{asChild:!0,children:(0,O.jsxs)(a,{variant:`ghost`,size:`icon-xs`,onClick:S,children:[N,P]})}),t[7]=S,t[8]=F);let I;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,O.jsx)(h,{children:`Zoom out`}),t[9]=I):I=t[9];let L;t[10]===F?L=t[11]:(L=(0,O.jsxs)(_,{children:[F,I]}),t[10]=F,t[11]=L);let R;t[12]===s?R=t[13]:(R=Math.round(s*100),t[12]=s,t[13]=R);let z;t[14]!==C||t[15]!==R?(z=(0,O.jsx)(v,{asChild:!0,children:(0,O.jsxs)(`button`,{type:`button`,onClick:C,className:`min-w-[3rem] px-2 py-1 text-xs font-mono text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors`,children:[R,`%`]})}),t[14]=C,t[15]=R,t[16]=z):z=t[16];let B;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,O.jsx)(h,{children:`Reset zoom`}),t[17]=B):B=t[17];let V;t[18]===z?V=t[19]:(V=(0,O.jsxs)(_,{children:[z,B]}),t[18]=z,t[19]=V);let H,te;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,O.jsx)(c,{className:`h-3.5 w-3.5`}),te=(0,O.jsx)(`span`,{className:`sr-only`,children:`Zoom in`}),t[20]=H,t[21]=te):(H=t[20],te=t[21]);let U;t[22]===m?U=t[23]:(U=(0,O.jsx)(v,{asChild:!0,children:(0,O.jsxs)(a,{variant:`ghost`,size:`icon-xs`,onClick:m,children:[H,te]})}),t[22]=m,t[23]=U);let ne;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,O.jsx)(h,{children:`Zoom in`}),t[24]=ne):ne=t[24];let W;t[25]===U?W=t[26]:(W=(0,O.jsxs)(_,{children:[U,ne]}),t[25]=U,t[26]=W);let re,ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(d,{className:`h-3.5 w-3.5`}),ie=(0,O.jsx)(`span`,{className:`sr-only`,children:`Reset view`}),t[27]=re,t[28]=ie):(re=t[27],ie=t[28]);let G;t[29]===C?G=t[30]:(G=(0,O.jsx)(v,{asChild:!0,children:(0,O.jsxs)(a,{variant:`ghost`,size:`icon-xs`,onClick:C,children:[re,ie]})}),t[29]=C,t[30]=G);let ae;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,O.jsx)(h,{children:`Reset view`}),t[31]=ae):ae=t[31];let K;t[32]===G?K=t[33]:(K=(0,O.jsxs)(_,{children:[G,ae]}),t[32]=G,t[33]=K);let oe;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,O.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),t[34]=oe):oe=t[34];let se,ce;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,O.jsx)(r,{className:`h-3.5 w-3.5`}),ce=(0,O.jsx)(`span`,{className:`sr-only`,children:`Close`}),t[35]=se,t[36]=ce):(se=t[35],ce=t[36]);let q;t[37]===i?q=t[38]:(q=(0,O.jsx)(v,{asChild:!0,children:(0,O.jsxs)(a,{variant:`ghost`,size:`icon-xs`,onClick:i,children:[se,ce]})}),t[37]=i,t[38]=q);let le;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,O.jsx)(h,{children:`Close (Esc)`}),t[39]=le):le=t[39];let J;t[40]===q?J=t[41]:(J=(0,O.jsxs)(_,{children:[q,le]}),t[40]=q,t[41]=J);let Y;t[42]!==V||t[43]!==W||t[44]!==K||t[45]!==J||t[46]!==L?(Y=(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 bg-background/90 border-b border-border shrink-0`,children:[M,(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[L,V,W,K,oe,J]})]}),t[42]=V,t[43]=W,t[44]=K,t[45]=J,t[46]=L,t[47]=Y):Y=t[47];let ue=u?`cursor-grabbing`:`cursor-grab`,X;t[48]===ue?X=t[49]:(X=o(`flex-1 overflow-hidden select-none`,ue),t[48]=ue,t[49]=X);let de=`translate(${l.x}px, ${l.y}px) scale(${s})`,fe=u?`none`:`transform 0.1s ease-out`,Z;t[50]!==de||t[51]!==fe?(Z={transform:de,transformOrigin:`center center`,transition:fe},t[50]=de,t[51]=fe,t[52]=Z):Z=t[52];let Q;t[53]===n?Q=t[54]:(Q={__html:n},t[53]=n,t[54]=Q);let $;t[55]!==Z||t[56]!==Q?($=(0,O.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,style:Z,dangerouslySetInnerHTML:Q}),t[55]=Z,t[56]=Q,t[57]=$):$=t[57];let pe;t[58]!==f||t[59]!==w||t[60]!==T||t[61]!==D||t[62]!==X||t[63]!==$?(pe=(0,O.jsx)(`div`,{ref:f,className:X,onMouseDown:w,onMouseMove:T,onMouseUp:D,onMouseLeave:D,children:$}),t[58]=f,t[59]=w,t[60]=T,t[61]=D,t[62]=X,t[63]=$,t[64]=pe):pe=t[64];let me;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,O.jsx)(`div`,{className:`shrink-0 px-4 py-2 text-center text-xs text-muted-foreground/60 bg-background/60 border-t border-border`,children:`Scroll to zoom · Drag to pan · Esc to close`}),t[65]=me):me=t[65];let he;return t[66]!==Y||t[67]!==pe?(he=(0,y.createPortal)((0,O.jsx)(g,{children:(0,O.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,"aria-label":`Diagram fullscreen view`,children:[Y,pe,me]})}),document.body),t[66]=Y,t[67]=pe,t[68]=he):he=t[68],he}function j(){return document.body.style.overflow=`hidden`,M}function M(){document.body.style.overflow=``}function N(e){let t=(0,b.c)(51),{content:r,className:i}=e,[s,c]=(0,x.useState)(!1),[d,f]=(0,x.useState)(!1),{svgOutput:p,renderError:m}=A(r,k()),y;t[0]===r?y=t[1]:(y=async function(){await navigator.clipboard.writeText(r),c(!0),setTimeout(()=>c(!1),2e3)},t[0]=r,t[1]=y);let S=y,C=m?`mermaid (render error)`:`mermaid diagram`,w;t[2]===C?w=t[3]:(w=(0,O.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground`,children:C}),t[2]=C,t[3]=w);let T;t[4]!==m||t[5]!==p?(T=p&&!m&&(0,O.jsxs)(_,{children:[(0,O.jsx)(v,{asChild:!0,children:(0,O.jsxs)(a,{variant:`action`,size:`icon-xs`,onClick:()=>f(!0),children:[(0,O.jsx)(n,{}),(0,O.jsx)(`span`,{className:`sr-only`,children:`View fullscreen`})]})}),(0,O.jsx)(h,{children:`View fullscreen`})]}),t[4]=m,t[5]=p,t[6]=T):T=t[6];let E;t[7]===s?E=t[8]:(E=s?(0,O.jsx)(l,{}):(0,O.jsx)(u,{}),t[7]=s,t[8]=E);let D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(`span`,{className:`sr-only`,children:`Copy mermaid code`}),t[9]=D):D=t[9];let j;t[10]!==S||t[11]!==E?(j=(0,O.jsxs)(a,{variant:`action`,size:`icon-xs`,onClick:S,children:[E,D]}),t[10]=S,t[11]=E,t[12]=j):j=t[12];let M;t[13]!==T||t[14]!==j?(M=(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[T,j]}),t[13]=T,t[14]=j,t[15]=M):M=t[15];let N;t[16]!==w||t[17]!==M?(N=(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/80 px-4 py-2`,children:[w,M]}),t[16]=w,t[17]=M,t[18]=N):N=t[18];let P=N;if(m){let e;t[19]===i?e=t[20]:(e=o(`group relative overflow-hidden rounded-lg border border-border bg-muted`,i),t[19]=i,t[20]=e);let n;t[21]===r?n=t[22]:(n=(0,O.jsx)(`pre`,{className:`overflow-x-auto p-4 max-w-full`,children:(0,O.jsx)(`code`,{className:`text-xs font-mono text-foreground leading-relaxed`,children:r})}),t[21]=r,t[22]=n);let a;return t[23]!==P||t[24]!==e||t[25]!==n?(a=(0,O.jsxs)(`div`,{className:e,children:[P,n]}),t[23]=P,t[24]=e,t[25]=n,t[26]=a):a=t[26],a}if(!p){let e;t[27]===i?e=t[28]:(e=o(`group relative overflow-hidden rounded-lg border border-border bg-muted`,i),t[27]=i,t[28]=e);let n;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,O.jsx)(`div`,{className:`p-4 text-xs text-muted-foreground`,children:`Rendering diagram…`}),t[29]=n):n=t[29];let r;return t[30]!==P||t[31]!==e?(r=(0,O.jsxs)(`div`,{className:e,children:[P,n]}),t[30]=P,t[31]=e,t[32]=r):r=t[32],r}let F;t[33]===i?F=t[34]:(F=o(`group relative overflow-hidden rounded-lg border border-border bg-muted`,i),t[33]=i,t[34]=F);let I;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>f(!0),t[35]=I):I=t[35];let L;t[36]===p?L=t[37]:(L=(0,O.jsx)(v,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,className:`block w-full text-left cursor-zoom-in p-4 max-w-full overflow-hidden [&_svg]:max-w-full [&_svg]:h-auto hover:bg-muted/70 transition-colors`,onClick:I,dangerouslySetInnerHTML:{__html:p}})}),t[36]=p,t[37]=L);let R;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,O.jsx)(h,{children:`Click to view fullscreen`}),t[38]=R):R=t[38];let z;t[39]===L?z=t[40]:(z=(0,O.jsxs)(_,{children:[L,R]}),t[39]=L,t[40]=z);let B;t[41]!==P||t[42]!==F||t[43]!==z?(B=(0,O.jsxs)(`div`,{className:F,children:[P,z]}),t[41]=P,t[42]=F,t[43]=z,t[44]=B):B=t[44];let V;t[45]!==d||t[46]!==p?(V=d&&(0,O.jsx)(ee,{svgOutput:p,onClose:()=>f(!1)}),t[45]=d,t[46]=p,t[47]=V):V=t[47];let H;return t[48]!==B||t[49]!==V?(H=(0,O.jsxs)(g,{children:[B,V]}),t[48]=B,t[49]=V,t[50]=H):H=t[50],H}var P=`graph.flowchart.sequenceDiagram.classDiagram.stateDiagram.erDiagram.journey.gantt.pie.quadrantChart.requirementDiagram.gitgraph.mindmap.timeline.zenuml.sankey.block.architecture.c4.packet.circuit.flowchart LR.flowchart TD.flowchart BT.flowchart RL.graph LR.graph TD.graph BT.graph RL`.split(`.`),F=[/-->/,/--\./,/-\./,/==>/,/--\|/,/\w+\[\w+\]/,/\w+\(\w+\)/,/\w+\{\w+\}/,/\w+>\w+\]/,/\w+\(\w+\)/,/\w+\[\(\w+\)\]/,/participant\s+\w+/,/actor\s+\w+/,/Note over \w+/,/loop\s+/,/alt\s+/,/opt\s+/,/class\s+\w+/,/interface\s+\w+/,/enum\s+\w+/,/\[\*\]/,/\[\*\]/,/title\s+/,/direction\s+/,/subgraph\s+/];function I(e){if(!e||typeof e!=`string`)return!1;let t=e.split(`
3
+ `).map(e=>e.trim()).filter(e=>e.length>0);if(t.length===0)return!1;if(/```mermaid\s*\n([\s\S]*?)\n```/.test(e))return!0;let n=t[0].toLowerCase();if(P.some(e=>n===e.toLowerCase()||n.startsWith(e.toLowerCase()+` `)))return!0;let r=0;for(let t of F)t.test(e)&&r++;return r>=2}function L(e){if(!I(e))return null;let t=/```mermaid\s*\n([\s\S]*?)\n```/.exec(e);if(t)return t[1].trim();let n=e.split(`
4
+ `).map(e=>e.trim()).filter(e=>e.length>0)[0].toLowerCase();return P.some(e=>n===e.toLowerCase()||n.startsWith(e.toLowerCase()+` `))?e.trim():null}var R=(0,x.memo)(function({content:e,className:t,enableMermaid:n=!1}){let r=(0,x.useMemo)(()=>!e||typeof e!=`string`?[]:z(e,n),[e,n]);if(r.length===0)return null;let i=(0,x.useMemo)(()=>{let e=0;return r.map(t=>{if(t.type===`list`&&t.ordered){let n=e+1;return e+=t.items.length,n}else if(t.type===`list`&&!t.ordered)return 1;else return e=0,1})},[r]);return(0,O.jsx)(`div`,{className:o(`prose-custom space-y-3 min-w-0 break-words`,t),children:r.map((e,t)=>(0,O.jsx)(B,{block:e,start:i[t]},t))})});function z(e,t=!1){let n=e.split(`
5
+ `),r=[],i=0;for(;i<n.length;){let e=n[i];if(e.trimStart().startsWith("```")){let a=e.trimStart().slice(3).trim(),o=[];for(i++;i<n.length&&!n[i].trimStart().startsWith("```");)o.push(n[i]),i++;t&&(a===`mermaid`||I(o.join(`
6
+ `)))?r.push({type:`mermaid`,code:o.join(`
7
+ `)}):r.push({type:`code`,language:a,code:o.join(`
8
+ `)}),i++;continue}let a=e.match(/^(#{1,6})(\s.*)?$/);if(a){r.push({type:`heading`,level:a[1].length,text:a[2]?a[2].trim():``}),i++;continue}if(/^(---|\*\*\*|___)/.test(e.trim())){r.push({type:`hr`}),i++;continue}if(e.includes(`|`)&&i+1<n.length&&n[i+1].match(/^\|?\s*[-:]+/)){let t=e.split(`|`).map(e=>e.trim()).filter(Boolean);i+=2;let a=[];for(;i<n.length&&n[i].includes(`|`);)a.push(n[i].split(`|`).map(e=>e.trim()).filter(Boolean)),i++;r.push({type:`table`,headers:t,rows:a});continue}if(e.startsWith(`> `)){let e=[];for(;i<n.length&&n[i].startsWith(`> `);)e.push(n[i].slice(2)),i++;r.push({type:`blockquote`,text:e.join(`
9
+ `)});continue}if(/^\s*[-*+]\s/.test(e)){let e=[];for(;i<n.length&&/^\s*[-*+]\s/.test(n[i]);)e.push(n[i].replace(/^\s*[-*+]\s/,``)),i++;r.push({type:`list`,ordered:!1,items:e});continue}if(/^\s*\d+\.\s/.test(e)){let e=[];for(;i<n.length&&/^\s*\d+\.\s/.test(n[i]);)e.push(n[i].replace(/^\s*\d+\.\s/,``)),i++;r.push({type:`list`,ordered:!0,items:e});continue}if(e.trim()===``){i++;continue}let o=[];for(;i<n.length&&n[i].trim()!==``&&!n[i].startsWith(`#`)&&!n[i].startsWith("```")&&!n[i].startsWith(`> `)&&!/^\s*[-*+]\s/.test(n[i])&&!/^\s*\d+\.\s/.test(n[i]);)o.push(n[i]),i++;if(o.length>0){let e=o.join(`
10
+ `);if(t&&I(e)){let t=L(e);t?r.push({type:`mermaid`,code:t}):r.push({type:`paragraph`,text:e})}else r.push({type:`paragraph`,text:e})}}return r}var B=(0,x.memo)(function(e){let t=(0,b.c)(42),{block:n,start:r}=e,i=r===void 0?1:r;switch(n.type){case`heading`:{let e=`h${n.level}`,r,i;t[0]!==e||t[1]!==n.level?(r=e,i=o({1:`text-xl font-bold`,2:`text-lg font-semibold`,3:`text-base font-semibold`,4:`text-sm font-semibold`,5:`text-sm font-medium`,6:`text-xs font-medium`}[n.level]),t[0]=e,t[1]=n.level,t[2]=r,t[3]=i):(r=t[2],i=t[3]);let a;t[4]===n.text?a=t[5]:(a=(0,O.jsx)(V,{text:n.text}),t[4]=n.text,t[5]=a);let s;return t[6]!==r||t[7]!==i||t[8]!==a?(s=(0,O.jsx)(r,{className:i,children:a}),t[6]=r,t[7]=i,t[8]=a,t[9]=s):s=t[9],s}case`code`:{let e;return t[10]!==n.code||t[11]!==n.language?(e=(0,O.jsx)(te,{language:n.language,code:n.code}),t[10]=n.code,t[11]=n.language,t[12]=e):e=t[12],e}case`blockquote`:{let e;return t[13]===n.text?e=t[14]:(e=(0,O.jsx)(`blockquote`,{className:`border-l-2 border-border pl-4 text-muted-foreground italic`,children:(0,O.jsx)(V,{text:n.text})}),t[13]=n.text,t[14]=e),e}case`list`:{if(n.ordered){let e;if(t[15]!==n.items||t[16]!==i){let r;t[18]===i?r=t[19]:(r=(e,t)=>(0,O.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,O.jsxs)(`span`,{className:`shrink-0 select-none tabular-nums`,children:[i+t,`.`]}),(0,O.jsx)(`span`,{children:(0,O.jsx)(V,{text:e})})]},t),t[18]=i,t[19]=r),e=n.items.map(r),t[15]=n.items,t[16]=i,t[17]=e}else e=t[17];let r;return t[20]===e?r=t[21]:(r=(0,O.jsx)(`ol`,{className:`space-y-1 text-sm`,children:e}),t[20]=e,t[21]=r),r}let e;t[22]===n.items?e=t[23]:(e=n.items.map(U),t[22]=n.items,t[23]=e);let r;return t[24]===e?r=t[25]:(r=(0,O.jsx)(`ul`,{className:`space-y-1 pl-5 text-sm list-outside overflow-visible list-disc`,children:e}),t[24]=e,t[25]=r),r}case`paragraph`:{let e;return t[26]===n.text?e=t[27]:(e=(0,O.jsx)(`p`,{className:`text-sm leading-relaxed whitespace-pre-wrap break-words`,children:(0,O.jsx)(V,{text:n.text})}),t[26]=n.text,t[27]=e),e}case`hr`:{let e;return t[28]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsx)(`hr`,{className:`border-border`}),t[28]=e):e=t[28],e}case`table`:{let e;t[29]===n.headers?e=t[30]:(e=n.headers.map(ne),t[29]=n.headers,t[30]=e);let r;t[31]===e?r=t[32]:(r=(0,O.jsx)(`thead`,{children:(0,O.jsx)(`tr`,{className:`border-b border-border bg-muted/50`,children:e})}),t[31]=e,t[32]=r);let i;t[33]===n.rows?i=t[34]:(i=n.rows.map(re),t[33]=n.rows,t[34]=i);let a;t[35]===i?a=t[36]:(a=(0,O.jsx)(`tbody`,{children:i}),t[35]=i,t[36]=a);let o;return t[37]!==r||t[38]!==a?(o=(0,O.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border max-w-full`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[r,a]})}),t[37]=r,t[38]=a,t[39]=o):o=t[39],o}case`mermaid`:{let e;return t[40]===n.code?e=t[41]:(e=(0,O.jsx)(N,{content:n.code}),t[40]=n.code,t[41]=e),e}default:return null}}),V=(0,x.memo)(function(e){let t=(0,b.c)(6),{text:n}=e,r;t[0]===n?r=t[1]:(r=H(n),t[0]=n,t[1]=r);let i=r,a;t[2]===i?a=t[3]:(a=i.map(ie),t[2]=i,t[3]=a);let o;return t[4]===a?o=t[5]:(o=(0,O.jsx)(O.Fragment,{children:a}),t[4]=a,t[5]=o),o});function H(e){let t=[],n=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\*[^*]+\*)|(__[^_]+__)|(_[^_]+_)|(~~[^~]+~~)|(\[[^\]]+\]\([^)]+\))/g,r=0,i;for(;(i=n.exec(e))!==null;){i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)});let n=i[0];if(n.startsWith("`"))t.push({type:`code`,text:n.slice(1,-1)});else if(n.startsWith(`**`))t.push({type:`bold`,text:n.slice(2,-2)});else if(n.startsWith(`__`))t.push({type:`bold`,text:n.slice(2,-2)});else if(n.startsWith(`~~`))t.push({type:`strikethrough`,text:n.slice(2,-2)});else if(n.startsWith(`*`)||n.startsWith(`_`))t.push({type:`italic`,text:n.slice(1,-1)});else if(n.startsWith(`[`)){let e=n.match(/\[([^\]]+)\]\(([^)]+)\)/);e&&t.push({type:`link`,text:e[1],href:e[2]})}r=i.index+n.length}return r<e.length&&t.push({type:`text`,text:e.slice(r)}),t.length>0?t:[{type:`text`,text:e}]}function te(e){let t=(0,b.c)(18),{language:n,code:r}=e,[i,o]=(0,x.useState)(!1),s;t[0]===r?s=t[1]:(s=async()=>{await navigator.clipboard.writeText(r),o(!0),setTimeout(()=>o(!1),2e3)},t[0]=r,t[1]=s);let c=s,d=n||`text`,f;t[2]===d?f=t[3]:(f=(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:d}),t[2]=d,t[3]=f);let p;t[4]===i?p=t[5]:(p=i?(0,O.jsx)(l,{}):(0,O.jsx)(u,{}),t[4]=i,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,O.jsx)(`span`,{className:`sr-only`,children:`Copy code`}),t[6]=m):m=t[6];let h;t[7]!==c||t[8]!==p?(h=(0,O.jsxs)(a,{variant:`action`,size:`icon-xs`,onClick:c,children:[p,m]}),t[7]=c,t[8]=p,t[9]=h):h=t[9];let g;t[10]!==f||t[11]!==h?(g=(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/80 px-4 py-2`,children:[f,h]}),t[10]=f,t[11]=h,t[12]=g):g=t[12];let _;t[13]===r?_=t[14]:(_=(0,O.jsx)(`pre`,{className:`overflow-x-auto p-4 max-w-full`,children:(0,O.jsx)(`code`,{className:`text-xs font-mono text-foreground leading-relaxed`,children:r})}),t[13]=r,t[14]=_);let v;return t[15]!==g||t[16]!==_?(v=(0,O.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border border-border bg-muted`,children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17],v}function U(e,t){return(0,O.jsx)(`li`,{children:(0,O.jsx)(V,{text:e})},t)}function ne(e,t){return(0,O.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:(0,O.jsx)(V,{text:e})},t)}function W(e,t){return(0,O.jsx)(`td`,{className:`px-3 py-2`,children:(0,O.jsx)(V,{text:e})},t)}function re(e,t){return(0,O.jsx)(`tr`,{className:`border-b border-border last:border-0`,children:e.map(W)},t)}function ie(e,t){switch(e.type){case`bold`:return(0,O.jsx)(`strong`,{className:`font-semibold`,children:e.text},t);case`italic`:return(0,O.jsx)(`em`,{children:e.text},t);case`strikethrough`:return(0,O.jsx)(`del`,{className:`text-muted-foreground`,children:e.text},t);case`code`:return(0,O.jsx)(`code`,{className:`rounded bg-muted/20 px-1.5 py-0.5 text-xs font-mono`,children:e.text},t);case`link`:return(0,O.jsx)(`a`,{href:e.href,className:`text-primary underline underline-offset-2 hover:text-primary/80`,target:`_blank`,rel:`noopener noreferrer`,children:e.text},t);default:return(0,O.jsx)(`span`,{children:e.text},t)}}export{R as t};
@@ -0,0 +1 @@
1
+ import{Ar as e,Ji as t,Vn as n,Wr as r,ba as i,da as a,ni as o}from"./dialogs-config-vkfELnGl.js";import{c as s,l as c,s as l,u}from"./history-view-Dn0hQIKU.js";var d=i(),f=e();function p(e){let i=(0,d.c)(25),{name:p,description:m,installed:h,onClick:g,onOpen:_,onUninstall:v,showInstalledControls:y}=e,b=y===void 0?!0:y,x=`flex flex-col gap-2 p-2.5 rounded-lg border border-border bg-card text-left transition-colors w-full ${h?``:`hover:bg-accent/50 cursor-pointer`}`,S=h?void 0:g,C=h?void 0:`button`,w;i[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,f.jsx)(`div`,{className:`flex-shrink-0 h-6 w-6 rounded-md bg-muted flex items-center justify-center`,children:(0,f.jsx)(o,{className:`h-3 w-3 text-muted-foreground`})}),i[0]=w):w=i[0];let T;i[1]===p?T=i[2]:(T=(0,f.jsx)(`span`,{className:`font-medium text-sm truncate`,children:p}),i[1]=p,i[2]=T);let E;i[3]!==h||i[4]!==b?(E=h&&b&&(0,f.jsx)(c,{delayDuration:300,children:(0,f.jsxs)(l,{children:[(0,f.jsx)(u,{asChild:!0,children:(0,f.jsx)(`span`,{className:`flex-shrink-0 h-4 w-4 rounded-full bg-green-500/15 flex items-center justify-center`,children:(0,f.jsx)(a,{className:`h-2.5 w-2.5 text-green-600 dark:text-green-400`})})}),(0,f.jsx)(s,{children:`Installed`})]})}),i[3]=h,i[4]=b,i[5]=E):E=i[5];let D;i[6]!==T||i[7]!==E?(D=(0,f.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[w,T,E]}),i[6]=T,i[7]=E,i[8]=D):D=i[8];let O;i[9]!==h||i[10]!==_||i[11]!==v||i[12]!==b?(O=h&&b&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[_&&(0,f.jsx)(c,{delayDuration:300,children:(0,f.jsxs)(l,{children:[(0,f.jsx)(u,{asChild:!0,children:(0,f.jsx)(n,{variant:`ghost`,size:`icon-sm`,onClick:e=>{e.stopPropagation(),_()},children:(0,f.jsx)(t,{className:`h-3.5 w-3.5`})})}),(0,f.jsx)(s,{children:`Open in Explorer`})]})}),v&&(0,f.jsx)(c,{delayDuration:300,children:(0,f.jsxs)(l,{children:[(0,f.jsx)(u,{asChild:!0,children:(0,f.jsx)(n,{variant:`ghost`,size:`icon-sm`,onClick:e=>{e.stopPropagation(),v()},className:`text-destructive hover:text-destructive`,children:(0,f.jsx)(r,{className:`h-3.5 w-3.5`})})}),(0,f.jsx)(s,{children:`Remove`})]})})]}),i[9]=h,i[10]=_,i[11]=v,i[12]=b,i[13]=O):O=i[13];let k;i[14]!==D||i[15]!==O?(k=(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[D,O]}),i[14]=D,i[15]=O,i[16]=k):k=i[16];let A;i[17]===m?A=i[18]:(A=(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-3`,children:m}),i[17]=m,i[18]=A);let j;return i[19]!==k||i[20]!==A||i[21]!==x||i[22]!==S||i[23]!==C?(j=(0,f.jsxs)(`div`,{className:x,onClick:S,role:C,children:[k,A]}),i[19]=k,i[20]=A,i[21]=x,i[22]=S,i[23]=C,i[24]=j):j=i[24],j}export{p as t};