@intent-hq/web 2.372.1 → 2.372.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web/app/immutable/chunks/{SSRyQIWE.js → -il6if-X.js} +1 -1
- package/web/app/immutable/chunks/{B-vPMZJe.js → 0PFbquWg.js} +1 -1
- package/web/app/immutable/chunks/{D7h3Dl5-.js → 2gbKHQXV.js} +1 -1
- package/web/app/immutable/chunks/{B2pOchvy.js → 3vi-OgRR.js} +1 -1
- package/web/app/immutable/chunks/{C9WFArWI.js → 4WFBPbig.js} +2 -2
- package/web/app/immutable/chunks/{D8PTjyMt.js → 64KJqioX.js} +1 -1
- package/web/app/immutable/chunks/{-A1Xt6t2.js → 8vt0w0gB.js} +1 -1
- package/web/app/immutable/chunks/{TET1QjU6.js → AzvtNQGc.js} +1 -1
- package/web/app/immutable/chunks/{B6jc-_sR.js → B3agx6Zv.js} +1 -1
- package/web/app/immutable/chunks/{CKEnN_Hn.js → B430oCRo.js} +1 -1
- package/web/app/immutable/chunks/{BbU8lQ23.js → B4N2SW_I.js} +1 -1
- package/web/app/immutable/chunks/{KwzSRF2d.js → B6OWzTDz.js} +1 -1
- package/web/app/immutable/chunks/{DFudQwu4.js → B77zwvv7.js} +1 -1
- package/web/app/immutable/chunks/{BEAj7h28.js → B8GoKZxM.js} +1 -1
- package/web/app/immutable/chunks/{DLR3Xiy1.js → B93aSOB6.js} +1 -1
- package/web/app/immutable/chunks/{CU2GkTBo.js → BAcZGd3g.js} +1 -1
- package/web/app/immutable/chunks/{kVZwUKh5.js → BDMD6FdT.js} +1 -1
- package/web/app/immutable/chunks/{D1S-BeW0.js → BFAXN_U2.js} +1 -1
- package/web/app/immutable/chunks/{DDRbr07B.js → BIZcpPtH.js} +1 -1
- package/web/app/immutable/chunks/{BJ8UpUx3.js → BMjTWq66.js} +1 -1
- package/web/app/immutable/chunks/{BRbooHVW.js → BQ0lhaiw.js} +1 -1
- package/web/app/immutable/chunks/{C8kqUaJu.js → BR-e1Dqz.js} +4 -4
- package/web/app/immutable/chunks/{BN7MhY13.js → BSXFgzj_.js} +1 -1
- package/web/app/immutable/chunks/{Dh6rqlVy.js → BbbO1mVP.js} +1 -1
- package/web/app/immutable/chunks/{CuiAAAM-.js → BiWBSez2.js} +2 -2
- package/web/app/immutable/chunks/{Cuk_Gihq.js → BjLzmoKu.js} +1 -1
- package/web/app/immutable/chunks/{BxNRSHj7.js → BjmThgx9.js} +3 -3
- package/web/app/immutable/chunks/{CTpG0iUn.js → BlPpu_gv.js} +1 -1
- package/web/app/immutable/chunks/{B-9Pvu6y.js → Bmgc_Vmk.js} +1 -1
- package/web/app/immutable/chunks/{DVuRO9FX.js → BpXYSrHL.js} +4 -4
- package/web/app/immutable/chunks/{VNZmrcSz.js → BuHIOAsb.js} +1 -1
- package/web/app/immutable/chunks/{C1elIQnx.js → Buf2XX2m.js} +1 -1
- package/web/app/immutable/chunks/{DaO8nz6N.js → Byc-Gwn1.js} +2 -2
- package/web/app/immutable/chunks/{EUqcNEWQ.js → C2f0QCtk.js} +1 -1
- package/web/app/immutable/chunks/{CJrtVlDG.js → C4tXJNlU.js} +1 -1
- package/web/app/immutable/chunks/{BRfr79MP.js → C5Ddrquv.js} +1 -1
- package/web/app/immutable/chunks/{CPI29I6f.js → C8F76z1j.js} +1 -1
- package/web/app/immutable/chunks/{D9sQ8qcN.js → C8GDR5mq.js} +1 -1
- package/web/app/immutable/chunks/{0A5oWXer.js → CBP_r2rZ.js} +1 -1
- package/web/app/immutable/chunks/{piULzuzd.js → CCr3GhwT.js} +1 -1
- package/web/app/immutable/chunks/{Cp6ekE_s.js → CEIGYgmC.js} +1 -1
- package/web/app/immutable/chunks/{Cp4OFkA0.js → CLkKOQIb.js} +1 -1
- package/web/app/immutable/chunks/{IcVyfKsD.js → CMR4RacT.js} +1 -1
- package/web/app/immutable/chunks/{zmWxChUq.js → CMd9xe_v.js} +1 -1
- package/web/app/immutable/chunks/{BD3toGAv.js → CNW9Rwes.js} +1 -1
- package/web/app/immutable/chunks/{DD1WD1M5.js → CNc8h__d.js} +1 -1
- package/web/app/immutable/chunks/{DuiyN7wg.js → CP03b_lt.js} +1 -1
- package/web/app/immutable/chunks/{Cqh6RRVt.js → CSUG4tUd.js} +2 -2
- package/web/app/immutable/chunks/{DiFC8Mk6.js → CVA75Jzf.js} +1 -1
- package/web/app/immutable/chunks/{C8e17gER.js → CXXobfG5.js} +1 -1
- package/web/app/immutable/chunks/{CVhHgrXf.js → C_MA8w30.js} +1 -1
- package/web/app/immutable/chunks/{C4Dbybcz.js → CbGkMYMi.js} +1 -1
- package/web/app/immutable/chunks/{DyVTwc41.js → CgyKOUjB.js} +1 -1
- package/web/app/immutable/chunks/{IpC95BdD.js → Ciyw1cDk.js} +1 -1
- package/web/app/immutable/chunks/{CuByX_yP.js → CjmicwNO.js} +1 -1
- package/web/app/immutable/chunks/Ck2JBj0W.js +3 -0
- package/web/app/immutable/chunks/{d4XsLpJr.js → CmfLCgYN.js} +1 -1
- package/web/app/immutable/chunks/{hlGimPBZ.js → CuNdhmq6.js} +1 -1
- package/web/app/immutable/chunks/{DEkD3je6.js → Cu_kcmjo.js} +1 -1
- package/web/app/immutable/chunks/{CrKTQysx.js → CvO597Pq.js} +1 -1
- package/web/app/immutable/chunks/{Dhb96fci.js → CwLBVHwC.js} +1 -1
- package/web/app/immutable/chunks/{Cc-PW4gv.js → CygNkso5.js} +1 -1
- package/web/app/immutable/chunks/{v3dlpdhZ.js → D-5xnKgT.js} +1 -1
- package/web/app/immutable/chunks/{ClsrgcJW.js → D0WHOKE3.js} +1 -1
- package/web/app/immutable/chunks/{DpBTZWt9.js → D4HebHoD.js} +1 -1
- package/web/app/immutable/chunks/{CJJs2g33.js → D4_8WlAX.js} +1 -1
- package/web/app/immutable/chunks/{TYee8CmD.js → D4p9bnGO.js} +1 -1
- package/web/app/immutable/chunks/{2EVipgJi.js → D73rJM26.js} +1 -1
- package/web/app/immutable/chunks/{B873lVHv.js → D7X_WaSL.js} +3 -3
- package/web/app/immutable/chunks/{ChUo22u6.js → D9E1Sed-.js} +3 -3
- package/web/app/immutable/chunks/{nPO4QUTk.js → D9ZsyNyz.js} +1 -1
- package/web/app/immutable/chunks/{vRnYB3t4.js → DAAshoKb.js} +1 -1
- package/web/app/immutable/chunks/{gFsMmW36.js → DL1rChoc.js} +1 -1
- package/web/app/immutable/chunks/{Oweeyv1v.js → DL9oF9R-.js} +1 -1
- package/web/app/immutable/chunks/{Dm3V_bi_.js → DO0YQnSr.js} +1 -1
- package/web/app/immutable/chunks/{fZM82vlq.js → DQITwHBm.js} +2 -2
- package/web/app/immutable/chunks/{QnlnDXiH.js → DSam4kPq.js} +2 -2
- package/web/app/immutable/chunks/{7UCN4F7m.js → DSviIBB2.js} +1 -1
- package/web/app/immutable/chunks/{CGprRn3S.js → DTl-epgW.js} +1 -1
- package/web/app/immutable/chunks/{D-Uz-39Z.js → DUnf3IJM.js} +1 -1
- package/web/app/immutable/chunks/{BiWJoWSv.js → DVkhmNxg.js} +3 -3
- package/web/app/immutable/chunks/{wUr2Clcr.js → DXT_tHZV.js} +3 -3
- package/web/app/immutable/chunks/{D7c2h2XU.js → DXq51U5Z.js} +1 -1
- package/web/app/immutable/chunks/{C7-pF3hJ.js → DZnf3Vcd.js} +1 -1
- package/web/app/immutable/chunks/{MUCe8vjx.js → D_yMjDjB.js} +6 -6
- package/web/app/immutable/chunks/{CtatSKin.js → DdfA1Cl6.js} +2 -2
- package/web/app/immutable/chunks/{CzTHqaDJ.js → DfvdR1t7.js} +13 -13
- package/web/app/immutable/chunks/{C3HJlgor.js → Di8laZBj.js} +1 -1
- package/web/app/immutable/chunks/{Bb_op89B.js → DjHgMTjl.js} +3 -3
- package/web/app/immutable/chunks/{DRbwhDjx.js → DlekFIEJ.js} +1 -1
- package/web/app/immutable/chunks/{jWqlu3Sf.js → DmNlyOFF.js} +2 -2
- package/web/app/immutable/chunks/{uh-AKdCH.js → DoGlKPs8.js} +1 -1
- package/web/app/immutable/chunks/{Demr6Qvy.js → DoKriIRg.js} +1 -1
- package/web/app/immutable/chunks/{CugIOLIa.js → DoUa1hTg.js} +1 -1
- package/web/app/immutable/chunks/{DXoCvZQl.js → DpqgMZNx.js} +1 -1
- package/web/app/immutable/chunks/{BUIz4Yba.js → Dqso2iIq.js} +1 -1
- package/web/app/immutable/chunks/{DVWpH0Ww.js → Dr_KWcsf.js} +1 -1
- package/web/app/immutable/chunks/{CvNJnDlW.js → DsATs4Yw.js} +3 -3
- package/web/app/immutable/chunks/{Bn_8JArX.js → DtPlbqlO.js} +1 -1
- package/web/app/immutable/chunks/{DlXO0azG.js → DumB3eQv.js} +1 -1
- package/web/app/immutable/chunks/{CFPreIC6.js → DyOuvQsx.js} +3 -3
- package/web/app/immutable/chunks/{CutJRErj.js → Dyda26aD.js} +1 -1
- package/web/app/immutable/chunks/{DBeNyp1m.js → Dz9187FZ.js} +1 -1
- package/web/app/immutable/chunks/{xs7GVnBi.js → DzXo18RQ.js} +1 -1
- package/web/app/immutable/chunks/{DkM2tUNb.js → FHdlPR2E.js} +1 -1
- package/web/app/immutable/chunks/{CiKM_Bkk.js → QJaPD5ja.js} +3 -3
- package/web/app/immutable/chunks/{QMZYeDiU.js → Smn45KEu.js} +1 -1
- package/web/app/immutable/chunks/{BtZepnY7.js → TWY-IEJw.js} +1 -1
- package/web/app/immutable/chunks/{DHk9xTTU.js → a_hFrVUs.js} +1 -1
- package/web/app/immutable/chunks/{DJPMh7Pg.js → eHy-2vQk.js} +1 -1
- package/web/app/immutable/chunks/{BbSguaMP.js → eWtOjdwZ.js} +1 -1
- package/web/app/immutable/chunks/{DAd8-v0C.js → ezsQjlt6.js} +1 -1
- package/web/app/immutable/chunks/{Be-tvUeZ.js → kRDyYnu-.js} +1 -1
- package/web/app/immutable/chunks/{BRIObpKH.js → lMYobXp7.js} +1 -1
- package/web/app/immutable/chunks/{vjUVG9_D.js → m5FEmsd9.js} +1 -1
- package/web/app/immutable/chunks/{BAy-IHSv.js → n1Mub_w4.js} +1 -1
- package/web/app/immutable/chunks/{D9uHbDgA.js → pO_uIUtS.js} +2 -2
- package/web/app/immutable/chunks/{D6QsCyM5.js → paBp5EDQ.js} +2 -2
- package/web/app/immutable/chunks/{BOj9vGyw.js → rUAQGuY9.js} +1 -1
- package/web/app/immutable/chunks/{BCAvwmcb.js → s5eSUTR7.js} +1 -1
- package/web/app/immutable/chunks/{DjmUoBsP.js → sppurVVE.js} +1 -1
- package/web/app/immutable/chunks/{Bc_WCBau.js → tDXv5z_U.js} +1 -1
- package/web/app/immutable/chunks/{DuvgBOgL.js → uMNoDmQ2.js} +1 -1
- package/web/app/immutable/chunks/{BQYZptYQ.js → xCNFDAsL.js} +1 -1
- package/web/app/immutable/chunks/{C-CEp48D.js → yc-ZA4uZ.js} +1 -1
- package/web/app/immutable/entry/{app.HXk4QgVW.js → app.DDy_f4Vr.js} +2 -2
- package/web/app/immutable/entry/start.CtWgyCM1.js +1 -0
- package/web/app/immutable/nodes/{0.C35VPs87.js → 0.BIgrj7tk.js} +1 -1
- package/web/app/immutable/nodes/{1.ZQ0mU96X.js → 1.BS4qG73n.js} +1 -1
- package/web/app/immutable/nodes/{10.Ba3bdQFj.js → 10.CoUmfWJP.js} +4 -4
- package/web/app/immutable/nodes/{11.ls9oXbQw.js → 11.Cp19-DaX.js} +1 -1
- package/web/app/immutable/nodes/{15.DwnvTlNj.js → 15._NKX_puo.js} +1 -1
- package/web/app/immutable/nodes/{19.ChdL9npo.js → 19.CrIpgdrd.js} +2 -2
- package/web/app/immutable/nodes/{2.CEHgYNfF.js → 2.B-ARMoF4.js} +4 -4
- package/web/app/immutable/nodes/{3.yDo-Jv4L.js → 3.CeiKZ0d6.js} +1 -1
- package/web/app/immutable/nodes/{4.BfGmTHCX.js → 4.-s0Jfvde.js} +1 -1
- package/web/app/immutable/nodes/{5.CdbvrG1H.js → 5.BIDxYMYJ.js} +1 -1
- package/web/app/immutable/nodes/{6.D-e34gg6.js → 6.3fDeScAq.js} +1 -1
- package/web/app/immutable/nodes/{7.DkqU_r1v.js → 7.DydkXABx.js} +1 -1
- package/web/app/immutable/nodes/{8.DXAWn9Y1.js → 8.DyQruTiJ.js} +1 -1
- package/web/app/immutable/nodes/{9.a_zRpwry.js → 9.D0w1njvH.js} +4 -4
- package/web/app/version.json +1 -1
- package/web/index.html +9 -9
- package/web/app/immutable/chunks/Qqd9dQHZ.js +0 -3
- package/web/app/immutable/entry/start.okH3MvzT.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{k as qa,s as fa}from"./
|
|
1
|
+
import{k as qa,s as fa}from"./D0WHOKE3.js";import{p as ma,g as Ct,I as Wa,X as Qa,e as Nn}from"./BwASeArv.js";import{Z as Ka,cW as Ga,A as Va,a_ as xn,bZ as Ya,v as Xa}from"./eHy-2vQk.js";import{bm as c,t as Pt,bo as w,bw as Tt,b as Rt,bq as qn,bs as Re,br as Za}from"./ClpAEjbe.js";import{bo as Wn,bs as Ot,a5 as O,bl as U,bS as b,bA as $,b_ as x,aD as e,W as l,ay as H,a7 as Oe,bO as L,bn as Lt,c9 as u,aA as k,aB as _,ca as ze,bH as h,b$ as Qt,bV as le,cd as Mt,br as va,be as un,c5 as Ja,bi as En,bj as er,bf as hn,am as ta,ax as na,ai as tr,aj as nr,c0 as ar}from"./CJxGDkBm.js";import{i as M}from"./wmcYjLAa.js";import{s as _a}from"./WSVFXKpL.js";import{e as rr}from"./CARsKzUN.js";import{s as q,g as en,f as ve,b as sr}from"./CnGVh7I3.js";import{a as or,n as ha}from"./oXpJ1LFx.js";import{r as ir,o as lr,A as aa,L as dr}from"./Byc-Gwn1.js";import{t as Dn}from"./DAsc1V4f.js";import{R as ra}from"./C1zxTHwk.js";import{I as ba}from"./MZe3NxQe.js";import"./Gb7Ohwuc.js";import{aN as wn,cK as ur,aw as cr,aL as pr,cE as gr,cF as fr,as as mr,au as vr,aB as _r,aH as hr,s as br,O as wr,e4 as kr,X as xr,cv as yr,c1 as $r}from"./D9Ykl3eH.js";import{Jq as Z,cp as zn,cn as wa,cq as kn,rs as Ar,DQ as Sr,fU as ka,DV as Ir,bE as Cr,A0 as Pr,mM as sa,uo as Tr,ct as Rr,uZ as oa,nI as Or,DA as Lr,DT as Nr,cb as Er}from"./CpP1PKzF.js";import{A as Dr,b as Mr}from"./Dd5ei__B.js";import{y as Fr}from"./Bqd7fdCF.js";import{l as zr}from"./D95Y9O1z.js";import{f as ia}from"./DpqgMZNx.js";import{h as Br,g as jr}from"./0LjODXcP.js";import{o as Hr,S as Ur}from"./DVkhmNxg.js";import"./BYiyLeZ4.js";import{ae as qr,ah as Wr,f as Mn,a1 as Qr}from"./BVi5KkOP.js";import{h as Kr,F as la}from"./CPDV_dyu.js";import"./Qt_rZNko.js";import{C as Gr,k as Vr,j as Yr,i as Xr}from"./B06RKBOm.js";import{L as Zr}from"./B-QV7rQf.js";import{c as de}from"./DSqSJXGX.js";import{c as Bn,b as da,d as jn,a as Hn,A as xa}from"./C8GDR5mq.js";import{l as Wt,b as Jr}from"./By588DV1.js";import{F as es,bc as ts}from"./CVA75Jzf.js";import{D as ns}from"./CXismnoJ.js";import{b as as}from"./B5fQcqb-.js";import{T as rs}from"./Cfkb8WUl.js";import"./D_G_nxUe.js";import{cl as ya,cP as ss,cO as os,bR as is,M as ls,F as yn,b5 as ds,au as us,aK as cs,aG as ps,cT as gs,be as fs,aA as ms,aL as vs,b1 as _s,ah as ua,a8 as hs,c6 as bs,ag as ws,cF as ks,an as xs,cS as ys,aD as $s}from"./CtJxHvGv.js";import{b as As}from"./NtFyWdpR.js";import"./B5wwCKYG.js";import{S as bn}from"./CWDALWEd.js";import{E as Ss}from"./C7RGdxsV.js";import"./V7b2Jgc1.js";import{f as Is}from"./B_eLdLQf.js";import{P as Cs}from"./C-F0IdwG.js";import{b as Ps,P as Ts}from"./DM2Efanx.js";import{h as Rs,H as Os,g as Ls}from"./Ct82vzld.js";const Ns=80,Es=10,Ds=new Ka(Ga,{renderer:{html({text:a}){return Va(a)},image({tokens:a}){return this.parser.parseInline(a)}}});function Qn(a){const n=document.createElement("template");n.innerHTML=Ds.parseInline(a,{async:!1});for(const o of n.content.querySelectorAll("br"))o.replaceWith(" ");return(n.content.textContent??"").replace(/\s+/g," ").trim()}function Ft(a){return a.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`+([^`]*?)`+/g,"$1").replace(/<[^>]+>/g,"").replace(/\\([\\`*_[\]{}()#+\-.!>])/g,"$1").replace(/[*~]/g,"").replace(/(^|[^A-Za-z0-9])_+/g,"$1").replace(/_+([^A-Za-z0-9]|$)/g,"$1").replace(/\s+/g," ").trim()}function Un(a,n){return a.slice(n).replace(/^(?:[ \t]*(?:\r\n|\n|\r))+/,"")}function Sn(a,n){return!n||n.length>Ns||n.split(/\s+/).length>Es||/[.!?;]$/.test(n)?!1:!/^[ \t]*(?:[-+*][ \t]+|\d+[.)][ \t]+|>|```|~~~|\|)/.test(a)}function tl(a){const o=a.trim().match(/^\*\*([^\r\n]+)\*\*$/);if(!o)return null;const i=Ft(o[1]);return Sn(o[0],i)?i:null}function Kn(a,n=!1,o=!0){const i=a.match(/^(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",r=a.slice(i.length).match(/^\*\*([^\r\n]+)\*\*[ \t]*(?:(?:\r\n|\n|\r)|$)/);if(!r)return null;if(n){const v=r[1],f=v.match(/\\+$/)?.[0].length??0;if(v!==v.trim()||v.includes("**")||v.startsWith("*")||v.endsWith("*")||f%2!==0)return null}const p=Ft(r[1]);return Sn(r[0],p)?{title:n&&o?Qn(r[1]):p,body:Un(a,i.length+r[0].length)}:null}function ca(a){const n=[];let o=a;for(;o.trim();){const i=Gn(o,!0),d=i.heading?{body:i.body}:Kn(o,!0,!1);if(!d)return null;n.push(o.slice(0,o.length-d.body.length)),o=d.body}return n.length?n:null}function nl(a){const n=[];let o=a;for(;o.trim();){const i=Gn(o,!0,Qn),d=i.heading?{title:i.heading,body:i.body}:Kn(o,!0);if(!d)return null;n.push(d.title),o=d.body}return n.length?n:null}function al(a){const n=Fs(a),o=[];let i=a;for(n.heading&&(o.push({title:n.heading,body:""}),i=n.body);i;){const d=Kn(i);if(!d||d.body.length>=i.length)break;o.push({title:d.title,body:""}),i=d.body}if(o.length===0){const d=a.trim(),r=Ft(d);return!d.includes(`
|
|
2
2
|
`)&&Sn(d,r)?[{title:r,body:""}]:d?[{title:null,body:d}]:[]}return o[o.length-1].body=i.trim(),o}function Ms(a){const n=a.replace(/^ {0,3}/,"");return!/^(?:\s|>|`{3}|~{3}|(?:[-+*]|\d+[.)])(?:[ \t]|$)|#{1,6}(?:[ \t]|$)|<|\[[^\]]*\]:)/.test(n)&&!/^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})$/.test(n)}function Gn(a,n=!1,o=Ft){const i=a.match(/^(?:\uFEFF)?(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",d=a.slice(i.length);if(n&&/^(?: {4}| {0,3}\t)/.test(d))return{heading:null,body:a};const r=d.match(/^[ \t]{0,3}#{1,6}[ \t]+([^\r\n]*?)(?:[ \t]+#+)?[ \t]*(?:\r\n|\n|\r|$)/);if(r&&Ft(r[1]))return{heading:o(r[1]),body:Un(a,i.length+r[0].length)};const p=d.match(/^([^\r\n]+)(?:\r\n|\n|\r)([ \t]{0,3})(?:=+|-+)[ \t]*(?:\r\n|\n|\r|$)/);return p&&(!n||Ms(p[1])&&!p[2].includes(" "))&&Ft(p[1])?{heading:o(p[1]),body:Un(a,i.length+p[0].length)}:{heading:null,body:a}}function Fs(a,{preserveInlineText:n=!1}={}){const o=n?Qn:Ft,i=Gn(a,!1,o);if(i.heading)return i;const d=a.match(/^(?:\uFEFF)?(?:[ \t]*(?:\r\n|\n|\r))*/)?.[0]??"",p=a.slice(d.length).match(/^([^\r\n]+)(?:\r\n|\n|\r)(?:[ \t]*(?:\r\n|\n|\r))+/);if(p){const v=Ft(p[1]),f=a.slice(d.length+p[0].length);if(f.trim()&&Sn(p[1],v))return{heading:o(p[1]),body:f}}return{heading:null,body:a}}const Kt="[--operational-row-inline-padding:var(--chat-operational-row-inline-padding,0.5rem)] [--operational-leading-slot-size:1.25rem] [--operational-leading-half-slot-size:0.625rem] [--operational-leading-gap:var(--chat-operational-leading-gap,0.5rem)]",rl="type-body font-family-child font-normal text-muted-foreground",sl=`${Kt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))]`,ol=`${Kt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))] pt-1.5`,il=`${Kt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))] pt-1`,ll=`${Kt} relative min-w-0 max-w-full`,dl=`${Kt} min-w-0 max-w-full pl-[calc(var(--operational-row-inline-padding)+var(--operational-leading-slot-size)+var(--operational-leading-gap))]`,ul=`${Kt} operational-group-child-row ml-2 min-w-0 w-[calc(100%-0.5rem)] max-w-[calc(100%-0.5rem)]`,cl="pt-6",pl="text-muted-foreground",gl="text-muted-foreground",$a="font-normal text-muted-foreground",fl="tool-call-container group relative block w-full min-w-0 max-w-full overflow-hidden type-body font-family-child font-normal text-muted-foreground",ml="h-[16px]! w-[16px]! shrink-0",vl=`${Kt} relative grid h-7 w-full min-w-0 max-w-full grid-cols-[var(--operational-leading-slot-size)_minmax(0,1fr)_auto] items-center gap-[var(--operational-leading-gap)] overflow-hidden rounded-md px-[var(--operational-row-inline-padding)] type-body transition-colors duration-[var(--motion-fast)] motion-reduce:transition-none`,_l=`a11y-ignore pointer-events-none flex size-[var(--operational-leading-slot-size)] min-w-[var(--operational-leading-slot-size)] shrink-0 items-center justify-center [&_svg]:size-[16px]! ${$a}`,hl=`type-body block min-w-0 max-w-full truncate overflow-hidden text-ellipsis whitespace-nowrap border-0 bg-transparent p-0 text-left ${$a}`,bl="type-body flex min-w-0 shrink-0 items-center gap-1 whitespace-nowrap",wl="h-[16px]! w-[16px]! shrink-0 opacity-60 transition-transform duration-[var(--motion-fast)] motion-reduce:transition-none";function kl(a){return qa(a,{axis:"y",duration:ma()?0:150})}function cn(a){return a.type==="thinking"||a.type==="tool_use"||a.type==="content_group"}function xl(a){const n=a?.[0];return!n||cn(n)?"":"pt-4"}function yl(a,n,o=()=>!0){const i=a[n];if(!i||!o(i)||!cn(i))return!1;let d=n-1;for(;d>=0&&!o(a[d]);)d-=1;return d>=0&&cn(a[d])}function $l(a,n,o=()=>!0,i=!1){const d=a[n];if(!d||!o(d))return"";let r=n-1;for(;r>=0&&!o(a[r]);)r-=1;if(r<0)return"";const p=a[r];if(p.type==="thinking"&&d.type==="thinking")return i||ca(p.text??p.content??"")!==null&&ca(d.text??d.content??"")!==null?"":"pt-14";const v=cn(p),f=cn(d);return v&&f?"":p.type==="thinking"&&!f?"pt-6":v||f?"pt-4":"pt-1"}const Al="shrink-0 whitespace-nowrap text-ui text-subtle focus-visible:outline-none focus-visible:text-foreground";function zs(a){if(a?.status==="halted")return c.agent_node_halted_label();if(a?.status==="resuming")return c.agent_node_resuming_label();if(a?.placement?.target==="remote"||Fr(a?.placement?.target)){if(a.placementError)return c.remoteAgent_status_failed();if(a.cloudStart)return c.remoteAgent_status_starting();if(a.effectiveIsolation==="pending")return a.setup?.state==="pending"?c.remoteAgent_status_preparingCheckout():a.setup?.state==="running"?c.remoteAgent_status_runningSetup():c.remoteAgent_status_starting()}if(a?.placement&&a.effectiveIsolation==="pending")return c.agent_node_provisioning_label()}var Bs=_('<span class="owner-fill block h-full svelte-sxf8s9"></span>'),js=_('<span class="shrink-0 text-xs text-muted-foreground"> </span>'),Hs=_('<span class="flex items-center gap-2"><span class="group-key size-1.5 shrink-0 rounded-full svelte-sxf8s9"></span> <span class="min-w-0 flex-1"> </span> <!> <span> </span></span>'),Us=_('<dd class="col-span-2 pl-[1.125rem] text-xs text-muted-foreground wrap-anywhere"> </dd>'),qs=_(`<div class="grid grid-cols-[1fr_auto] items-baseline gap-x-3 py-0.5 text-sm"><dt class="relative min-w-0 pl-[1.125rem] wrap-anywhere before:absolute before:top-2 before:left-0 before:size-1 before:rounded-full before:bg-muted-foreground before:content-['']"> </dt> <dd> </dd> <!></div>`),Ws=_('<dl class="ml-3.5 text-foreground"></dl>'),Fn=_("<!> <!>",1),Qs=_('<span class="flex items-center gap-2"><span class="min-w-0 flex-1"> </span> <span class="shrink-0 tabular-nums text-muted-foreground"> </span></span>'),Ks=_('<div class="min-w-0"><dt class="truncate text-sm text-foreground"> </dt> <dd class="text-xs text-muted-foreground wrap-anywhere"> </dd></div>'),Gs=_('<dl class="ml-3.5 flex flex-col gap-2"></dl>'),Vs=_('<section class="min-w-0" data-testid="prompt-breakdown"><div class="mb-3 flex items-baseline justify-between gap-3"><h3 class="text-sm font-medium"> </h3> <span class="shrink-0 text-sm tabular-nums text-muted-foreground"> </span></div> <div class="owner-strip mb-2 flex h-1.5 w-full overflow-hidden svelte-sxf8s9" role="img"></div> <!></section>');function Aa(a,n){const o=Wn();if(new.target)return Pt({component:Aa,...a});Ot(n,!0);let i=w(n,"breakdown",7);const d="type-body font-normal text-foreground data-[state=open]:font-normal";function r(T){return Jr(T,{maximumFractionDigits:T<1e4?1:0})}function p(T){return T==="native"?c.agent_contextBreakdown_owner_native_label():T==="intent"?c.agent_contextBreakdown_owner_intent_label():c.agent_contextBreakdown_owner_user_label()}const v=u(()=>i().owners.map(T=>c.agent_contextBreakdown_ownerShare_label({owner:p(T.owner),tokens:r(T.estTokens)})).join(", "));var f={get breakdown(){return i()},set breakdown(T){i(T),k()},$set:Tt,$on:(T,m)=>Rt(n,T,m)},S=Vs(),y=O(S),g=O(y),E=U(g,!0),F=b(g,2),Ce=U(F,!0);$(y);var D=b(y,2);Ct(D,21,()=>i().owners,T=>T.owner,(T,m)=>{var me=Bs();let ue;x(()=>{q(me,"data-owner",e(m).owner),ue=en(me,"",ue,{"flex-grow":e(m).share})}),l(T,me)}),$(D);var P=b(D,2);return de(P,()=>xa,(T,m)=>{m(T,{type:"multiple",children:(me,ue)=>{var R=Fn(),_e=H(R);Ct(_e,17,()=>i().groups,pe=>pe.kind,(pe,G)=>{var W=Oe(),ne=H(W);de(ne,()=>Bn,(ge,Fe)=>{Fe(ge,{get value(){return e(G).kind},get"data-prompt-group"(){return e(G).kind},children:(ot,K)=>{var I=Fn(),ae=H(I);de(ae,()=>da,(he,N)=>{N(he,{level:4,children:(Le,X)=>{var Q=Oe(),J=H(Q);de(J,()=>jn,(V,oe)=>{oe(V,{inset:!1,class:d,children:(ee,Ne)=>{var be=Hs(),je=O(be),et=b(je,2),ut=U(et,!0),tt=b(et,2);{var at=ct=>{var Nt=js(),yt=U(Nt,!0);x(Y=>L(yt,Y),[()=>c.agent_contextBreakdown_notCounted_label()]),l(ct,Nt)};M(tt,ct=>{e(G).kind==="native"&&ct(at)})}var Ee=b(tt,2),Gt=U(Ee,!0);$(be),x((ct,Nt)=>{q(je,"data-kind",e(G).kind),L(ut,ct),ve(Ee,1,`shrink-0 tabular-nums ${e(G).kind==="native"?"text-muted-foreground":""}`),L(Gt,Nt)},[()=>p(e(G).kind),()=>r(e(G).estTokens)]),l(ee,be)},$$slots:{default:!0}})}),l(Le,Q)},$$slots:{default:!0}})});var Be=b(ae,2);de(Be,()=>Hn,(he,N)=>{N(he,{inset:!1,children:(Le,X)=>{var Q=Ws();Ct(Q,21,()=>e(G).rows,J=>J.key,(J,V)=>{var oe=qs(),ee=O(oe),Ne=U(ee,!0),be=b(ee,2),je=U(be,!0),et=b(be,2);{var ut=tt=>{var at=Us(),Ee=U(at,!0);x(()=>L(Ee,e(V).hint)),l(tt,at)};M(et,tt=>{e(V).hint&&tt(ut)})}$(oe),x(tt=>{L(Ne,e(V).label),ve(be,1,`tabular-nums ${e(V).counted?"":"text-muted-foreground"}`),L(je,tt)},[()=>r(e(V).estTokens)]),l(J,oe)}),$(Q),l(Le,Q)},$$slots:{default:!0}})}),l(ot,I)},$$slots:{default:!0}})}),l(pe,W)});var ce=b(_e,2);{var xe=pe=>{var G=Oe(),W=H(G);de(W,()=>Bn,(ne,ge)=>{ge(ne,{value:"hidden-skills",class:"mt-1",children:(Fe,ot)=>{var K=Fn(),I=H(K);de(I,()=>da,(Be,he)=>{he(Be,{level:4,children:(N,Le)=>{var X=Oe(),Q=H(X);de(Q,()=>jn,(J,V)=>{V(J,{inset:!1,class:d,children:(oe,ee)=>{var Ne=Qs(),be=O(Ne),je=U(be,!0),et=b(be,2),ut=U(et,!0);$(Ne),x((tt,at)=>{L(je,tt),L(ut,at)},[()=>c.agent_contextBreakdown_hiddenSkills_title(),()=>Wt(i().hiddenSkills.length)]),l(oe,Ne)},$$slots:{default:!0}})}),l(N,X)},$$slots:{default:!0}})});var ae=b(I,2);de(ae,()=>Hn,(Be,he)=>{he(Be,{inset:!1,children:(N,Le)=>{var X=Gs();Ct(X,21,()=>i().hiddenSkills,Q=>Q.name,(Q,J)=>{var V=Ks(),oe=O(V),ee=U(oe,!0),Ne=b(oe,2),be=U(Ne,!0);$(V),x(je=>{L(ee,e(J).name),L(be,je)},[()=>[e(J).detail,e(J).fix].filter(Boolean).join(" · ")]),l(Q,V)}),$(X),l(N,X)},$$slots:{default:!0}})}),l(Fe,K)},$$slots:{default:!0}})}),l(pe,G)};M(ce,pe=>{i().hiddenSkills.length>0&&pe(xe)})}l(me,R)},$$slots:{default:!0}})}),$(S),x((T,m)=>{q(S,"aria-labelledby",`${o}-title`),q(g,"id",`${o}-title`),L(E,T),L(Ce,m),q(D,"aria-label",e(v))},[()=>c.agent_contextBreakdown_title(),()=>c.agent_contextBreakdown_tokens_label({tokens:r(i().estTokens)})]),l(a,S),Lt(f)}const Ys=["intent","user"],Xs=["systemPrompt","toolDescription","provider"],Zs=["native","user","intent"],$n=a=>typeof a=="object"&&a!==null&&!Array.isArray(a),An=a=>typeof a=="number"&&Number.isFinite(a)&&a>=0,Js=a=>a==="intent"||a==="user";function eo(a,n){if(!$n(a))return null;const{id:o,label:i,owner:d,location:r,chars:p,estTokens:v,controlHint:f}=a;if(typeof o!="string"||typeof i!="string"||!Js(d)||typeof r!="string"||!Xs.includes(r)||!An(p)||!An(v))return null;const S=$n(f)&&typeof f.text=="string"&&f.text;return{key:`${n}:${o}`,id:o,label:i,owner:d,chars:p,estTokens:v,counted:r!=="provider",...S?{hint:S}:{}}}function to(a){if(!$n(a))return null;const{name:n,reason:o,detail:i,fix:d}=a;return[n,o,i,d].some(r=>typeof r!="string")?null:{name:n,reason:o,detail:i,fix:d}}function no(a){if(!$n(a)||a.available!==!0)return null;const{totalChars:n,estTokens:o,sections:i,hiddenSkills:d}=a;if(!An(n)||!An(o)||!Array.isArray(i)||!Array.isArray(d))return null;const r=i.map(eo).filter(f=>f!==null).sort((f,S)=>S.chars-f.chars),p=Ys.map(f=>{const S=r.filter(g=>g.counted&&g.owner===f),y=S.reduce((g,E)=>g+E.chars,0);return{owner:f,chars:y,estTokens:S.reduce((g,E)=>g+E.estTokens,0),share:n>0?y/n:0}}).filter(f=>f.chars>0),v=Zs.map(f=>{const S=r.filter(y=>f==="native"?!y.counted:y.counted&&y.owner===f);return{kind:f,chars:S.reduce((y,g)=>y+g.chars,0),estTokens:S.reduce((y,g)=>y+g.estTokens,0),rows:S}}).filter(f=>f.rows.length>0);return{totalChars:n,estTokens:o,rows:r,groups:v,owners:p,hiddenSkills:d.map(to).filter(f=>f!==null)}}async function ao(a){try{const n=await Kr("agent.getSession",{agentId:a});return no(n?.session?.promptBreakdown)}catch{return null}}const pa=es.map(a=>({key:a.path.replace(/^agentFeatures\./,""),label:a.label,description:a.description}));function ro(a){const n=a.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase().trim();return n.charAt(0).toUpperCase()+n.slice(1)}function so(a){const n=a??{},o=pa.map(r=>({key:r.key,label:r.label(),description:r.description(),enabled:n[r.key]===!0,known:!0})),i=new Set(pa.map(r=>r.key)),d=[];for(const[r,p]of Object.entries(n))i.has(r)||d.push({key:r,label:ro(r),description:null,enabled:p===!0,known:!1});return d.sort((r,p)=>r.label.localeCompare(p.label)),o.concat(d)}var oo=_('<div class="mb-6 border-b border-border pb-6"><!></div>'),io=_("<span> </span>"),lo=_('<!> <span class="sr-only"> </span>',1),uo=_('<div role="listitem" class="text-xs text-subtle" aria-hidden="true">—</div>'),co=_('<section class="min-w-0"><h4 class="text-sm font-medium mb-3"> </h4> <div role="list" class="space-y-2"></div></section>'),po=_('<div class="@container"><!> <section><h3 class="text-sm font-medium"> </h3> <p class="mb-4 mt-1 text-sm text-muted-foreground"> </p> <div class="grid grid-cols-1 gap-6 @min-[28rem]:grid-cols-2" data-testid="harness-features-list"></div></section></div>');function Sa(a,n){const o=Wn();if(new.target)return Pt({component:Sa,...a});Ot(n,!0);let i=w(n,"open",15,!1),d=w(n,"static",7,!1),r=w(n,"version",7),p=w(n,"features",7,null),v=w(n,"agentId",7),f=w(n,"breakdown",7),S=le(null);const y=u(()=>f()===void 0&&!!v());ze(()=>{if(!i()||!e(y)||!v())return;const D=v();let P=!0;return ao(D).then(T=>{P&&h(S,{agentId:D,view:T},!0)}),()=>{P=!1}});const g=u(()=>f()!==void 0?f():e(y)&&e(S)&&e(S).agentId===v()?e(S).view:null),E=u(()=>so(p())),F=u(()=>[{enabled:!0,label:c.chat_shared_valueOn_label(),rows:e(E).filter(D=>D.enabled)},{enabled:!1,label:c.chat_shared_valueOff_label(),rows:e(E).filter(D=>!D.enabled)}]);var Ce={get open(){return i()},set open(D=!1){i(D),k()},get static(){return d()},set static(D=!1){d(D),k()},get version(){return r()},set version(D){r(D),k()},get features(){return p()},set features(D=null){p(D),k()},get agentId(){return v()},set agentId(D){v(D),k()},get breakdown(){return f()},set breakdown(D){f(D),k()},$set:Tt,$on:(D,P)=>Rt(n,D,P)};{let D=u(()=>c.chat_harnessFeaturesModal_title({version:r()}));Gr(a,{get static(){return d()},get title(){return e(D)},size:"wide",get open(){return i()},set open(P){i(P)},children:(P,T)=>{var m=po(),me=O(m);{var ue=W=>{var ne=oo(),ge=O(ne);Aa(ge,{get breakdown(){return e(g)}}),$(ne),l(W,ne)};M(me,W=>{e(g)&&W(ue)})}var R=b(me,2),_e=O(R),ce=U(_e,!0),xe=b(_e,2),pe=U(xe,!0),G=b(xe,2);Ct(G,21,()=>e(F),W=>W.enabled,(W,ne)=>{var ge=co(),Fe=O(ge),ot=U(Fe,!0),K=b(Fe,2);Ct(K,21,()=>e(ne).rows,I=>I.key,(I,ae)=>{Zr(I,{role:"listitem",class:"min-h-0 px-0 py-0 [&_.truncate]:whitespace-normal","data-testid":"harness-feature-state",get"data-feature"(){return e(ae).key},get"data-enabled"(){return e(ae).enabled},title:he=>{var N=Oe(),Le=H(N);{var X=J=>{var V=lo(),oe=H(V);qr(oe,{get content(){return e(ae).description},side:"top",size:"sm",children:(be,je)=>{var et=io(),ut=U(et,!0);x(()=>L(ut,e(ae).label)),l(be,et)},$$slots:{default:!0}});var ee=b(oe,2),Ne=U(ee,!0);x(()=>L(Ne,e(ae).description)),l(J,V)},Q=J=>{var V=Qt();x(()=>L(V,e(ae).label)),l(J,V)};M(Le,J=>{e(ae).description?J(X):J(Q,-1)})}l(he,N)},$$slots:{title:!0}})},I=>{var ae=uo();l(I,ae)}),$(K),$(ge),x(()=>{q(ge,"aria-label",e(ne).label),L(ot,e(ne).label)}),l(W,ge)}),$(G),$(R),$(m),x((W,ne)=>{q(R,"aria-labelledby",`${o}-capabilities`),q(_e,"id",`${o}-capabilities`),L(ce,W),L(pe,ne)},[()=>c.chat_harnessFeaturesModal_capabilities_title(),()=>c.chat_harnessFeaturesModal_description()]),l(P,m)},$$slots:{default:!0}})}return Lt(Ce)}var go=_('<p role="alert" class="type-body text-danger"> </p>');function Ia(a,n){if(new.target)return Pt({component:Ia,...a});Ot(n,!0);const o=()=>Re(g,"$outcome$",i),[i,d]=qn();let r=w(n,"open",15,!1),p=w(n,"agentName",7),v=w(n,"workspaceId",7),f=w(n,"agentId",7);const S=crypto.randomUUID(),y=Mt(""),g=xn(y,S),E=u(()=>o()?.workspaceId===v()&&o().agentId===f()?o():void 0),F=u(()=>e(E)?.status==="pending"),Ce=u(()=>e(E)?.status==="failed"?e(E).error:"");ze(()=>{const m=v();return f(),y.set(m),()=>Z.dispatch(zn(m,S))}),ze(()=>{e(E)?.status==="succeeded"&&(r(!1),Z.dispatch(wa(v(),S,e(E).requestId)))});function D(){const m=xn.select(Z.state,v(),S);m?.agentId===f()&&m.status==="pending"||Z.dispatch(kn(v(),S,crypto.randomUUID(),f(),{kind:"retire"}))}var P={get open(){return r()},set open(m=!1){r(m),k()},get agentName(){return p()},set agentName(m){p(m),k()},get workspaceId(){return v()},set workspaceId(m){v(m),k()},get agentId(){return f()},set agentId(m){f(m),k()},$set:Tt,$on:(m,me)=>Rt(n,m,me)};{const m=ce=>{var xe=Oe(),pe=H(xe);{var G=W=>{var ne=go(),ge=U(ne,!0);x(()=>L(ge,e(Ce))),l(W,ne)};M(pe,W=>{e(Ce)&&W(G)})}l(ce,xe)};let me=u(()=>c.modals_retireAgent_title()),ue=u(()=>c.modals_retireAgent_description({name:p()})),R=u(()=>c.modals_retireAgent_confirm_label()),_e=u(()=>c.modals_bulkActionConfirm_cancel_label());ns(a,{get title(){return e(me)},get description(){return e(ue)},get confirmLabel(){return e(R)},get cancelLabel(){return e(_e)},focusSubmit:!1,focusCancel:!0,get busy(){return e(F)},onConfirm:D,get open(){return r()},set open(ce){r(ce)},details:m,$$slots:{details:!0}})}var T=Lt(P);return d(),T}function fo({agentName:a,specialist:n}){const o=n?`{ topLevel: true, specialist: ${JSON.stringify(n)} }`:"{ topLevel: true }",i=n?`and keep the same specialist (${JSON.stringify(n)})`:"and, if you were created with a specialist, pass that exact same `specialist` value in the options";return`Please replace yourself with a fresh top-level agent and run a gradual, coordinated hand-off:
|
|
3
3
|
|
|
4
4
|
1. Create your replacement now: call \`ws.agent.create(${JSON.stringify(a)}, kickoffMessage, ${o})\`. The first argument must be your EXACT current name (${JSON.stringify(a)}) ${i}. Write the kickoff message as a thorough context hand-off: the overall goal, the current state of the work, key notes and files, decisions already made, and open threads.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var M_=Object.defineProperty;var Ag=n=>{throw TypeError(n)};var E_=(n,r,a)=>r in n?M_(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a;var Qs=(n,r,a)=>E_(n,typeof r!="symbol"?r+"":r,a),q_=(n,r,a)=>r.has(n)||Ag("Cannot "+a);var Co=(n,r,a)=>(q_(n,r,"read from private field"),a?a.call(n):r.get(n)),Mg=(n,r,a)=>r.has(n)?Ag("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,a);import{t as dn,bo as Z,bw as un,bp as nf,b as gn,bm as g,bq as Dr,bs as fe,br as Ei}from"./ClpAEjbe.js";import{bs as pn,a5 as I,bf as fs,bA as b,W as p,bn as fn,aA as ee,aB as E,ca as le,a7 as Bt,ay as ye,aD as e,cd as Nn,c9 as o,bS as m,bl as de,be as In,b_ as q,bO as z,c5 as ct,bH as _,bV as _e,bj as Es,bk as to,b$ as _n,ai as Od,aj as ps,bo as Wl,br as Rr,c0 as Lt,cb as nd,aw as _i,a as L_}from"./CJxGDkBm.js";import{i as B}from"./wmcYjLAa.js";import{k as ki}from"./Xh71Wbuh.js";import{g as Hn,i as H_,I as Mo,p as Eo,e as To}from"./BwASeArv.js";import{n as Dt,l as ma,c as Zs,j as Eg,k as Ho,h as O_}from"./oXpJ1LFx.js";import{b as rf,e as Fd,f as ke,s as Ue,c as Ut,g as gs}from"./CnGVh7I3.js";import{b as F_}from"./DfTSMq0b.js";import{b as hr}from"./NtFyWdpR.js";import{m as D_,U as N_,Z as B_,X as W_,Y as U_,I as qg,o as z_,l as j_,a2 as V_,x as Lg,$ as G_,a0 as Hg,r as K_,s as Q_}from"./CFPreIC6.js";import{Jq as O,fo as J_,eW as Y_,f3 as X_,eX as Z_,f1 as ew,f0 as tw,eZ as nw,e$ as rw,eY as aw,rs as sw,c6 as ow,i as Si,I$ as iw,D8 as af,Dd as lw,Df as Og,Dc as cw,De as dw,vB as uw,vD as gw,Cl as sf,cp as pw,cn as fw,Bu as vw,bE as hw,A0 as mw,Ca as rd,uZ as _w,cq as Fg,dB as ww,dC as bw,Ck as yw,el as Iw,CE as Sw,CD as $w,CI as kw,CH as xw,cQ as Cw,cT as Pw,nA as Rw,er as Tw,wO as Aw,CJ as Mw,wQ as Ew,CK as qw,cU as Lw,cV as Hw,nI as Ow,Ad as Fw,Dp as Dw,wj as Nw,wk as Bw,yY as Ww,z0 as ad,wf as Uw,wg as zw,rQ as jw,rd as Vw,rb as Gw,f_ as Kw,HK as Qw,Le as Jw,GI as Yw,gn as Xw,p0 as Zw,Je as eb,oh as tb,z$ as nb,ft as Dg,r0 as Ng,fm as rb,fl as ab,tz as sb,g3 as Bg,rc as ob,fe as ib,C5 as lb,m as cb,nJ as db,zE as ub,yW as gb,Ev as pb,Ek as Wg,xe as fb,xf as Ug,uY as zg,p1 as vb,DB as hb,gj as mb,g1 as _b,eU as wb,cM as bb,A3 as yb,Lj as Ib,Cq as Sb,LB as $b,x$ as kb,ga as xb,fd as Cb,cL as Pb,cI as Rb,cH as Tb,vp as Ab,xl as Mb,xj as Eb,cF as qb,cE as Lb,z2 as Hb,yZ as Ob,xk as Fb}from"./CpP1PKzF.js";import{a as Dd}from"./CC7to1B5.js";import{aB as Db,aA as Nb,b1 as Bb,_ as Wb,as as Ub,aD as zb,z as of,R as lf,aV as jb,aP as Vb,ai as jg,J as _l,aN as Vg,aM as Gg,aL as Kg}from"./CvNJnDlW.js";import{k as cf,F as Gb,G as df,ao as Kb,aX as Tl,a5 as uf,Q as Qb,aQ as sd,al as Jb,aD as Yb,B as Xb,y as gf,r as Zb,z as ey,u as ty,aV as ny,aB as pf,aA as ff,aC as ry,aG as od,aN as Qg,aM as wl,aO as Jg,P as Yg,d as ay,e as sy,as as oy,V as Xg,az as iy,c as ly,l as cy,aP as Zg,ak as dy,ar as ep,a as uy,av as gy,a9 as tp,ay as py,aR as np,aU as rp,m as ap,aa as fy,R as vy,at as sp,ah as hy,O as my,an as _y,h as wy,p as by,ax as op,a4 as yy,f as Iy,i as Sy,a2 as $y,a8 as ky}from"./wUr2Clcr.js";import{d as xy,l as Cy,x as Py,v as Ry,k as Ty,Z as ip,a5 as Ay,D as My,c as Ey}from"./BxKppgO5.js";import{g as Ci}from"./DypB-Dwi.js";import{dT as Hl,cR as vf,O as hf,W as qy,bs as Ly,aE as mf,dE as _f,aT as Ao,e4 as Hy,dt as wf,av as Nd,dS as Bd,aM as bf,cM as Oy,V as ha,a3 as Ys,B as Fy,a7 as Dy,a4 as Ny,M as By,a6 as Wy,ar as Uy,aF as yf,aN as Al,r as zy,n as $d,H as jy,dV as Vy,aP as Gy,aJ as Ky,c6 as Qy,aV as Jy,bJ as Yy,bH as Xy,bI as Zy,c5 as eI,c4 as tI,cK as nI,cJ as rI,aR as aI,b9 as sI,bb as oI,be as iI,ba as lI,bj as cI,bd as dI,bc as uI,bf as gI,bg as pI,bi as fI,bh as vI,aw as hI,ax as mI,cg as _I,ch as wI,ds as bI,dr as yI,a_ as II,G as SI,b2 as $I,cc as kI,C as lp,cZ as xI,b8 as ds,bY as CI,X as PI,E as RI,ad as TI,t as AI,cT as MI,d0 as cp,Q as dp,dq as EI,cN as id}from"./D9Ykl3eH.js";import{u as If,a as bl,ag as qI,x as LI,ad as Sf,af as HI,ac as $f,a4 as OI,F as up,D as FI,e as DI,n as NI,s as BI,m as WI,Y as UI,k as zI}from"./DRbwhDjx.js";import{a4 as jI,b5 as VI,cM as GI,a_ as KI,b4 as QI,c2 as JI,c9 as YI,w as XI,x as ZI,cd as eS}from"./DJPMh7Pg.js";import{n as tS,P as kf,F as nS,ai as rS,r as aS,ac as sS}from"./CgBcONKs.js";import{I as oS,s as iS,H as gp}from"./Bqd7fdCF.js";import{e as lS}from"./CL3a4Hm1.js";import{e as cS,f as dS}from"./BqoCUMk3.js";import{s as uS,o as Xs,b as gS,g as Ol,d as pS,l as wi}from"./CIyUrgF0.js";import{a4 as fS,a6 as vS,D as hS,M as mS,ab as pp,W as _S,i as wS,r as ir,v as Pi,u as Xr,p as $i,x as mr,S as Wd,m as Ul,s as qo,y as Ri,o as no,n as ro,t as fp,a9 as ao,w as so,a8 as Ud,q as _a,z as Lo,I as kd,Z as vp,g as bS,F as yS,U as xf,H as Cf,a7 as Pf,a5 as Ml,N as IS,E as Rf,R as SS,A as $S,b as kS,aa as xS,ac as yl,e as ld,l as CS,C as PS,f as Js,j as hp,G as us,Q as RS,d as cd,c as TS,a as mp,h as AS,K as MS,X as _p,a3 as dd,a0 as wp,$ as ES,a2 as bp,_ as yp,T as qS,B as LS,k as HS,a1 as OS,J as FS,P as DS,O as NS,V as BS}from"./BRbooHVW.js";import{m as WS}from"./PVXvIyE8.js";import{g as Tf}from"./0LjODXcP.js";import{b as US}from"./C5TH9nNS.js";import{g as zS}from"./BriVXGmT.js";import{a as jS}from"./CvXttgUy.js";import{q as Af,d as lr,r as VS,e as Fl,j as GS,g as xd,i as KS,f as Cd,c as QS,A as JS,O as Ip,k as YS}from"./Demr6Qvy.js";import{P as XS}from"./Dp3fRAus.js";import{e as ZS}from"./DemmMiIF.js";import{b as e$,a as t$,g as n$,c as r$,i as a$}from"./CNcD7ed8.js";import{R as s$,g as o$,W as Il,c as i$}from"./D1S-BeW0.js";import"./Gb7Ohwuc.js";import"./BYiyLeZ4.js";import{s as Ti}from"./WSVFXKpL.js";import{F as l$,h as c$}from"./CPDV_dyu.js";import"./Qt_rZNko.js";import{C as d$,e as Or,L as u$,l as zl,d as jl,K as Vl,h as zd,M as Gl,S as Da}from"./B06RKBOm.js";import{D as g$}from"./CHXqkR4Y.js";import{f as Sp}from"./D35mkEt2.js";import"./BoIfXiRv.js";import{i as Mf}from"./D-g0wh54.js";import{h as $p,i as kp,g as xp,P as Cp,C as p$,m as El,R as f$}from"./C1zxTHwk.js";import{f as xt,ae as v$}from"./BVi5KkOP.js";import{F as pt,bs as h$,cd as m$,aw as Na,a2 as Ef,c9 as _$,bf as w$,be as b$,bg as y$,aO as Pp,aj as ud,aB as gd,bB as qf,d3 as Dl,cF as I$,aM as Rp,cb as Tp,cK as Nl,bu as S$,aS as $$,d0 as k$,a8 as Lf,ac as x$,ag as C$,cr as P$,ba as R$,aC as Hf,cT as Ap,cz as T$,ax as A$,cD as M$,c3 as E$}from"./CtJxHvGv.js";import{c as Of}from"./ChTqQfQN.js";import"./BeYVt6Wg.js";import{c as Rt}from"./DSqSJXGX.js";import{a5 as Ff,bg as q$,ar as L$,k as H$,Y as O$,W as F$,a2 as D$,Z as N$,bw as B$,V as W$,a1 as U$,ah as z$}from"./DiFC8Mk6.js";import{d as Bl,f as j$,e as V$}from"./DXoCvZQl.js";import{A as G$}from"./BCrI1nnw.js";import{D as K$}from"./DnYPeWf9.js";import"./B5wwCKYG.js";import{a as Q$,C as J$}from"./BTW5Qz3T.js";import"./V7b2Jgc1.js";import{C as Y$}from"./C7RGdxsV.js";import{h as Pd,r as X$,a as Z$}from"./D6QsCyM5.js";import{s as ek}from"./CRpGhS3h.js";import{I as tk,a as nk}from"./MZe3NxQe.js";import{L as rk}from"./CIMWDf4a.js";import{g as ak,f as sk,b as ok}from"./b89lNINv.js";import{s as Ai,g as Kn,i as ik,j as lk,e as Mp,r as Ep,f as ck,d as dk,a as pd,h as uk}from"./ClsrgcJW.js";import{i as qp,a as gk}from"./Bu13V5mO.js";import{seekConversationToMessage as Lp}from"./Be-tvUeZ.js";import{l as Yt,o as fd,h as jd,n as Rd,q as pk}from"./By588DV1.js";import{o as fk}from"./DaO8nz6N.js";import{A as Df}from"./BQgCURYe.js";import{b as Nf}from"./Dd5ei__B.js";import{g as vk,e as Bf,v as hk,f as mk,N as _k,M as wk,K as bk,k as Wf,l as yk,H as Uf,s as zf}from"./Qqd9dQHZ.js";import{selectCurrentWorkspaceTabId as vd}from"./DujUyPvo.js";import{o as Ik}from"./DHk9xTTU.js";import{d as Sk}from"./B0Z-1lwJ.js";import{P as $k}from"./BHjJ9bUD.js";import{g as kk}from"./C1elIQnx.js";import{H as jf,M as xk,y as Ck,g as Pk,i as Rk,u as Tk,e as Vf,c as Gf,d as Ak}from"./Ct82vzld.js";import{c as Mk,h as Vd,f as Kf,M as Ek}from"./B6-GEB4b.js";import{t as qk}from"./DAsc1V4f.js";import{s as Lk}from"./BsieX9dN.js";import{i as Qf}from"./D95Y9O1z.js";import{d as Hk,i as Ok,r as Fk}from"./CTV49dzf.js";import{g as Dk}from"./CsFPvReh.js";var Nk=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),Bk=E("<div><!></div>");function Jf(n,r){if(new.target)return dn({component:Jf,...n});pn(r,!0);let a=Z(r,"ref",15,null),i=Z(r,"class",7),c=Z(r,"children",7),l=nf(r,Nk);var f={get ref(){return a()},set ref(v=null){a(v),ee()},get class(){return i()},set class(v){i(v),ee()},get children(){return c()},set children(v){c(v),ee()},$set:un,$on:(v,R)=>gn(r,v,R)},u=Bk();rf(u,v=>({"data-slot":"card-header",class:v,...l}),[()=>Fd("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-x-4 gap-y-1.5 pt-4 pb-2 has-data-[slot=card-action]:grid-cols-[minmax(0,1fr)_auto]",Y$,i())]);var w=I(u);return Ti(w,()=>c()??fs),b(u),hr(u,v=>a(v),()=>a()),p(n,u),fn(f)}var Wk=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),Uk=E("<div><!></div>");function Yf(n,r){if(new.target)return dn({component:Yf,...n});pn(r,!0);let a=Z(r,"ref",15,null),i=Z(r,"class",7),c=Z(r,"children",7),l=nf(r,Wk);var f={get ref(){return a()},set ref(v=null){a(v),ee()},get class(){return i()},set class(v){i(v),ee()},get children(){return c()},set children(v){c(v),ee()},$set:un,$on:(v,R)=>gn(r,v,R)},u=Uk();rf(u,v=>({"data-slot":"card-title",class:v,...l}),[()=>Fd("type-title min-w-0 break-words font-semibold leading-tight text-foreground",i())]);var w=I(u);return Ti(w,()=>c()??fs),b(u),hr(u,v=>a(v),()=>a()),p(n,u),fn(f)}const Sl=oS.CHAT_MEDIA,hd=uS().min(1).max(512);Xs({workspaceId:hd,agentId:hd,draftId:Ol(),principalId:hd,media:gS(tS).min(1).max(20)}).strict();const zk=Xs({sessionId:Ol()}).strict();zk.extend({control:pS("action",[Xs({action:wi("readiness")}).strict(),Xs({action:wi("export"),request:cS}).strict(),Xs({action:wi("transcribe"),request:dS}).strict(),Xs({action:wi("release"),jobId:Ol()}).strict(),Xs({action:wi("adopt"),jobId:Ol()}).strict()])}).strict();function Gd(n,r,a,i=async(c,l)=>typeof window>"u"||iS(window)!=="electron"?{ok:!1,error:"unavailable"}:lS().invoke(c,l)){let c=null,l=null,f=!1;async function u(){f=!0,a.removeEventListener("abort",w);const x=c;c=null,x&&await i(Sl.CLOSE,{sessionId:x}).catch(()=>{})}const w=()=>{u()};a.addEventListener("abort",w,{once:!0});const v=()=>{if(f||a.aborted||!r())throw new Error("media-send-retired")};async function R(){if(v(),c)return c;if(l)return l;l=(async()=>{const x=await i(Sl.BEGIN,n);if(!x.ok)throw new Error("media-export-unavailable");c=x.value.sessionId;try{return v(),c}catch(F){throw await u(),F}})();try{return await l}finally{l=null}}async function y(x){const F=await R();v();const D=await i(Sl.CONTROL,{sessionId:F,control:x});return v(),D}return{service:{exportMedia:x=>y({action:"export",request:x}),adoptMediaJob:x=>y({action:"adopt",jobId:x}),transcribeMedia:x=>y({action:"transcribe",request:x}),releaseMediaJob:async x=>c?await i(Sl.CONTROL,{sessionId:c,control:{action:"release",jobId:x}}):{ok:!0,value:void 0}},dispose:u,readiness:()=>y({action:"readiness"})}}const md=new Set;async function jk(n){const{drafts:r,signal:a}=n,i=structuredClone(n.capture),c=structuredClone(n.items),l=structuredClone(n.payload),{workspaceId:f,agentId:u}=i,w=Ci(O.state),v=Hl.select(O.state,f),R=vf.select(O.state),y=cf(),M=JSON.stringify([w,f,u]);if(!w||!v||!R||l.wsId!==f||md.has(M))return!1;md.add(M);const x=new AbortController,F=()=>x.abort();a.addEventListener("abort",F,{once:!0});const D=()=>!a.aborted&&!x.signal.aborted&&Ci(O.state)===w&&Hl.select(O.state,f)===v&&uf(y)&&r.isCurrentDraft(i),T=O.getReadableState().subscribe(()=>{D()||x.abort()});let H=null;try{if(!D()||jI(c))return!1;const V=If(i.attachments),oe=kf(nS(f,u),V,c.map(ue=>({contextItemId:ue.id,attachmentId:ue.attachmentId,path:ue.path}))),P=new Set([...oe.images,...oe.clips].map(ue=>ue.contextItemId));if(V.some(([ue])=>!P.has(ue))||oe.images.some(ue=>ue.mediaError)||oe.clips.some(ue=>ue.mediaError)||!rS(l.text,oe))throw new Error("invalid-evidence");if(H=n.warm?.take(i,x.signal)??null,!await r.flushDraft(i)||!D())return!1;const k=await xy.agents.get(u,f);if(!D())return!1;if(!k||k.workspaceId!==f||k.retiredAt||k.pendingDeleteAt||k.status==="deleted")throw new Error("unavailable");const Q=oe.clips.flatMap(ue=>ue.media?[ue.media]:[]);Q.length&&!H&&(H=Gd({workspaceId:f,agentId:u,draftId:crypto.randomUUID(),principalId:R.principal.id,media:Q},D,x.signal));const ge=Gb(c,oe),Re=df(ge),ve=await Kb({workspaceId:f,agentId:u,evidence:oe,clickedItems:c,sendItems:ge,clickedPayload:{...l,contextItems:ge,imageBlocks:Re.imageBlocks,fileBlocks:Re.fileBlocks},binding:y,service:H?.service??null,current:D,onRecord:()=>{}});return!ve||!D()?!1:Tl(O,u,ve)}catch{return D()&&O.dispatch(J_(u,g.dock_conversation_sendFailed_error())),!1}finally{T(),a.removeEventListener("abort",F),await H?.dispose(),md.delete(M)}}const Xf=1e4,Hp={wasBusy:!1,busySince:null,preempted:!1,prediction:null};function Op(n){return fS(n.messageMetadata)}function Vk(n,r){if(n.some(Op)){const a=n[0];return a&&!Op(a)&&Fp(a,r)?[a.id]:[]}return n.filter(a=>Fp(a,r)).map(a=>a.id)}function Gk(n){let r=null;for(const a of n)(a.status==="preparing"||a.status==="sending")&&a.createdAt>(r??-1/0)&&(r=a.createdAt);return r}function Fp(n,r){return!n.requeuedAfterFailure&&vS(n,r)}function Kk(n,r){const{busy:a,queue:i,delivered:c,now:l}=r,f=r.blocked||r.interrupted,u=r.timeoutMs??Xf;let w=n.prediction;if(w){const x=new Set(i.map(H=>H.id)),F=w.ids.filter(H=>x.has(H)&&!c.has(H)),D=l-w.startedAt>=u,T=n.wasBusy&&!a;!F.length||D||f&&!a||T?w=null:F.length!==w.ids.length&&(w={...w,ids:F})}const v=n.wasBusy&&!a,R=n.wasBusy?n.busySince:a?l:null,y=n.wasBusy&&n.preempted||R!==null&&r.directSendAt!==null&&r.directSendAt>R;if(!w&&v&&!f&&!y){const x=Vk(i,l).filter(F=>!c.has(F));x.length&&(w={ids:x,startedAt:l})}const M={wasBusy:a,busySince:a?R:null,preempted:a&&y,prediction:w};return n.wasBusy===M.wasBusy&&n.busySince===M.busySince&&n.preempted===M.preempted&&n.prediction===M.prediction?n:M}class Qk{constructor(){Qs(this,"previousWorkspaceId",null);Qs(this,"_isRebinding",!1);Qs(this,"_generation",0);Qs(this,"_rebindPromise",null);Qs(this,"_rebindResolve",null)}recordMount(r){return this.previousWorkspaceId=r,r}wasWorkspaceChangedDuringMount(r){return this.previousWorkspaceId!==r}shouldRebind(r){return!r||this.previousWorkspaceId===null?!1:r!==this.previousWorkspaceId}recordRebind(r){this.previousWorkspaceId=r}hasWorkspaceChanged(r){return r!==this.previousWorkspaceId}get trackedWorkspaceId(){return this.previousWorkspaceId}get isRebinding(){return this._isRebinding}startRebind(){return this._generation++,this._isRebinding=!0,this._rebindResolve?.(),this._rebindPromise=new Promise(r=>{this._rebindResolve=r}),this._generation}endRebind(r){r!==void 0&&r!==this._generation||(this._isRebinding=!1,this._rebindResolve?.(),this._rebindPromise=null,this._rebindResolve=null)}async waitForRebind(r=5e3){if(!this._isRebinding||!this._rebindPromise)return!1;const a=Date.now()+r;for(;this._isRebinding&&this._rebindPromise;){const i=a-Date.now();if(i<=0)return!1;let c;const l=await Promise.race([this._rebindPromise.then(()=>!1),new Promise(f=>{c=setTimeout(()=>f(!0),i)})]);if(clearTimeout(c),l)return!1}return!0}}function Jk(n,r){return!(n?.tabType!=="agent"||n.agentId!==r.agentId||!r.isActive||n.workspaceId&&n.workspaceId!==r.workspaceId||r.panelId&&(n.source!=="dictation"&&!r.isPanelFocused||n.panelId&&n.panelId!==r.panelId))}function Dp(n){const r=typeof n=="string"?n:n&&typeof n=="object"&&typeof n.script=="string"?n.script:void 0;return r||void 0}var Yk=E('<div role="status" aria-live="polite" data-presence-typing-indicator=""><span class="inline-flex min-w-[var(--operational-leading-slot-size)] shrink-0 items-center justify-center svelte-lm4khl"><!></span> <span class="min-w-0 truncate svelte-lm4khl"> </span> <span class="inline-flex shrink-0 items-center gap-0.5 svelte-lm4khl" aria-hidden="true"><span class="typing-dot size-1 rounded-full bg-current svelte-lm4khl"></span> <span class="typing-dot size-1 rounded-full bg-current svelte-lm4khl" style="animation-delay: 0.2s"></span> <span class="typing-dot size-1 rounded-full bg-current svelte-lm4khl" style="animation-delay: 0.4s"></span></span></div>');function Zf(n,r){if(new.target)return dn({component:Zf,...n});pn(r,!0);const a=()=>fe(R,"$typing$",i),[i,c]=Dr();let l=Z(r,"workspaceId",7),f=Z(r,"agentId",7),u=Z(r,"class",7,"");const w=Nn(""),v=Nn("");le(()=>{w.set(l())}),le(()=>{v.set(f())});const R=VI(w,v),y=o(()=>ZS(a()));var M={get workspaceId(){return l()},set workspaceId(H){l(H),ee()},get agentId(){return f()},set agentId(H){f(H),ee()},get class(){return u()},set class(H=""){u(H),ee()},$set:un,$on:(H,V)=>gn(r,H,V)},x=Bt(),F=ye(x);{var D=H=>{var V=Yk(),oe=I(V),P=I(oe);XS(P,{get people(){return a()},size:12,decorative:!0}),b(oe);var k=m(oe,2),Q=de(k,!0);In(2),b(V),q(()=>{ke(V,1,`${Af} flex h-4 min-w-0 items-center gap-[var(--operational-leading-gap)] px-[var(--operational-row-inline-padding)] font-family-child font-normal text-muted-foreground text-[11px] leading-4 ${u()??""} /* a11y-ignore: user-requested compact typing status in the composer gap */`,"svelte-lm4khl"),z(Q,e(y))}),p(H,V)};B(F,H=>{e(y)&&H(D)})}p(n,x);var T=fn(M);return c(),T}const Xk=50,Zk=5e3,ex=500,tx=()=>({authority:()=>Ci(O.state),persistSnapshot:Jb,dispatch:n=>O.dispatch(n),ownerView:n=>Yb.withStore(O)(n)});function nx(n){const r=n.store??tx(),a=crypto.randomUUID();let i=_e(!1),c=_e(!1),l=_e(!1),f=null,u=null,w=0,v=!1,R=null,y=null,M=null,x=0,F=null,D=null;const T={};let H,V=_e([]),oe=null,P=0,k="",Q=0,ge="";const Re=()=>{const N=n.workspaceId(),C=n.agentId();if(!N||!C||!(n.active?.()??!0))return null;const re=r.authority?.();if(!re||v)return null;const Te=n.inputValue(),L=ue(),Y=H?.shared,J=Y?.workspaceId===N&&Y.agentId===C?Y.lifetime:null,be=JSON.stringify([re,N,C,x,J,L.map(U=>[U.id,U.attachmentId,U.path])]);be!==ge&&(ge=be,Q+=1);const Ne=JSON.stringify([re,N,C,Te,L,x]);return Ne!==k&&(k=Ne,P+=1),{authority:re,ownerId:a,workspaceId:N,agentId:C,text:Te,attachments:JSON.parse(JSON.stringify(L)),generation:P,attachmentEpoch:Q}};let ve=null;const ue=()=>qI(n.contextItems(),LI(n.contextItems(),e(V))),we=N=>{if(H=N,!N||v)return;const C=N.restore;if(D&&C?.requestId===D.requestId&&C.status!=="pending"){const{apply:L}=D;D=null,_(c,!1),C.status==="restored"&&_(V,C.draft?.attachments??[]),L(C)}const re=N.shared;if(re&&!e(c)&&u===`${re.workspaceId}\0${re.agentId}`){const L=JSON.stringify([re.provenance,re.workspaceId,re.agentId,re.lifetime,re.revision]);if(oe!==L){oe=L;const Y=ve??f,J=Y&&n.inputValue()===Y.text&&JSON.stringify(ue())===Y.attachmentsJson;re.origin===a?ve={text:re.snapshot.text,attachmentsJson:JSON.stringify(re.snapshot.attachments)}:J&&(w+=1,M&&clearTimeout(M),_(V,re.snapshot.attachments),ve=f={text:re.snapshot.text,attachmentsJson:JSON.stringify(e(V))},n.setInputValue(re.snapshot.text),n.setContextItems(bl(e(V))),n.applyEditorContent(re.snapshot.text))}}ct(Re);const Te=[];for(const L of N.saves){if(L.status==="pending")continue;Te.push(L.id);const Y=T[L.id];delete T[L.id],Y?.(L)}Te.length>0&&queueMicrotask(()=>r.dispatch(ew(a,Te)))},ne=(N,C,re)=>{const Te=crypto.randomUUID();D={requestId:Te,apply:re},_(c,!0),r.dispatch(nw(a,Te,N,C))},te=()=>{D&&(D=null,_(c,!1),r.dispatch(aw(a)))},ze=()=>{const N=F;N&&(F=null,r.dispatch(rw(a)),H?.saves.some(C=>C.id===N)||delete T[N])};r.dispatch(Y_(a));const se=r.ownerView(a).subscribe(N=>ct(()=>we(N))),he=()=>{y&&(clearTimeout(y),y=null),_(l,!1)},Me=()=>{F&&(F=null,r.dispatch(tw(a)))};le(()=>{const N=n.active?.()??!0,C=n.workspaceId(),re=n.agentId();if(!N){ct(()=>{w+=1,u=null,te(),R&&clearTimeout(R),R=null,he(),M&&clearTimeout(M),M=null,_(i,!1),Me()});return}if(!C||!re)return;const Te=`${C}\0${re}`;if(u===Te)return;const L=u!==null;u=Te;const Y=++w;ct(()=>{f=null,ve=null,oe=null,_(V,[]),R&&clearTimeout(R),he(),M&&(clearTimeout(M),M=null),L&&(Me(),n.setInputValue(""),n.contextItemsAreScoped||n.setContextItems([]),n.applyEditorContent(""));const J=Qb(C,re);if(J){_(V,J.attachments),_(i,!1);const Ne=n.contextItems().length>0,U=J.text,Ie=JSON.stringify(J.attachments);n.setInputValue(J.text),Ne||n.setContextItems(bl(J.attachments)),n.applyEditorContent(J.text),f={text:J.text,attachmentsJson:Ie},ne(C,re,Ce=>{if(Ce.status!=="restored")return;const Le=Ce.draft;if(v||!(n.active?.()??!0)||u!==Te||w!==Y)return;const st=Le?.text??"",Xe=Le?.attachments??[],He=JSON.stringify(Xe);sd(C,re,{text:st,attachments:Xe});const Pe=n.inputValue()===U&&JSON.stringify(ue())===Ie;Ne||!Pe||(st!==U&&(n.setInputValue(st),n.applyEditorContent(st)),He!==Ie&&n.setContextItems(bl(Xe)),f={text:st,attachmentsJson:He})});return}_(i,!0),y=setTimeout(()=>{y=null,(n.active?.()??!0)&&_(l,!0)},ex),R=setTimeout(()=>{(n.active?.()??!0)&&(_(i,!1),he())},Zk);const be=()=>{!(n.active?.()??!0)||u!==Te||w!==Y||(R&&clearTimeout(R),_(i,!1),he())};ne(C,re,Ne=>{if(Ne.status!=="restored"){be();return}const U=Ne.draft;if(v||!(n.active?.()??!0)||u!==Te||w!==Y)return;const Ie=!!n.inputValue();if(!Ie&&U?.attachments?.length&&n.contextItems().length===0&&n.setContextItems(bl(U.attachments)),!Ie&&U?.text&&(n.setInputValue(U.text),M=setTimeout(()=>{(n.active?.()??!0)&&n.inputValue()===U.text&&n.applyEditorContent(U.text)},Xk)),f===null){const Ce=U?.text??"",Le=U?.attachments??[];f={text:Ce,attachmentsJson:JSON.stringify(Le)},sd(C,re,{text:Ce,attachments:Le})}be()})})}),le(()=>{const N=n.active?.()??!0,C=n.workspaceId(),re=n.agentId(),Te=e(i);if(!N){ct(ze);return}if(!C||!re)return;const L=n.inputValue(),Y=ue();if(ct(Re),ct(ze),Te||f===null&&!L&&Y.length===0)return;const J=JSON.stringify(Y);if(f!==null&&f.text===L&&f.attachmentsJson===J)return;JSON.stringify(e(V))!==J&&_(V,Y);const be=`${C}\0${re}`,Ne=x,U=crypto.randomUUID();T[U]=Ie=>{if(n.active?.()??!0){if(Ie.status==="saved"){u===be&&x===Ne&&(f={text:L,attachmentsJson:J});return}n.onSaveError?.(new Error(Ie.error))}},ct(()=>{F=U,r.dispatch(X_(a,U,{authority:r.authority?.()??void 0,workspaceId:C,agentId:re,text:L,attachments:Y,rollback:f?{text:f.text,attachments:JSON.parse(f.attachmentsJson)}:null}))})}),le(()=>()=>{v=!0,R&&clearTimeout(R),y&&clearTimeout(y),M&&clearTimeout(M),Me(),se(),r.dispatch(Z_(a))});const Ee=N=>{const C=Re();return C!==null&&C.authority===N.authority&&C.ownerId===N.ownerId&&C.workspaceId===N.workspaceId&&C.agentId===N.agentId&&C.generation===N.generation&&C.text===N.text&&JSON.stringify(C.attachments)===JSON.stringify(N.attachments)};return{captureDraft:Re,isCurrentDraft:Ee,updateAttachmentScreen(N,C,re){return!Ee(N)||!N.attachments.some(Te=>Te.id===C)?null:(_(V,N.attachments.map(Te=>Te.id===C?{...Te,screen:structuredClone(re)}:Te)),Re())},async flushDraft(N){if(!Ee(N))return!1;if(!r.persistSnapshot)throw new Error("draft-shared-transport-unavailable");return await r.persistSnapshot(a,N.workspaceId,N.agentId,N,N.authority),Ee(N)},get restorePending(){return e(c)},get gateActive(){return e(i)},get gateVisible(){return e(l)},invalidatePendingRestore(){if(w+=1,x+=1,te(),R&&(clearTimeout(R),R=null),M&&(clearTimeout(M),M=null),_(i,!1),he(),ze(),u!==null){const[N,C]=u.split("\0");sd(N,C,{text:"",attachments:[]}),ve=null,_(V,[]),f={text:"",attachmentsJson:"[]"}}}}}function Mi(n){if(!n)return null;const r=kf(JSON.stringify([n.workspaceId,n.agentId]),If(n.attachments),n.attachments.map(a=>({contextItemId:a.id,attachmentId:a.attachmentId,path:a.path})));return{...r,clips:r.clips.filter(a=>{const i=n.attachments.find(c=>c.id===a.contextItemId);return!!a.media&&!a.mediaError&&!!i&&a.path===i.path})}}async function rx(n,r,a){const i=O.state.principal.snapshot,c=()=>Ci(O.state)===n.authority&&a.isCurrentDraft(n);if(!i||!c()||!await a.flushDraft(n)||!c())return{ready:!1};const l=new AbortController,f=Gd({workspaceId:n.workspaceId,agentId:n.agentId,principalId:i.principal.id,draftId:crypto.randomUUID(),media:[r]},c,l.signal);try{const u=await f.readiness();return!c()||!u.ok?{ready:!1}:u.value.find(w=>w.sourceId===r.source.id)??{ready:!1}}finally{await f.dispose()}}function Np(n){let r=_e(null),a=_e(!1),i=_e(!1),c=null,l=!0,f=0,u=null;Es(()=>{l=!1,f++}),le(()=>{const y=n.capture();e(r)&&(!y||y.authority!==e(r).capture.authority||y.ownerId!==e(r).capture.ownerId||y.workspaceId!==e(r).capture.workspaceId||y.agentId!==e(r).capture.agentId||y.attachmentEpoch!==e(r).capture.attachmentEpoch)&&_(r,null)});async function w(y){if(n.disabled()||e(a))return;const M=n.drafts.captureDraft(),x=Mi(M),F=x?.clips.find(V=>V.contextItemId===y);if(!M||!F?.media||!x)return;const D=Xb({workspaceId:M.workspaceId,agentId:M.agentId,clip:F,evidence:x,marks:x.marks}),T=gf(M.workspaceId,F.path);if(!D||!T)return;const H=++f;c=document.activeElement instanceof HTMLElement?document.activeElement:null,_(a,!0),_(i,!1);try{if(await n.beforeOpen?.(),!l||f!==H||!n.drafts.isCurrentDraft(M))return;const V=await(n.prepareOutput??rx)(M,F.media,n.drafts);if(!l||f!==H||!n.drafts.isCurrentDraft(M))return;const{attachmentPath:oe,...P}=D;_(r,{capture:M,contextItemId:y,snapshot:{...P,openId:crypto.randomUUID(),mediaUrl:T,output:V,deleteReady:!0}})}catch{l&&f===H&&_(i,!0)}finally{l&&f===H&&_(a,!1)}}async function v(y){const M=crypto.randomUUID(),x=e(r),F=n.drafts.captureDraft();if(!x||!F||F.authority!==x.capture.authority||F.ownerId!==x.capture.ownerId||F.workspaceId!==x.capture.workspaceId||F.agentId!==x.capture.agentId||F.attachmentEpoch!==x.capture.attachmentEpoch)return{requestId:M,result:"stale-source"};const D=Mi(F),T=D?.clips.find(Q=>Q.contextItemId===x.contextItemId);if(!D||!T?.media)return{requestId:M,result:"stale-source"};const V=u?.openId===x.snapshot.openId&&u.inputRevision===y.revision&&JSON.stringify(u.media)===JSON.stringify(T.media)?{...y,revision:T.media.saved?.revision??0}:y,oe=aS(T.media,{openId:x.snapshot.openId,...x.snapshot.output?.version===2?{outputVersion:2}:{},pair:{workspaceId:F.workspaceId,agentId:F.agentId},sourceId:y.sourceId,sourceRevision:y.sourceRevision,expectedEditRevision:V.revision,edit:V});if(oe.status!=="saved")return{requestId:M,result:oe.status==="invalid-edit"?"failed":oe.status};const P=sS({...D,clips:D.clips.map(Q=>Q.id===T.id?{...Q,media:oe.media}:Q)})[x.contextItemId],k=n.drafts.updateAttachmentScreen(F,x.contextItemId,P);if(!k)return{requestId:M,result:"stale-source"};u={openId:x.snapshot.openId,media:oe.media,inputRevision:y.revision};try{if(!n.drafts.isCurrentDraft(k))return{requestId:M,result:"stale-source"};await n.drafts.flushDraft(k);const Q=n.drafts.captureDraft();return!l||e(r)?.snapshot.openId!==x.snapshot.openId||!Q||Q.attachmentEpoch!==x.capture.attachmentEpoch||Q.authority!==k.authority||Q.ownerId!==k.ownerId||Q.workspaceId!==k.workspaceId||Q.agentId!==k.agentId||JSON.stringify(Q.attachments.find(ge=>ge.id===x.contextItemId)?.screen)!==JSON.stringify(P)?{requestId:M,result:"stale-source"}:(u=null,{requestId:M,result:"saved",saved:oe.media.saved??void 0})}catch{return{requestId:M,result:"failed"}}}function R(y){return n.disabled()||!n.onRemove(y)?!1:(e(r)?.contextItemId===y&&_(r,null),!0)}return{get session(){return e(r)},get opening(){return e(a)},get problem(){return e(i)},open:w,save:v,remove:R,close(){_(r,null)},restoreFocus(){c?.isConnected&&c.focus()}}}var ax=E('<p role="alert"> </p>'),sx=E('<div class="recording-editor-surface svelte-cdb16"><!></div>'),ox=E("<!> <!> <!>",1);function ev(n,r){if(new.target)return dn({component:ev,...n});pn(r,!0);let a=Z(r,"capture",7),i=Z(r,"drafts",7),c=Z(r,"disabled",7,!1),l=Z(r,"onRemove",7),f=Z(r,"controllerFactory",7,Np),u=Z(r,"beforeOpen",7),w=Z(r,"onReviewChange",7);const v=ct(()=>f()({drafts:i(),capture:()=>a(),disabled:()=>c(),onRemove:P=>l()(P),beforeOpen:()=>u()?.()??Promise.resolve()}));le(()=>{const P=v.opening,k=v.session;ct(()=>w()?.(P,k?.snapshot.output?.ready?{openId:k.snapshot.openId,capture:k.capture}:null))});const R=o(Zb),y=o(()=>Mi(a())),M=o(()=>e(y)?.clips.map(P=>({id:P.contextItemId,kind:"clip",owner:"evidence",duration:Sp(P.durationMs),recording:!1,url:a()?gf(a().workspaceId,P.path):void 0,...P.media?.saved?{summary:ey(P.media.saved)}:{}}))??[]);let x=_e(null);var F={get capture(){return a()},set capture(P){a(P),ee()},get drafts(){return i()},set drafts(P){i(P),ee()},get disabled(){return c()},set disabled(P=!1){c(P),ee()},get onRemove(){return l()},set onRemove(P){l(P),ee()},get controllerFactory(){return f()},set controllerFactory(P=Np){f(P),ee()},get beforeOpen(){return u()},set beforeOpen(P){u(P),ee()},get onReviewChange(){return w()},set onReviewChange(P){w(P),ee()},$set:un,$on:(P,k)=>gn(r,P,k)},D=ox(),T=ye(D);{let P=o(()=>c()||v.opening);hS(T,{get items(){return e(M)},get labels(){return e(R)},get disabled(){return e(P)},onEdit:k=>void v.open(k),onMarkUp:k=>void v.open(k),get onRemove(){return v.remove}})}var H=m(T,2);{var V=P=>{var k=ax(),Q=de(k,!0);q(ge=>z(Q,ge),[()=>g.dock_captureEditor_saveFailed_label()]),p(P,k)};B(H,P=>{v.problem&&P(V)})}var oe=m(H,2);{let P=o(()=>!!v.session),k=o(()=>g.dock_captureEditor_recording_title({duration:v.session?Sp(v.session.snapshot.durationMs??0):""}));d$(oe,{get open(){return e(P)},size:"editor",showCloseButton:!1,get title(){return e(k)},escapeKeydownBehavior:"ignore",dismissOnInteractOutside:!1,onClose:()=>v.close(),onCloseAutoFocus:Q=>{Q.preventDefault(),v.restoreFocus()},get contentRef(){return e(x)},set contentRef(Q){_(x,Q,!0)},children:(Q,ge)=>{var Re=Bt(),ve=ye(Re);{var ue=we=>{var ne=Bt(),te=ye(ne);ki(te,()=>v.session.snapshot.openId,ze=>{var se=sx(),he=I(se);g$(he,{get snapshot(){return v.session.snapshot},get shortcutDialog(){return e(x)},onClose:()=>v.close(),get onSave(){return v.save},onDelete:async()=>!!v.session&&v.remove(v.session.contextItemId)}),b(se),p(ze,se)}),p(we,ne)};B(ve,we=>{v.session&&we(ue)})}p(Q,Re)},$$slots:{default:!0}})}return p(n,D),fn(F)}const $l=n=>JSON.stringify([n.authority,n.ownerId,n.workspaceId,n.agentId,n.attachmentEpoch,n.attachments]);function ix(n){let r=_e(!1),a=_e(!1),i=_e(null),c=!1,l=0,f=null,u=null;async function w(y){y.abort.abort(),y.slot?.cancel(),await y.native?.dispose()}async function v(){l++;const y=u;u=null,y&&await w(y)}to(()=>{const y=()=>{_(r,document.hasFocus(),!0)};return y(),window.addEventListener("focus",y),window.addEventListener("blur",y),()=>{window.removeEventListener("focus",y),window.removeEventListener("blur",y)}});const R=O.getReadableState().subscribe(()=>{u&&!u.current()&&v()});return Es(()=>{c=!0,R(),v()}),le(()=>{const y=n.capture(),M=y?$l(y):"",x=e(r)&&!e(a)&&(n.active()||e(i)?.key===M);ct(()=>{if(!x||!y){v();return}if(u?.key===M)return;if(f===M){v();return}v();const D=Mi(y)?.clips.flatMap(Re=>!Re.mediaError&&Re.media?[Re.media]:[])??[],T=D[0],H=O.state.principal.snapshot,V=Hl.select(O.state,y.workspaceId);if(!T||!H||!V||n.drafts.gateActive)return;const oe=cf(),P=new AbortController,k=()=>!c&&!P.signal.aborted&&Ci(O.state)===y.authority&&Hl.select(O.state,y.workspaceId)===V&&uf(oe)&&!!n.capture()&&$l(n.capture())===M,Q={key:M,capture:y,abort:P,native:null,slot:null,current:k};u=Q;const ge=l;n.drafts.flushDraft(y).then(async Re=>{if(!(u!==Q||ge!==l||!k())){if(!Re){f=M,await v();return}Q.native=Gd({workspaceId:y.workspaceId,agentId:y.agentId,draftId:crypto.randomUUID(),principalId:H.principal.id,media:structuredClone(D)},k,P.signal),Q.slot=ty(Q.native.service),f=M,Q.slot.warm(M,T,k)}}).catch(()=>{u===Q&&v()})})}),{cancel:v,async beforeEditorOpen(){_(a,!0),f=null,await v()},editorState(y,M){_(a,y,!0);const x=M?$l(M.capture):null;M&&e(i)?.openId!==M.openId&&(f=null),_(i,M&&x?{openId:M.openId,key:x}:null)},take(y,M){const x=u;if(!x?.native||!x.slot||x.key!==$l(y)||!x.current())return v(),null;u=null,l++;const F=x.native,D=x.slot,T=()=>x.abort.abort();return M.addEventListener("abort",T,{once:!0}),M.aborted&&T(),{service:{...F.service,takePreparedRecording:H=>D.take(x.key,H,()=>!M.aborted&&x.current())},async dispose(){M.removeEventListener("abort",T),await w(x)}}}}}var lx=E('<div role="status" class="px-3 py-1.5 text-xs text-muted-foreground" data-testid="chat-draft-loading-gate"><span> </span></div>');function tv(n,r){if(new.target)return dn({component:tv,...n});pn(r,!1);var a={$set:un,$on:(f,u)=>gn(r,f,u)};Mf();var i=lx(),c=I(i),l=de(c,!0);return b(i),q(f=>z(l,f),[()=>g.chat_draftGate_loading_label()]),p(n,i),fn(a)}var cx=E('<div data-new-messages-divider="" class="type-caption font-family-child my-6 flex items-center gap-2 px-2" role="separator"><div class="h-px flex-1 bg-border"></div> <span class="whitespace-nowrap px-1 font-medium text-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div>');function Td(n,r){if(new.target)return dn({component:Td,...n});pn(r,!1);var a={$set:un,$on:(f,u)=>gn(r,f,u)};Mf();var i=cx(),c=m(I(i),2),l=de(c,!0);return In(2),b(i),q((f,u)=>{Ue(i,"aria-label",f),z(l,u)},[()=>g.chat_newMessagesDivider_label(),()=>g.chat_newMessagesDivider_label()]),p(n,i),fn(a)}function dx(n,r){if(!r||n.length===0)return null;const a=n.indexOf(r);return a===-1||a===n.length-1?null:r}function ux(n,r,a){if(!r||n.length===0)return"none";const i=n.indexOf(r);return i===n.length-1?"none":i!==-1?"marker-loaded":a.complete?a.truncated?"marker-beyond-window":"none":"marker-pending"}function gx(n,r){return r&&n.includes(r)?r:null}function Bp(n,r,a){return r-n<=a}const px=.2;function Wp(n,r,a){const i=Math.max(0,a-r),c=n-px*r;return Math.min(Math.max(0,c),i)}function fx(n,r,a){return n!==null&&a&&n===r}function vx(n){return n?sw(n)&&ow(n)!==null&&typeof n.metadata?.taskNoteId=="string":!1}function hx(n){const r=[],a=new Set;let i,c;for(const H of n.messages){if(H.agentId&&H.agentId!==n.agentId){i=void 0,c=void 0;continue}if(a.has(H.id))continue;a.add(H.id),n.breakBeforeMessageIds?.has(H.id)&&(i=void 0,c=void 0);const V=mS(H);if(V?.kind!=="turn-failure")c=void 0;else{const oe=i?.seq!==void 0&&H.seq!==void 0&&Number.isSafeInteger(i.seq)&&Number.isSafeInteger(H.seq)&&H.seq===i.seq+1;(!c||!oe)&&(c={key:JSON.stringify([n.agentId,"notice",H.id]),anchorMessageId:H.id,correlation:"unavailable",records:[],recordedFailureCount:0},r.push(c)),c.records.push({messageId:H.id,reason:V.reason,timestamp:H.timestamp}),c.recordedFailureCount+=1}i=H}const l=new Map;for(const H of n.queue){if(!H.requeuedAfterFailure)continue;const V=H.turnId||void 0,oe=JSON.stringify([n.agentId,V?"turn":"queue",V??H.id]);let P=l.get(oe);P||(P={key:oe,correlation:V?"turn":"queue-entry",turnId:V,queueIds:[],state:"queued"},l.set(oe,P)),P.queueIds.includes(H.id)||P.queueIds.push(H.id)}const f=[...l.values()],u=n.session?.id===n.agentId?n.session:void 0,w=u?.status===Si.Error,v=n.transientError||w&&u.stopReason||null,R=w&&!v,y=w&&(!n.transientError||n.transientError===u.stopReason)?u.stopReasonTimestamp:void 0,M=y?pp(y):null,x=M&&v&&v===u?.stopReason?r.flatMap(H=>H.records).filter(H=>H.reason===v&&pp(H.timestamp)===M):[],F=x.length===1?x[0].messageId:void 0,T=(u?hf(u):!1)?"attempting":f.length?"queued":v||R?"action-needed":"inactive";return{history:r,queueRecovery:f,current:{state:T,error:v,needsFallbackReason:R,timestamp:y,noticeId:F}}}function mx(n,r){const a=n.hiddenTail[0]?.id,i=hx({...r,messages:[...n.groups.flatMap(u=>u.messages),...n.hiddenTail],breakBeforeMessageIds:new Set(a?[a]:[])}),c=i.current.noticeId,l=i.history.map(u=>({...u,records:u.records.filter(w=>w.messageId!==c)})).filter(u=>u.records.length>0),f=new Set(l.map(u=>u.records[0].messageId));return{...i,runsByAnchor:new Map(l.map(u=>[u.records[0].messageId,u])),collapsedMessageIds:new Set(i.history.flatMap(u=>u.records.map(w=>w.messageId).filter(w=>!f.has(w))))}}var _x=E('<div class="flex size-10 shrink-0 items-center justify-center rounded-md bg-muted/50"><!></div> <div class="min-w-0 flex-1"><div class="type-body truncate font-medium text-foreground"> </div> <div class="type-caption mt-0.5 line-clamp-2 text-muted-foreground"> </div></div> <div class="flex size-7 shrink-0 items-center justify-center rounded-md bg-muted/50 text-muted-foreground transition-colors group-hover:bg-muted"><!></div>',1),wx=E('<div class="flex size-9 shrink-0 items-center justify-center rounded-md bg-muted/50"><!></div> <span class="type-body font-medium"> </span>',1),bx=E('<div><div class="border-b border-border bg-muted/20 px-4 py-3"><p class="type-body font-medium text-foreground"> </p> <p class="type-caption mt-0.5 text-muted-foreground"> </p></div> <div class="max-h-[21rem] overflow-y-auto p-2"><!></div> <div class="border-t border-border bg-popover p-2"><!></div></div>'),yx=E('<div class="mb-5"><!></div>'),Ix=E('<p data-testid="agent-welcome-description"> </p> <!>',1),Sx=E("<!> <!>",1),$x=E('<p class="mb-3 px-4 text-sm text-subtle leading-relaxed whitespace-pre-wrap" data-testid="agent-welcome-description"> </p>'),kx=E("<!> <span> </span>",1),xx=E('<div class="mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-4 pb-6 pt-4 text-subtle"><!> <!> <!></div>');function nv(n,r){if(new.target)return dn({component:nv,...n});pn(r,!0);const a=()=>fe(x,"$userOverrides$",f),i=()=>fe(M,"$specialists$",f),c=()=>fe(H,"$isGitHubAuth$",f),l=()=>fe(V,"$recentSpecialistIds$",f),[f,u]=Dr();let w=Z(r,"onSpecialistChange",7),v=Z(r,"session",7),R=Z(r,"workspaceId",7);const y=Nn(R()??"");le(()=>y.set(R()??""));const M=Ff(y),x=q$();le(()=>{a()});const F=o(()=>{if(!v()||qy(v()))return null;const N=v().metadata?.specialist||v().agentMetadata?.specialist;return N&&i().find(C=>C.id===N)||null});async function D(N){N?await Bl({specialist:N,hash:"specialists"}):await Bl({view:"create-specialist"})}let T=_e(!1);const H=L$(),V=GI(),oe=o(()=>iw(H$(i(),c()),l()));let P=_e(!1);const k=o(()=>g.chat_regularAgentWelcome_generalDescription_label()),Q=o(()=>e(F)?.name??g.chat_shared_general_fallback()),ge=o(()=>e(F)?.description??g.chat_shared_noSpecializedBehavior_label()),Re=o(()=>e(F)?e(F).defaultBehaviorPrompt||"":e(k));var ve={get onSpecialistChange(){return w()},set onSpecialistChange(N){w(N),ee()},get session(){return v()},set session(N){v(N),ee()},get workspaceId(){return R()},set workspaceId(N){R(N),ee()},$set:un,$on:(N,C)=>gn(r,N,C)},ue=xx(),we=I(ue);{var ne=N=>{var C=yx(),re=I(C);K$(re,{class:"block w-full",align:"start",side:"bottom",contentClass:"w-[min(28rem,calc(100vw-2rem))]",get open(){return e(P)},set open(Y){_(P,Y,!0)},trigger:(Y,J)=>{let be=()=>(J?.()).props;{let Ne=o(()=>Fd("group flex h-auto min-h-(--control-height-medium) w-full cursor-pointer items-center gap-3 whitespace-normal rounded-lg border border-border bg-card px-4 py-3 text-left shadow-xs transition-colors","hover:border-input hover:bg-accent/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"));xt(Y,Ei(be,{type:"button",variant:"plain",wrapContent:!1,get class(){return e(Ne)},"data-testid":"specialist-picker-trigger",children:(U,Ie)=>{var Ce=_x(),Le=ye(Ce),st=I(Le);{let Se=o(()=>e(F)?.id??null),Ae=o(()=>e(F)?.icon??null);G$(st,{agentId:"blank",variant:"emphasized",get specialist(){return e(Se)},get icon(){return e(Ae)}})}b(Le);var Xe=m(Le,2),He=I(Xe),Pe=de(He,!0),j=m(He,2),ae=de(j,!0);b(Xe);var qe=m(Xe,2),G=I(qe);pt(G,{get icon(){return Na},size:10}),b(qe),q(()=>{z(Pe,e(Q)),z(ae,e(ge))}),p(U,Ce)},$$slots:{default:!0}}))}},content:Y=>{var J=bx(),be=I(J),Ne=I(be),U=de(Ne,!0),Ie=m(Ne,2),Ce=de(Ie,!0);b(be);var Le=m(be,2),st=I(Le);{let Pe=o(()=>e(F)?.id??null);D_(st,{get specialists(){return e(oe)},get value(){return e(Pe)},onchange:j=>{_(P,!1),w()?.(j)}})}b(Le);var Xe=m(Le,2),He=I(Xe);Rt(He,()=>Or,(Pe,j)=>{j(Pe,{class:"flex h-auto w-full cursor-pointer items-center gap-3 whitespace-normal rounded-md px-3 py-2 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onSelect:()=>{_(P,!1),D()},children:(ae,qe)=>{var G=wx(),Se=ye(G),Ae=I(Se);pt(Ae,{get icon(){return m$},size:12}),b(Se);var je=m(Se,2),Be=de(je,!0);q(We=>z(Be,We),[()=>g.chat_regularAgentWelcome_createSpecialist_label()]),p(ae,G)},$$slots:{default:!0}})}),b(Xe),b(J),q((Pe,j)=>{z(U,Pe),z(Ce,j)},[()=>g.workspace_createAgentSection_specialists_label(),()=>g.workspace_createAgentSection_specialists_description()]),p(Y,J)},$$slots:{trigger:!0,content:!0}}),b(C),p(N,C)};B(we,N=>{w()&&N(ne)})}var te=m(we,2);{var ze=N=>{var C=Bt(),re=ye(C);{let Te=o(()=>g.chat_specialistSelector_prompt_label());Rt(re,()=>J$,(L,Y)=>{Y(L,{class:"mb-3",role:"region",get"aria-label"(){return e(Te)},children:(J,be)=>{var Ne=Sx(),U=ye(Ne);Rt(U,()=>Jf,(Ce,Le)=>{Le(Ce,{children:(st,Xe)=>{var He=Bt(),Pe=ye(He);Rt(Pe,()=>Yf,(j,ae)=>{ae(j,{class:"type-caption font-medium",children:(qe,G)=>{In();var Se=_n();q(Ae=>z(Se,Ae),[()=>g.chat_specialistSelector_prompt_label()]),p(qe,Se)},$$slots:{default:!0}})}),p(st,He)},$$slots:{default:!0}})});var Ie=m(U,2);Rt(Ie,()=>Q$,(Ce,Le)=>{Le(Ce,{children:(st,Xe)=>{var He=Ix(),Pe=ye(He),j=de(Pe,!0),ae=m(Pe,2);xt(ae,{type:"button",variant:"link",get"aria-expanded"(){return e(T)},onclick:()=>_(T,!e(T)),class:"text-xs text-muted-foreground hover:text-foreground transition-colors mt-2 cursor-pointer",children:(qe,G)=>{In();var Se=_n();q(Ae=>z(Se,Ae),[()=>e(T)?g.chat_regularAgentWelcome_showLess_label():g.chat_regularAgentWelcome_showMore_label()]),p(qe,Se)},$$slots:{default:!0}}),q(()=>{ke(Pe,1,`text-sm text-subtle leading-relaxed whitespace-pre-wrap break-words ${e(T)?"":"line-clamp-6"}`),z(j,e(Re))}),p(st,He)},$$slots:{default:!0}})}),p(J,Ne)},$$slots:{default:!0}})})}p(N,C)},se=N=>{var C=$x(),re=de(C,!0);q(()=>z(re,e(Re))),p(N,C)};B(te,N=>{e(F)?N(ze):N(se,-1)})}var he=m(te,2);{var Me=N=>{xt(N,{variant:"ghost-light",size:"sm",onclick:()=>D(e(F).id),class:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer pl-1.5 mr-auto",children:(C,re)=>{var Te=kx(),L=ye(Te);pt(L,{get icon(){return h$},size:12,class:"opacity-60"});var Y=m(L,2),J=de(Y,!0);q(be=>z(J,be),[()=>g.chat_regularAgentWelcome_customize_label()]),p(C,Te)},$$slots:{default:!0}})};B(he,N=>{e(F)&&N(Me)})}b(ue),p(n,ue);var Ee=fn(ve);return u(),Ee}var Cx=E('<a class="cursor-pointer underline underline-offset-2 hover:opacity-80" data-suggested-prompt-link=""> </a>'),Px=E('<kbd data-suggested-prompt-hint=""> </kbd>'),Rx=E('<span class="type-caption"> </span>'),Tx=E('<div role="presentation" data-typography-role="body" data-suggested-prompt-row=""><span data-suggested-prompt-icon=""><!></span> <span class="min-w-0 flex-1 text-pretty" data-suggested-prompt-label=""><span role="button" tabindex="0" class="focus-visible:outline-none" data-suggested-prompt-text=""> </span><!></span> <!> <!></div>'),Ax=E('<div class="flex flex-col" data-testid="suggested-prompts-surface"><!></div>');function Kd(n,r){if(new.target)return dn({component:Kd,...n});pn(r,!0);let a=Z(r,"prompts",7),i=Z(r,"onSelect",7),c=Z(r,"onEdit",7),l=Z(r,"compact",7,!1),f=Z(r,"showShortcutHints",7,!1),u=Z(r,"reserveShortcutHintSpace",7,!1),w=Z(r,"workspaceId",7);const R=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC")?"⌃":"Alt+",y=GS.replace("text-ui","type-caption");function M(k){i()(k)}function x(k,Q){k.key!=="Enter"&&k.key!==" "||(k.preventDefault(),M(Q))}function F(k,Q){k.preventDefault(),k.stopPropagation(),Pd(Q,{workspaceId:w(),event:k})}function D(k,Q){(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),k.stopPropagation(),Pd(Q,{workspaceId:w(),event:k}))}function T(k){return k<3}var H={get prompts(){return a()},set prompts(k){a(k),ee()},get onSelect(){return i()},set onSelect(k){i(k),ee()},get onEdit(){return c()},set onEdit(k){c(k),ee()},get compact(){return l()},set compact(k=!1){l(k),ee()},get showShortcutHints(){return f()},set showShortcutHints(k=!1){f(k),ee()},get reserveShortcutHintSpace(){return u()},set reserveShortcutHintSpace(k=!1){u(k),ee()},get workspaceId(){return w()},set workspaceId(k){w(k),ee()},$set:un,$on:(k,Q)=>gn(r,k,Q)},V=Bt(),oe=ye(V);{var P=k=>{var Q=Ax(),ge=I(Q);{const Re=(ue,we)=>{let ne=()=>(we?.()).item,te=()=>(we?.()).index;const ze=o(()=>Bb(ne())),se=o(()=>e(ze)[0]?.type==="text"?e(ze)[0].content:"");var he=Tx(),Me=I(he),Ee=I(Me);pt(Ee,{get icon(){return Ef},size:16,get class(){return lr}}),b(Me);var N=m(Me,2),C=I(N),re=de(C,!0),Te=m(C);Hn(Te,17,()=>e(ze).slice(e(se)?1:0),H_,(U,Ie)=>{var Ce=Bt(),Le=ye(Ce);{var st=He=>{const Pe=o(()=>Nb(e(Ie).url));var j=Cx(),ae=de(j,!0);q(()=>{Ue(j,"href",e(Pe)),Ue(j,"title",e(Pe)),z(ae,e(Ie).label)}),ps("click",j,qe=>F(qe,e(Pe))),ps("keydown",j,qe=>D(qe,e(Pe))),p(He,j)},Xe=He=>{var Pe=_n();q(()=>z(Pe,e(Ie).content)),p(He,Pe)};B(Le,He=>{e(Ie).type==="link"?He(st):He(Xe,-1)})}p(U,Ce)}),b(N);var L=m(N,2);{var Y=U=>{var Ie=Px();let Ce;var Le=de(Ie);q(()=>{Ce=ke(Ie,1,`${y??""} mt-px inline-flex h-5 items-center self-start border-0 bg-transparent p-0 font-sans font-normal text-muted-foreground! opacity-100`,null,Ce,{invisible:!f()}),Ue(Ie,"aria-hidden",f()?void 0:"true"),Ue(Ie,"data-hint-visible",f()),z(Le,`${R}${te()+1}`)}),p(U,Ie)},J=o(()=>T(te())&&(f()||u()));B(L,U=>{e(J)&&U(Y)})}var be=m(L,2);{var Ne=U=>{v$(U,{side:"top",delayDuration:300,trigger:Le=>{{let st=o(()=>g.chat_suggestedPrompts_editInInput_ariaLabel());xt(Le,{type:"button",variant:"ghost-light",size:"icon-xs",iconOnly:!0,class:"absolute right-0.5 top-[calc(var(--operational-leading-half-slot-size)+var(--space-1)*0.5+1px)] shrink-0 -translate-y-1/2 rounded opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100",onclick:Xe=>{Xe.stopPropagation(),c()(ne())},get"aria-label"(){return e(st)},children:(Xe,He)=>{pt(Xe,{get icon(){return _$},size:"xs"})},$$slots:{default:!0}})}},content:Le=>{var st=Rx(),Xe=de(st,!0);q(He=>z(Xe,He),[()=>g.chat_suggestedPrompts_edit_tooltip()]),p(Le,st)},$$slots:{trigger:!0,content:!0}})};B(be,U=>{c()&&U(Ne)})}b(he),q(U=>{ke(he,1,`${Af} ${VS} group relative flex cursor-pointer items-center gap-[var(--operational-leading-gap)] rounded-sm border border-transparent bg-transparent px-1.5 py-0.5 text-left opacity-100 pr-9 transition-colors hover:text-foreground has-[[data-suggested-prompt-text]:focus-visible]:outline-2 has-[[data-suggested-prompt-text]:focus-visible]:outline-offset-2 has-[[data-suggested-prompt-text]:focus-visible]:outline-ring`),ke(Me,1,`${Fl??""} mt-px self-start`),Ue(C,"aria-label",U),z(re,e(se))},[()=>Db(ne())]),ps("click",C,U=>{U.stopPropagation(),M(ne())}),ps("keydown",C,U=>x(U,ne())),p(ue,he)};let ve=o(()=>l()?"[&>div>div:last-child]:gap-0":"[&>div>div:last-child]:gap-0.5");u$(ge,{get items(){return a()},virtualize:!1,onActivate:M,get class(){return`overflow-visible! [&>div>div:last-child]:flex [&>div>div:last-child]:flex-col ${e(ve)??""}`},"data-testid":"suggested-prompts-list",get"data-compact"(){return l()},row:Re,$$slots:{row:!0}})}b(Q),Dt(1,Q,()=>ma,()=>({tier:"fast",y:0,scale:1})),Dt(2,Q,()=>Zs,()=>({tier:"fast"})),p(k,Q)};B(oe,k=>{a().length>0&&k(P)})}return p(n,V),fn(H)}Od(["click","keydown"]);var Mx=E('<section class="pb-6 pt-6"><p class="type-body mb-5 max-w-[36rem] px-1.5 text-pretty text-muted-foreground"> </p> <!></section>');function rv(n,r){if(new.target)return dn({component:rv,...n});pn(r,!0);let a=Z(r,"onSelect",7),i=Z(r,"compact",7,!1);const c=o(()=>[{label:g.chat_chiefEmptyState_assignedPrs_label(),prompt:g.chat_chiefEmptyState_assignedPrs_prompt()},{label:g.chat_chiefEmptyState_staleWorkspaces_label(),prompt:g.chat_chiefEmptyState_staleWorkspaces_prompt()},{label:g.chat_chiefEmptyState_agentPerformance_label(),prompt:g.chat_chiefEmptyState_agentPerformance_prompt()},{label:g.chat_chiefEmptyState_morningBrief_label(),prompt:g.chat_chiefEmptyState_morningBrief_prompt()},{label:g.chat_chiefEmptyState_randomTheme_label(),prompt:g.chat_chiefEmptyState_randomTheme_prompt()}]),l=o(()=>e(c).map(M=>M.label));function f(M){const x=e(c).find(F=>F.label===M);x&&a()(x.prompt)}var u={get onSelect(){return a()},set onSelect(M){a(M),ee()},get compact(){return i()},set compact(M=!1){i(M),ee()},$set:un,$on:(M,x)=>gn(r,M,x)},w=Mx(),v=I(w),R=de(v,!0),y=m(v,2);return Kd(y,{get prompts(){return e(l)},onSelect:f,get compact(){return i()}}),b(w),q(M=>z(R,M),[()=>g.chat_chiefEmptyState_intro_label()]),p(n,w),fn(u)}const Qd=2e3,Ex=4e3,qx=Ex-Qd-2;function Lx(n,r=Qd){const a=[];let i=0;for(let c=n.length-1;c>=0&&i<r;c-=1){const l=n[c];if(l.role!=="user"&&l.role!=="assistant")continue;const f=(l.contentBlocks??[]).filter(w=>w.type==="text").map(w=>w.text||w.content||"").join(""),u=(l.role==="assistant"?N_(f).cleanedContent:f).trim();u&&(a.unshift({role:l.role,text:u}),i+=u.length)}return a}function Hx(n,r){const a=n.map(l=>`${l.role==="user"?"User":"Assistant"}: ${l.text}`).join(`
|
|
1
|
+
var M_=Object.defineProperty;var Ag=n=>{throw TypeError(n)};var E_=(n,r,a)=>r in n?M_(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a;var Qs=(n,r,a)=>E_(n,typeof r!="symbol"?r+"":r,a),q_=(n,r,a)=>r.has(n)||Ag("Cannot "+a);var Co=(n,r,a)=>(q_(n,r,"read from private field"),a?a.call(n):r.get(n)),Mg=(n,r,a)=>r.has(n)?Ag("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,a);import{t as dn,bo as Z,bw as un,bp as nf,b as gn,bm as g,bq as Dr,bs as fe,br as Ei}from"./ClpAEjbe.js";import{bs as pn,a5 as I,bf as fs,bA as b,W as p,bn as fn,aA as ee,aB as E,ca as le,a7 as Bt,ay as ye,aD as e,cd as Nn,c9 as o,bS as m,bl as de,be as In,b_ as q,bO as z,c5 as ct,bH as _,bV as _e,bj as Es,bk as to,b$ as _n,ai as Od,aj as ps,bo as Wl,br as Rr,c0 as Lt,cb as nd,aw as _i,a as L_}from"./CJxGDkBm.js";import{i as B}from"./wmcYjLAa.js";import{k as ki}from"./Xh71Wbuh.js";import{g as Hn,i as H_,I as Mo,p as Eo,e as To}from"./BwASeArv.js";import{n as Dt,l as ma,c as Zs,j as Eg,k as Ho,h as O_}from"./oXpJ1LFx.js";import{b as rf,e as Fd,f as ke,s as Ue,c as Ut,g as gs}from"./CnGVh7I3.js";import{b as F_}from"./DfTSMq0b.js";import{b as hr}from"./NtFyWdpR.js";import{m as D_,U as N_,Z as B_,X as W_,Y as U_,I as qg,o as z_,l as j_,a2 as V_,x as Lg,$ as G_,a0 as Hg,r as K_,s as Q_}from"./DyOuvQsx.js";import{Jq as O,fo as J_,eW as Y_,f3 as X_,eX as Z_,f1 as ew,f0 as tw,eZ as nw,e$ as rw,eY as aw,rs as sw,c6 as ow,i as Si,I$ as iw,D8 as af,Dd as lw,Df as Og,Dc as cw,De as dw,vB as uw,vD as gw,Cl as sf,cp as pw,cn as fw,Bu as vw,bE as hw,A0 as mw,Ca as rd,uZ as _w,cq as Fg,dB as ww,dC as bw,Ck as yw,el as Iw,CE as Sw,CD as $w,CI as kw,CH as xw,cQ as Cw,cT as Pw,nA as Rw,er as Tw,wO as Aw,CJ as Mw,wQ as Ew,CK as qw,cU as Lw,cV as Hw,nI as Ow,Ad as Fw,Dp as Dw,wj as Nw,wk as Bw,yY as Ww,z0 as ad,wf as Uw,wg as zw,rQ as jw,rd as Vw,rb as Gw,f_ as Kw,HK as Qw,Le as Jw,GI as Yw,gn as Xw,p0 as Zw,Je as eb,oh as tb,z$ as nb,ft as Dg,r0 as Ng,fm as rb,fl as ab,tz as sb,g3 as Bg,rc as ob,fe as ib,C5 as lb,m as cb,nJ as db,zE as ub,yW as gb,Ev as pb,Ek as Wg,xe as fb,xf as Ug,uY as zg,p1 as vb,DB as hb,gj as mb,g1 as _b,eU as wb,cM as bb,A3 as yb,Lj as Ib,Cq as Sb,LB as $b,x$ as kb,ga as xb,fd as Cb,cL as Pb,cI as Rb,cH as Tb,vp as Ab,xl as Mb,xj as Eb,cF as qb,cE as Lb,z2 as Hb,yZ as Ob,xk as Fb}from"./CpP1PKzF.js";import{a as Dd}from"./CC7to1B5.js";import{aB as Db,aA as Nb,b1 as Bb,_ as Wb,as as Ub,aD as zb,z as of,R as lf,aV as jb,aP as Vb,ai as jg,J as _l,aN as Vg,aM as Gg,aL as Kg}from"./DsATs4Yw.js";import{k as cf,F as Gb,G as df,ao as Kb,aX as Tl,a5 as uf,Q as Qb,aQ as sd,al as Jb,aD as Yb,B as Xb,y as gf,r as Zb,z as ey,u as ty,aV as ny,aB as pf,aA as ff,aC as ry,aG as od,aN as Qg,aM as wl,aO as Jg,P as Yg,d as ay,e as sy,as as oy,V as Xg,az as iy,c as ly,l as cy,aP as Zg,ak as dy,ar as ep,a as uy,av as gy,a9 as tp,ay as py,aR as np,aU as rp,m as ap,aa as fy,R as vy,at as sp,ah as hy,O as my,an as _y,h as wy,p as by,ax as op,a4 as yy,f as Iy,i as Sy,a2 as $y,a8 as ky}from"./DXT_tHZV.js";import{d as xy,l as Cy,x as Py,v as Ry,k as Ty,Z as ip,a5 as Ay,D as My,c as Ey}from"./BxKppgO5.js";import{g as Ci}from"./DypB-Dwi.js";import{dT as Hl,cR as vf,O as hf,W as qy,bs as Ly,aE as mf,dE as _f,aT as Ao,e4 as Hy,dt as wf,av as Nd,dS as Bd,aM as bf,cM as Oy,V as ha,a3 as Ys,B as Fy,a7 as Dy,a4 as Ny,M as By,a6 as Wy,ar as Uy,aF as yf,aN as Al,r as zy,n as $d,H as jy,dV as Vy,aP as Gy,aJ as Ky,c6 as Qy,aV as Jy,bJ as Yy,bH as Xy,bI as Zy,c5 as eI,c4 as tI,cK as nI,cJ as rI,aR as aI,b9 as sI,bb as oI,be as iI,ba as lI,bj as cI,bd as dI,bc as uI,bf as gI,bg as pI,bi as fI,bh as vI,aw as hI,ax as mI,cg as _I,ch as wI,ds as bI,dr as yI,a_ as II,G as SI,b2 as $I,cc as kI,C as lp,cZ as xI,b8 as ds,bY as CI,X as PI,E as RI,ad as TI,t as AI,cT as MI,d0 as cp,Q as dp,dq as EI,cN as id}from"./D9Ykl3eH.js";import{u as If,a as bl,ag as qI,x as LI,ad as Sf,af as HI,ac as $f,a4 as OI,F as up,D as FI,e as DI,n as NI,s as BI,m as WI,Y as UI,k as zI}from"./DlekFIEJ.js";import{a4 as jI,b5 as VI,cM as GI,a_ as KI,b4 as QI,c2 as JI,c9 as YI,w as XI,x as ZI,cd as eS}from"./eHy-2vQk.js";import{n as tS,P as kf,F as nS,ai as rS,r as aS,ac as sS}from"./CgBcONKs.js";import{I as oS,s as iS,H as gp}from"./Bqd7fdCF.js";import{e as lS}from"./CL3a4Hm1.js";import{e as cS,f as dS}from"./BqoCUMk3.js";import{s as uS,o as Xs,b as gS,g as Ol,d as pS,l as wi}from"./CIyUrgF0.js";import{a4 as fS,a6 as vS,D as hS,M as mS,ab as pp,W as _S,i as wS,r as ir,v as Pi,u as Xr,p as $i,x as mr,S as Wd,m as Ul,s as qo,y as Ri,o as no,n as ro,t as fp,a9 as ao,w as so,a8 as Ud,q as _a,z as Lo,I as kd,Z as vp,g as bS,F as yS,U as xf,H as Cf,a7 as Pf,a5 as Ml,N as IS,E as Rf,R as SS,A as $S,b as kS,aa as xS,ac as yl,e as ld,l as CS,C as PS,f as Js,j as hp,G as us,Q as RS,d as cd,c as TS,a as mp,h as AS,K as MS,X as _p,a3 as dd,a0 as wp,$ as ES,a2 as bp,_ as yp,T as qS,B as LS,k as HS,a1 as OS,J as FS,P as DS,O as NS,V as BS}from"./BQ0lhaiw.js";import{m as WS}from"./PVXvIyE8.js";import{g as Tf}from"./0LjODXcP.js";import{b as US}from"./C5TH9nNS.js";import{g as zS}from"./BriVXGmT.js";import{a as jS}from"./CvXttgUy.js";import{q as Af,d as lr,r as VS,e as Fl,j as GS,g as xd,i as KS,f as Cd,c as QS,A as JS,O as Ip,k as YS}from"./DoKriIRg.js";import{P as XS}from"./Dp3fRAus.js";import{e as ZS}from"./DemmMiIF.js";import{b as e$,a as t$,g as n$,c as r$,i as a$}from"./CNcD7ed8.js";import{R as s$,g as o$,W as Il,c as i$}from"./BFAXN_U2.js";import"./Gb7Ohwuc.js";import"./BYiyLeZ4.js";import{s as Ti}from"./WSVFXKpL.js";import{F as l$,h as c$}from"./CPDV_dyu.js";import"./Qt_rZNko.js";import{C as d$,e as Or,L as u$,l as zl,d as jl,K as Vl,h as zd,M as Gl,S as Da}from"./B06RKBOm.js";import{D as g$}from"./CHXqkR4Y.js";import{f as Sp}from"./D35mkEt2.js";import"./BoIfXiRv.js";import{i as Mf}from"./D-g0wh54.js";import{h as $p,i as kp,g as xp,P as Cp,C as p$,m as El,R as f$}from"./C1zxTHwk.js";import{f as xt,ae as v$}from"./BVi5KkOP.js";import{F as pt,bs as h$,cd as m$,aw as Na,a2 as Ef,c9 as _$,bf as w$,be as b$,bg as y$,aO as Pp,aj as ud,aB as gd,bB as qf,d3 as Dl,cF as I$,aM as Rp,cb as Tp,cK as Nl,bu as S$,aS as $$,d0 as k$,a8 as Lf,ac as x$,ag as C$,cr as P$,ba as R$,aC as Hf,cT as Ap,cz as T$,ax as A$,cD as M$,c3 as E$}from"./CtJxHvGv.js";import{c as Of}from"./ChTqQfQN.js";import"./BeYVt6Wg.js";import{c as Rt}from"./DSqSJXGX.js";import{a5 as Ff,bg as q$,ar as L$,k as H$,Y as O$,W as F$,a2 as D$,Z as N$,bw as B$,V as W$,a1 as U$,ah as z$}from"./CVA75Jzf.js";import{d as Bl,f as j$,e as V$}from"./DpqgMZNx.js";import{A as G$}from"./BCrI1nnw.js";import{D as K$}from"./DnYPeWf9.js";import"./B5wwCKYG.js";import{a as Q$,C as J$}from"./BTW5Qz3T.js";import"./V7b2Jgc1.js";import{C as Y$}from"./C7RGdxsV.js";import{h as Pd,r as X$,a as Z$}from"./paBp5EDQ.js";import{s as ek}from"./CRpGhS3h.js";import{I as tk,a as nk}from"./MZe3NxQe.js";import{L as rk}from"./CIMWDf4a.js";import{g as ak,f as sk,b as ok}from"./b89lNINv.js";import{s as Ai,g as Kn,i as ik,j as lk,e as Mp,r as Ep,f as ck,d as dk,a as pd,h as uk}from"./D0WHOKE3.js";import{i as qp,a as gk}from"./Bu13V5mO.js";import{seekConversationToMessage as Lp}from"./kRDyYnu-.js";import{l as Yt,o as fd,h as jd,n as Rd,q as pk}from"./By588DV1.js";import{o as fk}from"./Byc-Gwn1.js";import{A as Df}from"./BQgCURYe.js";import{b as Nf}from"./Dd5ei__B.js";import{g as vk,e as Bf,v as hk,f as mk,N as _k,M as wk,K as bk,k as Wf,l as yk,H as Uf,s as zf}from"./Ck2JBj0W.js";import{selectCurrentWorkspaceTabId as vd}from"./DujUyPvo.js";import{o as Ik}from"./a_hFrVUs.js";import{d as Sk}from"./B0Z-1lwJ.js";import{P as $k}from"./BHjJ9bUD.js";import{g as kk}from"./Buf2XX2m.js";import{H as jf,M as xk,y as Ck,g as Pk,i as Rk,u as Tk,e as Vf,c as Gf,d as Ak}from"./Ct82vzld.js";import{c as Mk,h as Vd,f as Kf,M as Ek}from"./B6-GEB4b.js";import{t as qk}from"./DAsc1V4f.js";import{s as Lk}from"./BsieX9dN.js";import{i as Qf}from"./D95Y9O1z.js";import{d as Hk,i as Ok,r as Fk}from"./CTV49dzf.js";import{g as Dk}from"./CsFPvReh.js";var Nk=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),Bk=E("<div><!></div>");function Jf(n,r){if(new.target)return dn({component:Jf,...n});pn(r,!0);let a=Z(r,"ref",15,null),i=Z(r,"class",7),c=Z(r,"children",7),l=nf(r,Nk);var f={get ref(){return a()},set ref(v=null){a(v),ee()},get class(){return i()},set class(v){i(v),ee()},get children(){return c()},set children(v){c(v),ee()},$set:un,$on:(v,R)=>gn(r,v,R)},u=Bk();rf(u,v=>({"data-slot":"card-header",class:v,...l}),[()=>Fd("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-x-4 gap-y-1.5 pt-4 pb-2 has-data-[slot=card-action]:grid-cols-[minmax(0,1fr)_auto]",Y$,i())]);var w=I(u);return Ti(w,()=>c()??fs),b(u),hr(u,v=>a(v),()=>a()),p(n,u),fn(f)}var Wk=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),Uk=E("<div><!></div>");function Yf(n,r){if(new.target)return dn({component:Yf,...n});pn(r,!0);let a=Z(r,"ref",15,null),i=Z(r,"class",7),c=Z(r,"children",7),l=nf(r,Wk);var f={get ref(){return a()},set ref(v=null){a(v),ee()},get class(){return i()},set class(v){i(v),ee()},get children(){return c()},set children(v){c(v),ee()},$set:un,$on:(v,R)=>gn(r,v,R)},u=Uk();rf(u,v=>({"data-slot":"card-title",class:v,...l}),[()=>Fd("type-title min-w-0 break-words font-semibold leading-tight text-foreground",i())]);var w=I(u);return Ti(w,()=>c()??fs),b(u),hr(u,v=>a(v),()=>a()),p(n,u),fn(f)}const Sl=oS.CHAT_MEDIA,hd=uS().min(1).max(512);Xs({workspaceId:hd,agentId:hd,draftId:Ol(),principalId:hd,media:gS(tS).min(1).max(20)}).strict();const zk=Xs({sessionId:Ol()}).strict();zk.extend({control:pS("action",[Xs({action:wi("readiness")}).strict(),Xs({action:wi("export"),request:cS}).strict(),Xs({action:wi("transcribe"),request:dS}).strict(),Xs({action:wi("release"),jobId:Ol()}).strict(),Xs({action:wi("adopt"),jobId:Ol()}).strict()])}).strict();function Gd(n,r,a,i=async(c,l)=>typeof window>"u"||iS(window)!=="electron"?{ok:!1,error:"unavailable"}:lS().invoke(c,l)){let c=null,l=null,f=!1;async function u(){f=!0,a.removeEventListener("abort",w);const x=c;c=null,x&&await i(Sl.CLOSE,{sessionId:x}).catch(()=>{})}const w=()=>{u()};a.addEventListener("abort",w,{once:!0});const v=()=>{if(f||a.aborted||!r())throw new Error("media-send-retired")};async function R(){if(v(),c)return c;if(l)return l;l=(async()=>{const x=await i(Sl.BEGIN,n);if(!x.ok)throw new Error("media-export-unavailable");c=x.value.sessionId;try{return v(),c}catch(F){throw await u(),F}})();try{return await l}finally{l=null}}async function y(x){const F=await R();v();const D=await i(Sl.CONTROL,{sessionId:F,control:x});return v(),D}return{service:{exportMedia:x=>y({action:"export",request:x}),adoptMediaJob:x=>y({action:"adopt",jobId:x}),transcribeMedia:x=>y({action:"transcribe",request:x}),releaseMediaJob:async x=>c?await i(Sl.CONTROL,{sessionId:c,control:{action:"release",jobId:x}}):{ok:!0,value:void 0}},dispose:u,readiness:()=>y({action:"readiness"})}}const md=new Set;async function jk(n){const{drafts:r,signal:a}=n,i=structuredClone(n.capture),c=structuredClone(n.items),l=structuredClone(n.payload),{workspaceId:f,agentId:u}=i,w=Ci(O.state),v=Hl.select(O.state,f),R=vf.select(O.state),y=cf(),M=JSON.stringify([w,f,u]);if(!w||!v||!R||l.wsId!==f||md.has(M))return!1;md.add(M);const x=new AbortController,F=()=>x.abort();a.addEventListener("abort",F,{once:!0});const D=()=>!a.aborted&&!x.signal.aborted&&Ci(O.state)===w&&Hl.select(O.state,f)===v&&uf(y)&&r.isCurrentDraft(i),T=O.getReadableState().subscribe(()=>{D()||x.abort()});let H=null;try{if(!D()||jI(c))return!1;const V=If(i.attachments),oe=kf(nS(f,u),V,c.map(ue=>({contextItemId:ue.id,attachmentId:ue.attachmentId,path:ue.path}))),P=new Set([...oe.images,...oe.clips].map(ue=>ue.contextItemId));if(V.some(([ue])=>!P.has(ue))||oe.images.some(ue=>ue.mediaError)||oe.clips.some(ue=>ue.mediaError)||!rS(l.text,oe))throw new Error("invalid-evidence");if(H=n.warm?.take(i,x.signal)??null,!await r.flushDraft(i)||!D())return!1;const k=await xy.agents.get(u,f);if(!D())return!1;if(!k||k.workspaceId!==f||k.retiredAt||k.pendingDeleteAt||k.status==="deleted")throw new Error("unavailable");const Q=oe.clips.flatMap(ue=>ue.media?[ue.media]:[]);Q.length&&!H&&(H=Gd({workspaceId:f,agentId:u,draftId:crypto.randomUUID(),principalId:R.principal.id,media:Q},D,x.signal));const ge=Gb(c,oe),Re=df(ge),ve=await Kb({workspaceId:f,agentId:u,evidence:oe,clickedItems:c,sendItems:ge,clickedPayload:{...l,contextItems:ge,imageBlocks:Re.imageBlocks,fileBlocks:Re.fileBlocks},binding:y,service:H?.service??null,current:D,onRecord:()=>{}});return!ve||!D()?!1:Tl(O,u,ve)}catch{return D()&&O.dispatch(J_(u,g.dock_conversation_sendFailed_error())),!1}finally{T(),a.removeEventListener("abort",F),await H?.dispose(),md.delete(M)}}const Xf=1e4,Hp={wasBusy:!1,busySince:null,preempted:!1,prediction:null};function Op(n){return fS(n.messageMetadata)}function Vk(n,r){if(n.some(Op)){const a=n[0];return a&&!Op(a)&&Fp(a,r)?[a.id]:[]}return n.filter(a=>Fp(a,r)).map(a=>a.id)}function Gk(n){let r=null;for(const a of n)(a.status==="preparing"||a.status==="sending")&&a.createdAt>(r??-1/0)&&(r=a.createdAt);return r}function Fp(n,r){return!n.requeuedAfterFailure&&vS(n,r)}function Kk(n,r){const{busy:a,queue:i,delivered:c,now:l}=r,f=r.blocked||r.interrupted,u=r.timeoutMs??Xf;let w=n.prediction;if(w){const x=new Set(i.map(H=>H.id)),F=w.ids.filter(H=>x.has(H)&&!c.has(H)),D=l-w.startedAt>=u,T=n.wasBusy&&!a;!F.length||D||f&&!a||T?w=null:F.length!==w.ids.length&&(w={...w,ids:F})}const v=n.wasBusy&&!a,R=n.wasBusy?n.busySince:a?l:null,y=n.wasBusy&&n.preempted||R!==null&&r.directSendAt!==null&&r.directSendAt>R;if(!w&&v&&!f&&!y){const x=Vk(i,l).filter(F=>!c.has(F));x.length&&(w={ids:x,startedAt:l})}const M={wasBusy:a,busySince:a?R:null,preempted:a&&y,prediction:w};return n.wasBusy===M.wasBusy&&n.busySince===M.busySince&&n.preempted===M.preempted&&n.prediction===M.prediction?n:M}class Qk{constructor(){Qs(this,"previousWorkspaceId",null);Qs(this,"_isRebinding",!1);Qs(this,"_generation",0);Qs(this,"_rebindPromise",null);Qs(this,"_rebindResolve",null)}recordMount(r){return this.previousWorkspaceId=r,r}wasWorkspaceChangedDuringMount(r){return this.previousWorkspaceId!==r}shouldRebind(r){return!r||this.previousWorkspaceId===null?!1:r!==this.previousWorkspaceId}recordRebind(r){this.previousWorkspaceId=r}hasWorkspaceChanged(r){return r!==this.previousWorkspaceId}get trackedWorkspaceId(){return this.previousWorkspaceId}get isRebinding(){return this._isRebinding}startRebind(){return this._generation++,this._isRebinding=!0,this._rebindResolve?.(),this._rebindPromise=new Promise(r=>{this._rebindResolve=r}),this._generation}endRebind(r){r!==void 0&&r!==this._generation||(this._isRebinding=!1,this._rebindResolve?.(),this._rebindPromise=null,this._rebindResolve=null)}async waitForRebind(r=5e3){if(!this._isRebinding||!this._rebindPromise)return!1;const a=Date.now()+r;for(;this._isRebinding&&this._rebindPromise;){const i=a-Date.now();if(i<=0)return!1;let c;const l=await Promise.race([this._rebindPromise.then(()=>!1),new Promise(f=>{c=setTimeout(()=>f(!0),i)})]);if(clearTimeout(c),l)return!1}return!0}}function Jk(n,r){return!(n?.tabType!=="agent"||n.agentId!==r.agentId||!r.isActive||n.workspaceId&&n.workspaceId!==r.workspaceId||r.panelId&&(n.source!=="dictation"&&!r.isPanelFocused||n.panelId&&n.panelId!==r.panelId))}function Dp(n){const r=typeof n=="string"?n:n&&typeof n=="object"&&typeof n.script=="string"?n.script:void 0;return r||void 0}var Yk=E('<div role="status" aria-live="polite" data-presence-typing-indicator=""><span class="inline-flex min-w-[var(--operational-leading-slot-size)] shrink-0 items-center justify-center svelte-lm4khl"><!></span> <span class="min-w-0 truncate svelte-lm4khl"> </span> <span class="inline-flex shrink-0 items-center gap-0.5 svelte-lm4khl" aria-hidden="true"><span class="typing-dot size-1 rounded-full bg-current svelte-lm4khl"></span> <span class="typing-dot size-1 rounded-full bg-current svelte-lm4khl" style="animation-delay: 0.2s"></span> <span class="typing-dot size-1 rounded-full bg-current svelte-lm4khl" style="animation-delay: 0.4s"></span></span></div>');function Zf(n,r){if(new.target)return dn({component:Zf,...n});pn(r,!0);const a=()=>fe(R,"$typing$",i),[i,c]=Dr();let l=Z(r,"workspaceId",7),f=Z(r,"agentId",7),u=Z(r,"class",7,"");const w=Nn(""),v=Nn("");le(()=>{w.set(l())}),le(()=>{v.set(f())});const R=VI(w,v),y=o(()=>ZS(a()));var M={get workspaceId(){return l()},set workspaceId(H){l(H),ee()},get agentId(){return f()},set agentId(H){f(H),ee()},get class(){return u()},set class(H=""){u(H),ee()},$set:un,$on:(H,V)=>gn(r,H,V)},x=Bt(),F=ye(x);{var D=H=>{var V=Yk(),oe=I(V),P=I(oe);XS(P,{get people(){return a()},size:12,decorative:!0}),b(oe);var k=m(oe,2),Q=de(k,!0);In(2),b(V),q(()=>{ke(V,1,`${Af} flex h-4 min-w-0 items-center gap-[var(--operational-leading-gap)] px-[var(--operational-row-inline-padding)] font-family-child font-normal text-muted-foreground text-[11px] leading-4 ${u()??""} /* a11y-ignore: user-requested compact typing status in the composer gap */`,"svelte-lm4khl"),z(Q,e(y))}),p(H,V)};B(F,H=>{e(y)&&H(D)})}p(n,x);var T=fn(M);return c(),T}const Xk=50,Zk=5e3,ex=500,tx=()=>({authority:()=>Ci(O.state),persistSnapshot:Jb,dispatch:n=>O.dispatch(n),ownerView:n=>Yb.withStore(O)(n)});function nx(n){const r=n.store??tx(),a=crypto.randomUUID();let i=_e(!1),c=_e(!1),l=_e(!1),f=null,u=null,w=0,v=!1,R=null,y=null,M=null,x=0,F=null,D=null;const T={};let H,V=_e([]),oe=null,P=0,k="",Q=0,ge="";const Re=()=>{const N=n.workspaceId(),C=n.agentId();if(!N||!C||!(n.active?.()??!0))return null;const re=r.authority?.();if(!re||v)return null;const Te=n.inputValue(),L=ue(),Y=H?.shared,J=Y?.workspaceId===N&&Y.agentId===C?Y.lifetime:null,be=JSON.stringify([re,N,C,x,J,L.map(U=>[U.id,U.attachmentId,U.path])]);be!==ge&&(ge=be,Q+=1);const Ne=JSON.stringify([re,N,C,Te,L,x]);return Ne!==k&&(k=Ne,P+=1),{authority:re,ownerId:a,workspaceId:N,agentId:C,text:Te,attachments:JSON.parse(JSON.stringify(L)),generation:P,attachmentEpoch:Q}};let ve=null;const ue=()=>qI(n.contextItems(),LI(n.contextItems(),e(V))),we=N=>{if(H=N,!N||v)return;const C=N.restore;if(D&&C?.requestId===D.requestId&&C.status!=="pending"){const{apply:L}=D;D=null,_(c,!1),C.status==="restored"&&_(V,C.draft?.attachments??[]),L(C)}const re=N.shared;if(re&&!e(c)&&u===`${re.workspaceId}\0${re.agentId}`){const L=JSON.stringify([re.provenance,re.workspaceId,re.agentId,re.lifetime,re.revision]);if(oe!==L){oe=L;const Y=ve??f,J=Y&&n.inputValue()===Y.text&&JSON.stringify(ue())===Y.attachmentsJson;re.origin===a?ve={text:re.snapshot.text,attachmentsJson:JSON.stringify(re.snapshot.attachments)}:J&&(w+=1,M&&clearTimeout(M),_(V,re.snapshot.attachments),ve=f={text:re.snapshot.text,attachmentsJson:JSON.stringify(e(V))},n.setInputValue(re.snapshot.text),n.setContextItems(bl(e(V))),n.applyEditorContent(re.snapshot.text))}}ct(Re);const Te=[];for(const L of N.saves){if(L.status==="pending")continue;Te.push(L.id);const Y=T[L.id];delete T[L.id],Y?.(L)}Te.length>0&&queueMicrotask(()=>r.dispatch(ew(a,Te)))},ne=(N,C,re)=>{const Te=crypto.randomUUID();D={requestId:Te,apply:re},_(c,!0),r.dispatch(nw(a,Te,N,C))},te=()=>{D&&(D=null,_(c,!1),r.dispatch(aw(a)))},ze=()=>{const N=F;N&&(F=null,r.dispatch(rw(a)),H?.saves.some(C=>C.id===N)||delete T[N])};r.dispatch(Y_(a));const se=r.ownerView(a).subscribe(N=>ct(()=>we(N))),he=()=>{y&&(clearTimeout(y),y=null),_(l,!1)},Me=()=>{F&&(F=null,r.dispatch(tw(a)))};le(()=>{const N=n.active?.()??!0,C=n.workspaceId(),re=n.agentId();if(!N){ct(()=>{w+=1,u=null,te(),R&&clearTimeout(R),R=null,he(),M&&clearTimeout(M),M=null,_(i,!1),Me()});return}if(!C||!re)return;const Te=`${C}\0${re}`;if(u===Te)return;const L=u!==null;u=Te;const Y=++w;ct(()=>{f=null,ve=null,oe=null,_(V,[]),R&&clearTimeout(R),he(),M&&(clearTimeout(M),M=null),L&&(Me(),n.setInputValue(""),n.contextItemsAreScoped||n.setContextItems([]),n.applyEditorContent(""));const J=Qb(C,re);if(J){_(V,J.attachments),_(i,!1);const Ne=n.contextItems().length>0,U=J.text,Ie=JSON.stringify(J.attachments);n.setInputValue(J.text),Ne||n.setContextItems(bl(J.attachments)),n.applyEditorContent(J.text),f={text:J.text,attachmentsJson:Ie},ne(C,re,Ce=>{if(Ce.status!=="restored")return;const Le=Ce.draft;if(v||!(n.active?.()??!0)||u!==Te||w!==Y)return;const st=Le?.text??"",Xe=Le?.attachments??[],He=JSON.stringify(Xe);sd(C,re,{text:st,attachments:Xe});const Pe=n.inputValue()===U&&JSON.stringify(ue())===Ie;Ne||!Pe||(st!==U&&(n.setInputValue(st),n.applyEditorContent(st)),He!==Ie&&n.setContextItems(bl(Xe)),f={text:st,attachmentsJson:He})});return}_(i,!0),y=setTimeout(()=>{y=null,(n.active?.()??!0)&&_(l,!0)},ex),R=setTimeout(()=>{(n.active?.()??!0)&&(_(i,!1),he())},Zk);const be=()=>{!(n.active?.()??!0)||u!==Te||w!==Y||(R&&clearTimeout(R),_(i,!1),he())};ne(C,re,Ne=>{if(Ne.status!=="restored"){be();return}const U=Ne.draft;if(v||!(n.active?.()??!0)||u!==Te||w!==Y)return;const Ie=!!n.inputValue();if(!Ie&&U?.attachments?.length&&n.contextItems().length===0&&n.setContextItems(bl(U.attachments)),!Ie&&U?.text&&(n.setInputValue(U.text),M=setTimeout(()=>{(n.active?.()??!0)&&n.inputValue()===U.text&&n.applyEditorContent(U.text)},Xk)),f===null){const Ce=U?.text??"",Le=U?.attachments??[];f={text:Ce,attachmentsJson:JSON.stringify(Le)},sd(C,re,{text:Ce,attachments:Le})}be()})})}),le(()=>{const N=n.active?.()??!0,C=n.workspaceId(),re=n.agentId(),Te=e(i);if(!N){ct(ze);return}if(!C||!re)return;const L=n.inputValue(),Y=ue();if(ct(Re),ct(ze),Te||f===null&&!L&&Y.length===0)return;const J=JSON.stringify(Y);if(f!==null&&f.text===L&&f.attachmentsJson===J)return;JSON.stringify(e(V))!==J&&_(V,Y);const be=`${C}\0${re}`,Ne=x,U=crypto.randomUUID();T[U]=Ie=>{if(n.active?.()??!0){if(Ie.status==="saved"){u===be&&x===Ne&&(f={text:L,attachmentsJson:J});return}n.onSaveError?.(new Error(Ie.error))}},ct(()=>{F=U,r.dispatch(X_(a,U,{authority:r.authority?.()??void 0,workspaceId:C,agentId:re,text:L,attachments:Y,rollback:f?{text:f.text,attachments:JSON.parse(f.attachmentsJson)}:null}))})}),le(()=>()=>{v=!0,R&&clearTimeout(R),y&&clearTimeout(y),M&&clearTimeout(M),Me(),se(),r.dispatch(Z_(a))});const Ee=N=>{const C=Re();return C!==null&&C.authority===N.authority&&C.ownerId===N.ownerId&&C.workspaceId===N.workspaceId&&C.agentId===N.agentId&&C.generation===N.generation&&C.text===N.text&&JSON.stringify(C.attachments)===JSON.stringify(N.attachments)};return{captureDraft:Re,isCurrentDraft:Ee,updateAttachmentScreen(N,C,re){return!Ee(N)||!N.attachments.some(Te=>Te.id===C)?null:(_(V,N.attachments.map(Te=>Te.id===C?{...Te,screen:structuredClone(re)}:Te)),Re())},async flushDraft(N){if(!Ee(N))return!1;if(!r.persistSnapshot)throw new Error("draft-shared-transport-unavailable");return await r.persistSnapshot(a,N.workspaceId,N.agentId,N,N.authority),Ee(N)},get restorePending(){return e(c)},get gateActive(){return e(i)},get gateVisible(){return e(l)},invalidatePendingRestore(){if(w+=1,x+=1,te(),R&&(clearTimeout(R),R=null),M&&(clearTimeout(M),M=null),_(i,!1),he(),ze(),u!==null){const[N,C]=u.split("\0");sd(N,C,{text:"",attachments:[]}),ve=null,_(V,[]),f={text:"",attachmentsJson:"[]"}}}}}function Mi(n){if(!n)return null;const r=kf(JSON.stringify([n.workspaceId,n.agentId]),If(n.attachments),n.attachments.map(a=>({contextItemId:a.id,attachmentId:a.attachmentId,path:a.path})));return{...r,clips:r.clips.filter(a=>{const i=n.attachments.find(c=>c.id===a.contextItemId);return!!a.media&&!a.mediaError&&!!i&&a.path===i.path})}}async function rx(n,r,a){const i=O.state.principal.snapshot,c=()=>Ci(O.state)===n.authority&&a.isCurrentDraft(n);if(!i||!c()||!await a.flushDraft(n)||!c())return{ready:!1};const l=new AbortController,f=Gd({workspaceId:n.workspaceId,agentId:n.agentId,principalId:i.principal.id,draftId:crypto.randomUUID(),media:[r]},c,l.signal);try{const u=await f.readiness();return!c()||!u.ok?{ready:!1}:u.value.find(w=>w.sourceId===r.source.id)??{ready:!1}}finally{await f.dispose()}}function Np(n){let r=_e(null),a=_e(!1),i=_e(!1),c=null,l=!0,f=0,u=null;Es(()=>{l=!1,f++}),le(()=>{const y=n.capture();e(r)&&(!y||y.authority!==e(r).capture.authority||y.ownerId!==e(r).capture.ownerId||y.workspaceId!==e(r).capture.workspaceId||y.agentId!==e(r).capture.agentId||y.attachmentEpoch!==e(r).capture.attachmentEpoch)&&_(r,null)});async function w(y){if(n.disabled()||e(a))return;const M=n.drafts.captureDraft(),x=Mi(M),F=x?.clips.find(V=>V.contextItemId===y);if(!M||!F?.media||!x)return;const D=Xb({workspaceId:M.workspaceId,agentId:M.agentId,clip:F,evidence:x,marks:x.marks}),T=gf(M.workspaceId,F.path);if(!D||!T)return;const H=++f;c=document.activeElement instanceof HTMLElement?document.activeElement:null,_(a,!0),_(i,!1);try{if(await n.beforeOpen?.(),!l||f!==H||!n.drafts.isCurrentDraft(M))return;const V=await(n.prepareOutput??rx)(M,F.media,n.drafts);if(!l||f!==H||!n.drafts.isCurrentDraft(M))return;const{attachmentPath:oe,...P}=D;_(r,{capture:M,contextItemId:y,snapshot:{...P,openId:crypto.randomUUID(),mediaUrl:T,output:V,deleteReady:!0}})}catch{l&&f===H&&_(i,!0)}finally{l&&f===H&&_(a,!1)}}async function v(y){const M=crypto.randomUUID(),x=e(r),F=n.drafts.captureDraft();if(!x||!F||F.authority!==x.capture.authority||F.ownerId!==x.capture.ownerId||F.workspaceId!==x.capture.workspaceId||F.agentId!==x.capture.agentId||F.attachmentEpoch!==x.capture.attachmentEpoch)return{requestId:M,result:"stale-source"};const D=Mi(F),T=D?.clips.find(Q=>Q.contextItemId===x.contextItemId);if(!D||!T?.media)return{requestId:M,result:"stale-source"};const V=u?.openId===x.snapshot.openId&&u.inputRevision===y.revision&&JSON.stringify(u.media)===JSON.stringify(T.media)?{...y,revision:T.media.saved?.revision??0}:y,oe=aS(T.media,{openId:x.snapshot.openId,...x.snapshot.output?.version===2?{outputVersion:2}:{},pair:{workspaceId:F.workspaceId,agentId:F.agentId},sourceId:y.sourceId,sourceRevision:y.sourceRevision,expectedEditRevision:V.revision,edit:V});if(oe.status!=="saved")return{requestId:M,result:oe.status==="invalid-edit"?"failed":oe.status};const P=sS({...D,clips:D.clips.map(Q=>Q.id===T.id?{...Q,media:oe.media}:Q)})[x.contextItemId],k=n.drafts.updateAttachmentScreen(F,x.contextItemId,P);if(!k)return{requestId:M,result:"stale-source"};u={openId:x.snapshot.openId,media:oe.media,inputRevision:y.revision};try{if(!n.drafts.isCurrentDraft(k))return{requestId:M,result:"stale-source"};await n.drafts.flushDraft(k);const Q=n.drafts.captureDraft();return!l||e(r)?.snapshot.openId!==x.snapshot.openId||!Q||Q.attachmentEpoch!==x.capture.attachmentEpoch||Q.authority!==k.authority||Q.ownerId!==k.ownerId||Q.workspaceId!==k.workspaceId||Q.agentId!==k.agentId||JSON.stringify(Q.attachments.find(ge=>ge.id===x.contextItemId)?.screen)!==JSON.stringify(P)?{requestId:M,result:"stale-source"}:(u=null,{requestId:M,result:"saved",saved:oe.media.saved??void 0})}catch{return{requestId:M,result:"failed"}}}function R(y){return n.disabled()||!n.onRemove(y)?!1:(e(r)?.contextItemId===y&&_(r,null),!0)}return{get session(){return e(r)},get opening(){return e(a)},get problem(){return e(i)},open:w,save:v,remove:R,close(){_(r,null)},restoreFocus(){c?.isConnected&&c.focus()}}}var ax=E('<p role="alert"> </p>'),sx=E('<div class="recording-editor-surface svelte-cdb16"><!></div>'),ox=E("<!> <!> <!>",1);function ev(n,r){if(new.target)return dn({component:ev,...n});pn(r,!0);let a=Z(r,"capture",7),i=Z(r,"drafts",7),c=Z(r,"disabled",7,!1),l=Z(r,"onRemove",7),f=Z(r,"controllerFactory",7,Np),u=Z(r,"beforeOpen",7),w=Z(r,"onReviewChange",7);const v=ct(()=>f()({drafts:i(),capture:()=>a(),disabled:()=>c(),onRemove:P=>l()(P),beforeOpen:()=>u()?.()??Promise.resolve()}));le(()=>{const P=v.opening,k=v.session;ct(()=>w()?.(P,k?.snapshot.output?.ready?{openId:k.snapshot.openId,capture:k.capture}:null))});const R=o(Zb),y=o(()=>Mi(a())),M=o(()=>e(y)?.clips.map(P=>({id:P.contextItemId,kind:"clip",owner:"evidence",duration:Sp(P.durationMs),recording:!1,url:a()?gf(a().workspaceId,P.path):void 0,...P.media?.saved?{summary:ey(P.media.saved)}:{}}))??[]);let x=_e(null);var F={get capture(){return a()},set capture(P){a(P),ee()},get drafts(){return i()},set drafts(P){i(P),ee()},get disabled(){return c()},set disabled(P=!1){c(P),ee()},get onRemove(){return l()},set onRemove(P){l(P),ee()},get controllerFactory(){return f()},set controllerFactory(P=Np){f(P),ee()},get beforeOpen(){return u()},set beforeOpen(P){u(P),ee()},get onReviewChange(){return w()},set onReviewChange(P){w(P),ee()},$set:un,$on:(P,k)=>gn(r,P,k)},D=ox(),T=ye(D);{let P=o(()=>c()||v.opening);hS(T,{get items(){return e(M)},get labels(){return e(R)},get disabled(){return e(P)},onEdit:k=>void v.open(k),onMarkUp:k=>void v.open(k),get onRemove(){return v.remove}})}var H=m(T,2);{var V=P=>{var k=ax(),Q=de(k,!0);q(ge=>z(Q,ge),[()=>g.dock_captureEditor_saveFailed_label()]),p(P,k)};B(H,P=>{v.problem&&P(V)})}var oe=m(H,2);{let P=o(()=>!!v.session),k=o(()=>g.dock_captureEditor_recording_title({duration:v.session?Sp(v.session.snapshot.durationMs??0):""}));d$(oe,{get open(){return e(P)},size:"editor",showCloseButton:!1,get title(){return e(k)},escapeKeydownBehavior:"ignore",dismissOnInteractOutside:!1,onClose:()=>v.close(),onCloseAutoFocus:Q=>{Q.preventDefault(),v.restoreFocus()},get contentRef(){return e(x)},set contentRef(Q){_(x,Q,!0)},children:(Q,ge)=>{var Re=Bt(),ve=ye(Re);{var ue=we=>{var ne=Bt(),te=ye(ne);ki(te,()=>v.session.snapshot.openId,ze=>{var se=sx(),he=I(se);g$(he,{get snapshot(){return v.session.snapshot},get shortcutDialog(){return e(x)},onClose:()=>v.close(),get onSave(){return v.save},onDelete:async()=>!!v.session&&v.remove(v.session.contextItemId)}),b(se),p(ze,se)}),p(we,ne)};B(ve,we=>{v.session&&we(ue)})}p(Q,Re)},$$slots:{default:!0}})}return p(n,D),fn(F)}const $l=n=>JSON.stringify([n.authority,n.ownerId,n.workspaceId,n.agentId,n.attachmentEpoch,n.attachments]);function ix(n){let r=_e(!1),a=_e(!1),i=_e(null),c=!1,l=0,f=null,u=null;async function w(y){y.abort.abort(),y.slot?.cancel(),await y.native?.dispose()}async function v(){l++;const y=u;u=null,y&&await w(y)}to(()=>{const y=()=>{_(r,document.hasFocus(),!0)};return y(),window.addEventListener("focus",y),window.addEventListener("blur",y),()=>{window.removeEventListener("focus",y),window.removeEventListener("blur",y)}});const R=O.getReadableState().subscribe(()=>{u&&!u.current()&&v()});return Es(()=>{c=!0,R(),v()}),le(()=>{const y=n.capture(),M=y?$l(y):"",x=e(r)&&!e(a)&&(n.active()||e(i)?.key===M);ct(()=>{if(!x||!y){v();return}if(u?.key===M)return;if(f===M){v();return}v();const D=Mi(y)?.clips.flatMap(Re=>!Re.mediaError&&Re.media?[Re.media]:[])??[],T=D[0],H=O.state.principal.snapshot,V=Hl.select(O.state,y.workspaceId);if(!T||!H||!V||n.drafts.gateActive)return;const oe=cf(),P=new AbortController,k=()=>!c&&!P.signal.aborted&&Ci(O.state)===y.authority&&Hl.select(O.state,y.workspaceId)===V&&uf(oe)&&!!n.capture()&&$l(n.capture())===M,Q={key:M,capture:y,abort:P,native:null,slot:null,current:k};u=Q;const ge=l;n.drafts.flushDraft(y).then(async Re=>{if(!(u!==Q||ge!==l||!k())){if(!Re){f=M,await v();return}Q.native=Gd({workspaceId:y.workspaceId,agentId:y.agentId,draftId:crypto.randomUUID(),principalId:H.principal.id,media:structuredClone(D)},k,P.signal),Q.slot=ty(Q.native.service),f=M,Q.slot.warm(M,T,k)}}).catch(()=>{u===Q&&v()})})}),{cancel:v,async beforeEditorOpen(){_(a,!0),f=null,await v()},editorState(y,M){_(a,y,!0);const x=M?$l(M.capture):null;M&&e(i)?.openId!==M.openId&&(f=null),_(i,M&&x?{openId:M.openId,key:x}:null)},take(y,M){const x=u;if(!x?.native||!x.slot||x.key!==$l(y)||!x.current())return v(),null;u=null,l++;const F=x.native,D=x.slot,T=()=>x.abort.abort();return M.addEventListener("abort",T,{once:!0}),M.aborted&&T(),{service:{...F.service,takePreparedRecording:H=>D.take(x.key,H,()=>!M.aborted&&x.current())},async dispose(){M.removeEventListener("abort",T),await w(x)}}}}}var lx=E('<div role="status" class="px-3 py-1.5 text-xs text-muted-foreground" data-testid="chat-draft-loading-gate"><span> </span></div>');function tv(n,r){if(new.target)return dn({component:tv,...n});pn(r,!1);var a={$set:un,$on:(f,u)=>gn(r,f,u)};Mf();var i=lx(),c=I(i),l=de(c,!0);return b(i),q(f=>z(l,f),[()=>g.chat_draftGate_loading_label()]),p(n,i),fn(a)}var cx=E('<div data-new-messages-divider="" class="type-caption font-family-child my-6 flex items-center gap-2 px-2" role="separator"><div class="h-px flex-1 bg-border"></div> <span class="whitespace-nowrap px-1 font-medium text-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div>');function Td(n,r){if(new.target)return dn({component:Td,...n});pn(r,!1);var a={$set:un,$on:(f,u)=>gn(r,f,u)};Mf();var i=cx(),c=m(I(i),2),l=de(c,!0);return In(2),b(i),q((f,u)=>{Ue(i,"aria-label",f),z(l,u)},[()=>g.chat_newMessagesDivider_label(),()=>g.chat_newMessagesDivider_label()]),p(n,i),fn(a)}function dx(n,r){if(!r||n.length===0)return null;const a=n.indexOf(r);return a===-1||a===n.length-1?null:r}function ux(n,r,a){if(!r||n.length===0)return"none";const i=n.indexOf(r);return i===n.length-1?"none":i!==-1?"marker-loaded":a.complete?a.truncated?"marker-beyond-window":"none":"marker-pending"}function gx(n,r){return r&&n.includes(r)?r:null}function Bp(n,r,a){return r-n<=a}const px=.2;function Wp(n,r,a){const i=Math.max(0,a-r),c=n-px*r;return Math.min(Math.max(0,c),i)}function fx(n,r,a){return n!==null&&a&&n===r}function vx(n){return n?sw(n)&&ow(n)!==null&&typeof n.metadata?.taskNoteId=="string":!1}function hx(n){const r=[],a=new Set;let i,c;for(const H of n.messages){if(H.agentId&&H.agentId!==n.agentId){i=void 0,c=void 0;continue}if(a.has(H.id))continue;a.add(H.id),n.breakBeforeMessageIds?.has(H.id)&&(i=void 0,c=void 0);const V=mS(H);if(V?.kind!=="turn-failure")c=void 0;else{const oe=i?.seq!==void 0&&H.seq!==void 0&&Number.isSafeInteger(i.seq)&&Number.isSafeInteger(H.seq)&&H.seq===i.seq+1;(!c||!oe)&&(c={key:JSON.stringify([n.agentId,"notice",H.id]),anchorMessageId:H.id,correlation:"unavailable",records:[],recordedFailureCount:0},r.push(c)),c.records.push({messageId:H.id,reason:V.reason,timestamp:H.timestamp}),c.recordedFailureCount+=1}i=H}const l=new Map;for(const H of n.queue){if(!H.requeuedAfterFailure)continue;const V=H.turnId||void 0,oe=JSON.stringify([n.agentId,V?"turn":"queue",V??H.id]);let P=l.get(oe);P||(P={key:oe,correlation:V?"turn":"queue-entry",turnId:V,queueIds:[],state:"queued"},l.set(oe,P)),P.queueIds.includes(H.id)||P.queueIds.push(H.id)}const f=[...l.values()],u=n.session?.id===n.agentId?n.session:void 0,w=u?.status===Si.Error,v=n.transientError||w&&u.stopReason||null,R=w&&!v,y=w&&(!n.transientError||n.transientError===u.stopReason)?u.stopReasonTimestamp:void 0,M=y?pp(y):null,x=M&&v&&v===u?.stopReason?r.flatMap(H=>H.records).filter(H=>H.reason===v&&pp(H.timestamp)===M):[],F=x.length===1?x[0].messageId:void 0,T=(u?hf(u):!1)?"attempting":f.length?"queued":v||R?"action-needed":"inactive";return{history:r,queueRecovery:f,current:{state:T,error:v,needsFallbackReason:R,timestamp:y,noticeId:F}}}function mx(n,r){const a=n.hiddenTail[0]?.id,i=hx({...r,messages:[...n.groups.flatMap(u=>u.messages),...n.hiddenTail],breakBeforeMessageIds:new Set(a?[a]:[])}),c=i.current.noticeId,l=i.history.map(u=>({...u,records:u.records.filter(w=>w.messageId!==c)})).filter(u=>u.records.length>0),f=new Set(l.map(u=>u.records[0].messageId));return{...i,runsByAnchor:new Map(l.map(u=>[u.records[0].messageId,u])),collapsedMessageIds:new Set(i.history.flatMap(u=>u.records.map(w=>w.messageId).filter(w=>!f.has(w))))}}var _x=E('<div class="flex size-10 shrink-0 items-center justify-center rounded-md bg-muted/50"><!></div> <div class="min-w-0 flex-1"><div class="type-body truncate font-medium text-foreground"> </div> <div class="type-caption mt-0.5 line-clamp-2 text-muted-foreground"> </div></div> <div class="flex size-7 shrink-0 items-center justify-center rounded-md bg-muted/50 text-muted-foreground transition-colors group-hover:bg-muted"><!></div>',1),wx=E('<div class="flex size-9 shrink-0 items-center justify-center rounded-md bg-muted/50"><!></div> <span class="type-body font-medium"> </span>',1),bx=E('<div><div class="border-b border-border bg-muted/20 px-4 py-3"><p class="type-body font-medium text-foreground"> </p> <p class="type-caption mt-0.5 text-muted-foreground"> </p></div> <div class="max-h-[21rem] overflow-y-auto p-2"><!></div> <div class="border-t border-border bg-popover p-2"><!></div></div>'),yx=E('<div class="mb-5"><!></div>'),Ix=E('<p data-testid="agent-welcome-description"> </p> <!>',1),Sx=E("<!> <!>",1),$x=E('<p class="mb-3 px-4 text-sm text-subtle leading-relaxed whitespace-pre-wrap" data-testid="agent-welcome-description"> </p>'),kx=E("<!> <span> </span>",1),xx=E('<div class="mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-4 pb-6 pt-4 text-subtle"><!> <!> <!></div>');function nv(n,r){if(new.target)return dn({component:nv,...n});pn(r,!0);const a=()=>fe(x,"$userOverrides$",f),i=()=>fe(M,"$specialists$",f),c=()=>fe(H,"$isGitHubAuth$",f),l=()=>fe(V,"$recentSpecialistIds$",f),[f,u]=Dr();let w=Z(r,"onSpecialistChange",7),v=Z(r,"session",7),R=Z(r,"workspaceId",7);const y=Nn(R()??"");le(()=>y.set(R()??""));const M=Ff(y),x=q$();le(()=>{a()});const F=o(()=>{if(!v()||qy(v()))return null;const N=v().metadata?.specialist||v().agentMetadata?.specialist;return N&&i().find(C=>C.id===N)||null});async function D(N){N?await Bl({specialist:N,hash:"specialists"}):await Bl({view:"create-specialist"})}let T=_e(!1);const H=L$(),V=GI(),oe=o(()=>iw(H$(i(),c()),l()));let P=_e(!1);const k=o(()=>g.chat_regularAgentWelcome_generalDescription_label()),Q=o(()=>e(F)?.name??g.chat_shared_general_fallback()),ge=o(()=>e(F)?.description??g.chat_shared_noSpecializedBehavior_label()),Re=o(()=>e(F)?e(F).defaultBehaviorPrompt||"":e(k));var ve={get onSpecialistChange(){return w()},set onSpecialistChange(N){w(N),ee()},get session(){return v()},set session(N){v(N),ee()},get workspaceId(){return R()},set workspaceId(N){R(N),ee()},$set:un,$on:(N,C)=>gn(r,N,C)},ue=xx(),we=I(ue);{var ne=N=>{var C=yx(),re=I(C);K$(re,{class:"block w-full",align:"start",side:"bottom",contentClass:"w-[min(28rem,calc(100vw-2rem))]",get open(){return e(P)},set open(Y){_(P,Y,!0)},trigger:(Y,J)=>{let be=()=>(J?.()).props;{let Ne=o(()=>Fd("group flex h-auto min-h-(--control-height-medium) w-full cursor-pointer items-center gap-3 whitespace-normal rounded-lg border border-border bg-card px-4 py-3 text-left shadow-xs transition-colors","hover:border-input hover:bg-accent/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"));xt(Y,Ei(be,{type:"button",variant:"plain",wrapContent:!1,get class(){return e(Ne)},"data-testid":"specialist-picker-trigger",children:(U,Ie)=>{var Ce=_x(),Le=ye(Ce),st=I(Le);{let Se=o(()=>e(F)?.id??null),Ae=o(()=>e(F)?.icon??null);G$(st,{agentId:"blank",variant:"emphasized",get specialist(){return e(Se)},get icon(){return e(Ae)}})}b(Le);var Xe=m(Le,2),He=I(Xe),Pe=de(He,!0),j=m(He,2),ae=de(j,!0);b(Xe);var qe=m(Xe,2),G=I(qe);pt(G,{get icon(){return Na},size:10}),b(qe),q(()=>{z(Pe,e(Q)),z(ae,e(ge))}),p(U,Ce)},$$slots:{default:!0}}))}},content:Y=>{var J=bx(),be=I(J),Ne=I(be),U=de(Ne,!0),Ie=m(Ne,2),Ce=de(Ie,!0);b(be);var Le=m(be,2),st=I(Le);{let Pe=o(()=>e(F)?.id??null);D_(st,{get specialists(){return e(oe)},get value(){return e(Pe)},onchange:j=>{_(P,!1),w()?.(j)}})}b(Le);var Xe=m(Le,2),He=I(Xe);Rt(He,()=>Or,(Pe,j)=>{j(Pe,{class:"flex h-auto w-full cursor-pointer items-center gap-3 whitespace-normal rounded-md px-3 py-2 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onSelect:()=>{_(P,!1),D()},children:(ae,qe)=>{var G=wx(),Se=ye(G),Ae=I(Se);pt(Ae,{get icon(){return m$},size:12}),b(Se);var je=m(Se,2),Be=de(je,!0);q(We=>z(Be,We),[()=>g.chat_regularAgentWelcome_createSpecialist_label()]),p(ae,G)},$$slots:{default:!0}})}),b(Xe),b(J),q((Pe,j)=>{z(U,Pe),z(Ce,j)},[()=>g.workspace_createAgentSection_specialists_label(),()=>g.workspace_createAgentSection_specialists_description()]),p(Y,J)},$$slots:{trigger:!0,content:!0}}),b(C),p(N,C)};B(we,N=>{w()&&N(ne)})}var te=m(we,2);{var ze=N=>{var C=Bt(),re=ye(C);{let Te=o(()=>g.chat_specialistSelector_prompt_label());Rt(re,()=>J$,(L,Y)=>{Y(L,{class:"mb-3",role:"region",get"aria-label"(){return e(Te)},children:(J,be)=>{var Ne=Sx(),U=ye(Ne);Rt(U,()=>Jf,(Ce,Le)=>{Le(Ce,{children:(st,Xe)=>{var He=Bt(),Pe=ye(He);Rt(Pe,()=>Yf,(j,ae)=>{ae(j,{class:"type-caption font-medium",children:(qe,G)=>{In();var Se=_n();q(Ae=>z(Se,Ae),[()=>g.chat_specialistSelector_prompt_label()]),p(qe,Se)},$$slots:{default:!0}})}),p(st,He)},$$slots:{default:!0}})});var Ie=m(U,2);Rt(Ie,()=>Q$,(Ce,Le)=>{Le(Ce,{children:(st,Xe)=>{var He=Ix(),Pe=ye(He),j=de(Pe,!0),ae=m(Pe,2);xt(ae,{type:"button",variant:"link",get"aria-expanded"(){return e(T)},onclick:()=>_(T,!e(T)),class:"text-xs text-muted-foreground hover:text-foreground transition-colors mt-2 cursor-pointer",children:(qe,G)=>{In();var Se=_n();q(Ae=>z(Se,Ae),[()=>e(T)?g.chat_regularAgentWelcome_showLess_label():g.chat_regularAgentWelcome_showMore_label()]),p(qe,Se)},$$slots:{default:!0}}),q(()=>{ke(Pe,1,`text-sm text-subtle leading-relaxed whitespace-pre-wrap break-words ${e(T)?"":"line-clamp-6"}`),z(j,e(Re))}),p(st,He)},$$slots:{default:!0}})}),p(J,Ne)},$$slots:{default:!0}})})}p(N,C)},se=N=>{var C=$x(),re=de(C,!0);q(()=>z(re,e(Re))),p(N,C)};B(te,N=>{e(F)?N(ze):N(se,-1)})}var he=m(te,2);{var Me=N=>{xt(N,{variant:"ghost-light",size:"sm",onclick:()=>D(e(F).id),class:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer pl-1.5 mr-auto",children:(C,re)=>{var Te=kx(),L=ye(Te);pt(L,{get icon(){return h$},size:12,class:"opacity-60"});var Y=m(L,2),J=de(Y,!0);q(be=>z(J,be),[()=>g.chat_regularAgentWelcome_customize_label()]),p(C,Te)},$$slots:{default:!0}})};B(he,N=>{e(F)&&N(Me)})}b(ue),p(n,ue);var Ee=fn(ve);return u(),Ee}var Cx=E('<a class="cursor-pointer underline underline-offset-2 hover:opacity-80" data-suggested-prompt-link=""> </a>'),Px=E('<kbd data-suggested-prompt-hint=""> </kbd>'),Rx=E('<span class="type-caption"> </span>'),Tx=E('<div role="presentation" data-typography-role="body" data-suggested-prompt-row=""><span data-suggested-prompt-icon=""><!></span> <span class="min-w-0 flex-1 text-pretty" data-suggested-prompt-label=""><span role="button" tabindex="0" class="focus-visible:outline-none" data-suggested-prompt-text=""> </span><!></span> <!> <!></div>'),Ax=E('<div class="flex flex-col" data-testid="suggested-prompts-surface"><!></div>');function Kd(n,r){if(new.target)return dn({component:Kd,...n});pn(r,!0);let a=Z(r,"prompts",7),i=Z(r,"onSelect",7),c=Z(r,"onEdit",7),l=Z(r,"compact",7,!1),f=Z(r,"showShortcutHints",7,!1),u=Z(r,"reserveShortcutHintSpace",7,!1),w=Z(r,"workspaceId",7);const R=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC")?"⌃":"Alt+",y=GS.replace("text-ui","type-caption");function M(k){i()(k)}function x(k,Q){k.key!=="Enter"&&k.key!==" "||(k.preventDefault(),M(Q))}function F(k,Q){k.preventDefault(),k.stopPropagation(),Pd(Q,{workspaceId:w(),event:k})}function D(k,Q){(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),k.stopPropagation(),Pd(Q,{workspaceId:w(),event:k}))}function T(k){return k<3}var H={get prompts(){return a()},set prompts(k){a(k),ee()},get onSelect(){return i()},set onSelect(k){i(k),ee()},get onEdit(){return c()},set onEdit(k){c(k),ee()},get compact(){return l()},set compact(k=!1){l(k),ee()},get showShortcutHints(){return f()},set showShortcutHints(k=!1){f(k),ee()},get reserveShortcutHintSpace(){return u()},set reserveShortcutHintSpace(k=!1){u(k),ee()},get workspaceId(){return w()},set workspaceId(k){w(k),ee()},$set:un,$on:(k,Q)=>gn(r,k,Q)},V=Bt(),oe=ye(V);{var P=k=>{var Q=Ax(),ge=I(Q);{const Re=(ue,we)=>{let ne=()=>(we?.()).item,te=()=>(we?.()).index;const ze=o(()=>Bb(ne())),se=o(()=>e(ze)[0]?.type==="text"?e(ze)[0].content:"");var he=Tx(),Me=I(he),Ee=I(Me);pt(Ee,{get icon(){return Ef},size:16,get class(){return lr}}),b(Me);var N=m(Me,2),C=I(N),re=de(C,!0),Te=m(C);Hn(Te,17,()=>e(ze).slice(e(se)?1:0),H_,(U,Ie)=>{var Ce=Bt(),Le=ye(Ce);{var st=He=>{const Pe=o(()=>Nb(e(Ie).url));var j=Cx(),ae=de(j,!0);q(()=>{Ue(j,"href",e(Pe)),Ue(j,"title",e(Pe)),z(ae,e(Ie).label)}),ps("click",j,qe=>F(qe,e(Pe))),ps("keydown",j,qe=>D(qe,e(Pe))),p(He,j)},Xe=He=>{var Pe=_n();q(()=>z(Pe,e(Ie).content)),p(He,Pe)};B(Le,He=>{e(Ie).type==="link"?He(st):He(Xe,-1)})}p(U,Ce)}),b(N);var L=m(N,2);{var Y=U=>{var Ie=Px();let Ce;var Le=de(Ie);q(()=>{Ce=ke(Ie,1,`${y??""} mt-px inline-flex h-5 items-center self-start border-0 bg-transparent p-0 font-sans font-normal text-muted-foreground! opacity-100`,null,Ce,{invisible:!f()}),Ue(Ie,"aria-hidden",f()?void 0:"true"),Ue(Ie,"data-hint-visible",f()),z(Le,`${R}${te()+1}`)}),p(U,Ie)},J=o(()=>T(te())&&(f()||u()));B(L,U=>{e(J)&&U(Y)})}var be=m(L,2);{var Ne=U=>{v$(U,{side:"top",delayDuration:300,trigger:Le=>{{let st=o(()=>g.chat_suggestedPrompts_editInInput_ariaLabel());xt(Le,{type:"button",variant:"ghost-light",size:"icon-xs",iconOnly:!0,class:"absolute right-0.5 top-[calc(var(--operational-leading-half-slot-size)+var(--space-1)*0.5+1px)] shrink-0 -translate-y-1/2 rounded opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100",onclick:Xe=>{Xe.stopPropagation(),c()(ne())},get"aria-label"(){return e(st)},children:(Xe,He)=>{pt(Xe,{get icon(){return _$},size:"xs"})},$$slots:{default:!0}})}},content:Le=>{var st=Rx(),Xe=de(st,!0);q(He=>z(Xe,He),[()=>g.chat_suggestedPrompts_edit_tooltip()]),p(Le,st)},$$slots:{trigger:!0,content:!0}})};B(be,U=>{c()&&U(Ne)})}b(he),q(U=>{ke(he,1,`${Af} ${VS} group relative flex cursor-pointer items-center gap-[var(--operational-leading-gap)] rounded-sm border border-transparent bg-transparent px-1.5 py-0.5 text-left opacity-100 pr-9 transition-colors hover:text-foreground has-[[data-suggested-prompt-text]:focus-visible]:outline-2 has-[[data-suggested-prompt-text]:focus-visible]:outline-offset-2 has-[[data-suggested-prompt-text]:focus-visible]:outline-ring`),ke(Me,1,`${Fl??""} mt-px self-start`),Ue(C,"aria-label",U),z(re,e(se))},[()=>Db(ne())]),ps("click",C,U=>{U.stopPropagation(),M(ne())}),ps("keydown",C,U=>x(U,ne())),p(ue,he)};let ve=o(()=>l()?"[&>div>div:last-child]:gap-0":"[&>div>div:last-child]:gap-0.5");u$(ge,{get items(){return a()},virtualize:!1,onActivate:M,get class(){return`overflow-visible! [&>div>div:last-child]:flex [&>div>div:last-child]:flex-col ${e(ve)??""}`},"data-testid":"suggested-prompts-list",get"data-compact"(){return l()},row:Re,$$slots:{row:!0}})}b(Q),Dt(1,Q,()=>ma,()=>({tier:"fast",y:0,scale:1})),Dt(2,Q,()=>Zs,()=>({tier:"fast"})),p(k,Q)};B(oe,k=>{a().length>0&&k(P)})}return p(n,V),fn(H)}Od(["click","keydown"]);var Mx=E('<section class="pb-6 pt-6"><p class="type-body mb-5 max-w-[36rem] px-1.5 text-pretty text-muted-foreground"> </p> <!></section>');function rv(n,r){if(new.target)return dn({component:rv,...n});pn(r,!0);let a=Z(r,"onSelect",7),i=Z(r,"compact",7,!1);const c=o(()=>[{label:g.chat_chiefEmptyState_assignedPrs_label(),prompt:g.chat_chiefEmptyState_assignedPrs_prompt()},{label:g.chat_chiefEmptyState_staleWorkspaces_label(),prompt:g.chat_chiefEmptyState_staleWorkspaces_prompt()},{label:g.chat_chiefEmptyState_agentPerformance_label(),prompt:g.chat_chiefEmptyState_agentPerformance_prompt()},{label:g.chat_chiefEmptyState_morningBrief_label(),prompt:g.chat_chiefEmptyState_morningBrief_prompt()},{label:g.chat_chiefEmptyState_randomTheme_label(),prompt:g.chat_chiefEmptyState_randomTheme_prompt()}]),l=o(()=>e(c).map(M=>M.label));function f(M){const x=e(c).find(F=>F.label===M);x&&a()(x.prompt)}var u={get onSelect(){return a()},set onSelect(M){a(M),ee()},get compact(){return i()},set compact(M=!1){i(M),ee()},$set:un,$on:(M,x)=>gn(r,M,x)},w=Mx(),v=I(w),R=de(v,!0),y=m(v,2);return Kd(y,{get prompts(){return e(l)},onSelect:f,get compact(){return i()}}),b(w),q(M=>z(R,M),[()=>g.chat_chiefEmptyState_intro_label()]),p(n,w),fn(u)}const Qd=2e3,Ex=4e3,qx=Ex-Qd-2;function Lx(n,r=Qd){const a=[];let i=0;for(let c=n.length-1;c>=0&&i<r;c-=1){const l=n[c];if(l.role!=="user"&&l.role!=="assistant")continue;const f=(l.contentBlocks??[]).filter(w=>w.type==="text").map(w=>w.text||w.content||"").join(""),u=(l.role==="assistant"?N_(f).cleanedContent:f).trim();u&&(a.unshift({role:l.role,text:u}),i+=u.length)}return a}function Hx(n,r){const a=n.map(l=>`${l.role==="user"?"User":"Assistant"}: ${l.text}`).join(`
|
|
2
2
|
|
|
3
3
|
`).slice(-Qd),i=r.map(l=>l.trim()).filter(Boolean);if(i.length===0)return a;const c=`Suggested prompts:
|
|
4
4
|
${i.map(l=>`- ${l}`).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S}from"./BdWqymET.js";import{aE as l}from"./CJxGDkBm.js";import{g as c}from"./
|
|
1
|
+
import{a as S}from"./BdWqymET.js";import{aE as l}from"./CJxGDkBm.js";import{g as c}from"./D_yMjDjB.js";import{p as g}from"./CuNdhmq6.js";import{d as I}from"./B0Z-1lwJ.js";import{dP as f}from"./D9Ykl3eH.js";import{Cl as u,m as y,Jq as o,h6 as A,vF as m,vG as N,vI as b}from"./CpP1PKzF.js";import{g as W,n as h}from"./ByoP16rr.js";import{S as D,a as R,n as E}from"./pO_uIUtS.js";import{n as O,o as v}from"./a_hFrVUs.js";const P="intent:onboarding-skip:v1";function k(e){return u.getItem(h(P,e))==="1"}function re(e){k(e)||u.setItem(h(P,e),"1")}function _(e){return e.connections?.hasReceivedList===!0&&k(W(e))}function F(e,a){return e.some(t=>t.id!==y&&t.id!==a&&t.status!=="Archived"&&t.status!=="Deleted")}function j(e,a,t=!1){return t||F(e,a)?"/":"/workspace/new"}function d(e,a){return j(f.select(e),a,_(e))}const se=Object.freeze(Object.defineProperty({__proto__:null,resolveWindowEmptyDestination:d},Symbol.toStringTag,{value:"Module"})),r=new S("WorkspaceNavigation");async function L(e){r.info(`[navigateToAgent] Navigating to agent: ${e}`);const t=l(g).params.id;if(!t){r.error("[navigateToAgent] No workspace ID found in current page params");return}const n=new URL(window.location.href);n.searchParams.set("drawerOpen","1"),n.searchParams.set("drawerType","agent"),n.searchParams.set("selectedAgent",e),n.searchParams.delete("selectedTerminal"),await c(n.toString(),{replaceState:!0}),o.dispatch(m(t,"agent",e))}async function C(e){r.info(`[navigateToTerminal] Navigating to terminal: ${e}`);const t=l(g).params.id;if(!t){r.error("[navigateToTerminal] No workspace ID found in current page params");return}const n=new URL(window.location.href),i=n.searchParams.get("drawerOpen")==="1",s=n.searchParams.get("drawerType")==="terminal";(!i||!s)&&n.searchParams.set("drawerOpen","1"),n.searchParams.set("drawerType","terminal"),n.searchParams.set("selectedTerminal",e),n.searchParams.delete("selectedAgent"),await c(n.toString(),{replaceState:!0}),o.dispatch(m(t,"terminal",e))}function $(e){return!e||!(e instanceof Element)?void 0:e.closest("[data-panel-id]")?.getAttribute("data-panel-id")??void 0}async function p(e,a){r.info(`[navigateToNote] Navigating to note: ${e}`,a);const t=l(g),n=a?.workspaceId??t.params.id;if(!n){r.error("[navigateToNote] No workspace ID found in current page params");return}o.dispatch(b(n,e,{openInAdjacentPanel:a?.openInAdjacentPanel??!1,openInNewAdjacentPanel:a?.openInNewAdjacentPanel??!1,sourcePanelId:a?.sourcePanelId}))}async function U(e,a,t){r.info(`[navigateToFile] Navigating to file: ${e}${a?` (line ${a})`:""}`,t);const i=l(g).params.id;if(!i){r.error("[navigateToFile] No workspace ID found in current page params");return}o.dispatch(N(i,e,{line:a,openInAdjacentPanel:t?.openInAdjacentPanel??!1,sourcePanelId:t?.sourcePanelId}))}async function M(){r.info("[navigateToSpec] Navigating to workspace spec"),await p("spec")}async function B(){r.info("[closeDrawer] Closing drawer");const a=l(g).params.id;if(!a){r.error("[closeDrawer] No workspace ID found in current page params");return}const t=new URL(window.location.href);t.searchParams.set("drawerOpen","0"),t.searchParams.delete("selectedAgent"),t.searchParams.delete("selectedTerminal"),await c(t.toString(),{replaceState:!0}),o.dispatch(A(a))}async function K(){r.info("[clearMainContent] Clearing main content");const e=new URL(window.location.href);e.searchParams.set("mainContentType","empty"),e.searchParams.delete("selectedNoteId"),e.searchParams.delete("selectedFile"),e.searchParams.delete("line"),await c(e.toString(),{replaceState:!1})}async function G(e,a,t){r.info("[navigateToTask] Navigating to task",{noteId:e,taskPosition:a,taskText:t}),await p(e);const n=()=>{I("scroll-to-task",{noteId:e,taskPosition:a,taskText:t},{bubbles:!0}),r.debug("[navigateToTask] Dispatched scroll-to-task event",{noteId:e,taskPosition:a})},i=[100,300,600];for(const s of i)setTimeout(n,s)}async function H(e){r.info("[navigateToSettings] Navigating to settings",e);const a=new URL("/settings",window.location.origin),t=window.location.pathname.match(/^\/workspace\/([^/]+)/)?.[1],n=t==="new"?void 0:t,i=e?.workspaceId??n;if(e?.tab&&a.searchParams.set("tab",e.tab),e?.specialist&&a.searchParams.set("specialist",e.specialist),e?.view&&a.searchParams.set("view",e.view),i&&a.searchParams.set("workspaceId",i),e?.hash&&(a.hash=e.hash),typeof window<"u"&&window.location.pathname==="/settings"){if(e?.tab||e?.specialist||e?.view||e?.workspaceId){const s=new URL(window.location.href);e?.tab&&s.searchParams.set("tab",e.tab),e?.specialist&&s.searchParams.set("specialist",e.specialist),e?.view&&s.searchParams.set("view",e.view),e?.workspaceId&&s.searchParams.set("workspaceId",e.workspaceId),e?.hash&&(s.hash=e.hash),await c(s.toString(),{replaceState:!0});return}if(e?.hash){const s=`#${e.hash}`;window.location.hash===s&&(window.location.hash=""),window.location.hash=s;return}return}await E(a.pathname+a.search+a.hash)}function T(){const e=typeof sessionStorage>"u"?null:sessionStorage.getItem(D);if(e&&e!=="/"&&!R(e))return e;const a=w();return a?`/workspace/${a.id}`:d(o.state)}async function z(){const e=T();r.info("[navigateBackFromSettings] Navigating back to:",e),await O(e)}function w(e){return f.select(o.state).find(a=>a.id!==e&&a.status!=="Archived"&&a.status!=="Deleted")}async function Y(){const e=w();if(e){r.info("[navigateToFirstWorkspace] Showing workspace:",e.id),await v(e.id);return}const a=d(o.state);r.info("[navigateToFirstWorkspace] Navigating to:",a),await c(a)}async function q(e){const a=w(e);if(a){r.info("[navigateAfterWorkspaceRemoval] Showing workspace:",a.id),await v(a.id);return}const t=d(o.state,e);r.info("[navigateAfterWorkspaceRemoval] Navigating to:",t),await c(t)}const ie=Object.freeze(Object.defineProperty({__proto__:null,clearMainContent:K,closeDrawer:B,findSourcePanelId:$,getSettingsPreviousPath:T,navigateAfterWorkspaceRemoval:q,navigateBackFromSettings:z,navigateToAgent:L,navigateToFile:U,navigateToFirstWorkspace:Y,navigateToNote:p,navigateToSettings:H,navigateToSpec:M,navigateToTask:G,navigateToTerminal:C},Symbol.toStringTag,{value:"Module"}));export{U as a,Y as b,p as c,H as d,G as e,$ as f,d as g,ie as h,_ as i,z as n,re as r,se as w};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/0LjODXcP.js","/app/immutable/chunks/CpP1PKzF.js","/app/immutable/chunks/PVXvIyE8.js","/app/immutable/chunks/CJxGDkBm.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/CgBcONKs.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/WSVFXKpL.js","/app/immutable/chunks/ClpAEjbe.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/C5TH9nNS.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as Qt,bo as J,bw as te,bs as M,bq as ee,b as re,bm as n,_ as se}from"./ClpAEjbe.js";import{bo as ae,bs as ne,ca as C,bH as Y,c5 as yt,aD as O,bj as ie,a5 as F,bS as p,bA as D,b_ as x,W as f,bn as oe,cd as lt,bV as kt,c9 as N,aA as Z,bl as R,bO as h,ay as wt,aB as y}from"./CJxGDkBm.js";import{i as I}from"./wmcYjLAa.js";import{f as St,g as le,s as ce}from"./CnGVh7I3.js";import{b as ue}from"./NtFyWdpR.js";import{b as de}from"./5vm8eILD.js";import{Jq as m,CZ as pe,CP as me,CO as fe,Jk as _e,CA as ve,iy as be,iY as ge}from"./CpP1PKzF.js";import{d as xe,T as he,D as ye,L as ke,o as we}from"./Dsw5zy-Y.js";import{F as ct,d3 as Se,cb as $e,c$ as Ae}from"./CtJxHvGv.js";import{f as $t}from"./BVi5KkOP.js";import{m as rt}from"./C1zxTHwk.js";import"./CPDV_dyu.js";import"./WSVFXKpL.js";import"./ChTqQfQN.js";import"./BeYVt6Wg.js";import{r as Ce}from"./WQlIWqz7.js";import{selectScriptById as ut,selectScriptRuntime as Oe,selectScriptOutput as At,selectScriptRetainedOutput as Fe,selectCanDeleteScript as Ct}from"./
|
|
2
|
+
import{t as Qt,bo as J,bw as te,bs as M,bq as ee,b as re,bm as n,_ as se}from"./ClpAEjbe.js";import{bo as ae,bs as ne,ca as C,bH as Y,c5 as yt,aD as O,bj as ie,a5 as F,bS as p,bA as D,b_ as x,W as f,bn as oe,cd as lt,bV as kt,c9 as N,aA as Z,bl as R,bO as h,ay as wt,aB as y}from"./CJxGDkBm.js";import{i as I}from"./wmcYjLAa.js";import{f as St,g as le,s as ce}from"./CnGVh7I3.js";import{b as ue}from"./NtFyWdpR.js";import{b as de}from"./5vm8eILD.js";import{Jq as m,CZ as pe,CP as me,CO as fe,Jk as _e,CA as ve,iy as be,iY as ge}from"./CpP1PKzF.js";import{d as xe,T as he,D as ye,L as ke,o as we}from"./Dsw5zy-Y.js";import{F as ct,d3 as Se,cb as $e,c$ as Ae}from"./CtJxHvGv.js";import{f as $t}from"./BVi5KkOP.js";import{m as rt}from"./C1zxTHwk.js";import"./CPDV_dyu.js";import"./WSVFXKpL.js";import"./ChTqQfQN.js";import"./BeYVt6Wg.js";import{r as Ce}from"./WQlIWqz7.js";import{selectScriptById as ut,selectScriptRuntime as Oe,selectScriptOutput as At,selectScriptRetainedOutput as Fe,selectCanDeleteScript as Ct}from"./uMNoDmQ2.js";import{g as De}from"./CTV49dzf.js";import{c1 as Re,dY as Ie,dz as Ot}from"./D9Ykl3eH.js";import"./Gb7Ohwuc.js";import"./BYiyLeZ4.js";import"./Qt_rZNko.js";import{e as Le}from"./CwRzaOEp.js";import{v as Ft}from"./CVA75Jzf.js";var Dt=y("<!> ",1),qe=y('<div class="bg-danger-background/20 border-y border-danger/20 px-3 py-1.5 flex items-center justify-between"><div class="flex items-center gap-2 text-sm text-danger font-medium"><div class="w-4 h-4 rounded-full bg-danger-background flex items-center justify-center"><!></div> <span> </span></div> <!></div>'),Pe=y('<pre class="retained-text px-3 pb-3 text-xs svelte-115p4sl"> </pre>'),Te=y('<p class="px-3 pb-3 text-xs text-muted-foreground" role="status"> </p>'),Be=y('<details class="retained-output border-b border-border svelte-115p4sl"><summary class="cursor-pointer px-3 py-2 text-xs text-muted-foreground"> </summary> <p class="px-3 pb-2 text-xs text-muted-foreground"> </p> <!></details>'),Ee=y('<div class="px-3 py-1 text-xs text-muted-foreground"> </div>'),ze=y('<code class="text-muted-foreground font-mono text-xs"> </code>'),Me=y('<span class="sr-only"> </span>'),We=y('<div class="flex-1 flex items-center justify-center px-4 py-8"><div class="flex items-center gap-3 text-sm"><span class="text-subtle font-mono">$</span> <!> <!> <!></div></div>'),je=y('<div><!> <!> <!> <!> <div><div class="xterm-output svelte-115p4sl"></div></div></div>');function Ue(_,c){const j=ae();if(new.target)return Qt({component:Ue,..._});ne(c,!0);const L=()=>M(zt,"$outputAuthority",q),u=()=>M(qt,"$runtime$",q),v=()=>M(Pt,"$output$",q),S=()=>M(Et,"$codeFontFamilyCSS",q),W=()=>M(Tt,"$retainedOutput$",q),Rt=()=>M(Bt,"$hidesAgentLifecycleActions$",q),dt=()=>M(Lt,"$script$",q),[q,It]=ee();let $=J(c,"scriptId",7),b=J(c,"workspaceId",7),st=J(c,"class",7,""),at=J(c,"runDisabled",7,!1),P=J(c,"runDisabledReason",7,null);const pt=N(()=>at()||P()!==null),T=lt(""),U=lt(""),mt=lt("");let nt=kt(!1);C(()=>T.set(b())),C(()=>U.set($()));let B,i=null,H=null,G=null,V=null,E=null,X=null;const Lt=ut(T,U),qt=Oe(T,U),Pt=At(T,U),Tt=Fe(T,U,mt),Bt=Re(T),Et=De(),zt=Ie(T),ft=crypto.randomUUID();C(()=>{const t=b();return $(),()=>{t&&m.dispatch(pe(t,ft))}}),C(()=>{const t=b(),e=$(),a=L(),s=u();if(!a||!t||!e)return;s.status,s.startedAt;const l=crypto.randomUUID();return mt.set(l),Y(nt,yt(()=>v().chunks.length===0),!0),m.dispatch(me(t,e,l)),()=>m.dispatch(fe(t,e,l))});let Q=kt(0);const Mt=N(()=>u().status==="exited"&&u().exitCode!=null&&u().exitCode!==0&&u().exitCode<128);function Wt(){if(!B||i)return;V=new he(B);const t=V.getCurrentTheme();i=new ye({allowProposedApi:!0,fontFamily:S(),fontSize:13,lineHeight:1.2,letterSpacing:0,cursorBlink:!1,cursorStyle:"underline",cursorWidth:1,scrollback:1e4,allowTransparency:!0,convertEol:!0,disableStdin:!0,drawBoldTextInBrightColors:!0,theme:t}),i.attachCustomKeyEventHandler(a=>{const s=a.metaKey||a.ctrlKey;return!(s&&a.key==="`"||s&&a.key==="j"||s&&a.key==="k")}),H=new we,i.loadAddon(H);const e=new ke((a,s)=>{try{const l=new URL(s);l.hostname==="localhost"||l.hostname==="127.0.0.1"?Ce(s).then(g=>{se(async()=>{const{getPanelLayoutManager:k}=await import("./0LjODXcP.js").then(A=>A.p);return{getPanelLayoutManager:k}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url).then(({getPanelLayoutManager:k})=>{k(b()).openBrowserPanel(g.url,void 0,void 0,g.requestedUrl)}).catch(()=>{window.open(g.url,"_blank")})}):window.open(s,"_blank")}catch{window.open(s,"_blank")}});i.loadAddon(e),i.open(B),V.applyTheme(i),X=requestAnimationFrame(()=>{X=null,H?.fit()}),G=new ResizeObserver(()=>{H?.fit()}),G.observe(B),jt()}function jt(){if(!i)return;const t=At.select(m.state,b(),$());t.chunks.length>0&&i.write(t.chunks.map(e=>e.text).join("")),Y(Q,t.dropped+t.chunks.length)}function _t(){E!==null&&(cancelAnimationFrame(E),E=null),X!==null&&(cancelAnimationFrame(X),X=null),G?.disconnect(),G=null,V?.dispose(),V=null;const t=i;i=null,H=null,Y(Q,0),t&&xe(t)}C(()=>{const t=v(),e=yt(()=>O(Q)),a=t.dropped+t.chunks.length;if(!i||a<=e)return;const s=Math.max(e-t.dropped,0);i.write(t.chunks.slice(s).map(l=>l.text).join("")),Y(Q,a)}),C(()=>{const t=S();i&&i.options.fontFamily!==t&&(i.options.fontFamily=t)});function Ut(){O(pt)||m.dispatch(_e(b(),$()))}function Ht(){if(!b()){rt.error(n.terminal_scriptOutput_noWorkspace_error());return}m.dispatch(be(b(),$(),W()?.text,ft))}C(()=>{u().status==="idle"&&v().chunks.length===0&&_t()}),C(()=>{!(u().status==="idle"&&v().chunks.length===0)&&B&&!i&&(E!==null&&cancelAnimationFrame(E),E=requestAnimationFrame(()=>{E=null,Wt()}))}),ie(()=>{_t()});var Vt={get scriptId(){return $()},set scriptId(t){$(t),Z()},get workspaceId(){return b()},set workspaceId(t){b(t),Z()},get class(){return st()},set class(t=""){st(t),Z()},get runDisabled(){return at()},set runDisabled(t=!1){at(t),Z()},get runDisabledReason(){return P()},set runDisabledReason(t=null){P(t),Z()},$set:te,$on:(t,e)=>re(c,t,e)},tt=je(),vt=F(tt);{var Xt=t=>{var e=qe(),a=F(e),s=F(a),l=F(s);ct(l,{get icon(){return Se},size:"xs"}),D(s);var g=p(s,2),k=R(g,!0);D(a);var A=p(a,2);{var d=r=>{$t(r,{variant:"outline",size:"sm",class:"h-7 text-xs bg-background border border-border text-danger",onclick:Ht,children:(o,w)=>{var z=Dt(),K=wt(z);ct(K,{get icon(){return Ae},size:"sm",class:"mr-1.5"});var et=p(K);x(ot=>h(et,` ${ot??""}`),[()=>n.terminal_scriptOutput_askAiToFix_label()]),f(o,z)},$$slots:{default:!0}})};I(A,r=>{Rt()||r(d)})}D(e),x(r=>h(k,r),[()=>n.terminal_scriptOutput_buildFailed_label({exitCode:u().exitCode??0})]),f(t,e)};I(vt,t=>{O(Mt)&&t(Xt)})}var bt=p(vt,2);{var Kt=t=>{var e=Be(),a=F(e),s=R(a,!0),l=p(a,2),g=R(l,!0),k=p(l,2);{var A=r=>{var o=Pe();let w;var z=R(o,!0);x(()=>{w=le(o,"",w,{"font-family":S()}),h(z,W().text)}),f(r,o)},d=r=>{var o=Te(),w=R(o,!0);x(z=>h(w,z),[()=>W().status==="loading"?n.terminal_scriptOutput_retainedLoading_label():n.terminal_scriptOutput_retainedUnavailable_label()]),f(r,o)};I(k,r=>{W().status==="available"?r(A):r(d,-1)})}D(e),x((r,o)=>{h(s,r),h(g,o)},[()=>n.terminal_scriptOutput_retained_label(),()=>n.terminal_scriptOutput_retained_description()]),de("open","toggle",e,r=>Y(nt,r),()=>O(nt)),f(t,e)};I(bt,t=>{W()&&t(Kt)})}var gt=p(bt,2);{var Jt=t=>{var e=Ee(),a=R(e,!0);x(s=>h(a,s),[()=>n.terminal_scriptOutput_live_label()]),f(t,e)};I(gt,t=>{v().chunks.length>0&&W()&&t(Jt)})}var xt=p(gt,2);{var Yt=t=>{var e=We(),a=F(e),s=p(F(a),2);{var l=d=>{var r=ze(),o=R(r,!0);x(w=>h(o,w),[()=>ve(dt())]),f(d,r)};I(s,d=>{dt()&&d(l)})}var g=p(s,2);{let d=N(()=>P()??void 0),r=N(()=>n.terminal_scriptOutput_run_label()),o=N(()=>P()?j:void 0);$t(g,{variant:"ghost",size:"xs",get disabled(){return O(pt)},get tooltip(){return O(d)},get"aria-label"(){return O(r)},get"aria-describedby"(){return O(o)},onclick:Ut,class:"text-muted-foreground hover:text-foreground",children:(w,z)=>{var K=Dt(),et=wt(K);ct(et,{get icon(){return $e},class:"h-3 w-3 mr-1"});var ot=p(et);x(Gt=>h(ot,` ${Gt??""}`),[()=>n.terminal_scriptOutput_run_label()]),f(w,K)},$$slots:{default:!0}})}var k=p(g,2);{var A=d=>{var r=Me(),o=R(r,!0);x(()=>{ce(r,"id",j),h(o,P())}),f(d,r)};I(k,d=>{P()&&d(A)})}D(a),D(e),f(t,e)};I(xt,t=>{u().status==="idle"&&v().chunks.length===0&&t(Yt)})}var it=p(xt,2);let ht;var Nt=F(it);ue(Nt,t=>B=t,()=>B),D(it),D(tt),x(()=>{St(tt,1,`script-output-viewer ${st()??""}`,"svelte-115p4sl"),ht=St(it,1,"flex-1 relative overflow-hidden",null,ht,{hidden:u().status==="idle"&&v().chunks.length===0})}),f(_,tt);var Zt=oe(Vt);return It(),Zt}async function fr(_,c,j){const L=ut.select(m.state,_,c);if(!L||!j()||!Ct.select(m.state,_,c))return;const u=Ft(L.runtime?.status),v=Ot.select(m.state,_);if(!v){rt.error(n.workspace_client_accessChanged_error());return}if(!await Le({title:n.scripts_delete_title({name:L.name}),description:u?n.scripts_delete_running_description():n.scripts_delete_description(),confirmLabel:n.scripts_delete_label(),destructive:!0}))return;if(v!==Ot.select(m.state,_)){rt.error(n.workspace_client_accessChanged_error());return}const S=ut.select(m.state,_,c);if(!j()||!S||S.createdAt!==L.createdAt||S.name!==L.name||!u&&Ft(S.runtime?.status)||!Ct.select(m.state,_,c)){rt.error(n.scripts_delete_changed_error());return}m.dispatch(ge(_,c,n.terminal_quakeOverlay_deleteScriptFailed_error()))}export{Ue as S,fr as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as h}from"./
|
|
1
|
+
import{J as h}from"./eHy-2vQk.js";import{c as v}from"./ChTqQfQN.js";import{O as d}from"./CPDV_dyu.js";const g=v("AttachmentImageUrl");function y(t,n){const r=n.split("/").filter(e=>e.length>0).map(e=>encodeURIComponent(e)).join("/");return`workspace-file://${t}/${r}`}const u=new Map,a=new Map;let f=0,m=!1;function p(){m||(m=!0,d(()=>{f+=1,u.clear(),a.clear()}))}function A(t,n){u.delete(`${t}/${n}`)}function F(t,n,r){p();let e=!1,i=!1,o=!1;async function l(){if(!e){if(i){o=!0;return}i=!0;try{const c=await $(t,n);e||r(c)}finally{i=!1,o&&(o=!1,l())}}}const s=d(()=>{l()});return l(),{imageFailed(){e||(A(t,n),r(null))},dispose(){e=!0,s()}}}function $(t,n){p();const r=f,e=`${t}/${n}`,i=u.get(e);if(i)return Promise.resolve(i);const o=a.get(e);if(o)return o;const l=(async()=>{try{const s=await h({attachmentId:n,workspaceId:t});if(r!==f)return null;if(!s.exists)return g.warn("Attachment file missing on disk",{attachmentId:n}),null;const c=y(t,s.path);return u.set(e,c),c}catch(s){return g.warn("Failed to resolve attachment image",{attachmentId:n,error:s}),null}finally{r===f&&a.delete(e)}})();return a.set(e,l),l}export{A as e,F as o,$ as r};
|