@intent-hq/web 2.340.3 → 2.340.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{DSHZfyo_.js → 3GrOZVuM.js} +1 -1
  3. package/web/app/immutable/chunks/{C00mtWcq.js → 5AMRxL2p.js} +1 -1
  4. package/web/app/immutable/chunks/{CiEUvkIa.js → 5lbq1luC.js} +1 -1
  5. package/web/app/immutable/chunks/{BCqL69Gx.js → 6Rd3XzmA.js} +1 -1
  6. package/web/app/immutable/chunks/{BKw22VVz.js → 7GFSQ1mk.js} +3 -3
  7. package/web/app/immutable/chunks/{4OSQiSla.js → 7TJp7Cqs.js} +3 -3
  8. package/web/app/immutable/chunks/{D-_ejvos.js → 8DfuL71y.js} +1 -1
  9. package/web/app/immutable/chunks/{BZC70rhu.js → AoW9O1en.js} +1 -1
  10. package/web/app/immutable/chunks/{DRhbJBMm.js → B1VS11Sx.js} +1 -1
  11. package/web/app/immutable/chunks/{fsmJXbBL.js → B295po1q.js} +1 -1
  12. package/web/app/immutable/chunks/{R4vcdqOV.js → B4MCfVdX.js} +1 -1
  13. package/web/app/immutable/chunks/{ChJBbLcN.js → B4MKAnIM.js} +1 -1
  14. package/web/app/immutable/chunks/{CryeAtwP.js → B6XNWfj0.js} +1 -1
  15. package/web/app/immutable/chunks/{BhDIlKkK.js → B6qr1BjX.js} +1 -1
  16. package/web/app/immutable/chunks/{BdeHuxov.js → B7E1TTSD.js} +1 -1
  17. package/web/app/immutable/chunks/{DPgy0Y0f.js → B7otOkJE.js} +1 -1
  18. package/web/app/immutable/chunks/{CgSi3h6S.js → B9MuPd-q.js} +1 -1
  19. package/web/app/immutable/chunks/{dMWLb00T.js → BAnVDdDc.js} +2 -2
  20. package/web/app/immutable/chunks/{RZB8uyf6.js → BAxPObMg.js} +1 -1
  21. package/web/app/immutable/chunks/{BmckD0hJ.js → BBoA2XIC.js} +1 -1
  22. package/web/app/immutable/chunks/{COwp2maS.js → BDTtE2qf.js} +1 -1
  23. package/web/app/immutable/chunks/{DP1gj1P0.js → BI2wV_th.js} +2 -2
  24. package/web/app/immutable/chunks/{iyJUK6Cj.js → BJJOwB8X.js} +1 -1
  25. package/web/app/immutable/chunks/{DrV-Glrs.js → BNdF1joz.js} +1 -1
  26. package/web/app/immutable/chunks/{Dk7tetMi.js → BNwpscA-.js} +1 -1
  27. package/web/app/immutable/chunks/{CJvjscrS.js → BVhrkmN7.js} +6 -6
  28. package/web/app/immutable/chunks/{BSHSizX7.js → BYwPzLgn.js} +3 -3
  29. package/web/app/immutable/chunks/{CI9mDL93.js → BcyvhLuO.js} +1 -1
  30. package/web/app/immutable/chunks/{D7tfgQoT.js → Bd5Ngc3A.js} +1 -1
  31. package/web/app/immutable/chunks/{DRWLVsrA.js → BdH1zUmH.js} +1 -1
  32. package/web/app/immutable/chunks/{DV1K8LIx.js → BdjqGQQ7.js} +1 -1
  33. package/web/app/immutable/chunks/{CQnR7QXm.js → Bdmue4Ad.js} +1 -1
  34. package/web/app/immutable/chunks/{D6HqZ0XG.js → BeSCEwwg.js} +1 -1
  35. package/web/app/immutable/chunks/{x_VSlZKZ.js → BfeDdRP9.js} +1 -1
  36. package/web/app/immutable/chunks/{Q5I5a1K5.js → BiYa5Rkr.js} +1 -1
  37. package/web/app/immutable/chunks/{DcMoaaQX.js → BkZ8KMxa.js} +4 -4
  38. package/web/app/immutable/chunks/{oagxTbcc.js → Bm-3um5t.js} +1 -1
  39. package/web/app/immutable/chunks/{C-KCgJON.js → BrsvPhtQ.js} +1 -1
  40. package/web/app/immutable/chunks/{D79RGF_C.js → BuxgaRC7.js} +1 -1
  41. package/web/app/immutable/chunks/{CjXgIawz.js → BuzEX4kk.js} +1 -1
  42. package/web/app/immutable/chunks/{OFq3bkU0.js → ByP0tOux.js} +1 -1
  43. package/web/app/immutable/chunks/{CU6Dm-Jf.js → Bz6o_ny3.js} +1 -1
  44. package/web/app/immutable/chunks/{26KSLfG_.js → C2L5iiPL.js} +1 -1
  45. package/web/app/immutable/chunks/{B2PqBWuh.js → C4ZravQc.js} +2 -2
  46. package/web/app/immutable/chunks/{EoxkVaOK.js → C5MLcySE.js} +1 -1
  47. package/web/app/immutable/chunks/{DX8Wg8kC.js → C5RQ5PeP.js} +1 -1
  48. package/web/app/immutable/chunks/{EjTJ3uqr.js → C7DPlkuW.js} +1 -1
  49. package/web/app/immutable/chunks/{kE-HeUrF.js → C7dV8yvT.js} +1 -1
  50. package/web/app/immutable/chunks/{BbHCWReC.js → CACzui8O.js} +1 -1
  51. package/web/app/immutable/chunks/{CWMAmlUv.js → CAYbsJtO.js} +1 -1
  52. package/web/app/immutable/chunks/{Cq_cp-oT.js → CBh_a5Pc.js} +1 -1
  53. package/web/app/immutable/chunks/{XH1ZgrUI.js → CChoqmTi.js} +1 -1
  54. package/web/app/immutable/chunks/{C-ZN6lZQ.js → CG30gFvp.js} +1 -1
  55. package/web/app/immutable/chunks/{DNG7JjBW.js → CGYTCq4O.js} +1 -1
  56. package/web/app/immutable/chunks/{B0HhBj8V.js → CJjFfLnl.js} +1 -1
  57. package/web/app/immutable/chunks/{CMQliJeM.js → CMDNVB1H.js} +1 -1
  58. package/web/app/immutable/chunks/{TyNqg1qR.js → CNh3OVor.js} +1 -1
  59. package/web/app/immutable/chunks/{CpY3qvpv.js → COKJtJ2E.js} +1 -1
  60. package/web/app/immutable/chunks/{Jye-JxtR.js → CQkcu3KH.js} +1 -1
  61. package/web/app/immutable/chunks/{DevNl8k0.js → CXyeNBgz.js} +1 -1
  62. package/web/app/immutable/chunks/{OnRgPvKv.js → C_UVvMtS.js} +1 -1
  63. package/web/app/immutable/chunks/{9ZYP73v1.js → C_ox9a6h.js} +1 -1
  64. package/web/app/immutable/chunks/{Br-jHqg8.js → Cc-Gk3R8.js} +1 -1
  65. package/web/app/immutable/chunks/{CYoLQLuK.js → CeNPD-xB.js} +2 -2
  66. package/web/app/immutable/chunks/{CQfnh1PI.js → Chrr8yAG.js} +1 -1
  67. package/web/app/immutable/chunks/{BgADNvKj.js → CjkUiqmB.js} +1 -1
  68. package/web/app/immutable/chunks/{BzAqByNj.js → Ck-ywVoG.js} +1 -1
  69. package/web/app/immutable/chunks/{BaoOKRsG.js → CkdZPR0X.js} +1 -1
  70. package/web/app/immutable/chunks/{BQiHqjNR.js → CkwHpJZh.js} +1 -1
  71. package/web/app/immutable/chunks/{BVNgrAmW.js → Cnu3bGXK.js} +2 -2
  72. package/web/app/immutable/chunks/{VJ9MdSGH.js → Cpa8jVTb.js} +2 -2
  73. package/web/app/immutable/chunks/{BZfzYSp6.js → Cpg6wKLa.js} +1 -1
  74. package/web/app/immutable/chunks/{Bh84Avqk.js → Cr_-YXT5.js} +1 -1
  75. package/web/app/immutable/chunks/{CswiiZ8T.js → Cxo01ygZ.js} +1 -1
  76. package/web/app/immutable/chunks/{Dm7SZs-h.js → D-jh6lXt.js} +1 -1
  77. package/web/app/immutable/chunks/{4lKULKWx.js → D3ug-rpn.js} +2 -2
  78. package/web/app/immutable/chunks/{BbaKKYpf.js → D4SAaHiP.js} +1 -1
  79. package/web/app/immutable/chunks/{DSPHGQ4J.js → D4bKontA.js} +3 -3
  80. package/web/app/immutable/chunks/{CIWSpGw4.js → D7I4VA1S.js} +1 -1
  81. package/web/app/immutable/chunks/{B2dcgs6v.js → D8tZASxu.js} +1 -1
  82. package/web/app/immutable/chunks/{DOjreC5W.js → DAsj_7vB.js} +1 -1
  83. package/web/app/immutable/chunks/{BkfIAcnL.js → DFgCL1V1.js} +1 -1
  84. package/web/app/immutable/chunks/{DdykudA9.js → DMB4MgAA.js} +1 -1
  85. package/web/app/immutable/chunks/{D2bdWg46.js → DMF8OOZf.js} +4 -4
  86. package/web/app/immutable/chunks/{XiWj7wZv.js → DO5-fj7t.js} +1 -1
  87. package/web/app/immutable/chunks/{CwMk81ua.js → DOfWJbtl.js} +4 -4
  88. package/web/app/immutable/chunks/{1ZSR9HkF.js → DTZcbtOQ.js} +1 -1
  89. package/web/app/immutable/chunks/{D3OHzDMw.js → DUDDXjfN.js} +4 -4
  90. package/web/app/immutable/chunks/{eYKnFXCS.js → DUv3ERVT.js} +1 -1
  91. package/web/app/immutable/chunks/{BBN-ms7_.js → DWzj1mDm.js} +1 -1
  92. package/web/app/immutable/chunks/{DIyZQP_b.js → DXBZ8PL2.js} +1 -1
  93. package/web/app/immutable/chunks/{Ve_wEmmV.js → Daa-imNp.js} +1 -1
  94. package/web/app/immutable/chunks/{Jwu4AyqJ.js → DarvX7z7.js} +3 -3
  95. package/web/app/immutable/chunks/{BzUnu-YI.js → DcHvleTq.js} +1 -1
  96. package/web/app/immutable/chunks/{rmNySh9z.js → DcdbFMmX.js} +1 -1
  97. package/web/app/immutable/chunks/{BL8iv-_B.js → Dd83nS7z.js} +12 -12
  98. package/web/app/immutable/chunks/{DIYZbm4y.js → DdQARX_Y.js} +1 -1
  99. package/web/app/immutable/chunks/{CnyDSFJC.js → Dea_n_n7.js} +1 -1
  100. package/web/app/immutable/chunks/{BiWQobGq.js → Dgr96rlz.js} +1 -1
  101. package/web/app/immutable/chunks/{RVIXZSnK.js → DmrAbz-2.js} +1 -1
  102. package/web/app/immutable/chunks/{B6e-aZNQ.js → DulKxVZF.js} +1 -1
  103. package/web/app/immutable/chunks/{XJuHrBYv.js → Dumy7p5B.js} +1 -1
  104. package/web/app/immutable/chunks/{DzG_bsPw.js → DxtL4n5v.js} +1 -1
  105. package/web/app/immutable/chunks/{GnD40zME.js → DyASZoz8.js} +1 -1
  106. package/web/app/immutable/chunks/{B4dLcxdK.js → IISMFCVN.js} +1 -1
  107. package/web/app/immutable/chunks/{Cv1yfPh7.js → LOpIKwMN.js} +1 -1
  108. package/web/app/immutable/chunks/{DQsj4gzP.js → Mxi9K9ZC.js} +1 -1
  109. package/web/app/immutable/chunks/{rmC8RjnE.js → OWC3VHa4.js} +1 -1
  110. package/web/app/immutable/chunks/{VAgNvzCV.js → PdCTscxM.js} +1 -1
  111. package/web/app/immutable/chunks/{DCMF47aQ.js → UBbOcatL.js} +1 -1
  112. package/web/app/immutable/chunks/{DHR7uU79.js → YIz6OWf_.js} +1 -1
  113. package/web/app/immutable/chunks/{Ba_TYo7-.js → djdTC7W0.js} +1 -1
  114. package/web/app/immutable/chunks/{ByvuMYC7.js → etvDcPKN.js} +1 -1
  115. package/web/app/immutable/chunks/{VOwJvPEX.js → kt_sRsvF.js} +1 -1
  116. package/web/app/immutable/chunks/{BQIUg6uG.js → oXtq5ftC.js} +1 -1
  117. package/web/app/immutable/chunks/{8CuoNl6o.js → po0FYO9I.js} +1 -1
  118. package/web/app/immutable/chunks/{B4HRrAhA.js → qH41TME9.js} +1 -1
  119. package/web/app/immutable/chunks/{mia9NhYo.js → qgUvzPgY.js} +1 -1
  120. package/web/app/immutable/chunks/{gbrIpSK7.js → qjyldP6M.js} +2 -2
  121. package/web/app/immutable/chunks/{Cd8gAm5s.js → t4wtnk-H.js} +1 -1
  122. package/web/app/immutable/chunks/{DAYPdlm5.js → u5nN0dSP.js} +1 -1
  123. package/web/app/immutable/chunks/{BA6q2_uM.js → xOrPT_-o.js} +1 -1
  124. package/web/app/immutable/entry/{app.BFgLELZd.js → app.D8N7ZRZ9.js} +2 -2
  125. package/web/app/immutable/entry/start.D45GVHYB.js +1 -0
  126. package/web/app/immutable/nodes/{0.C57zYgjC.js → 0.HRpTr_SR.js} +1 -1
  127. package/web/app/immutable/nodes/{1.NKzhdz6_.js → 1.B46sFnSf.js} +1 -1
  128. package/web/app/immutable/nodes/{10.BJd1tJUb.js → 10.BgAq-l76.js} +1 -1
  129. package/web/app/immutable/nodes/{14.BSABgBsc.js → 14.Bc7NWrzJ.js} +1 -1
  130. package/web/app/immutable/nodes/{17.Ce_ACqYo.js → 17.C_5BCS0Z.js} +2 -2
  131. package/web/app/immutable/nodes/{2.UaH2-hxu.js → 2.CxyQC8mv.js} +4 -4
  132. package/web/app/immutable/nodes/{3.C7CTnJbM.js → 3.B2gkmoMw.js} +1 -1
  133. package/web/app/immutable/nodes/{4.Dt6-OnIi.js → 4.qWgjdPJ0.js} +1 -1
  134. package/web/app/immutable/nodes/{5.BIcmGfu2.js → 5.B6t6xhOQ.js} +1 -1
  135. package/web/app/immutable/nodes/{6.BSZz9Bmw.js → 6.CT67BHR4.js} +1 -1
  136. package/web/app/immutable/nodes/{7.CsKE9_QG.js → 7.BgPhC6Yw.js} +1 -1
  137. package/web/app/immutable/nodes/{8.iSvxqVyP.js → 8.D1koOYBw.js} +4 -4
  138. package/web/app/immutable/nodes/{9.Bt_Df-y5.js → 9.BPcmknvb.js} +4 -4
  139. package/web/app/version.json +1 -1
  140. package/web/index.html +9 -9
  141. package/web/app/immutable/entry/start.CkeqWblE.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/B4dLcxdK.js","/app/immutable/chunks/DTDbZc--.js","/app/immutable/chunks/GdlMbZRO.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/Cv-W__h8.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/DPvDLGgX.js","/app/immutable/chunks/ClsZrb8B.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/BePtUMMB.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/D4os-974.js","/app/immutable/chunks/BiLjH_HB.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/j0KL2ItM.js","/app/immutable/chunks/CgCdkhNg.js","/app/immutable/chunks/DBkMUdAo.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BZeUwBn0.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/BKpkoMuv.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/B10dK85Q.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/1o85IiDb.js","/app/immutable/chunks/CEpchTPD.js","/app/immutable/chunks/ZhmlPELZ.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/CUrYTyIw.js","/app/immutable/chunks/BtpuPEaR.js","/app/immutable/chunks/Ct5KmixI.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/4lKULKWx.js","/app/immutable/chunks/CjU1deOg.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/CB56tJ4V.js","/app/immutable/chunks/C3BW_tmx.js","/app/immutable/chunks/BahFkvC5.js"])))=>i.map(i=>d[i]);
2
- var Ct=Object.defineProperty;var Dt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>Dt(e,typeof t!="symbol"?t+"":t,n);import{B as xt,O as Rt,dG as Be,cG as pe,dr as Pt,al as Bt,b1 as Ge,z as Ot,dS as $t}from"./B10dK85Q.js";import{Ir as A,g as be,nx as x,vH as Ut,Bs as Ye,vJ as Lt,CF as Je,cx as Nt,cy as Ht,ny as Qe,nk as Ft,c as ke,fF as Kt,lN as Wt,cF as jt}from"./DBkMUdAo.js";import{e as qt,b as ae,F as Vt,y as re,_ as ve,G as zt,C as Gt,W as Xe,v as Yt,u as Jt,M as Qt}from"./BZeUwBn0.js";import{D as Oe,a as Xt,d as Zt}from"./CQcEqK4G.js";import{l as en,o as tn,g as Ze,r as nn,m as an,D as rn}from"./C4rKE1Qu.js";import{a as et,e as sn}from"./CEpchTPD.js";import{f as on}from"./Cl5axapM.js";import{bp as b,_ as fe}from"./Cv-W__h8.js";import{a9 as tt,aA as se,J as he,a as nt,n as at,cQ as rt,e as st,aH as it,M as cn,ab as ln,aT as $e,d as le,C as dn,cR as un,U as mn,a6 as pn,aI as fn,bY as hn}from"./D-_ejvos.js";import{bD as gn,bq as yn,aX as wn,by as bn,bs as kn,ax as vn}from"./BePtUMMB.js";import{O as _n,z as Sn}from"./GdlMbZRO.js";import{t as q,q as Mn,v as An}from"./j0KL2ItM.js";import{x as In,J as Tn,ai as En,ar as Cn}from"./BKw22VVz.js";import{a as Ue,b as Dn,g as xn}from"./DypB-Dwi.js";import{z as Rn}from"./CUrYTyIw.js";import{C as Pn}from"./BvFAWM27.js";import{i as Bn}from"./CyY6TpOV.js";import{o as $,e as On,l as V,s as E,n as ce,b as $n,d as Un,c as Ln}from"./CIyUrgF0.js";function Cr(e,t){if(e)return e.model}function Nn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Dr({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?xt(e):!1)&&!Nn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function xr(e){return Rt(e.messageMetadata)}function Hn(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function Rr(e){return Hn({...e,createdAt:Date.parse(e.queuedAt)})}const Fn=8*1024*1024,Kn=3*1024*1024;function Wn(e){return Math.ceil(Math.max(0,e)/3)*4}function jn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Kn&&typeof t=="number"&&t===Wn(e.size)?t:null}async function ot(e,t,n,a,r=()=>{}){const s=()=>{if(!a())throw new Error("media-send-retired")};if(s(),r("overlay-render"),!n.exportMedia)throw new Error("media-export-unavailable");const i=en(e.source,e.saved);if(i.length>1e4)throw new Error("media-animation-layer-limit");const o=[];for(const c of i)s(),o.push({...c,png:await tn(e.source,e.saved,c.atMs)});s(),r("export");const l=await n.exportMedia({outputVersion:qt,jobId:t,media:e,layers:o});if(s(),!l.ok)throw new Error(["media-export-failed",l.error].filter(Boolean).join(":"));return{jobId:t,value:l.value}}const _e={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function Le(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function ge(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=tt(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function qn(e){const t=e.video==="full"?b.dock_captureEditor_videoFull_label():b.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?b.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?b.dock_captureEditor_voiceTranscript_label():b.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function Vn(e,t,n,a){if(a?.error==="permission")return a.kind==="pick"?"accessibility":"screen";if(e==="permission"||t==="permission")return"screen";if(n?.startsWith("microphone-permission"))return"microphone";if(n?.startsWith("speech-permission"))return"speech"}const j=on;function Pr(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,i=t.speech.error??t.speech.capability?.reason??null,o=Vn(t.captureError,t.clips.find(g=>g.status==="failed"&&g.error==="permission")?.error??null,i,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?s?.annotationUnavailable:void 0,c=t.annotationIssue,d=t.captureError==="permission",u=c?.error==="permission"&&c.kind!=="pick",h=c?.error==="permission"&&c.kind==="pick",p=i?.startsWith("speech-permission")?"speech":i?.startsWith("microphone-permission")||i==="permission"?"microphone":void 0,m={},y={},f=(g,D,L)=>{m[g]=D,L&&(y[g]=L)};s&&(d&&(f("capture",s.permission,"screen"),t.recording||f("record",s.permission,"screen")),u&&!t.annotating&&f("annotate",s.permission,"screen"),h&&(f("pick",s.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&f("annotate",s.accessibilityPermission,"accessibility")),p&&!t.dictation&&f("mic",(i&&r.speechError?.(i))??s.speechPermission,p));const k=g=>{const D=y[g];D&&e.actions.onOpenSettings(D)},v=new Set(t.evidenceOwnedItemIds),I=t.clips.find(g=>g.status==="recording"),S=t.clips.length>=ae.clips,_=t.capabilities,B=t.speech.available,C=new Set(t.clips.filter(g=>g.status==="recording"||g.status==="placing"||!!g.media).flatMap(g=>g.captureHistory?.map(D=>D.image.id)??[])),P=[...t.tiles.filter(({image:g,marks:D})=>!!g.media||g.source!=="annotate"||!C.has(g.id)||D.some(({mark:L})=>!L.clipId)).map(({image:g,marks:D})=>({kind:"image",id:g.contextItemId,url:a.previews[g.id]??"",markCount:D.length,owner:"evidence",...a.previews[g.id]?{}:{status:"placing"}})),...t.clips.filter(g=>!g.discarding).map(g=>({kind:"clip",id:g.contextItemId??g.id,duration:j(g.status==="recording"?Le(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:qn(g.media.saved)}:{},...g.status==="ready"&&ge(e.workspaceId,g.path)?{url:ge(e.workspaceId,g.path)}:{},owner:"evidence",...g.status==="placing"?{status:"placing"}:{},...g.status==="failed"?{status:"failed",...g.error==="limit"?{error:b.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(g=>!v.has(g.id)).map(g=>({...g.imageData&&g.imageMimeType?{kind:"image",id:g.id,url:`data:${g.imageMimeType};base64,${g.imageData}`,markCount:0,file:{name:g.label,imageData:g.imageData,imageMimeType:g.imageMimeType}}:{kind:"file",id:g.id,name:g.label},owner:"attachment",...g.placementStatus==="placing"?{status:"placing"}:{},...g.placementStatus==="failed"?{status:"failed",error:g.placementError}:{}}))];return{mediaStatus:t.recording?{kind:"recording",label:r.recording}:t.dictation?{kind:"listening",label:r.listening}:t.annotating?{kind:"annotating",label:r.annotating}:void 0,...o?{settingsPane:o}:{},...l?{annotationNotice:l}:{},labels:r,attachments:P,...s?{placeholder:t.dictation?"":s.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!_.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:r.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!_.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!_.annotate,recording:t.recording&&!I?.discarding,recordingDisabled:!!I?.discarding||!t.recording&&(!_.record||S),...S&&!t.recording?{recordingTooltip:r.clipLimit}:{},recordingTime:j(I?Le(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!m.mic,...t.speech.error&&r.speechError?{dictationTooltip:r.speechError(t.speech.error)}:{},dictationTime:t.dictation?j(a.now-t.dictation.startedAt):j(0),inputLevels:t.speech.levels,...Object.keys(m).length?{alerts:m}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:k,beforeSubmit:e.beforeSubmit}}const Se=()=>globalThis.electronAPI,zn=["image/png","image/jpeg","image/webp"],Ne=e=>zn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function Br(e,t){const{view:n,items:a,previews:r}=t,s=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(s){const c=a.find(p=>p.id===s.image.contextItemId),d=s.image.media;if(s.image.mediaError)return null;if(d?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const p={...d,saved:d.saved},m=await t.createSavedPreviewUrl(t.workspaceId,p);try{const y=await t.fetchBytes(m),f=p.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:y,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(f?.w??p.source.width)),height:Math.max(1,Math.round(f?.h??p.source.height)),displayScale:s.image.displayScale,capturedAt:s.image.capturedAt},raw:y,marks:[]}}}finally{t.revokeUrl(m)}}const u=Ne(c?.imageMimeType),h=r[s.image.id];return!c?.imageData||!u||!h?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(h),intent:{pixels:{mimeType:u,width:s.image.width,height:s.image.height,displayScale:s.image.displayScale,capturedAt:s.image.capturedAt,...s.image.hash?{hash:s.image.hash}:{}},raw:He(c.imageData),marks:s.marks.map(({mark:p})=>({tool:p.tool,geometry:p.geometry,bounds:p.bounds,element:p.element}))}}}const i=n.clips.find(c=>c.id===e||c.contextItemId===e);if(i){const c=i.status==="ready"?ge(t.workspaceId,i.path):null;if(!c)return null;const d=a.find(h=>h.id===i.contextItemId),u=await t.fetchBytes(c);if(!Yn(u))throw new Error("Not a recording file");return{kind:"clip",name:d?.label||`recording-${i.id.slice(0,8)}.mp4`,mimeType:d?.attachmentMimeType||"video/mp4",bytes:u,durationMs:i.durationMs,hasMicAudio:i.hasMicAudio}}const o=a.find(c=>c.id===e),l=Ne(o?.imageMimeType);return o?.imageData&&l?{kind:"image",name:o.label||"image",mimeType:l,bytes:He(o.imageData)}:null}async function Gn(e){const t=await fetch(e);if(!t.ok)throw new Error(`Media request failed (${t.status})`);const n=new Uint8Array(await t.arrayBuffer()),a=Number(t.headers.get("content-length")??Number.NaN);if(n.byteLength===0||Number.isFinite(a)&&a!==n.byteLength)throw new Error("Media response was incomplete");return n}function Yn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Or(e){try{return(await Se()?.invoke(_e.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Jn(){try{return await Se()?.invoke(_e.CLIPBOARD_READ,{})??null}catch{return null}}async function $r(e){try{const t=await Se()?.invoke(_e.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Fe=new WeakSet;async function Qn(e,t){const[n]=e;if(e.length!==1||!n||n.size!==t.size)return!1;try{const a=await crypto.subtle.digest("SHA-256",await n.arrayBuffer());return Array.from(new Uint8Array(a),s=>s.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function Ur(e,{onIntentMedia:t,isCurrent:n,read:a=Jn}){const r=e.clipboardData;if(Fe.has(e)||!r||r.files.length===0)return!1;const s=e.target,i=Array.from(r.files),o=r.types.filter(l=>l!=="Files").map(l=>[l,r.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await Qn(i,l)){n()&&t(l);return}if(!n()||!(s instanceof Node)||!s.isConnected)return;const c=new DataTransfer;for(const u of i)c.items.add(u);for(const[u,h]of o)c.setData(u,h);const d=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Fe.add(d),s.dispatchEvent(d)}),!0}function Xn(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function Zn(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function ct(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function ea(e){const t=await crypto.subtle.digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}const lt={placeAttachment:it,beginAttachmentUpload:st,sendAttachmentUploadChunk:rt,commitAttachmentUpload:at,abortAttachmentUpload:nt,getAttachmentInfo:he,mintIdempotencyKey:se};async function Me(e,t,n,a=lt){const{idempotencyKey:r}=n,s={...r!==void 0?{idempotencyKey:r}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},i=async m=>un(m,r)?$e(e,r,a.getAttachmentInfo):void 0;if(ct(n.data)<=cn)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...s})}catch(m){const y=await i(m);if(y)return y;throw m}const o=Xn(n.data),l=await ea(o);let c,d;try{({uploadId:c,maxChunkBytes:d}=await a.beginAttachmentUpload(e,t,o.byteLength,l,{mimeType:n.mimeType,...s}))}catch(m){if(r!==void 0&&ln(m)){const y=await $e(e,r,a.getAttachmentInfo);if(y)return y}throw m}const u=Math.min(mn,d),h=Math.ceil(o.byteLength/u);let p=!1;try{for(let m=0;m<h;m++){const y=o.subarray(m*u,(m+1)*u);await a.sendAttachmentUploadChunk(c,m,Zn(y),e)}return p=!0,await a.commitAttachmentUpload(c,e)}catch(m){const y=p?await i(m):void 0;if(y)return y;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),m}}function ta(e,t){return pn(e,`image-${Date.now()}-${t+1}`)}class Ae extends Error{constructor(n,a){super(n);Pe(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function na(e,t){return e instanceof Ae?e.retryBlocks:t}async function aa(e,t,n=lt,a=()=>!0){const r=l=>(...c)=>(le(a),l(...c));n={placeAttachment:r(n.placeAttachment),beginAttachmentUpload:r(n.beginAttachmentUpload),sendAttachmentUploadChunk:r(n.sendAttachmentUploadChunk),commitAttachmentUpload:r(n.commitAttachmentUpload),abortAttachmentUpload:r(n.abortAttachmentUpload),getAttachmentInfo:r(n.getAttachmentInfo),mintIdempotencyKey:r(n.mintIdempotencyKey)};const s=[],i=[],o=[];for(let l=0;l<t.length;l++){le(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const p={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};s.push(p),i.push(p);continue}const d=c,u=d.placementFileName??ta(d.mimeType,l),h=n.mintIdempotencyKey(d.placementIdempotencyKey);try{const p=await Me(e,u,{data:d.data,mimeType:d.mimeType,...h!==void 0?{idempotencyKey:h}:{}},n),m={type:"image",attachmentId:p.attachmentId,...p.mimeType??d.mimeType?{mimeType:p.mimeType??d.mimeType}:{}};s.push(m),i.push(m)}catch(p){const m=dn(p);o.push(m?`${u} (${m})`:u),i.push(h!==void 0?{...d,placementIdempotencyKey:h,placementFileName:u}:d)}}if(o.length>0)throw new Ae(b.chat_imagePlacement_failed_error({names:o.join(", ")}),i);return le(a),s}const Lr=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Ae,base64DecodedBytes:ct,imageRetryBlocks:na,placeImageAttachment:Me,toImageReferenceBlocks:aa},Symbol.toStringTag,{value:"Module"}));function dt(){try{return gn()}catch{return null}}function ra(){return{backendId:A.state.connections.windowBackendId??null,generation:A.state.daemonHealth.connectionGeneration,transport:dt()}}class Ie extends Error{constructor(){super("dock-evidence-backend-changed")}}function N(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const H={current:e=>dt()===e.transport&&A.state.daemonHealth.connectionGeneration===e.generation&&(A.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>yn(),placeImage:(e,t,n,a)=>Me(e,t,n,{placeAttachment:N(a,it),beginAttachmentUpload:N(a,st),sendAttachmentUploadChunk:N(a,rt),commitAttachmentUpload:N(a,at),abortAttachmentUpload:N(a,nt),getAttachmentInfo:N(a,he),mintIdempotencyKey:se}),lookup:(e,t)=>he({workspaceId:e,idempotencyKey:t}),mintKey:se};function G(e){return H.current(e)}function sa(e,t){const n=A.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:x(n.drafts,Vt(e,t))?.clearRevision??0,binding:ra()}}function Nr(e,t,n){const a=sa(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&G(n.binding)}function ut(e,t){return()=>{if(!e.current(t))throw new Ie}}const mt=Object.freeze({rawRetention:!1,chiefAttachments:!1});function Hr(e){return e!==mt}const de=new Map;function pt(e,t=H){const n=`${e.backendId}:${e.generation}`;let a=de.get(n);if(!a){const r=ut(t,e);a=(async()=>{r();const i=await t.capabilities();r();const o=i?.server?.capabilities;if(!o||typeof o!="object")throw new Error("unobserved");return{rawRetention:o.rawScreenshotRetention===1,chiefAttachments:o.chiefAttachments===1}})().catch(()=>(de.delete(n),mt)),de.set(n,a)}return a}class Z extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function ft(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function ia(e){const t=String(e?.message??"");return ft(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function oa(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const r=Date.parse(a.expiresAt);return Number.isFinite(r)?a.expired||r<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Ke(e){return{ok:!0,path:e.path,fileName:e.fileName,size:e.size,attachmentId:e.attachmentId,...e.mimeType?{mimeType:e.mimeType}:{},uploadedAt:e.uploadedAt,replayed:!0,...e.rawScreenshot?{rawScreenshot:e.rawScreenshot}:{}}}class ca extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const We=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function la(e){const t=e.api??H,n=e.now??Date.now,a=ut(t,e.binding);a();const r=await pt(e.binding,t);a();const s=r.rawRetention&&(e.workspaceId!==be||r.chiefAttachments),i=[];for(const o of e.images){const l=e.records[o.image.id];let c=l&&l.signature===o.signature&&l.workspaceId===e.workspaceId&&l.backendId===e.binding.backendId?l:{imageId:o.image.id,signature:o.signature,workspaceId:e.workspaceId,backendId:e.binding.backendId,compositeKey:null,rawKey:null,composite:null,raw:null,rawSettled:!1};const d=u=>{c=u,e.onRecord(u)};try{if(!c.composite){const h=c.compositeKey,p=t.mintKey(h??void 0)??null;p!==c.compositeKey&&d({...c,compositeKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a()),m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}.${We(o.composite.mimeType)}`,{data:o.composite.base64,mimeType:o.composite.mimeType,...p?{idempotencyKey:p}:{}},a),a()),d({...c,composite:{attachmentId:m.attachmentId,mimeType:m.mimeType??o.composite.mimeType}})}const u=c.composite.attachmentId;if(s&&o.raw&&!c.raw&&!c.rawSettled){const h=c.rawKey,p=t.mintKey(h??void 0);if(p){p!==c.rawKey&&d({...c,rawKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a());try{m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}-original.${We(o.raw.mimeType)}`,{data:o.raw.base64,mimeType:o.raw.mimeType,idempotencyKey:p,rawScreenshot:{compositeAttachmentId:u}},a),a());const y=oa(m,u,n());if(y==="expired")d({...c,rawSettled:!0});else if(y)d({...c,raw:y});else throw new Z("echo")}catch(y){if(ia(y))d({...c,rawSettled:!0});else throw y instanceof Z?y:ft(y)?new Z("refused"):y}}else throw new Z("unkeyed")}}catch(u){throw u instanceof Ie?u:new ca(o.image.id,u)}i.push(c)}return i}async function Fr(e,t,n,a){const r=()=>{if(!H.current(a))throw new Ie};r();const s=await H.placeImage(e,t,{...n,idempotencyKey:H.mintKey()},r);return r(),s}const da=new Set(["invalid-saved-edit","media-send-retired","transcript-unavailable","transcript-pending","invalid-edit","stale-source","legacy-baked-marks","timing-unavailable","audio-unavailable","media-source-unavailable","media-export-unavailable","media-animation-layer-limit","media-export-failed","legacy-original-unavailable","capture-render-unavailable","capture-blur-unavailable","stale-source-pixels","not-a-screenshot","not-admitted","unavailable","dock-evidence-missing-pixels","draft-restore-failed","image-budget-exceeded"]),ua=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class O extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function ie(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!da.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>ua.has(r)?r:"other")].join(":")}function Kr(e,t){return e instanceof O?{stage:e.stage,code:ie(e.code)}:{stage:t,code:ie(e)}}function F(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??re(t,t.capturedMarks??[],e.transcript);if(n.video!=="full"||n.voice!=="audio"||n.crop||n.blurRegions.length||n.blurStrokes?.length)return!1;const a=ve(n,t,e.transcript);return t.visuals==="clean"?!a.errors.length&&!a.muted&&n.cuts.length===0&&!n.marks.some(r=>r.included)&&a.marks.length===0&&a.transcript===null&&a.kept.length===1&&a.kept[0].startMs===0&&a.kept[0].endMs===t.durationMs&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs===t.durationMs:!a.errors.length&&!a.muted&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs>=t.durationMs}async function ma(e,t,n,a,r,s){const i={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let o="validate";try{const l=()=>{if(!r()||!G(n))throw new Error("media-send-retired")};for(const c of[...t.images,...t.clips]){if(o="validate",s?.stage(o),c.mediaError)throw new Error("invalid-saved-edit");if(!c.media||F(c.media))continue;l();const d=structuredClone(c.media),u=d.source;let h=d.saved??re(u,u.capturedMarks??[],d.transcript),p=crypto.randomUUID();try{if(u.kind==="recording"&&h.voice==="transcript"&&d.transcript?.status!=="ready"){if(o="transcribe",s?.stage(o),!a?.transcribeMedia)throw new Error("transcript-unavailable");const f=await a.transcribeMedia({jobId:p,media:d});if(l(),!f.ok)throw new Error("transcript-unavailable");d.transcript=f.value,d.saved||(h=re(u,u.capturedMarks??[],d.transcript))}o="plan",s?.stage(o);const m=ve(h,u,d.transcript);if(m.errors.length)throw new Error(m.errors[0]);const y={id:c.id,kind:u.kind,video:h.video,voice:h.voice,transcript:m.transcript,batches:u.batches,marks:m.marks.map(({n:f,mark:k,frameAtMs:v})=>({n:f,id:k.id,at_ms:v,kind:k.kind,label:k.label,note:k.note,context:k.context,geometry:k.geometry}))};if(u.kind==="screenshot"){o="screenshot-source",s?.stage(o);const f=u.path.split("/").map(encodeURIComponent).join("/"),k=tt(`intent://local/file/${f}`,e);if(!k||k.kind!=="image")throw new Error("media-source-unavailable");const v=await Gn(k.url);l();const I={base64:Ze(v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};o="screenshot-render",s?.stage(o),i.images[c.id]=await nn(u,h,I),l()}else{if(!m.clips.length){y.video_attachment_id=null,y.frames=[],y.kept_ms=[],i.metadata.push(y);continue}const f={...d,saved:h};let k=await a?.takePreparedRecording?.(f);if(k&&(p=k.jobId),l(),!k){if(!a)throw new Error("media-export-unavailable");k=await ot(f,p,a,()=>r()&&G(n),S=>{o=S,s?.stage(S),S==="export"&&s?.exportAttempt(p)})}p=k.jobId,o="placement",s?.stage(o);const v=[k.value.video,...k.value.frames],I=[];for(let S=0;S<v.length;S++){l();const _=v[S],B=`capture-${c.id.slice(0,12)}-${S}.${S===0?"mp4":_.mimeType==="image/jpeg"?"jpg":"png"}`,C=await fn(e,B,{sourcePath:_.sourcePath,mimeType:_.mimeType,idempotencyKey:se()},void 0,void 0,()=>r()&&G(n));l(),S===0?i.files.push({type:"file",attachmentId:C.attachmentId,fileName:B,mimeType:C.mimeType??_.mimeType,size:C.size}):(i.frames.push({type:"image",attachmentId:C.attachmentId,mimeType:_.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),i.framePromptBytes.push(jn(_))),I.push(C.attachmentId)}y.video_attachment_id=I[0],y.frames=k.value.frames.map((S,_)=>({mark_id:S.markId,attachment_id:I[_+1]})),y.kept_ms=m.clips}i.metadata.push(y)}finally{s?.stage("release"),await a?.releaseMediaJob?.(p).catch(()=>{})}}return i}catch(l){throw l instanceof O?l:new O(o,ie(l))}}const ue=1568,pa=.85;async function fa(e,t){const n=Math.round(e.length*3/4/1024),a=await ha(e,t),{width:r,height:s}=a,i=r>ue||s>ue;let o=r,l=s;if(i){const f=ue/Math.max(r,s);o=Math.round(r*f),l=Math.round(s*f)}const c=new OffscreenCanvas(o,l),d=c.getContext("2d");if(!d)throw new Error("Failed to get 2D canvas context for image resize");d.drawImage(a,0,0,o,l);let u=t;ga(d,o,l)||(u="image/jpeg");const h=await c.convertToBlob({type:u,quality:u==="image/jpeg"?pa:void 0}),p=h.type||u,m=await ya(h),y=Math.round(m.length*3/4/1024);return console.debug(`[image-resize] ${r}×${s} → ${o}×${l} | ${t} → ${p} | ${n} KB → ${y} KB`),{base64:m,mimeType:p}}async function ha(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);const r=new Blob([a],{type:t});return createImageBitmap(r)}function ga(e,t,n){const r=e.getImageData(0,0,t,n).data;for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1}async function ya(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return btoa(a)}const T={...Oe,badge:Oe.badgeRadius*2};function wa(e,t,n=1,a=0){const r=Math.max(1,e.displayScale)*n,s=[],i=o=>o*n;for(const{n:o,mark:l}of t){const c=l.geometry;if(c.kind==="rect")s.push({kind:"rect",x:i(c.x),y:i(c.y),w:i(c.w),h:i(c.h),width:T.stroke*r});else if(c.kind==="path")s.push({kind:"path",points:c.points.map(m=>({x:i(m.x),y:i(m.y)})),width:T.pen*r});else{const m={x:i(c.from.x),y:i(c.from.y)},y={x:i(c.to.x),y:i(c.to.y)};s.push({kind:"arrow",from:m,to:y,head:Sa(m,y,T.arrowHead*r),width:T.stroke*r})}if(!T.showNumbers)continue;const d=Math.max(a,T.badge/2*r),u=i(l.bounds.x+l.bounds.w),h=i(l.bounds.y),p=Zt({x:i(l.bounds.x),y:h,w:u-i(l.bounds.x),h:i(l.bounds.h)},{x:0,y:0,w:i(e.width),h:i(e.height)},r,d);s.push({kind:"badge",...p,radius:d,label:String(o),font:d*T.badgeTextScale})}return s}function ba(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,r,s)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*r,s(),e.strokeStyle=T.accent,e.lineWidth=a,s()};e.strokeStyle=T.accent,e.lineCap="round",e.lineJoin="round";for(const a of t)if(a.kind==="rect")n(a.width,a.width/T.stroke,()=>e.strokeRect(a.x,a.y,a.w,a.h));else if(a.kind==="path"||a.kind==="arrow"){e.lineWidth=a.width,e.beginPath();const r=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&r.forEach((i,o)=>o?e.lineTo(i.x,i.y):e.moveTo(i.x,i.y)),a.kind==="arrow"&&(e.moveTo(a.head.left.x,a.head.left.y),e.lineTo(a.to.x,a.to.y),e.lineTo(a.head.right.x,a.head.right.y));const s=a.kind==="path"?new Path2D(Xt(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>s?e.stroke(s):e.stroke())}else e.fillStyle=T.paper,e.beginPath(),e.arc(a.x,a.y,a.radius,0,Math.PI*2),e.closePath(),e.fill(),e.strokeStyle=T.accent,e.lineWidth=T.badgeOutline*a.radius/T.badgeRadius,e.stroke(),e.fillStyle=T.ink,e.font=`600 ${a.font}px ${T.badgeFontFamily}`,e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,a.x,a.y)}async function ka(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function va(e){const t=await e.convertToBlob({type:"image/png"});return Ze(await t.arrayBuffer())}async function ht(e,t,n,a,r=0){await an();const s=await ka(e.base64,e.mimeType);try{const i=Math.min(1,a/Math.max(t.width,t.height)),o=new OffscreenCanvas(Math.max(1,Math.round(t.width*i)),Math.max(1,Math.round(t.height*i))),l=o.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(s,0,0,o.width,o.height),ba(l,wa(t,n,i,r)),o}finally{s.close()}}async function _a(e,t,n){const a=await ht(e,t,n,Math.max(t.width,t.height));return fa(await va(a),"image/png")}async function Wr(e,t,n,a=384){const r=await ht(e,t,n,a,a/32);return URL.createObjectURL(await r.convertToBlob({type:"image/png"}))}function Sa(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),r=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-r),y:t.y-n*Math.sin(a-r)},right:{x:t.x-n*Math.cos(a+r),y:t.y-n*Math.sin(a+r)}}}function jr(e,t){const n=zt(t??void 0),a=new Set(t?.clips.filter(r=>!!r.media&&!F(r.media)).map(r=>r.contextItemId));return e.filter(r=>!n.has(r.id)&&!a.has(r.id))}async function qr({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:r,clickedPayload:s,binding:i,service:o,current:l,onRecord:c,timing:d}){const u=()=>{if(!l()||!G(i))throw new O("validate","media-send-retired")};if(u(),n?.images.some(w=>w.mediaError)||n?.clips.some(w=>w.mediaError))throw new O("validate","invalid-saved-edit");const h=w=>!!w.media&&!F(w.media),p=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(w=>[w.id,a.find(M=>M.id===w.contextItemId)?.attachmentId??null]))}:null;for(const w of n?.clips??[]){if(!w.media||!F(w.media))continue;const M=a.find(Q=>Q.id===w.contextItemId);if(!M||M.attachmentId!==w.media.source.attachmentId||M.path!==w.media.source.path||M.placementStatus!==void 0&&M.placementStatus!=="placed")throw new O("validate","legacy-original-unavailable")}const m=n?await ma(e,n,i,o,l,d):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},y=new Set(n?.clips.filter(w=>h(w)||!!w.media&&F(w.media)).map(w=>w.id)),f=new Set(n?.clips.filter(w=>y.has(w.id)).flatMap(w=>(w.captureHistory??[]).map(M=>M.image.id))),k=(n?.images??[]).filter(w=>w.source!=="annotate"||!!w.media||!f.has(w.id)||n.marks.some(M=>M.imageId===w.id&&!(M.clipId&&y.has(M.clipId))));d?.stage("burn");let v=[];try{v=n?await Ma({...n,images:k},a,m.images):[]}catch(w){throw new O("burn",ie(w))}if(m.framePromptBytes.reduce((w,M)=>w+(M??0),0)>Fn)throw new O("validate","image-budget-exceeded");const S=new Set(n?.images.filter(w=>w.media).map(w=>w.id)),_=n?{...n,images:k.map(w=>m.images[w.id]?{...w,width:m.images[w.id].width,height:m.images[w.id].height}:w),clips:n.clips.filter(w=>!h(w)),marks:n.marks.filter(w=>!S.has(w.imageId)&&!n.clips.some(M=>h(M)&&M.id===w.clipId))}:null;u();const B=m.metadata.some(w=>typeof w.transcript=="string"&&w.transcript.trim());if(!s.text.trim()&&!r.length&&!s.workspaceContextStr?.trim()&&!v.length&&!m.files.length&&!m.frames.length&&!s.imageBlocks?.length&&!s.fileBlocks?.length&&!B)return null;let C=v,P=null;d?.stage("placement");const Re=n?await pt(i):null;if(u(),n&&(e!==be||Re?.chiefAttachments)){const w=await la({workspaceId:e,binding:i,images:k.map((M,Q)=>{const X=a.find(Et=>Et.id===M.contextItemId);return{image:M,signature:Gt(n,M.id),composite:{base64:v[Q].data,mimeType:v[Q].mimeType},raw:!M.media&&X?.imageData&&X.imageMimeType?{base64:X.imageData,mimeType:X.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),C=w.map(M=>({type:"image",attachmentId:M.composite.attachmentId,mimeType:M.composite.mimeType})),P=Object.fromEntries(w.map(M=>[M.imageId,{attachmentId:M.composite.attachmentId,raw:M.raw}]))}const g=new Map(n?Xe(n).map(({n:w,mark:M})=>[M.id,w]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:g}:p&&{...p,markNumbers:g},L=n&&D?{...s,imageBlocks:[...C,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Jt(_,D),m.metadata.length?`[Edited capture outputs]
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/IISMFCVN.js","/app/immutable/chunks/DTDbZc--.js","/app/immutable/chunks/GdlMbZRO.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/Cv-W__h8.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/DPvDLGgX.js","/app/immutable/chunks/ClsZrb8B.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/BePtUMMB.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/D4os-974.js","/app/immutable/chunks/BiLjH_HB.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/j0KL2ItM.js","/app/immutable/chunks/CgCdkhNg.js","/app/immutable/chunks/DBkMUdAo.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BZeUwBn0.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/BKpkoMuv.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/B10dK85Q.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/1o85IiDb.js","/app/immutable/chunks/CEpchTPD.js","/app/immutable/chunks/ZhmlPELZ.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/CUrYTyIw.js","/app/immutable/chunks/BtpuPEaR.js","/app/immutable/chunks/Ct5KmixI.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/D3ug-rpn.js","/app/immutable/chunks/CjU1deOg.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/CB56tJ4V.js","/app/immutable/chunks/C3BW_tmx.js","/app/immutable/chunks/BahFkvC5.js"])))=>i.map(i=>d[i]);
2
+ var Ct=Object.defineProperty;var Dt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>Dt(e,typeof t!="symbol"?t+"":t,n);import{B as xt,O as Rt,dG as Be,cG as pe,dr as Pt,al as Bt,b1 as Ge,z as Ot,dS as $t}from"./B10dK85Q.js";import{Ir as A,g as be,nx as x,vH as Ut,Bs as Ye,vJ as Lt,CF as Je,cx as Nt,cy as Ht,ny as Qe,nk as Ft,c as ke,fF as Kt,lN as Wt,cF as jt}from"./DBkMUdAo.js";import{e as qt,b as ae,F as Vt,y as re,_ as ve,G as zt,C as Gt,W as Xe,v as Yt,u as Jt,M as Qt}from"./BZeUwBn0.js";import{D as Oe,a as Xt,d as Zt}from"./CQcEqK4G.js";import{l as en,o as tn,g as Ze,r as nn,m as an,D as rn}from"./C4rKE1Qu.js";import{a as et,e as sn}from"./CEpchTPD.js";import{f as on}from"./Cl5axapM.js";import{bp as b,_ as fe}from"./Cv-W__h8.js";import{a9 as tt,aA as se,J as he,a as nt,n as at,cQ as rt,e as st,aH as it,M as cn,ab as ln,aT as $e,d as le,C as dn,cR as un,U as mn,a6 as pn,aI as fn,bY as hn}from"./8DfuL71y.js";import{bD as gn,bq as yn,aX as wn,by as bn,bs as kn,ax as vn}from"./BePtUMMB.js";import{O as _n,z as Sn}from"./GdlMbZRO.js";import{t as q,q as Mn,v as An}from"./j0KL2ItM.js";import{x as In,J as Tn,ai as En,ar as Cn}from"./7GFSQ1mk.js";import{a as Ue,b as Dn,g as xn}from"./DypB-Dwi.js";import{z as Rn}from"./CUrYTyIw.js";import{C as Pn}from"./BvFAWM27.js";import{i as Bn}from"./CyY6TpOV.js";import{o as $,e as On,l as V,s as E,n as ce,b as $n,d as Un,c as Ln}from"./CIyUrgF0.js";function Cr(e,t){if(e)return e.model}function Nn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Dr({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?xt(e):!1)&&!Nn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function xr(e){return Rt(e.messageMetadata)}function Hn(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function Rr(e){return Hn({...e,createdAt:Date.parse(e.queuedAt)})}const Fn=8*1024*1024,Kn=3*1024*1024;function Wn(e){return Math.ceil(Math.max(0,e)/3)*4}function jn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Kn&&typeof t=="number"&&t===Wn(e.size)?t:null}async function ot(e,t,n,a,r=()=>{}){const s=()=>{if(!a())throw new Error("media-send-retired")};if(s(),r("overlay-render"),!n.exportMedia)throw new Error("media-export-unavailable");const i=en(e.source,e.saved);if(i.length>1e4)throw new Error("media-animation-layer-limit");const o=[];for(const c of i)s(),o.push({...c,png:await tn(e.source,e.saved,c.atMs)});s(),r("export");const l=await n.exportMedia({outputVersion:qt,jobId:t,media:e,layers:o});if(s(),!l.ok)throw new Error(["media-export-failed",l.error].filter(Boolean).join(":"));return{jobId:t,value:l.value}}const _e={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function Le(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function ge(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=tt(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function qn(e){const t=e.video==="full"?b.dock_captureEditor_videoFull_label():b.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?b.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?b.dock_captureEditor_voiceTranscript_label():b.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function Vn(e,t,n,a){if(a?.error==="permission")return a.kind==="pick"?"accessibility":"screen";if(e==="permission"||t==="permission")return"screen";if(n?.startsWith("microphone-permission"))return"microphone";if(n?.startsWith("speech-permission"))return"speech"}const j=on;function Pr(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,i=t.speech.error??t.speech.capability?.reason??null,o=Vn(t.captureError,t.clips.find(g=>g.status==="failed"&&g.error==="permission")?.error??null,i,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?s?.annotationUnavailable:void 0,c=t.annotationIssue,d=t.captureError==="permission",u=c?.error==="permission"&&c.kind!=="pick",h=c?.error==="permission"&&c.kind==="pick",p=i?.startsWith("speech-permission")?"speech":i?.startsWith("microphone-permission")||i==="permission"?"microphone":void 0,m={},y={},f=(g,D,L)=>{m[g]=D,L&&(y[g]=L)};s&&(d&&(f("capture",s.permission,"screen"),t.recording||f("record",s.permission,"screen")),u&&!t.annotating&&f("annotate",s.permission,"screen"),h&&(f("pick",s.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&f("annotate",s.accessibilityPermission,"accessibility")),p&&!t.dictation&&f("mic",(i&&r.speechError?.(i))??s.speechPermission,p));const k=g=>{const D=y[g];D&&e.actions.onOpenSettings(D)},v=new Set(t.evidenceOwnedItemIds),I=t.clips.find(g=>g.status==="recording"),S=t.clips.length>=ae.clips,_=t.capabilities,B=t.speech.available,C=new Set(t.clips.filter(g=>g.status==="recording"||g.status==="placing"||!!g.media).flatMap(g=>g.captureHistory?.map(D=>D.image.id)??[])),P=[...t.tiles.filter(({image:g,marks:D})=>!!g.media||g.source!=="annotate"||!C.has(g.id)||D.some(({mark:L})=>!L.clipId)).map(({image:g,marks:D})=>({kind:"image",id:g.contextItemId,url:a.previews[g.id]??"",markCount:D.length,owner:"evidence",...a.previews[g.id]?{}:{status:"placing"}})),...t.clips.filter(g=>!g.discarding).map(g=>({kind:"clip",id:g.contextItemId??g.id,duration:j(g.status==="recording"?Le(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:qn(g.media.saved)}:{},...g.status==="ready"&&ge(e.workspaceId,g.path)?{url:ge(e.workspaceId,g.path)}:{},owner:"evidence",...g.status==="placing"?{status:"placing"}:{},...g.status==="failed"?{status:"failed",...g.error==="limit"?{error:b.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(g=>!v.has(g.id)).map(g=>({...g.imageData&&g.imageMimeType?{kind:"image",id:g.id,url:`data:${g.imageMimeType};base64,${g.imageData}`,markCount:0,file:{name:g.label,imageData:g.imageData,imageMimeType:g.imageMimeType}}:{kind:"file",id:g.id,name:g.label},owner:"attachment",...g.placementStatus==="placing"?{status:"placing"}:{},...g.placementStatus==="failed"?{status:"failed",error:g.placementError}:{}}))];return{mediaStatus:t.recording?{kind:"recording",label:r.recording}:t.dictation?{kind:"listening",label:r.listening}:t.annotating?{kind:"annotating",label:r.annotating}:void 0,...o?{settingsPane:o}:{},...l?{annotationNotice:l}:{},labels:r,attachments:P,...s?{placeholder:t.dictation?"":s.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!_.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:r.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!_.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!_.annotate,recording:t.recording&&!I?.discarding,recordingDisabled:!!I?.discarding||!t.recording&&(!_.record||S),...S&&!t.recording?{recordingTooltip:r.clipLimit}:{},recordingTime:j(I?Le(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!m.mic,...t.speech.error&&r.speechError?{dictationTooltip:r.speechError(t.speech.error)}:{},dictationTime:t.dictation?j(a.now-t.dictation.startedAt):j(0),inputLevels:t.speech.levels,...Object.keys(m).length?{alerts:m}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:k,beforeSubmit:e.beforeSubmit}}const Se=()=>globalThis.electronAPI,zn=["image/png","image/jpeg","image/webp"],Ne=e=>zn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function Br(e,t){const{view:n,items:a,previews:r}=t,s=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(s){const c=a.find(p=>p.id===s.image.contextItemId),d=s.image.media;if(s.image.mediaError)return null;if(d?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const p={...d,saved:d.saved},m=await t.createSavedPreviewUrl(t.workspaceId,p);try{const y=await t.fetchBytes(m),f=p.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:y,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(f?.w??p.source.width)),height:Math.max(1,Math.round(f?.h??p.source.height)),displayScale:s.image.displayScale,capturedAt:s.image.capturedAt},raw:y,marks:[]}}}finally{t.revokeUrl(m)}}const u=Ne(c?.imageMimeType),h=r[s.image.id];return!c?.imageData||!u||!h?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(h),intent:{pixels:{mimeType:u,width:s.image.width,height:s.image.height,displayScale:s.image.displayScale,capturedAt:s.image.capturedAt,...s.image.hash?{hash:s.image.hash}:{}},raw:He(c.imageData),marks:s.marks.map(({mark:p})=>({tool:p.tool,geometry:p.geometry,bounds:p.bounds,element:p.element}))}}}const i=n.clips.find(c=>c.id===e||c.contextItemId===e);if(i){const c=i.status==="ready"?ge(t.workspaceId,i.path):null;if(!c)return null;const d=a.find(h=>h.id===i.contextItemId),u=await t.fetchBytes(c);if(!Yn(u))throw new Error("Not a recording file");return{kind:"clip",name:d?.label||`recording-${i.id.slice(0,8)}.mp4`,mimeType:d?.attachmentMimeType||"video/mp4",bytes:u,durationMs:i.durationMs,hasMicAudio:i.hasMicAudio}}const o=a.find(c=>c.id===e),l=Ne(o?.imageMimeType);return o?.imageData&&l?{kind:"image",name:o.label||"image",mimeType:l,bytes:He(o.imageData)}:null}async function Gn(e){const t=await fetch(e);if(!t.ok)throw new Error(`Media request failed (${t.status})`);const n=new Uint8Array(await t.arrayBuffer()),a=Number(t.headers.get("content-length")??Number.NaN);if(n.byteLength===0||Number.isFinite(a)&&a!==n.byteLength)throw new Error("Media response was incomplete");return n}function Yn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Or(e){try{return(await Se()?.invoke(_e.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Jn(){try{return await Se()?.invoke(_e.CLIPBOARD_READ,{})??null}catch{return null}}async function $r(e){try{const t=await Se()?.invoke(_e.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Fe=new WeakSet;async function Qn(e,t){const[n]=e;if(e.length!==1||!n||n.size!==t.size)return!1;try{const a=await crypto.subtle.digest("SHA-256",await n.arrayBuffer());return Array.from(new Uint8Array(a),s=>s.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function Ur(e,{onIntentMedia:t,isCurrent:n,read:a=Jn}){const r=e.clipboardData;if(Fe.has(e)||!r||r.files.length===0)return!1;const s=e.target,i=Array.from(r.files),o=r.types.filter(l=>l!=="Files").map(l=>[l,r.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await Qn(i,l)){n()&&t(l);return}if(!n()||!(s instanceof Node)||!s.isConnected)return;const c=new DataTransfer;for(const u of i)c.items.add(u);for(const[u,h]of o)c.setData(u,h);const d=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Fe.add(d),s.dispatchEvent(d)}),!0}function Xn(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function Zn(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function ct(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function ea(e){const t=await crypto.subtle.digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}const lt={placeAttachment:it,beginAttachmentUpload:st,sendAttachmentUploadChunk:rt,commitAttachmentUpload:at,abortAttachmentUpload:nt,getAttachmentInfo:he,mintIdempotencyKey:se};async function Me(e,t,n,a=lt){const{idempotencyKey:r}=n,s={...r!==void 0?{idempotencyKey:r}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},i=async m=>un(m,r)?$e(e,r,a.getAttachmentInfo):void 0;if(ct(n.data)<=cn)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...s})}catch(m){const y=await i(m);if(y)return y;throw m}const o=Xn(n.data),l=await ea(o);let c,d;try{({uploadId:c,maxChunkBytes:d}=await a.beginAttachmentUpload(e,t,o.byteLength,l,{mimeType:n.mimeType,...s}))}catch(m){if(r!==void 0&&ln(m)){const y=await $e(e,r,a.getAttachmentInfo);if(y)return y}throw m}const u=Math.min(mn,d),h=Math.ceil(o.byteLength/u);let p=!1;try{for(let m=0;m<h;m++){const y=o.subarray(m*u,(m+1)*u);await a.sendAttachmentUploadChunk(c,m,Zn(y),e)}return p=!0,await a.commitAttachmentUpload(c,e)}catch(m){const y=p?await i(m):void 0;if(y)return y;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),m}}function ta(e,t){return pn(e,`image-${Date.now()}-${t+1}`)}class Ae extends Error{constructor(n,a){super(n);Pe(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function na(e,t){return e instanceof Ae?e.retryBlocks:t}async function aa(e,t,n=lt,a=()=>!0){const r=l=>(...c)=>(le(a),l(...c));n={placeAttachment:r(n.placeAttachment),beginAttachmentUpload:r(n.beginAttachmentUpload),sendAttachmentUploadChunk:r(n.sendAttachmentUploadChunk),commitAttachmentUpload:r(n.commitAttachmentUpload),abortAttachmentUpload:r(n.abortAttachmentUpload),getAttachmentInfo:r(n.getAttachmentInfo),mintIdempotencyKey:r(n.mintIdempotencyKey)};const s=[],i=[],o=[];for(let l=0;l<t.length;l++){le(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const p={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};s.push(p),i.push(p);continue}const d=c,u=d.placementFileName??ta(d.mimeType,l),h=n.mintIdempotencyKey(d.placementIdempotencyKey);try{const p=await Me(e,u,{data:d.data,mimeType:d.mimeType,...h!==void 0?{idempotencyKey:h}:{}},n),m={type:"image",attachmentId:p.attachmentId,...p.mimeType??d.mimeType?{mimeType:p.mimeType??d.mimeType}:{}};s.push(m),i.push(m)}catch(p){const m=dn(p);o.push(m?`${u} (${m})`:u),i.push(h!==void 0?{...d,placementIdempotencyKey:h,placementFileName:u}:d)}}if(o.length>0)throw new Ae(b.chat_imagePlacement_failed_error({names:o.join(", ")}),i);return le(a),s}const Lr=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Ae,base64DecodedBytes:ct,imageRetryBlocks:na,placeImageAttachment:Me,toImageReferenceBlocks:aa},Symbol.toStringTag,{value:"Module"}));function dt(){try{return gn()}catch{return null}}function ra(){return{backendId:A.state.connections.windowBackendId??null,generation:A.state.daemonHealth.connectionGeneration,transport:dt()}}class Ie extends Error{constructor(){super("dock-evidence-backend-changed")}}function N(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const H={current:e=>dt()===e.transport&&A.state.daemonHealth.connectionGeneration===e.generation&&(A.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>yn(),placeImage:(e,t,n,a)=>Me(e,t,n,{placeAttachment:N(a,it),beginAttachmentUpload:N(a,st),sendAttachmentUploadChunk:N(a,rt),commitAttachmentUpload:N(a,at),abortAttachmentUpload:N(a,nt),getAttachmentInfo:N(a,he),mintIdempotencyKey:se}),lookup:(e,t)=>he({workspaceId:e,idempotencyKey:t}),mintKey:se};function G(e){return H.current(e)}function sa(e,t){const n=A.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:x(n.drafts,Vt(e,t))?.clearRevision??0,binding:ra()}}function Nr(e,t,n){const a=sa(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&G(n.binding)}function ut(e,t){return()=>{if(!e.current(t))throw new Ie}}const mt=Object.freeze({rawRetention:!1,chiefAttachments:!1});function Hr(e){return e!==mt}const de=new Map;function pt(e,t=H){const n=`${e.backendId}:${e.generation}`;let a=de.get(n);if(!a){const r=ut(t,e);a=(async()=>{r();const i=await t.capabilities();r();const o=i?.server?.capabilities;if(!o||typeof o!="object")throw new Error("unobserved");return{rawRetention:o.rawScreenshotRetention===1,chiefAttachments:o.chiefAttachments===1}})().catch(()=>(de.delete(n),mt)),de.set(n,a)}return a}class Z extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function ft(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function ia(e){const t=String(e?.message??"");return ft(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function oa(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const r=Date.parse(a.expiresAt);return Number.isFinite(r)?a.expired||r<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Ke(e){return{ok:!0,path:e.path,fileName:e.fileName,size:e.size,attachmentId:e.attachmentId,...e.mimeType?{mimeType:e.mimeType}:{},uploadedAt:e.uploadedAt,replayed:!0,...e.rawScreenshot?{rawScreenshot:e.rawScreenshot}:{}}}class ca extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const We=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function la(e){const t=e.api??H,n=e.now??Date.now,a=ut(t,e.binding);a();const r=await pt(e.binding,t);a();const s=r.rawRetention&&(e.workspaceId!==be||r.chiefAttachments),i=[];for(const o of e.images){const l=e.records[o.image.id];let c=l&&l.signature===o.signature&&l.workspaceId===e.workspaceId&&l.backendId===e.binding.backendId?l:{imageId:o.image.id,signature:o.signature,workspaceId:e.workspaceId,backendId:e.binding.backendId,compositeKey:null,rawKey:null,composite:null,raw:null,rawSettled:!1};const d=u=>{c=u,e.onRecord(u)};try{if(!c.composite){const h=c.compositeKey,p=t.mintKey(h??void 0)??null;p!==c.compositeKey&&d({...c,compositeKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a()),m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}.${We(o.composite.mimeType)}`,{data:o.composite.base64,mimeType:o.composite.mimeType,...p?{idempotencyKey:p}:{}},a),a()),d({...c,composite:{attachmentId:m.attachmentId,mimeType:m.mimeType??o.composite.mimeType}})}const u=c.composite.attachmentId;if(s&&o.raw&&!c.raw&&!c.rawSettled){const h=c.rawKey,p=t.mintKey(h??void 0);if(p){p!==c.rawKey&&d({...c,rawKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a());try{m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}-original.${We(o.raw.mimeType)}`,{data:o.raw.base64,mimeType:o.raw.mimeType,idempotencyKey:p,rawScreenshot:{compositeAttachmentId:u}},a),a());const y=oa(m,u,n());if(y==="expired")d({...c,rawSettled:!0});else if(y)d({...c,raw:y});else throw new Z("echo")}catch(y){if(ia(y))d({...c,rawSettled:!0});else throw y instanceof Z?y:ft(y)?new Z("refused"):y}}else throw new Z("unkeyed")}}catch(u){throw u instanceof Ie?u:new ca(o.image.id,u)}i.push(c)}return i}async function Fr(e,t,n,a){const r=()=>{if(!H.current(a))throw new Ie};r();const s=await H.placeImage(e,t,{...n,idempotencyKey:H.mintKey()},r);return r(),s}const da=new Set(["invalid-saved-edit","media-send-retired","transcript-unavailable","transcript-pending","invalid-edit","stale-source","legacy-baked-marks","timing-unavailable","audio-unavailable","media-source-unavailable","media-export-unavailable","media-animation-layer-limit","media-export-failed","legacy-original-unavailable","capture-render-unavailable","capture-blur-unavailable","stale-source-pixels","not-a-screenshot","not-admitted","unavailable","dock-evidence-missing-pixels","draft-restore-failed","image-budget-exceeded"]),ua=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class O extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function ie(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!da.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>ua.has(r)?r:"other")].join(":")}function Kr(e,t){return e instanceof O?{stage:e.stage,code:ie(e.code)}:{stage:t,code:ie(e)}}function F(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??re(t,t.capturedMarks??[],e.transcript);if(n.video!=="full"||n.voice!=="audio"||n.crop||n.blurRegions.length||n.blurStrokes?.length)return!1;const a=ve(n,t,e.transcript);return t.visuals==="clean"?!a.errors.length&&!a.muted&&n.cuts.length===0&&!n.marks.some(r=>r.included)&&a.marks.length===0&&a.transcript===null&&a.kept.length===1&&a.kept[0].startMs===0&&a.kept[0].endMs===t.durationMs&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs===t.durationMs:!a.errors.length&&!a.muted&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs>=t.durationMs}async function ma(e,t,n,a,r,s){const i={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let o="validate";try{const l=()=>{if(!r()||!G(n))throw new Error("media-send-retired")};for(const c of[...t.images,...t.clips]){if(o="validate",s?.stage(o),c.mediaError)throw new Error("invalid-saved-edit");if(!c.media||F(c.media))continue;l();const d=structuredClone(c.media),u=d.source;let h=d.saved??re(u,u.capturedMarks??[],d.transcript),p=crypto.randomUUID();try{if(u.kind==="recording"&&h.voice==="transcript"&&d.transcript?.status!=="ready"){if(o="transcribe",s?.stage(o),!a?.transcribeMedia)throw new Error("transcript-unavailable");const f=await a.transcribeMedia({jobId:p,media:d});if(l(),!f.ok)throw new Error("transcript-unavailable");d.transcript=f.value,d.saved||(h=re(u,u.capturedMarks??[],d.transcript))}o="plan",s?.stage(o);const m=ve(h,u,d.transcript);if(m.errors.length)throw new Error(m.errors[0]);const y={id:c.id,kind:u.kind,video:h.video,voice:h.voice,transcript:m.transcript,batches:u.batches,marks:m.marks.map(({n:f,mark:k,frameAtMs:v})=>({n:f,id:k.id,at_ms:v,kind:k.kind,label:k.label,note:k.note,context:k.context,geometry:k.geometry}))};if(u.kind==="screenshot"){o="screenshot-source",s?.stage(o);const f=u.path.split("/").map(encodeURIComponent).join("/"),k=tt(`intent://local/file/${f}`,e);if(!k||k.kind!=="image")throw new Error("media-source-unavailable");const v=await Gn(k.url);l();const I={base64:Ze(v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};o="screenshot-render",s?.stage(o),i.images[c.id]=await nn(u,h,I),l()}else{if(!m.clips.length){y.video_attachment_id=null,y.frames=[],y.kept_ms=[],i.metadata.push(y);continue}const f={...d,saved:h};let k=await a?.takePreparedRecording?.(f);if(k&&(p=k.jobId),l(),!k){if(!a)throw new Error("media-export-unavailable");k=await ot(f,p,a,()=>r()&&G(n),S=>{o=S,s?.stage(S),S==="export"&&s?.exportAttempt(p)})}p=k.jobId,o="placement",s?.stage(o);const v=[k.value.video,...k.value.frames],I=[];for(let S=0;S<v.length;S++){l();const _=v[S],B=`capture-${c.id.slice(0,12)}-${S}.${S===0?"mp4":_.mimeType==="image/jpeg"?"jpg":"png"}`,C=await fn(e,B,{sourcePath:_.sourcePath,mimeType:_.mimeType,idempotencyKey:se()},void 0,void 0,()=>r()&&G(n));l(),S===0?i.files.push({type:"file",attachmentId:C.attachmentId,fileName:B,mimeType:C.mimeType??_.mimeType,size:C.size}):(i.frames.push({type:"image",attachmentId:C.attachmentId,mimeType:_.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),i.framePromptBytes.push(jn(_))),I.push(C.attachmentId)}y.video_attachment_id=I[0],y.frames=k.value.frames.map((S,_)=>({mark_id:S.markId,attachment_id:I[_+1]})),y.kept_ms=m.clips}i.metadata.push(y)}finally{s?.stage("release"),await a?.releaseMediaJob?.(p).catch(()=>{})}}return i}catch(l){throw l instanceof O?l:new O(o,ie(l))}}const ue=1568,pa=.85;async function fa(e,t){const n=Math.round(e.length*3/4/1024),a=await ha(e,t),{width:r,height:s}=a,i=r>ue||s>ue;let o=r,l=s;if(i){const f=ue/Math.max(r,s);o=Math.round(r*f),l=Math.round(s*f)}const c=new OffscreenCanvas(o,l),d=c.getContext("2d");if(!d)throw new Error("Failed to get 2D canvas context for image resize");d.drawImage(a,0,0,o,l);let u=t;ga(d,o,l)||(u="image/jpeg");const h=await c.convertToBlob({type:u,quality:u==="image/jpeg"?pa:void 0}),p=h.type||u,m=await ya(h),y=Math.round(m.length*3/4/1024);return console.debug(`[image-resize] ${r}×${s} → ${o}×${l} | ${t} → ${p} | ${n} KB → ${y} KB`),{base64:m,mimeType:p}}async function ha(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);const r=new Blob([a],{type:t});return createImageBitmap(r)}function ga(e,t,n){const r=e.getImageData(0,0,t,n).data;for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1}async function ya(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return btoa(a)}const T={...Oe,badge:Oe.badgeRadius*2};function wa(e,t,n=1,a=0){const r=Math.max(1,e.displayScale)*n,s=[],i=o=>o*n;for(const{n:o,mark:l}of t){const c=l.geometry;if(c.kind==="rect")s.push({kind:"rect",x:i(c.x),y:i(c.y),w:i(c.w),h:i(c.h),width:T.stroke*r});else if(c.kind==="path")s.push({kind:"path",points:c.points.map(m=>({x:i(m.x),y:i(m.y)})),width:T.pen*r});else{const m={x:i(c.from.x),y:i(c.from.y)},y={x:i(c.to.x),y:i(c.to.y)};s.push({kind:"arrow",from:m,to:y,head:Sa(m,y,T.arrowHead*r),width:T.stroke*r})}if(!T.showNumbers)continue;const d=Math.max(a,T.badge/2*r),u=i(l.bounds.x+l.bounds.w),h=i(l.bounds.y),p=Zt({x:i(l.bounds.x),y:h,w:u-i(l.bounds.x),h:i(l.bounds.h)},{x:0,y:0,w:i(e.width),h:i(e.height)},r,d);s.push({kind:"badge",...p,radius:d,label:String(o),font:d*T.badgeTextScale})}return s}function ba(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,r,s)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*r,s(),e.strokeStyle=T.accent,e.lineWidth=a,s()};e.strokeStyle=T.accent,e.lineCap="round",e.lineJoin="round";for(const a of t)if(a.kind==="rect")n(a.width,a.width/T.stroke,()=>e.strokeRect(a.x,a.y,a.w,a.h));else if(a.kind==="path"||a.kind==="arrow"){e.lineWidth=a.width,e.beginPath();const r=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&r.forEach((i,o)=>o?e.lineTo(i.x,i.y):e.moveTo(i.x,i.y)),a.kind==="arrow"&&(e.moveTo(a.head.left.x,a.head.left.y),e.lineTo(a.to.x,a.to.y),e.lineTo(a.head.right.x,a.head.right.y));const s=a.kind==="path"?new Path2D(Xt(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>s?e.stroke(s):e.stroke())}else e.fillStyle=T.paper,e.beginPath(),e.arc(a.x,a.y,a.radius,0,Math.PI*2),e.closePath(),e.fill(),e.strokeStyle=T.accent,e.lineWidth=T.badgeOutline*a.radius/T.badgeRadius,e.stroke(),e.fillStyle=T.ink,e.font=`600 ${a.font}px ${T.badgeFontFamily}`,e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,a.x,a.y)}async function ka(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function va(e){const t=await e.convertToBlob({type:"image/png"});return Ze(await t.arrayBuffer())}async function ht(e,t,n,a,r=0){await an();const s=await ka(e.base64,e.mimeType);try{const i=Math.min(1,a/Math.max(t.width,t.height)),o=new OffscreenCanvas(Math.max(1,Math.round(t.width*i)),Math.max(1,Math.round(t.height*i))),l=o.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(s,0,0,o.width,o.height),ba(l,wa(t,n,i,r)),o}finally{s.close()}}async function _a(e,t,n){const a=await ht(e,t,n,Math.max(t.width,t.height));return fa(await va(a),"image/png")}async function Wr(e,t,n,a=384){const r=await ht(e,t,n,a,a/32);return URL.createObjectURL(await r.convertToBlob({type:"image/png"}))}function Sa(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),r=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-r),y:t.y-n*Math.sin(a-r)},right:{x:t.x-n*Math.cos(a+r),y:t.y-n*Math.sin(a+r)}}}function jr(e,t){const n=zt(t??void 0),a=new Set(t?.clips.filter(r=>!!r.media&&!F(r.media)).map(r=>r.contextItemId));return e.filter(r=>!n.has(r.id)&&!a.has(r.id))}async function qr({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:r,clickedPayload:s,binding:i,service:o,current:l,onRecord:c,timing:d}){const u=()=>{if(!l()||!G(i))throw new O("validate","media-send-retired")};if(u(),n?.images.some(w=>w.mediaError)||n?.clips.some(w=>w.mediaError))throw new O("validate","invalid-saved-edit");const h=w=>!!w.media&&!F(w.media),p=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(w=>[w.id,a.find(M=>M.id===w.contextItemId)?.attachmentId??null]))}:null;for(const w of n?.clips??[]){if(!w.media||!F(w.media))continue;const M=a.find(Q=>Q.id===w.contextItemId);if(!M||M.attachmentId!==w.media.source.attachmentId||M.path!==w.media.source.path||M.placementStatus!==void 0&&M.placementStatus!=="placed")throw new O("validate","legacy-original-unavailable")}const m=n?await ma(e,n,i,o,l,d):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},y=new Set(n?.clips.filter(w=>h(w)||!!w.media&&F(w.media)).map(w=>w.id)),f=new Set(n?.clips.filter(w=>y.has(w.id)).flatMap(w=>(w.captureHistory??[]).map(M=>M.image.id))),k=(n?.images??[]).filter(w=>w.source!=="annotate"||!!w.media||!f.has(w.id)||n.marks.some(M=>M.imageId===w.id&&!(M.clipId&&y.has(M.clipId))));d?.stage("burn");let v=[];try{v=n?await Ma({...n,images:k},a,m.images):[]}catch(w){throw new O("burn",ie(w))}if(m.framePromptBytes.reduce((w,M)=>w+(M??0),0)>Fn)throw new O("validate","image-budget-exceeded");const S=new Set(n?.images.filter(w=>w.media).map(w=>w.id)),_=n?{...n,images:k.map(w=>m.images[w.id]?{...w,width:m.images[w.id].width,height:m.images[w.id].height}:w),clips:n.clips.filter(w=>!h(w)),marks:n.marks.filter(w=>!S.has(w.imageId)&&!n.clips.some(M=>h(M)&&M.id===w.clipId))}:null;u();const B=m.metadata.some(w=>typeof w.transcript=="string"&&w.transcript.trim());if(!s.text.trim()&&!r.length&&!s.workspaceContextStr?.trim()&&!v.length&&!m.files.length&&!m.frames.length&&!s.imageBlocks?.length&&!s.fileBlocks?.length&&!B)return null;let C=v,P=null;d?.stage("placement");const Re=n?await pt(i):null;if(u(),n&&(e!==be||Re?.chiefAttachments)){const w=await la({workspaceId:e,binding:i,images:k.map((M,Q)=>{const X=a.find(Et=>Et.id===M.contextItemId);return{image:M,signature:Gt(n,M.id),composite:{base64:v[Q].data,mimeType:v[Q].mimeType},raw:!M.media&&X?.imageData&&X.imageMimeType?{base64:X.imageData,mimeType:X.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),C=w.map(M=>({type:"image",attachmentId:M.composite.attachmentId,mimeType:M.composite.mimeType})),P=Object.fromEntries(w.map(M=>[M.imageId,{attachmentId:M.composite.attachmentId,raw:M.raw}]))}const g=new Map(n?Xe(n).map(({n:w,mark:M})=>[M.id,w]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:g}:p&&{...p,markNumbers:g},L=n&&D?{...s,imageBlocks:[...C,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Jt(_,D),m.metadata.length?`[Edited capture outputs]
3
3
  ${JSON.stringify(m.metadata)}`:"",s.workspaceContextStr].filter(Boolean).join(`
4
4
 
5
5
  `),messageMetadata:{...s.messageMetadata,...Yt(_,D),edited_captures:m.metadata}}:s;return u(),L}async function Ma(e,t,n={}){const a=Xe(e);return Promise.all(e.images.map(async r=>{if(n[r.id])return{type:"image",...n[r.id]};const s=t.find(o=>o.id===r.contextItemId);if(!s?.imageData||!s.imageMimeType)throw new Error("dock-evidence-missing-pixels");const i=await _a({base64:s.imageData,mimeType:s.imageMimeType},r,a.filter(({mark:o})=>o.imageId===r.id));return{type:"image",data:i.base64,mimeType:i.mimeType}}))}const Aa="intent.dock.captureEditorPreview";function Vr(){try{return et()&&localStorage.getItem(Aa)==="1"}catch{return!1}}function zr(e){const{clip:t}=e;if(t.status!=="ready"||!t.path)return null;const n=e.marks.filter(s=>s.clipId===t.id&&typeof s.clipMs=="number").sort((s,i)=>s.clipMs-i.clipMs).map(s=>({id:s.id,tool:s.tool,atMs:s.clipMs,...s.element?.name?{label:s.element.name.slice(0,200)}:{}})),a=Qt(e.evidence??void 0,t.id),r=a?t.media:void 0;return{kind:"recording",workspaceId:e.workspaceId,agentId:e.agentId,attachmentId:a?.attachmentId??t.id,sourceRevision:a?`${a.id}:${a.revision}`:t.path,attachmentPath:t.path,title:"",durationMs:t.durationMs,marks:n,provenance:a?{...a.audio==="unknown"?{}:{hasMicAudio:a.audio==="available"},visuals:a.visuals}:{hasMicAudio:t.hasMicAudio,visuals:n.length>0?"baked-marks":"clean"},...a&&r?{source:a,saved:r.saved??null,transcript:r.transcript??null}:{}}}async function Gr(e){if(!et())return{ok:!1,error:"unavailable"};try{return await sn().invoke(rn.OPEN,e)??{ok:!1,error:"unavailable"}}catch{return{ok:!1,error:"transport"}}}function Yr(e){let t=null,n=null;const a=o=>e.releaseMediaJob?.(o).catch(()=>{});function r(){const o=t;t=null,!(!o||o.taken||o.stopped)&&(o.stopped=!0,clearTimeout(o.timer),a(o.id))}function s(o,l,c){if(t?.key===o||n===o||(r(),n=null,!e.adoptMediaJob||!e.exportMedia||!c()||F(l)))return;const d=structuredClone(l),u=d.saved??re(d.source,d.source.capturedMarks??[],d.transcript),h=ve(u,d.source,d.transcript);if(d.source.kind!=="recording"||d.source.visuals!=="clean"||h.errors.length||!h.clips.length||u.voice==="transcript"&&d.transcript?.status!=="ready")return;const p={...d,saved:u},m=crypto.randomUUID(),y={key:o,mediaKey:JSON.stringify(p),id:m,current:c,taken:!1,stopped:!1,settled:!1,failed:!1,timer:setTimeout(()=>{t===y&&(n=o,r())},3e4),result:Promise.resolve({error:new Error("not-started")})};t=y,y.result=ot(p,m,e,()=>!y.stopped&&y.current()).then(async f=>y.stopped||!y.current()?(await a(m),{error:new Error("media-send-retired")}):{value:f},async f=>(y.failed=!0,t===y&&(n=o),await a(m),{error:f})).finally(()=>{y.settled=!0})}async function i(o,l,c){const d=t;if(!d||d.key!==o||d.mediaKey!==JSON.stringify(l)||d.stopped||d.taken||!c())return null;if(d.failed&&d.settled)return r(),null;d.taken=!0,d.current=c,clearTimeout(d.timer),t=null;const u=await d.result;if("error"in u)throw u.error;try{if(!c())throw new Error("media-send-retired");const h=await e.adoptMediaJob?.(d.id);if(!c())throw new Error("media-send-retired");return!h?.ok||!h.value?(await a(d.id),null):u.value}catch(h){throw await a(d.id),h}}return{warm:s,take:i,cancel:r}}function Jr(e={}){const t=a=>_n(a,typeof e=="function"?e():e),n=a=>wn(t(a));return{actionHints:{get capture(){return{label:b.dock_composer_screenshotAction_label(),shortcut:t("dock.capture")}},get record(){return{label:b.ui_shortcuts_dockRecord_label(),shortcut:t("dock.record")}},get dictate(){return{label:b.dock_shortcut_dictate_label()}}},get capture(){return b.dock_composer_capture_tooltip({shortcut:n("dock.capture")})},captureMode:{get window(){return b.dock_composer_captureWindow_tooltip({shortcut:n("dock.capture")})},get region(){return b.dock_composer_captureRegion_tooltip({shortcut:n("dock.capture")})}},captureModes:{fullscreen:b.dock_composer_captureFullscreen_label(),window:b.dock_composer_captureWindow_label(),region:b.dock_composer_captureRegion_label()},captureOptions:b.dock_composer_captureModes_ariaLabel(),captureLimit:b.dock_composer_captureLimit_tooltip(),clipLimit:b.dock_composer_clipLimit_tooltip({limit:q(ae.clips)}),get record(){return b.dock_composer_record_tooltip({shortcut:n("dock.record")})},stopRecording:b.dock_composer_stopRecording_tooltip(),annotationTools:b.annotation_toolbar_ariaLabel(),annotateCurrent:a=>b.dock_composer_annotate_ariaLabel({tool:a}),tools:{pick:b.dock_composer_pick_label(),box:b.dock_composer_box_label(),pen:b.dock_composer_pen_label(),arrow:b.annotation_arrow_label()},get dictate(){return b.dock_shortcut_dictate_label()},stopDictating:b.dock_composer_stopDictating_tooltip(),annotating:b.dock_composer_annotating_status(),listening:b.dock_composer_listening_status(),recording:b.dock_composer_recording_status(),markUp:b.dock_composer_markUp_label(),remove:b.chat_contextChip_remove_label(),play:b.dock_composer_play_label(),edit:b.dock_composer_edit_label(),done:b.dock_composer_done_label(),attachments:b.context_attachments_title_label(),retry:b.chat_shared_retry_label(),attachmentPending:b.dock_composer_attachmentPending_status(),attachmentFailed:b.dock_composer_attachmentFailed_error(),image:a=>b.dock_composer_image_ariaLabel({n:q(a)}),clip:a=>b.dock_composer_clip_ariaLabel({duration:a}),recordingReference:(a,r)=>r?b.dock_composer_recordingEnd_chip({n:q(a)}):b.dock_composer_recordingStart_chip({n:q(a)}),speechError:a=>a.includes("permission")?b.dock_composer_speechPermission_error():["unsupported-platform","helper-missing","recognizer-unavailable","locale-unsupported","assets-unavailable","unavailable"].includes(a)?b.dock_composer_speechUnavailable_error():b.dock_composer_speechFailed_error()}}function Qr(e,t){return{enabled:e,limit:ae.files,excludedIds:t,unavailableMessage:b.dock_composer_filesUnavailable_error(),limitMessage:b.dock_composer_fileLimit_error({limit:q(ae.files)})}}function Ia(e){try{return new URL(e.pageUrl).hostname||e.pageUrl}catch{return e.pageUrl}}function Xr(e,t){return e.targetAgentId===t}function Zr(e){const t=e.element,n=e.viewport,a=Ia(e),r=t?`<${t.tagName.toLowerCase()}> · ${a}`:e.title||a,s=["<browser-element-capture>",`Page URL: ${e.pageUrl}`,`Page title: ${e.title}`,...t?[`DOM path: ${t.domPath}`,`CSS selector: ${t.selector}`,`Text snippet: ${t.textSnippet}`,...t.sourceRef?[`Source ref: ${t.sourceRef}`]:[],...n?[`Viewport: ${n.width}×${n.height}`]:[],`Element bounds: ${t.rect.width}×${t.rect.height} at (${t.rect.x}, ${t.rect.y})`]:[],"</browser-element-capture>"].join(`
@@ -8,4 +8,4 @@ ${JSON.stringify(m.metadata)}`:"",s.workspaceContextStr].filter(Boolean).join(`
8
8
  \`\`\`
9
9
  ${i}
10
10
  \`\`\`]`)}return Ta(a.join(`
11
- `),e)}function es(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const a=n(),{imageBlocks:r,fileBlocks:s}=Ea(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:Ca(a.contextItems,a.checkedPanels,a.checkedSelections),noteIds:a.noteIds,...r.length>0?{imageBlocks:r}:{},...s.length>0?{fileBlocks:s}:{},...a.pickedMentions?{messageMetadata:a.pickedMentions}:{}},hasAttachments:r.length>0||s.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}const Da="chat-read:",K=new Map,ye=new Set;function ts(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(t)}function ns(e,t){const n=K.get(e);if(!(!n||!n.delete(t))&&n.size===0){K.delete(e);for(const a of[...ye])a(e)}}function as(e){return ye.add(e),()=>ye.delete(e)}function rs(e){return K.has(e)}function ss(e){const t=K.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Da))return!0;return!1}function xa(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!Ye(a.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(Lt(t,r));const s=e.state.pendingSubmissions.byAgentId[t.agentId];return s&&x(s.submissions,r.id)?r:null}function Ra(e,t,n,a,r){const s=Be.select(e.state,n),i=pe.select(e.state)?.principal.id,o=Ue(e.state);if(!s||!i||!o)return null;const l=In(t,n),c={agentId:t,workspaceId:n,principalId:i,participation:s,authority:o,owner:l.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},d=()=>l.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&Be.select(e.state,n)===s&&pe.select(e.state)?.principal.id===i&&Ue(e.state)===o;if(!d())return null;e.dispatch(Ut(c,a,Pt.select(e.state,n)));const u=xa(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ye(h.scope,c)&&(!!x(h.operations,u.id)||!!x(h.submissions,u.id))}}:null}function we(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??Tn();return Ra(e,t,n.wsId,pe.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&Bt.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Pa(e,t,n){const a=we(e,t,n);return a?(e.dispatch(Je(t,{...n,userAppMessageId:a.submission.appMessageId,submission:{scope:a.scope,id:a.submission.id}})),!0):!1}async function Ba(e,t,n,a){const r=n.submission;if(!r)return"legacy";const s=r.reference,i=()=>s.scope.agentId===e&&s.scope.workspaceId===t&&Ge.select(A.state,e)===n?hn.select(A.state,s.scope):void 0,o=i();if(!o)return null;if(!o.supported)return"legacy";const l={wsId:t,text:n.text,imageBlocks:n.options?.imageBlocks,fileBlocks:n.options?.fileBlocks,noteIds:n.options?.noteIds,messageMetadata:n.options?.messageMetadata,model:a??n.options?.model};if(r.outcome==="rejected"){const p=x(o.tombstones,s.id);return x(o.submissions,s.id)||p&&p.reason!=="rejected"?null:we(A,e,l)}if(r.outcome==="accepted")return we(A,e,l);await Promise.all([En(e,t).catch(()=>{}),Cn(e,t).catch(()=>{})]);const c=i();if(!c||x(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./B4dLcxdK.js").then(m=>m.C);return{notify:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]),import.meta.url);if(i()!==c)return null;let u=!1;const h=()=>{u=!0};return d.warning(b.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${s.id}`,duration:Number.POSITIVE_INFINITY,action:{label:b.agent_chatSend_resend_label(),onClick:()=>{if(u)return;u=!0;const p=i();!p||p.generation!==c.generation||p.submissions!==c.submissions||p.observationVersion!==c.observationVersion||x(p.submissions,s.id)?.status!=="uncertain"||Pa(A,e,l)}},cancel:{label:b.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function is(e,t,n){const a=Ge.select(A.state,e),r=a?.submission?await Ba(e,t,a,n):"legacy";if(r){if(r==="legacy"){await A.dispatch(n===void 0?Nt(e,t):Ht(e,t,n));return}!r.isCurrent()||!a||A.dispatch(Je(e,{wsId:t,text:a.text,imageBlocks:a.options?.imageBlocks,fileBlocks:a.options?.fileBlocks,noteIds:a.options?.noteIds,messageMetadata:a.options?.messageMetadata,model:n??a.options?.model,userAppMessageId:r.submission.appMessageId,submission:{scope:r.scope,id:r.submission.id}}))}}const os=A.createSelector((e,t)=>{const n=x(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:Qe(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Oa(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==ke.Deleted&&!t.notificationsMuted&&Kt(t)==="topLevel"}function $a(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!Rn(e.metadata,t)?t:null}function Ua(e){return e.status===ke.Error&&!Ot($t(e))}function cs(e,t){return t.filter(n=>Oa(e,n)).flatMap(n=>{const a=Ft(n),r=$a(n),s=n.status===ke.Error;if(!a&&!r&&!s)return[];const i=a?.timestamp??(s?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:a?.kind??(s?"failed":"question"),reason:a?.reason,timestamp:i&&Number.isFinite(Date.parse(i))?i:void 0,questionMessageId:r,canRetry:Ua(n)}]})}function ls(e){return e.displayStatus==="failed"?"failed":e.displayStatus==="blocked"?"blocked":e.attention==="review_required"?"review":e.displayStatus==="needs_attention"?"question":e.activity==="agent_running"||e.displayStatus==="in_progress"?"running":e.scriptsRunning===!0?"scripts_running":e.backgroundTasksRunning===!0?"background_tasks_running":e.displayStatus==="pr_ready"?"pr_ready":e.displayStatus==="pr_merged"?"merged":e.displayStatus==="complete"?"complete":e.attention==="unread"?"unread":e.displayStatus==="pr_open"||e.displayStatus==="pr_queued"?e.displayStatus:"idle"}function ds(e){const t=e.kind==="prs"?e.organization?.trim().toLowerCase():void 0;return{key:JSON.stringify([e.kind,e.workspaceId,t||null,[...new Set((t?[]:e.repositories).map(n=>JSON.stringify([n.key,n.owner,n.name])))].sort()]),hasGitHubRepositories:!!t||e.repositories.some(n=>!!n.owner),hasLocalRepositories:!t&&e.repositories.some(n=>!n.owner)}}function Te(e){const t=bn(e);if(t?.kind!=="pr"||!Number.isSafeInteger(t.number)||t.number<=0)return null;const n=t.owner.toLowerCase(),a=t.repo.toLowerCase();return{owner:n,repo:a,number:t.number,id:`${n}/${a}#${t.number}`,url:`https://github.com/${n}/${a}/pull/${t.number}`}}function us(e,t,n,a){const r=e.filter(s=>a?a.includes(s.id):n?s.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(i=>i.owner?.toLowerCase()===s.repositoryOwner?.toLowerCase()&&i.name.toLowerCase()===s.repositoryName?.toLowerCase()));return[...new Map(r.flatMap(s=>[...(s.pullRequests??[]).map(i=>i.url),s.activePullRequest?.url,s.prUrl]).flatMap(s=>{const i=s?Te(s):null;return i?[[i.id,{owner:i.owner,repo:i.repo,number:i.number}]]:[]})).values()].sort((s,i)=>`${s.owner}/${s.repo}#${s.number}`.localeCompare(`${i.owner}/${i.repo}#${i.number}`))}function ms(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const ps=A.createSelector(e=>e.homeIntegrations),fs=A.createSelector(e=>{const t=e.homeIntegrations;return!t.linkedItems||!Object.keys(t.linkedItems).length?t:{...t,items:[...new Map([...Object.values(t.linkedItems),...t.items].map(n=>[n.id,n])).values()].sort((n,a)=>(a.updatedAt??"").localeCompare(n.updatedAt??""))}}),gt=A.createSelector(e=>Qe(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:Te(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),hs=A.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?Te(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return gt.select(e).find(a=>a.url===n)??null}),gs=A.createSelector(e=>gt.select(e).map(t=>t.url));let ee=null;function ys(e){return ee=e,()=>{ee===e&&(ee=null)}}function ws(){return ee}function bs(e){return[...e.groups.length>0?e.groups.filter(n=>n.expanded).flatMap(n=>n.items):e.workspaces,...e.asideExpanded?e.aside:[]].map(n=>n.id)}function ks(e,t,n){if(e.length===0)return null;const a=t===null?-1:e.indexOf(t);return a===-1?e[0]:e[a+(n==="clockwise"?1:-1)]??null}let te=null;function vs(e){return te=e,()=>{te===e&&(te=null)}}function _s(){return te}function Ss(e){return An(e)}function La(e){return Mn(e)}function Na(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function me(e){if(e.length===0)return[];const t=[];let n=null;for(const a of e){const r=a.timestamp?typeof a.timestamp=="string"?new Date(a.timestamp):a.timestamp:new Date;(!n||!Na(n.date,r))&&(n={date:r,label:La(r),messages:[]},t.push(n)),n.messages.push(a)}return t}function Ms(e){const t=new Map;return e.map(({date:n})=>{const a=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,r=t.get(a)??0;return t.set(a,r+1),r===0?a:`${a}#${r}`})}function As(e,t){const n=new Map;let a=t?null:void 0;for(const r of e.groups)for(const s of r.messages)a!==void 0&&n.set(s.id,a),s.role==="user"&&!Bn(s)&&(a=s);return n}function Ha(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function je(e,t){const n=new Map;return e.map(a=>{const r=`${t}-${Ha(a.date)}`,s=(n.get(r)??0)+1;return n.set(r,s),{...a,groupKey:s===1?r:`${r}-${s}`}})}function Fa(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(s=>s.id)),a=new Set(t.map(s=>s.appMessageId).filter(s=>typeof s=="string"&&s.length>0)),r=e.filter(s=>!n.has(s.id)&&!(typeof s.appMessageId=="string"&&s.appMessageId.length>0&&a.has(s.appMessageId)));return r.length===e.length?e:r}function Is(e,t,n){return e=Fa(e,t),e.length===0?{groups:me(t),detached:!1,hiddenTail:[]}:n?{groups:je(me(e),"h"),detached:!0,hiddenTail:t}:{groups:je(me([...e,...t]),"d"),detached:!1,hiddenTail:[]}}function Ts(e){const{scrollTop:t,threshold:n,fetching:a,exhausted:r,historyCount:s,tailCount:i,tailTruncated:o,totalMessages:l,spacerAbove:c=0}=e;return t>n+c||a||r?!1:s>0||o||l>i+s}const Es=300;function Cs(e){const{fetching:t,chainEvaluationPending:n,visible:a,hideArmed:r}=e;return t||n?a&&!r?"none":"show":a&&!r?"arm-hide":"none"}const qe=24,Ka=320;function Ee(e){return Number.isFinite(e)?Math.min(Ka,Math.max(qe,e)):qe}const Wa=.2,ja=.12;function qa(e,t,n=Wa){const a=Ee(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function Ds(e,t){const n=Ee(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function xs(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:r,currentSpacerHeight:s,viewportHeight:i}=e;let o=e.rowHeightEma;n>0&&r>0&&(o=qa(o,r/n));const l=e.unloadedRows??t-n,d=a||t<=0||n<=0||l<=0||o===null?0:Math.round(l*o),u=Math.abs(d-s);return u===0?{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}:d===0||s===0||u>s*ja||i>0&&u>i?{spacerHeight:d,rowHeightEma:o,applied:!0,scrollTopDelta:d-s}:{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const Va=Pn,za=2;function Rs(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=Va,nearPages:s=za}=e;if(n<=0||t>=n)return"serial";const i=Ee(a??Number.NaN);return(n-Math.max(0,t))/i>s*r?"seek":"serial"}const yt=200,Ga=1;function Ps(e,t,n=yt){const a=t.timestamp-n;return[...e.filter(r=>r.timestamp>=a),t]}function Bs(e){const{samples:t,viewportHeight:n,windowMs:a=yt,viewportFactor:r=Ga}=e;if(n<=0||t.length<2)return"gentle";const s=t[t.length-1].timestamp-a,i=t.filter(l=>l.timestamp>=s);if(i.length<2)return"gentle";let o=0;for(let l=1;l<i.length;l+=1)o+=Math.abs(i[l].scrollTop-i[l-1].scrollTop);return o>n*r?"rapid":"gentle"}function Os(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:a}=e;if(a<=0||n<=0)return 0;const r=Math.min(1,Math.max(0,t/n));return Math.min(a-1,Math.max(0,Math.floor(r*a)))}function $s(e){const{totalMessages:t,residentCount:n,exhausted:a,startOrdinalEstimate:r,detachedFromTail:s}=e,i=Math.max(0,t-n);if(!s)return{above:a?0:i,below:0};const o=Math.max(0,e.hiddenTailCount??0);if(a)return{above:0,below:i+o};if(r!==null){const c=Math.min(i,Math.max(0,Math.round(r)));return{above:c,below:i-c+o}}const l=Math.min(i,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:i-l,below:l+o}}function Us(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:r,totalMessages:s}=e;return t?!0:n>0?!1:!r&&s<=a}const Ya="intent.drafts.sync",Ja="intent.drafts.changed",Qa=$({id:E(),type:E(),label:E(),description:E().optional(),content:E().optional(),path:E().optional(),imageData:E().optional(),imageMimeType:E().optional(),attachmentId:E().optional(),attachmentMimeType:E().optional(),attachmentSize:ce().optional(),sourcePath:E().optional(),placementStatus:V("failed").optional(),screen:On().optional()}),wt=$({text:E(),attachments:$n(Qa)}),z={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};Un("kind",[$({...z,kind:V("read")}),$({...z,...ne,kind:V("edit"),origin:E().min(1),sequence:ce().int().positive(),snapshot:wt}),$({...z,...ne,kind:V("flush")}),$({...z,...ne,kind:V("clear"),origin:E().min(1)})]);const bt=$({...z,...ne,origin:E(),sequence:ce().int().nonnegative(),snapshot:wt}),Xa=$({accepted:Ln(),draft:bt});function Za(e,t,n=t){const a=new Map,r=new Set,s=crypto.randomUUID();let i=0,o=!1;const l=()=>{const f=t();if(o||!f)throw new Error("draft-authority-unavailable");return f},c=()=>{const f=n();if(!f||o)throw new Error("draft-authority-unavailable");return()=>{if(o||n()!==f)throw new Error("draft-authority-changed")}},d=(f,k,v)=>{const I=JSON.stringify([f,k,v]);let S=a.get(I);return S||(S={dirty:0},a.set(I,S)),S},u=(f,k)=>{if(o||f.provenance!==t())return;const v=d(f.provenance,f.workspaceId,f.agentId);if(!(v.value?.lifetime===f.lifetime&&v.value.revision>f.revision)&&(v.value=f,k&&v.dirty===0))for(const I of r)I(f)},h=e.subscribe(f=>{const k=bt.safeParse(f);k.success&&u(k.data,!0)}),p=async(f,k)=>{k();const v=Xa.parse(await e.request(f));if(k(),f.provenance!==l()||v.draft.provenance!==f.provenance)throw new Error("draft-authority-changed");if(!v.accepted)throw u(v.draft,!1),new Error("draft-changed-in-another-editor");return v.draft},m=async(f,k)=>{const v=l(),I=c(),S=d(v,f,k);S.tail&&await S.tail;const _=await p({kind:"read",provenance:v,workspaceId:f,agentId:k},I);return u(_,!1),_},y=(f,k,v)=>{const I=l(),S=c(),_=d(I,f,k),B=_.tail??(_.value?Promise.resolve(_.value):p({kind:"read",provenance:I,workspaceId:f,agentId:k},S));_.dirty+=1;const C=B.then(P=>p(v(P),S));return _.tail=C,C.then(P=>{_.dirty-=1,_.tail===C&&(_.tail=void 0),u(P,!0)},()=>{_.dirty-=1,_.tail===C&&(_.tail=void 0)}),C};return{authority:()=>o?null:n(),read:m,async edit(f,k,v,I){const S=++i;return y(k,v,_=>({kind:"edit",provenance:_.provenance,workspaceId:k,agentId:v,lifetime:_.lifetime,revision:_.revision,origin:f,sequence:S,snapshot:I}))},async flush(f,k){const v=l(),I=c(),S=d(v,f,k),_=await(S.tail??(S.value?Promise.resolve(S.value):m(f,k)));await p({kind:"flush",provenance:v,workspaceId:f,agentId:k,lifetime:_.lifetime,revision:_.revision},I)},async clear(f,k){await y(f,k,v=>({kind:"clear",provenance:v.provenance,workspaceId:f,agentId:k,lifetime:v.lifetime,revision:v.revision,origin:s}))},subscribe(f){return r.add(f),()=>{r.delete(f)}},dispose(){o=!0,h(),r.clear(),a.clear()}}}let U=null;async function Ls(e,t,n,a,r){const s=U;if(!s)throw new Error("draft-shared-transport-unavailable");const i=()=>{if(U!==s||s.authority()!==r)throw new Error("draft-authority-changed")};i(),await s.edit(e,t,n,a),i(),await s.flush(t,n),i()}async function Ns(e,t){await Promise.resolve(),U&&await U.flush(e,t)}function Hs(){if(!Sn())return null;const e=Za({request:n=>vn(Ya,n),subscribe:n=>kn(a=>{a.method===Ja&&n(a.params)})},()=>Dn(A.state),()=>xn(A.state));U=e;const t=e.dispose;return e.dispose=()=>{U===e&&(U=null),t()},e}const kt=new Map;function vt(e,t){return`${e}\0${t}`}function Fs(e,t){return kt.get(vt(e,t))}function Ks(e,t,n){kt.set(vt(e,t),n)}const Ws=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.userMessageIndexes,n):void 0}),js=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.retryAgents,n):void 0});function er(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const s=e/1e3,i=s.toFixed(1);return i.endsWith(".0")?`${Math.round(s)}s`:`${i}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return n>0?`${n}h ${a}m ${r}s`:`${a}m ${r}s`}function qs(e){return er(Math.max(1e3,Math.round(e/1e3)*1e3))}const tr=new Set(["launch","init","session-create","session-load","prompt"]),nr=new Set(["tool-call","tool-waiting"]);function ar(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Vs(e){return e&&tr.has(e)?"pulse":e&&nr.has(e)?"twist":"bloom"}const _t="stalled";function zs(e,t){const n=ar(e);return!n||n.phase!==_t||typeof t=="number"&&t>n.timestamp?null:n}function Gs(e){let t=null;for(const n of e)n.phase!==_t&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const Ve={get title(){return b.chat_streamingStatus_sessionCorrupted_title()},get message(){return b.chat_streamingStatus_sessionCorrupted_message()}};function Ys(e,t){return e?t===!0?{corrupted:!0,title:Ve.title,message:Ve.message,detail:e}:{corrupted:!1,title:b.chat_streamingStatus_responseFailed_label(),message:e,detail:null}:null}const Js=A.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Qs=A.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),Xs=A.createSelector(e=>{const t=[];for(const s of Object.values(e.panelLayout.byWorkspaceId))for(const i of Object.values(s.panels))for(const o of i.tabs)o.type==="agent"&&o.agentId&&t.push(o.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[be]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(s=>a.has(s)),dividerSessionAgentIds:n,openAgentTabIds:t}}),Zs=A.createSelector((e,t)=>x(e.questionUi.consumers,t)),rr=3e4,Y=new Map;function ei(e,t){const n=Y.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>Y.delete(e),rr);Y.set(e,{value:t,timer:a})}function ti(e){const t=Y.get(e);if(t)return clearTimeout(t.timer),Y.delete(e),t.value}const St=A.createSelector((e,t,n)=>e.agentWorkers?.byKey[jt(t,n)]??Wt),sr=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="unsupported"?[]:(a.snapshot?.workers??[]).filter(r=>r.status==="running"||r.status==="unknown")}),ni=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="failed"?!0:a.status!=="ready"||!a.snapshot?!1:a.snapshot.truncated?!0:a.snapshot.support.status!=="supported"&&sr.select(e,t,n).length>0}),ir=1e3,Mt={requireViewedAndFocused:!0,requireAssistantTail:!0},J=new Map,R=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const or=200;function cr(e,t){if(R.delete(e),R.set(e,t),R.size>or){const n=R.keys().next().value;n!==void 0&&R.delete(n)}}function At(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function ai(e){return At(e)?.id??null}function ri(e){De(e,{requireViewedAndFocused:!0})}function si(e){De(e,{requireViewedAndFocused:!1})}function ii(e){Ce(),De(e,Mt)}function oi(e){W===e&&(J.has(e)||(W=null,xe(e,Mt)))}function ci(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),xe(t,{requireViewedAndFocused:!1}))}function It(e){const t=J.get(e);t&&(clearTimeout(t.timer),J.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{J.delete(e),xe(e,t)},ir);J.set(e,{timer:n,gates:t})}let ze=null;function lr(){return ze??=Promise.all([fe(()=>import("./CjU1deOg.js"),__vite__mapDeps([38,17,18,3,19,20,5,7,4,21,13,2,39,40]),import.meta.url),fe(()=>import("./C3BW_tmx.js").then(e=>e.p),__vite__mapDeps([41,36,4,3,17,18,19,20,5,7,21,13,2,9,6,8,10,11,12,14,32,31,42,28,35]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),ze}async function xe(e,t){let n=null;try{const{appStore:a,appClient:r}=await lr(),s=a.state;if(t.requireViewedAndFocused&&(s.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const i=s.agentSessions?.byAgentId[e];if(!i)return;const o=typeof i.workspaceId=="string"?i.workspaceId:"";if(o.length===0)return;if(t.requireAssistantTail&&s.chatState?.byAgentId[e]?.initialHistoryPending){W=e;return}const l=At(i.messages??[]);if(!l){t.requireAssistantTail&&(W=e);return}if(t.requireAssistantTail&&l.role!=="assistant")return;const c=l.id;if(R.get(e)===c)return;cr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&R.get(e)===n&&R.delete(e)}catch{n!==null&&R.get(e)===n&&R.delete(e)}}const oe=new Map;function Tt(e,t){return`${e}\0${t}`}function li(e,t){return oe.get(Tt(e,t))}function di(e,t,n){oe.set(Tt(e,t),n)}function ui(e){if(e.length===0)return;const t=new Set(e);for(const n of[...oe.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&oe.delete(n)}}export{bs as $,Br as A,zr as B,Kr as C,O as D,Fa as E,jr as F,Ea as G,Da as H,Gn as I,Ns as J,qs as K,Ss as L,ir as M,zs as N,Es as O,li as P,Fs as Q,yt as R,_s as S,cs as T,ws as U,qe as V,ls as W,Gs as X,Vs as Y,rs as Z,ss as _,ts as a,Lr as a0,na as a1,As as a2,Ur as a3,Us as a4,G as a5,Hr as a6,Nr as a7,xr as a8,Os as a9,St as aA,ni as aB,os as aC,Qs as aD,Xs as aE,Js as aF,ps as aG,hs as aH,fs as aI,gs as aJ,gt as aK,Zs as aL,js as aM,Ws as aN,di as aO,Ks as aP,Ts as aQ,$r as aR,ms as aS,$s as aT,ei as aU,ks as aV,Pa as aW,ti as aX,aa as aY,Or as aZ,ci as aa,oi as ab,ri as ac,si as ad,ii as ae,ai as af,Cs as ag,as as ah,Gr as ai,Hn as aj,Ls as ak,Fr as al,es as am,qr as an,Ba as ao,pt as ap,Rr as aq,vs as ar,xs as as,ys as at,ns as au,Ce as av,is as aw,Cr as ax,Ds as ay,sr as az,we as b,Ps as c,Xr as d,Zr as e,Ms as f,Pr as g,Ca as h,Dr as i,sa as j,ra as k,Bs as l,Rs as m,ui as n,us as o,Is as p,Qr as q,Jr as r,Wr as s,Hs as t,Yr as u,Ys as v,ds as w,Vr as x,ge as y,qn as z};
11
+ `),e)}function es(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const a=n(),{imageBlocks:r,fileBlocks:s}=Ea(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:Ca(a.contextItems,a.checkedPanels,a.checkedSelections),noteIds:a.noteIds,...r.length>0?{imageBlocks:r}:{},...s.length>0?{fileBlocks:s}:{},...a.pickedMentions?{messageMetadata:a.pickedMentions}:{}},hasAttachments:r.length>0||s.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}const Da="chat-read:",K=new Map,ye=new Set;function ts(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(t)}function ns(e,t){const n=K.get(e);if(!(!n||!n.delete(t))&&n.size===0){K.delete(e);for(const a of[...ye])a(e)}}function as(e){return ye.add(e),()=>ye.delete(e)}function rs(e){return K.has(e)}function ss(e){const t=K.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Da))return!0;return!1}function xa(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!Ye(a.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(Lt(t,r));const s=e.state.pendingSubmissions.byAgentId[t.agentId];return s&&x(s.submissions,r.id)?r:null}function Ra(e,t,n,a,r){const s=Be.select(e.state,n),i=pe.select(e.state)?.principal.id,o=Ue(e.state);if(!s||!i||!o)return null;const l=In(t,n),c={agentId:t,workspaceId:n,principalId:i,participation:s,authority:o,owner:l.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},d=()=>l.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&Be.select(e.state,n)===s&&pe.select(e.state)?.principal.id===i&&Ue(e.state)===o;if(!d())return null;e.dispatch(Ut(c,a,Pt.select(e.state,n)));const u=xa(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ye(h.scope,c)&&(!!x(h.operations,u.id)||!!x(h.submissions,u.id))}}:null}function we(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??Tn();return Ra(e,t,n.wsId,pe.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&Bt.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Pa(e,t,n){const a=we(e,t,n);return a?(e.dispatch(Je(t,{...n,userAppMessageId:a.submission.appMessageId,submission:{scope:a.scope,id:a.submission.id}})),!0):!1}async function Ba(e,t,n,a){const r=n.submission;if(!r)return"legacy";const s=r.reference,i=()=>s.scope.agentId===e&&s.scope.workspaceId===t&&Ge.select(A.state,e)===n?hn.select(A.state,s.scope):void 0,o=i();if(!o)return null;if(!o.supported)return"legacy";const l={wsId:t,text:n.text,imageBlocks:n.options?.imageBlocks,fileBlocks:n.options?.fileBlocks,noteIds:n.options?.noteIds,messageMetadata:n.options?.messageMetadata,model:a??n.options?.model};if(r.outcome==="rejected"){const p=x(o.tombstones,s.id);return x(o.submissions,s.id)||p&&p.reason!=="rejected"?null:we(A,e,l)}if(r.outcome==="accepted")return we(A,e,l);await Promise.all([En(e,t).catch(()=>{}),Cn(e,t).catch(()=>{})]);const c=i();if(!c||x(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./IISMFCVN.js").then(m=>m.C);return{notify:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]),import.meta.url);if(i()!==c)return null;let u=!1;const h=()=>{u=!0};return d.warning(b.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${s.id}`,duration:Number.POSITIVE_INFINITY,action:{label:b.agent_chatSend_resend_label(),onClick:()=>{if(u)return;u=!0;const p=i();!p||p.generation!==c.generation||p.submissions!==c.submissions||p.observationVersion!==c.observationVersion||x(p.submissions,s.id)?.status!=="uncertain"||Pa(A,e,l)}},cancel:{label:b.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function is(e,t,n){const a=Ge.select(A.state,e),r=a?.submission?await Ba(e,t,a,n):"legacy";if(r){if(r==="legacy"){await A.dispatch(n===void 0?Nt(e,t):Ht(e,t,n));return}!r.isCurrent()||!a||A.dispatch(Je(e,{wsId:t,text:a.text,imageBlocks:a.options?.imageBlocks,fileBlocks:a.options?.fileBlocks,noteIds:a.options?.noteIds,messageMetadata:a.options?.messageMetadata,model:n??a.options?.model,userAppMessageId:r.submission.appMessageId,submission:{scope:r.scope,id:r.submission.id}}))}}const os=A.createSelector((e,t)=>{const n=x(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:Qe(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Oa(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==ke.Deleted&&!t.notificationsMuted&&Kt(t)==="topLevel"}function $a(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!Rn(e.metadata,t)?t:null}function Ua(e){return e.status===ke.Error&&!Ot($t(e))}function cs(e,t){return t.filter(n=>Oa(e,n)).flatMap(n=>{const a=Ft(n),r=$a(n),s=n.status===ke.Error;if(!a&&!r&&!s)return[];const i=a?.timestamp??(s?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:a?.kind??(s?"failed":"question"),reason:a?.reason,timestamp:i&&Number.isFinite(Date.parse(i))?i:void 0,questionMessageId:r,canRetry:Ua(n)}]})}function ls(e){return e.displayStatus==="failed"?"failed":e.displayStatus==="blocked"?"blocked":e.attention==="review_required"?"review":e.displayStatus==="needs_attention"?"question":e.activity==="agent_running"||e.displayStatus==="in_progress"?"running":e.scriptsRunning===!0?"scripts_running":e.backgroundTasksRunning===!0?"background_tasks_running":e.displayStatus==="pr_ready"?"pr_ready":e.displayStatus==="pr_merged"?"merged":e.displayStatus==="complete"?"complete":e.attention==="unread"?"unread":e.displayStatus==="pr_open"||e.displayStatus==="pr_queued"?e.displayStatus:"idle"}function ds(e){const t=e.kind==="prs"?e.organization?.trim().toLowerCase():void 0;return{key:JSON.stringify([e.kind,e.workspaceId,t||null,[...new Set((t?[]:e.repositories).map(n=>JSON.stringify([n.key,n.owner,n.name])))].sort()]),hasGitHubRepositories:!!t||e.repositories.some(n=>!!n.owner),hasLocalRepositories:!t&&e.repositories.some(n=>!n.owner)}}function Te(e){const t=bn(e);if(t?.kind!=="pr"||!Number.isSafeInteger(t.number)||t.number<=0)return null;const n=t.owner.toLowerCase(),a=t.repo.toLowerCase();return{owner:n,repo:a,number:t.number,id:`${n}/${a}#${t.number}`,url:`https://github.com/${n}/${a}/pull/${t.number}`}}function us(e,t,n,a){const r=e.filter(s=>a?a.includes(s.id):n?s.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(i=>i.owner?.toLowerCase()===s.repositoryOwner?.toLowerCase()&&i.name.toLowerCase()===s.repositoryName?.toLowerCase()));return[...new Map(r.flatMap(s=>[...(s.pullRequests??[]).map(i=>i.url),s.activePullRequest?.url,s.prUrl]).flatMap(s=>{const i=s?Te(s):null;return i?[[i.id,{owner:i.owner,repo:i.repo,number:i.number}]]:[]})).values()].sort((s,i)=>`${s.owner}/${s.repo}#${s.number}`.localeCompare(`${i.owner}/${i.repo}#${i.number}`))}function ms(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const ps=A.createSelector(e=>e.homeIntegrations),fs=A.createSelector(e=>{const t=e.homeIntegrations;return!t.linkedItems||!Object.keys(t.linkedItems).length?t:{...t,items:[...new Map([...Object.values(t.linkedItems),...t.items].map(n=>[n.id,n])).values()].sort((n,a)=>(a.updatedAt??"").localeCompare(n.updatedAt??""))}}),gt=A.createSelector(e=>Qe(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:Te(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),hs=A.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?Te(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return gt.select(e).find(a=>a.url===n)??null}),gs=A.createSelector(e=>gt.select(e).map(t=>t.url));let ee=null;function ys(e){return ee=e,()=>{ee===e&&(ee=null)}}function ws(){return ee}function bs(e){return[...e.groups.length>0?e.groups.filter(n=>n.expanded).flatMap(n=>n.items):e.workspaces,...e.asideExpanded?e.aside:[]].map(n=>n.id)}function ks(e,t,n){if(e.length===0)return null;const a=t===null?-1:e.indexOf(t);return a===-1?e[0]:e[a+(n==="clockwise"?1:-1)]??null}let te=null;function vs(e){return te=e,()=>{te===e&&(te=null)}}function _s(){return te}function Ss(e){return An(e)}function La(e){return Mn(e)}function Na(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function me(e){if(e.length===0)return[];const t=[];let n=null;for(const a of e){const r=a.timestamp?typeof a.timestamp=="string"?new Date(a.timestamp):a.timestamp:new Date;(!n||!Na(n.date,r))&&(n={date:r,label:La(r),messages:[]},t.push(n)),n.messages.push(a)}return t}function Ms(e){const t=new Map;return e.map(({date:n})=>{const a=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,r=t.get(a)??0;return t.set(a,r+1),r===0?a:`${a}#${r}`})}function As(e,t){const n=new Map;let a=t?null:void 0;for(const r of e.groups)for(const s of r.messages)a!==void 0&&n.set(s.id,a),s.role==="user"&&!Bn(s)&&(a=s);return n}function Ha(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function je(e,t){const n=new Map;return e.map(a=>{const r=`${t}-${Ha(a.date)}`,s=(n.get(r)??0)+1;return n.set(r,s),{...a,groupKey:s===1?r:`${r}-${s}`}})}function Fa(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(s=>s.id)),a=new Set(t.map(s=>s.appMessageId).filter(s=>typeof s=="string"&&s.length>0)),r=e.filter(s=>!n.has(s.id)&&!(typeof s.appMessageId=="string"&&s.appMessageId.length>0&&a.has(s.appMessageId)));return r.length===e.length?e:r}function Is(e,t,n){return e=Fa(e,t),e.length===0?{groups:me(t),detached:!1,hiddenTail:[]}:n?{groups:je(me(e),"h"),detached:!0,hiddenTail:t}:{groups:je(me([...e,...t]),"d"),detached:!1,hiddenTail:[]}}function Ts(e){const{scrollTop:t,threshold:n,fetching:a,exhausted:r,historyCount:s,tailCount:i,tailTruncated:o,totalMessages:l,spacerAbove:c=0}=e;return t>n+c||a||r?!1:s>0||o||l>i+s}const Es=300;function Cs(e){const{fetching:t,chainEvaluationPending:n,visible:a,hideArmed:r}=e;return t||n?a&&!r?"none":"show":a&&!r?"arm-hide":"none"}const qe=24,Ka=320;function Ee(e){return Number.isFinite(e)?Math.min(Ka,Math.max(qe,e)):qe}const Wa=.2,ja=.12;function qa(e,t,n=Wa){const a=Ee(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function Ds(e,t){const n=Ee(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function xs(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:r,currentSpacerHeight:s,viewportHeight:i}=e;let o=e.rowHeightEma;n>0&&r>0&&(o=qa(o,r/n));const l=e.unloadedRows??t-n,d=a||t<=0||n<=0||l<=0||o===null?0:Math.round(l*o),u=Math.abs(d-s);return u===0?{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}:d===0||s===0||u>s*ja||i>0&&u>i?{spacerHeight:d,rowHeightEma:o,applied:!0,scrollTopDelta:d-s}:{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const Va=Pn,za=2;function Rs(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=Va,nearPages:s=za}=e;if(n<=0||t>=n)return"serial";const i=Ee(a??Number.NaN);return(n-Math.max(0,t))/i>s*r?"seek":"serial"}const yt=200,Ga=1;function Ps(e,t,n=yt){const a=t.timestamp-n;return[...e.filter(r=>r.timestamp>=a),t]}function Bs(e){const{samples:t,viewportHeight:n,windowMs:a=yt,viewportFactor:r=Ga}=e;if(n<=0||t.length<2)return"gentle";const s=t[t.length-1].timestamp-a,i=t.filter(l=>l.timestamp>=s);if(i.length<2)return"gentle";let o=0;for(let l=1;l<i.length;l+=1)o+=Math.abs(i[l].scrollTop-i[l-1].scrollTop);return o>n*r?"rapid":"gentle"}function Os(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:a}=e;if(a<=0||n<=0)return 0;const r=Math.min(1,Math.max(0,t/n));return Math.min(a-1,Math.max(0,Math.floor(r*a)))}function $s(e){const{totalMessages:t,residentCount:n,exhausted:a,startOrdinalEstimate:r,detachedFromTail:s}=e,i=Math.max(0,t-n);if(!s)return{above:a?0:i,below:0};const o=Math.max(0,e.hiddenTailCount??0);if(a)return{above:0,below:i+o};if(r!==null){const c=Math.min(i,Math.max(0,Math.round(r)));return{above:c,below:i-c+o}}const l=Math.min(i,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:i-l,below:l+o}}function Us(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:r,totalMessages:s}=e;return t?!0:n>0?!1:!r&&s<=a}const Ya="intent.drafts.sync",Ja="intent.drafts.changed",Qa=$({id:E(),type:E(),label:E(),description:E().optional(),content:E().optional(),path:E().optional(),imageData:E().optional(),imageMimeType:E().optional(),attachmentId:E().optional(),attachmentMimeType:E().optional(),attachmentSize:ce().optional(),sourcePath:E().optional(),placementStatus:V("failed").optional(),screen:On().optional()}),wt=$({text:E(),attachments:$n(Qa)}),z={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};Un("kind",[$({...z,kind:V("read")}),$({...z,...ne,kind:V("edit"),origin:E().min(1),sequence:ce().int().positive(),snapshot:wt}),$({...z,...ne,kind:V("flush")}),$({...z,...ne,kind:V("clear"),origin:E().min(1)})]);const bt=$({...z,...ne,origin:E(),sequence:ce().int().nonnegative(),snapshot:wt}),Xa=$({accepted:Ln(),draft:bt});function Za(e,t,n=t){const a=new Map,r=new Set,s=crypto.randomUUID();let i=0,o=!1;const l=()=>{const f=t();if(o||!f)throw new Error("draft-authority-unavailable");return f},c=()=>{const f=n();if(!f||o)throw new Error("draft-authority-unavailable");return()=>{if(o||n()!==f)throw new Error("draft-authority-changed")}},d=(f,k,v)=>{const I=JSON.stringify([f,k,v]);let S=a.get(I);return S||(S={dirty:0},a.set(I,S)),S},u=(f,k)=>{if(o||f.provenance!==t())return;const v=d(f.provenance,f.workspaceId,f.agentId);if(!(v.value?.lifetime===f.lifetime&&v.value.revision>f.revision)&&(v.value=f,k&&v.dirty===0))for(const I of r)I(f)},h=e.subscribe(f=>{const k=bt.safeParse(f);k.success&&u(k.data,!0)}),p=async(f,k)=>{k();const v=Xa.parse(await e.request(f));if(k(),f.provenance!==l()||v.draft.provenance!==f.provenance)throw new Error("draft-authority-changed");if(!v.accepted)throw u(v.draft,!1),new Error("draft-changed-in-another-editor");return v.draft},m=async(f,k)=>{const v=l(),I=c(),S=d(v,f,k);S.tail&&await S.tail;const _=await p({kind:"read",provenance:v,workspaceId:f,agentId:k},I);return u(_,!1),_},y=(f,k,v)=>{const I=l(),S=c(),_=d(I,f,k),B=_.tail??(_.value?Promise.resolve(_.value):p({kind:"read",provenance:I,workspaceId:f,agentId:k},S));_.dirty+=1;const C=B.then(P=>p(v(P),S));return _.tail=C,C.then(P=>{_.dirty-=1,_.tail===C&&(_.tail=void 0),u(P,!0)},()=>{_.dirty-=1,_.tail===C&&(_.tail=void 0)}),C};return{authority:()=>o?null:n(),read:m,async edit(f,k,v,I){const S=++i;return y(k,v,_=>({kind:"edit",provenance:_.provenance,workspaceId:k,agentId:v,lifetime:_.lifetime,revision:_.revision,origin:f,sequence:S,snapshot:I}))},async flush(f,k){const v=l(),I=c(),S=d(v,f,k),_=await(S.tail??(S.value?Promise.resolve(S.value):m(f,k)));await p({kind:"flush",provenance:v,workspaceId:f,agentId:k,lifetime:_.lifetime,revision:_.revision},I)},async clear(f,k){await y(f,k,v=>({kind:"clear",provenance:v.provenance,workspaceId:f,agentId:k,lifetime:v.lifetime,revision:v.revision,origin:s}))},subscribe(f){return r.add(f),()=>{r.delete(f)}},dispose(){o=!0,h(),r.clear(),a.clear()}}}let U=null;async function Ls(e,t,n,a,r){const s=U;if(!s)throw new Error("draft-shared-transport-unavailable");const i=()=>{if(U!==s||s.authority()!==r)throw new Error("draft-authority-changed")};i(),await s.edit(e,t,n,a),i(),await s.flush(t,n),i()}async function Ns(e,t){await Promise.resolve(),U&&await U.flush(e,t)}function Hs(){if(!Sn())return null;const e=Za({request:n=>vn(Ya,n),subscribe:n=>kn(a=>{a.method===Ja&&n(a.params)})},()=>Dn(A.state),()=>xn(A.state));U=e;const t=e.dispose;return e.dispose=()=>{U===e&&(U=null),t()},e}const kt=new Map;function vt(e,t){return`${e}\0${t}`}function Fs(e,t){return kt.get(vt(e,t))}function Ks(e,t,n){kt.set(vt(e,t),n)}const Ws=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.userMessageIndexes,n):void 0}),js=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.retryAgents,n):void 0});function er(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const s=e/1e3,i=s.toFixed(1);return i.endsWith(".0")?`${Math.round(s)}s`:`${i}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return n>0?`${n}h ${a}m ${r}s`:`${a}m ${r}s`}function qs(e){return er(Math.max(1e3,Math.round(e/1e3)*1e3))}const tr=new Set(["launch","init","session-create","session-load","prompt"]),nr=new Set(["tool-call","tool-waiting"]);function ar(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Vs(e){return e&&tr.has(e)?"pulse":e&&nr.has(e)?"twist":"bloom"}const _t="stalled";function zs(e,t){const n=ar(e);return!n||n.phase!==_t||typeof t=="number"&&t>n.timestamp?null:n}function Gs(e){let t=null;for(const n of e)n.phase!==_t&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const Ve={get title(){return b.chat_streamingStatus_sessionCorrupted_title()},get message(){return b.chat_streamingStatus_sessionCorrupted_message()}};function Ys(e,t){return e?t===!0?{corrupted:!0,title:Ve.title,message:Ve.message,detail:e}:{corrupted:!1,title:b.chat_streamingStatus_responseFailed_label(),message:e,detail:null}:null}const Js=A.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Qs=A.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),Xs=A.createSelector(e=>{const t=[];for(const s of Object.values(e.panelLayout.byWorkspaceId))for(const i of Object.values(s.panels))for(const o of i.tabs)o.type==="agent"&&o.agentId&&t.push(o.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[be]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(s=>a.has(s)),dividerSessionAgentIds:n,openAgentTabIds:t}}),Zs=A.createSelector((e,t)=>x(e.questionUi.consumers,t)),rr=3e4,Y=new Map;function ei(e,t){const n=Y.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>Y.delete(e),rr);Y.set(e,{value:t,timer:a})}function ti(e){const t=Y.get(e);if(t)return clearTimeout(t.timer),Y.delete(e),t.value}const St=A.createSelector((e,t,n)=>e.agentWorkers?.byKey[jt(t,n)]??Wt),sr=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="unsupported"?[]:(a.snapshot?.workers??[]).filter(r=>r.status==="running"||r.status==="unknown")}),ni=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="failed"?!0:a.status!=="ready"||!a.snapshot?!1:a.snapshot.truncated?!0:a.snapshot.support.status!=="supported"&&sr.select(e,t,n).length>0}),ir=1e3,Mt={requireViewedAndFocused:!0,requireAssistantTail:!0},J=new Map,R=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const or=200;function cr(e,t){if(R.delete(e),R.set(e,t),R.size>or){const n=R.keys().next().value;n!==void 0&&R.delete(n)}}function At(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function ai(e){return At(e)?.id??null}function ri(e){De(e,{requireViewedAndFocused:!0})}function si(e){De(e,{requireViewedAndFocused:!1})}function ii(e){Ce(),De(e,Mt)}function oi(e){W===e&&(J.has(e)||(W=null,xe(e,Mt)))}function ci(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),xe(t,{requireViewedAndFocused:!1}))}function It(e){const t=J.get(e);t&&(clearTimeout(t.timer),J.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{J.delete(e),xe(e,t)},ir);J.set(e,{timer:n,gates:t})}let ze=null;function lr(){return ze??=Promise.all([fe(()=>import("./CjU1deOg.js"),__vite__mapDeps([38,17,18,3,19,20,5,7,4,21,13,2,39,40]),import.meta.url),fe(()=>import("./C3BW_tmx.js").then(e=>e.p),__vite__mapDeps([41,36,4,3,17,18,19,20,5,7,21,13,2,9,6,8,10,11,12,14,32,31,42,28,35]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),ze}async function xe(e,t){let n=null;try{const{appStore:a,appClient:r}=await lr(),s=a.state;if(t.requireViewedAndFocused&&(s.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const i=s.agentSessions?.byAgentId[e];if(!i)return;const o=typeof i.workspaceId=="string"?i.workspaceId:"";if(o.length===0)return;if(t.requireAssistantTail&&s.chatState?.byAgentId[e]?.initialHistoryPending){W=e;return}const l=At(i.messages??[]);if(!l){t.requireAssistantTail&&(W=e);return}if(t.requireAssistantTail&&l.role!=="assistant")return;const c=l.id;if(R.get(e)===c)return;cr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&R.get(e)===n&&R.delete(e)}catch{n!==null&&R.get(e)===n&&R.delete(e)}}const oe=new Map;function Tt(e,t){return`${e}\0${t}`}function li(e,t){return oe.get(Tt(e,t))}function di(e,t,n){oe.set(Tt(e,t),n)}function ui(e){if(e.length===0)return;const t=new Set(e);for(const n of[...oe.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&oe.delete(n)}}export{bs as $,Br as A,zr as B,Kr as C,O as D,Fa as E,jr as F,Ea as G,Da as H,Gn as I,Ns as J,qs as K,Ss as L,ir as M,zs as N,Es as O,li as P,Fs as Q,yt as R,_s as S,cs as T,ws as U,qe as V,ls as W,Gs as X,Vs as Y,rs as Z,ss as _,ts as a,Lr as a0,na as a1,As as a2,Ur as a3,Us as a4,G as a5,Hr as a6,Nr as a7,xr as a8,Os as a9,St as aA,ni as aB,os as aC,Qs as aD,Xs as aE,Js as aF,ps as aG,hs as aH,fs as aI,gs as aJ,gt as aK,Zs as aL,js as aM,Ws as aN,di as aO,Ks as aP,Ts as aQ,$r as aR,ms as aS,$s as aT,ei as aU,ks as aV,Pa as aW,ti as aX,aa as aY,Or as aZ,ci as aa,oi as ab,ri as ac,si as ad,ii as ae,ai as af,Cs as ag,as as ah,Gr as ai,Hn as aj,Ls as ak,Fr as al,es as am,qr as an,Ba as ao,pt as ap,Rr as aq,vs as ar,xs as as,ys as at,ns as au,Ce as av,is as aw,Cr as ax,Ds as ay,sr as az,we as b,Ps as c,Xr as d,Zr as e,Ms as f,Pr as g,Ca as h,Dr as i,sa as j,ra as k,Bs as l,Rs as m,ui as n,us as o,Is as p,Qr as q,Jr as r,Wr as s,Hs as t,Yr as u,Ys as v,ds as w,Vr as x,ge as y,qn as z};
@@ -1,4 +1,4 @@
1
- import{t as He,br as v,bp as d,a_ as be,bz as je,b as Ze,bu as or,bv as _t,bt as Ur}from"./Cv-W__h8.js";import{bs as Xe,ay as X,be as ut,b$ as nt,b_ as q,bO as Y,W as y,bS as m,aD as e,a7 as ht,bl as xe,bn as Ye,c9 as c,aA as p,aB as re,ca as Le,c0 as pt,bH as s,a5 as oe,bA as ne,bV as V,br as Ct,bk as Ar,bj as Br,bf as Lo,bo as Nr,c5 as kt,aw as Yt,bz as Fo,cd as qt}from"./DYhIMPy1.js";import{c as Q}from"./D4os-974.js";import{n as yr,p as Ro,v as Lt,u as Me,w as So,I as To,g as It}from"./DPvDLGgX.js";import{b as wt}from"./BaIAhI85.js";import{d as xr}from"./D3OHzDMw.js";import{H as $o,G as Uo,I as Ao}from"./GdlMbZRO.js";import{c as nr}from"./ChTqQfQN.js";import{a as Bo}from"./CC7to1B5.js";import{f as Be,bc as No}from"./BePtUMMB.js";import{k as st}from"./DTDbZc--.js";import{s as Oo}from"./ClsZrb8B.js";import{ck as Or,F as _e,a4 as Mo,aV as Do,an as Ko,cF as Vo,aI as Wo,aW as Jt,Y as ar,_ as ir,aZ as Mr,as as zo,ay as Dr,cO as Go,cd as Kr,bO as Vr,ci as qo}from"./BKpkoMuv.js";import"./CgCdkhNg.js";import{Ir as Pe,fL as Ho,br as jo,z8 as Zo,yv as Xo,Kq as Cr,dI as Yo,bL as Jo,Kp as Qo,uf as en,Kn as kr,gr as tn,tC as rn,Ko as on,K3 as Ir,Km as Er}from"./DBkMUdAo.js";import"./BgcFKXg4.js";import{R as nn,k as Ht,l as dt,j as an,i as qe,p as Wr,h as zr,K as sn,m as ln,o as dn,n as un,M as Gr,d as cn}from"./D2pEu7en.js";import{a as qr,B as Et}from"./BvFAWM27.js";import{cq as fn}from"./B4dLcxdK.js";import{a3 as gn,u as vn}from"./Ba_TYo7-.js";import{w as pn,K as wn}from"./BtpuPEaR.js";import{I as $t}from"./B8IFnCn1.js";import{d as bn}from"./BSY2iZcG.js";import{a3 as mn,ae as _n}from"./D2bdWg46.js";import{i as Qt}from"./CEpchTPD.js";import{i as hn,a as yn}from"./CUQ53Tah.js";import{B as xn,m as Cn,n as kn}from"./VJ9MdSGH.js";import"./BvDMLNjQ.js";import{t as Ke}from"./j0KL2ItM.js";import{M as Hr}from"./C-SF0TBp.js";import"./9s3slwY6.js";import"./Dj_1qKAG.js";import{b as In}from"./DAZ23kin.js";import"./DUGj7TPr.js";import{o as Pr,s as lt,n as St}from"./CIyUrgF0.js";import{g as En}from"./DfN8_dcw.js";import{f as Pn}from"./R4vcdqOV.js";import{aw as Ln,_ as Fn}from"./4OSQiSla.js";import{aO as Rn}from"./B10dK85Q.js";function Sn(o,r){return o.loadURL(r)}function Tn(o){return{previousUrlProp:o||null}}function Lr(o,r){o.previousUrlProp=r}function $n(o,r,i){const b=i||r;return o.previousUrlProp===b?null:(o.previousUrlProp=b,b)}function Un(o,r,i){return r?o.previousUrlProp===null?(o.previousUrlProp=r,{shouldLoad:!1,targetUrl:null}):r===o.previousUrlProp?{shouldLoad:!1,targetUrl:null}:i.webviewReady?(o.previousUrlProp=r,i.isValidBrowserUrl(r)?{shouldLoad:!0,targetUrl:r}:{shouldLoad:!1,targetUrl:null}):{shouldLoad:!1,targetUrl:null}:{shouldLoad:!1,targetUrl:null}}const jr=nr("TabBoundsReporter"),An=150;function jt(o,r,i){!(r>0)||!(i>0)||window.electronAPI?.invoke("browser:report-tab-bounds",{tabId:o,width:r,height:i}).catch(b=>{jr.debug("Failed to report tab bounds",{tabId:o,error:b})})}function Fr(o){window.electronAPI?.invoke("browser:report-tab-bounds",{tabId:o}).catch(r=>{jr.debug("Failed to clear tab bounds",{tabId:o,error:r})})}function Bn(o,r){let i=r,b;const x=typeof ResizeObserver>"u"?void 0:new ResizeObserver(C=>{if(!i)return;const h=C[C.length-1]?.contentRect;if(!h)return;const N=i;clearTimeout(b),b=setTimeout(()=>{jt(N,h.width,h.height)},An)});if(x?.observe(o),i){const C=o.getBoundingClientRect();jt(i,C.width,C.height)}return{update(C){if(C!==i&&(clearTimeout(b),i&&Fr(i),i=C,i)){const h=o.getBoundingClientRect();jt(i,h.width,h.height)}},destroy(){clearTimeout(b),x?.disconnect(),i&&Fr(i)}}}function Zr(o){let r=o.trim();if(!r)return null;/^[a-z][a-z0-9+.-]*:\/\//i.test(r)||(r=(r.includes("localhost")||r.includes("127.0.0.1")||r.includes("0.0.0.0")?"http://":"https://")+r);try{return new URL(r),r}catch{return null}}function ot(o,r=typeof window<"u"?window.location.origin:""){return o==="about:blank"||Xr(o,r)}function Xr(o,r=typeof window<"u"?window.location.origin:""){if(!o)return!1;try{const i=new URL(o);return qr.NAVIGATION_ALLOWED.includes(i.protocol)&&i.origin!==r}catch{return!1}}const er="__INTENT_PANEL_BRACKET__:",Nn=`
1
+ import{t as He,br as v,bp as d,a_ as be,bz as je,b as Ze,bu as or,bv as _t,bt as Ur}from"./Cv-W__h8.js";import{bs as Xe,ay as X,be as ut,b$ as nt,b_ as q,bO as Y,W as y,bS as m,aD as e,a7 as ht,bl as xe,bn as Ye,c9 as c,aA as p,aB as re,ca as Le,c0 as pt,bH as s,a5 as oe,bA as ne,bV as V,br as Ct,bk as Ar,bj as Br,bf as Lo,bo as Nr,c5 as kt,aw as Yt,bz as Fo,cd as qt}from"./DYhIMPy1.js";import{c as Q}from"./D4os-974.js";import{n as yr,p as Ro,v as Lt,u as Me,w as So,I as To,g as It}from"./DPvDLGgX.js";import{b as wt}from"./BaIAhI85.js";import{d as xr}from"./DUDDXjfN.js";import{H as $o,G as Uo,I as Ao}from"./GdlMbZRO.js";import{c as nr}from"./ChTqQfQN.js";import{a as Bo}from"./CC7to1B5.js";import{f as Be,bc as No}from"./BePtUMMB.js";import{k as st}from"./DTDbZc--.js";import{s as Oo}from"./ClsZrb8B.js";import{ck as Or,F as _e,a4 as Mo,aV as Do,an as Ko,cF as Vo,aI as Wo,aW as Jt,Y as ar,_ as ir,aZ as Mr,as as zo,ay as Dr,cO as Go,cd as Kr,bO as Vr,ci as qo}from"./BKpkoMuv.js";import"./CgCdkhNg.js";import{Ir as Pe,fL as Ho,br as jo,z8 as Zo,yv as Xo,Kq as Cr,dI as Yo,bL as Jo,Kp as Qo,uf as en,Kn as kr,gr as tn,tC as rn,Ko as on,K3 as Ir,Km as Er}from"./DBkMUdAo.js";import"./BgcFKXg4.js";import{R as nn,k as Ht,l as dt,j as an,i as qe,p as Wr,h as zr,K as sn,m as ln,o as dn,n as un,M as Gr,d as cn}from"./D2pEu7en.js";import{a as qr,B as Et}from"./BvFAWM27.js";import{cq as fn}from"./IISMFCVN.js";import{a3 as gn,u as vn}from"./djdTC7W0.js";import{w as pn,K as wn}from"./BtpuPEaR.js";import{I as $t}from"./B8IFnCn1.js";import{d as bn}from"./BSY2iZcG.js";import{a3 as mn,ae as _n}from"./DMF8OOZf.js";import{i as Qt}from"./CEpchTPD.js";import{i as hn,a as yn}from"./CUQ53Tah.js";import{B as xn,m as Cn,n as kn}from"./Cpa8jVTb.js";import"./BvDMLNjQ.js";import{t as Ke}from"./j0KL2ItM.js";import{M as Hr}from"./C-SF0TBp.js";import"./9s3slwY6.js";import"./Dj_1qKAG.js";import{b as In}from"./DAZ23kin.js";import"./DUGj7TPr.js";import{o as Pr,s as lt,n as St}from"./CIyUrgF0.js";import{g as En}from"./DfN8_dcw.js";import{f as Pn}from"./B4MCfVdX.js";import{aw as Ln,_ as Fn}from"./7TJp7Cqs.js";import{aO as Rn}from"./B10dK85Q.js";function Sn(o,r){return o.loadURL(r)}function Tn(o){return{previousUrlProp:o||null}}function Lr(o,r){o.previousUrlProp=r}function $n(o,r,i){const b=i||r;return o.previousUrlProp===b?null:(o.previousUrlProp=b,b)}function Un(o,r,i){return r?o.previousUrlProp===null?(o.previousUrlProp=r,{shouldLoad:!1,targetUrl:null}):r===o.previousUrlProp?{shouldLoad:!1,targetUrl:null}:i.webviewReady?(o.previousUrlProp=r,i.isValidBrowserUrl(r)?{shouldLoad:!0,targetUrl:r}:{shouldLoad:!1,targetUrl:null}):{shouldLoad:!1,targetUrl:null}:{shouldLoad:!1,targetUrl:null}}const jr=nr("TabBoundsReporter"),An=150;function jt(o,r,i){!(r>0)||!(i>0)||window.electronAPI?.invoke("browser:report-tab-bounds",{tabId:o,width:r,height:i}).catch(b=>{jr.debug("Failed to report tab bounds",{tabId:o,error:b})})}function Fr(o){window.electronAPI?.invoke("browser:report-tab-bounds",{tabId:o}).catch(r=>{jr.debug("Failed to clear tab bounds",{tabId:o,error:r})})}function Bn(o,r){let i=r,b;const x=typeof ResizeObserver>"u"?void 0:new ResizeObserver(C=>{if(!i)return;const h=C[C.length-1]?.contentRect;if(!h)return;const N=i;clearTimeout(b),b=setTimeout(()=>{jt(N,h.width,h.height)},An)});if(x?.observe(o),i){const C=o.getBoundingClientRect();jt(i,C.width,C.height)}return{update(C){if(C!==i&&(clearTimeout(b),i&&Fr(i),i=C,i)){const h=o.getBoundingClientRect();jt(i,h.width,h.height)}},destroy(){clearTimeout(b),x?.disconnect(),i&&Fr(i)}}}function Zr(o){let r=o.trim();if(!r)return null;/^[a-z][a-z0-9+.-]*:\/\//i.test(r)||(r=(r.includes("localhost")||r.includes("127.0.0.1")||r.includes("0.0.0.0")?"http://":"https://")+r);try{return new URL(r),r}catch{return null}}function ot(o,r=typeof window<"u"?window.location.origin:""){return o==="about:blank"||Xr(o,r)}function Xr(o,r=typeof window<"u"?window.location.origin:""){if(!o)return!1;try{const i=new URL(o);return qr.NAVIGATION_ALLOWED.includes(i.protocol)&&i.origin!==r}catch{return!1}}const er="__INTENT_PANEL_BRACKET__:",Nn=`
2
2
  (function() {
3
3
  if (window.__augmentKeyboardInterceptorInstalled) return;
4
4
  window.__augmentKeyboardInterceptorInstalled = true;
@@ -1,4 +1,4 @@
1
- import{t as Ke,br as k,a_ as E,bp as Ce,bz as Ue,b as Ve,q as ur,n as vr,r as gr,o as fr,p as hr,s as mr,bv as ht,bt as pr,f as _r,l as xr,g as br,e as wr,d as kr,m as yr,j as $r,i as Sr,h as Cr,k as Nr}from"./Cv-W__h8.js";import{bs as Je,ca as Xe,aD as e,ay as be,a5 as o,bH as I,bS as n,a7 as Pt,W as i,be as st,b$ as et,b_ as M,bO as C,bA as s,bl as O,bn as qe,bV as we,aA as y,c9 as _,aB as x,br as mt}from"./DYhIMPy1.js";import{nz as Rr,Ir as ct,mH as Tt,ea as Mr,eu as Pr,ev as Ir}from"./DBkMUdAo.js";import{I as He,D as Oe,y as Lr,h as at}from"./j0KL2ItM.js";import{dr as Ar,bf as zr}from"./B10dK85Q.js";import{a8 as jt}from"./4OSQiSla.js";import{I as it,v as Ee,n as Ge,p as It,u as Er}from"./DPvDLGgX.js";import{f as xe}from"./BePtUMMB.js";import"./ClsZrb8B.js";import{F as fe,_ as Dr,cM as Hr,as as ot,at as pt,bZ as Wr,aR as Tr,bJ as jr,bD as Fr,b5 as Br,cR as Gr,ci as Or,b2 as St,cW as Rt,cm as _t,bk as Kr,cA as Ur,aq as Vr}from"./BKpkoMuv.js";import{i as Jr}from"./BL8iv-_B.js";import{z as Ft,B as qr}from"./VJ9MdSGH.js";import{H as Bt}from"./CcNhqKh5.js";import{I as Vt}from"./B8IFnCn1.js";import"./9s3slwY6.js";import{M as Mt}from"./CwMk81ua.js";import{t as Ct}from"./D2pEu7en.js";const Qr=[/^diff --git /,/^index\s/,/^---\s/,/^\+\+\+\s/,/^\/];function Yr($){const r=[];if(!$)return r;const d=$.split(`
1
+ import{t as Ke,br as k,a_ as E,bp as Ce,bz as Ue,b as Ve,q as ur,n as vr,r as gr,o as fr,p as hr,s as mr,bv as ht,bt as pr,f as _r,l as xr,g as br,e as wr,d as kr,m as yr,j as $r,i as Sr,h as Cr,k as Nr}from"./Cv-W__h8.js";import{bs as Je,ca as Xe,aD as e,ay as be,a5 as o,bH as I,bS as n,a7 as Pt,W as i,be as st,b$ as et,b_ as M,bO as C,bA as s,bl as O,bn as qe,bV as we,aA as y,c9 as _,aB as x,br as mt}from"./DYhIMPy1.js";import{nz as Rr,Ir as ct,mH as Tt,ea as Mr,eu as Pr,ev as Ir}from"./DBkMUdAo.js";import{I as He,D as Oe,y as Lr,h as at}from"./j0KL2ItM.js";import{dr as Ar,bf as zr}from"./B10dK85Q.js";import{a8 as jt}from"./7TJp7Cqs.js";import{I as it,v as Ee,n as Ge,p as It,u as Er}from"./DPvDLGgX.js";import{f as xe}from"./BePtUMMB.js";import"./ClsZrb8B.js";import{F as fe,_ as Dr,cM as Hr,as as ot,at as pt,bZ as Wr,aR as Tr,bJ as jr,bD as Fr,b5 as Br,cR as Gr,ci as Or,b2 as St,cW as Rt,cm as _t,bk as Kr,cA as Ur,aq as Vr}from"./BKpkoMuv.js";import{i as Jr}from"./Dd83nS7z.js";import{z as Ft,B as qr}from"./Cpa8jVTb.js";import{H as Bt}from"./CcNhqKh5.js";import{I as Vt}from"./B8IFnCn1.js";import"./9s3slwY6.js";import{M as Mt}from"./DOfWJbtl.js";import{t as Ct}from"./D2pEu7en.js";const Qr=[/^diff --git /,/^index\s/,/^---\s/,/^\+\+\+\s/,/^\/];function Yr($){const r=[];if(!$)return r;const d=$.split(`
2
2
  `);let m=null,b=0,u=0;const T=P=>{const h=P.match(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),J=h?parseInt(h[1],10):0,K=h&&h[2]?parseInt(h[2],10):null,pe=h?parseInt(h[3],10):0,q=h&&h[4]?parseInt(h[4],10):null;m={header:P,oldStart:J,oldLines:K,newStart:pe,newLines:q,lines:[]},r.push(m),b=J,u=pe};for(const P of d){if(P.startsWith("@@")){T(P);continue}if(!m)continue;const h=m;P.startsWith("+")?h.lines.push({type:"addition",content:P.slice(1),oldNum:null,newNum:u++,raw:P}):P.startsWith("-")?h.lines.push({type:"deletion",content:P.slice(1),oldNum:b++,newNum:null,raw:P}):P.startsWith(" ")?h.lines.push({type:"context",content:P.slice(1),oldNum:b++,newNum:u++,raw:P}):Qr.some(J=>J.test(P))||P.trim()===""&&h.lines.push({type:"context",content:"",oldNum:b++,newNum:u++,raw:P})}return r}var Zr=x('<div><!> <!> <!></div> <p class="text-ui text-subtle mt-1"> </p>',1);function Jt($,r){if(new.target)return Ke({component:Jt,...$});Je(r,!0);let d=k(r,"lineNumber",7,0),m=k(r,"fileName",7,""),b=k(r,"onSend",7),u=k(r,"onClose",7),T=k(r,"isSending",7,!1),P=k(r,"class",7,""),h=we(""),J=we(null);Xe(()=>{e(J)&&e(J).focus()});function K(){!e(h).trim()||T()||(b()?.(e(h).trim(),d(),m()),I(h,""))}function pe(L){L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),K()),L.key==="Escape"&&u()?.()}var q={get lineNumber(){return d()},set lineNumber(L=0){d(L),y()},get fileName(){return m()},set fileName(L=""){m(L),y()},get onSend(){return b()},set onSend(L){b(L),y()},get onClose(){return u()},set onClose(L){u(L),y()},get isSending(){return T()},set isSending(L=!1){T(L),y()},get class(){return P()},set class(L=""){P(L),y()},$set:Ue,$on:(L,he)=>Ve(r,L,he)},w=Zr(),D=be(w),de=o(D);{let L=_(()=>Ce.codeReview_inlineComment_askLine_placeholder());Vt(de,{onkeydown:pe,get placeholder(){return e(L)},get disabled(){return T()},class:"flex-1 h-8 rounded-md border border-border bg-background px-3 text-sm placeholder:text-muted-foreground disabled:opacity-50",get ref(){return e(J)},set ref(he){I(J,he,!0)},get value(){return e(h)},set value(he){I(h,he,!0)}})}var ce=n(de,2);{let L=_(()=>!e(h).trim()||T());xe(ce,{type:"button",variant:"primary",onclick:K,get disabled(){return e(L)},class:"h-8 w-8 p-0",children:(he,Ne)=>{var _e=Pt(),S=be(_e);{var z=me=>{it(me,{size:14})},Le=me=>{fe(me,{get icon(){return Dr},class:"h-3.5 w-3.5"})};E(S,me=>{T()?me(z):me(Le,-1)})}i(he,_e)},$$slots:{default:!0}})}var ae=n(ce,2);xe(ae,{type:"button",variant:"ghost",onclick:()=>u()?.(),class:"h-8 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors",children:(L,he)=>{st();var Ne=et();M(_e=>C(Ne,_e),[()=>Ce.codeReview_inlineComment_cancel_label()]),i(L,Ne)},$$slots:{default:!0}}),s(D);var te=n(D,2),ke=O(te,!0);return M(L=>{Ee(D,1,`walkthrough-inline-comment flex items-center gap-2 ${P()??""}`),C(ke,L)},[()=>Ce.codeReview_inlineComment_inputHint_label()]),i($,w),qe(q)}var Xr=x('<div class="text-xs text-slate-400 dark:text-slate-500 mt-1"> </div>'),en=x('<span class="font-medium"> </span> <!>',1),tn=x('<div class="flex items-start gap-3 py-2"><div><!></div> <div class="flex-1 min-w-0"><div class="text-sm leading-relaxed text-slate-700 dark:text-slate-300"><!></div></div></div>'),rn=x('<div class="px-4 pb-3 divide-y divide-border"></div>'),nn=x('<div class="border-t border-border"><!> <!></div>'),an=x('<div class="flex items-center gap-2 px-4 py-2 text-xs text-slate-500 dark:text-slate-400 border-t border-border"><!> <span> </span></div>'),sn=x('<div class="flex items-center gap-2"><!> <!> <!></div> <p class="text-ui text-slate-400 dark:text-slate-500 mt-1"> </p>',1),on=x("<!> <span> </span>",1),ln=x('<div><div class="flex items-start gap-3 px-4 py-3"><div class="shrink-0 mt-0.5"><!></div> <div class="flex-1 min-w-0"><div class="text-sm text-slate-800 dark:text-slate-200 leading-relaxed"><!></div> <!></div> <!></div> <!> <!> <div class="border-t border-border px-4 py-2"><!></div></div>');function qt($,r){if(new.target)return Ke({component:qt,...$});Je(r,!0);let d=k(r,"annotation",7),m=k(r,"lineNumber",7),b=k(r,"fileName",7),u=k(r,"messages",23,()=>[]),T=k(r,"onSendMessage",7),P=k(r,"onClose",7),h=k(r,"isSending",7,!1),J=k(r,"isAgentResponding",7,!1),K=k(r,"timestamp",7),pe=k(r,"class",7,""),q=we(""),w=we(!1),D=we(!1),de=we(null);Xe(()=>{e(w)&&e(de)&&e(de).focus()});function ce(){!e(q).trim()||h()||(T()?.(e(q).trim(),m(),b()),I(q,""))}function ae(a){a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),ce()),a.key==="Escape"&&(e(q)?I(q,""):I(w,!1))}function te(a){switch(a){case"highlight":return Br;case"context":return Fr;case"explanation":default:return jr}}function ke(a){switch(a){case"highlight":return"text-orange-500";case"context":return"text-blue-500";case"explanation":default:return"text-warning-ink"}}function L(a){return a?Lr(a):""}const he=_(()=>u().length>0);var Ne={get annotation(){return d()},set annotation(a){d(a),y()},get lineNumber(){return m()},set lineNumber(a){m(a),y()},get fileName(){return b()},set fileName(a){b(a),y()},get messages(){return u()},set messages(a=[]){u(a),y()},get onSendMessage(){return T()},set onSendMessage(a){T(a),y()},get onClose(){return P()},set onClose(a){P(a),y()},get isSending(){return h()},set isSending(a=!1){h(a),y()},get isAgentResponding(){return J()},set isAgentResponding(a=!1){J(a),y()},get timestamp(){return K()},set timestamp(a){K(a),y()},get class(){return pe()},set class(a=""){pe(a),y()},$set:Ue,$on:(a,W)=>Ve(r,a,W)},_e=ln(),S=o(_e),z=o(S),Le=o(z);{let a=_(()=>te(d().type)),W=_(()=>ke(d().type));fe(Le,{get icon(){return e(a)},get class(){return`h-4 w-4 ${e(W)??""}`}})}s(z);var me=n(z,2),v=o(me),R=o(v);Mt(R,{get content(){return d().message},className:"[&>*:first-child]:mt-0 [&>*:last-child]:mb-0"}),s(v);var A=n(v,2);{var Z=a=>{var W=Xr(),X=O(W,!0);M(ee=>C(X,ee),[()=>L(K())]),i(a,W)};E(A,a=>{K()&&a(Z)})}s(me);var ie=n(me,2);{var $e=a=>{{let W=_(()=>Ce.codeReview_commentThread_dismiss_tooltip());xe(a,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,get onclick(){return P()},class:"shrink-0 text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300 transition-colors",get title(){return e(W)},children:(X,ee)=>{fe(X,{get icon(){return Hr}})},$$slots:{default:!0}})}};E(ie,a=>{P()&&a($e)})}s(S);var Se=n(S,2);{var ye=a=>{var W=nn(),X=o(W);xe(X,{type:"button",variant:"ghost",onclick:()=>I(D,!e(D)),class:"w-full flex items-center justify-between px-4 py-2 text-sm text-slate-600 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:(Q,se)=>{var Y=en(),c=be(Y),p=O(c,!0),B=n(c,2);{let ue=_(()=>e(D)?ot:pt);fe(B,{get icon(){return e(ue)},class:"h-3 w-3"})}M(ue=>C(p,ue),[()=>Ce.codeReview_commentThread_suggestedChanges_label()]),i(Q,Y)},$$slots:{default:!0}});var ee=n(X,2);{var re=Q=>{var se=rn();Ge(se,21,u,Y=>Y.id,(Y,c)=>{var p=tn(),B=o(p),ue=o(B);{let g=_(()=>e(c).type==="user"?Gr:Or),N=_(()=>e(c).type==="user"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400");fe(ue,{get icon(){return e(g)},get class(){return`h-2.5 w-2.5 ${e(N)??""}`}})}s(B);var Re=n(B,2),t=o(Re),l=o(t);Mt(l,{get content(){return e(c).content},className:"[&>*:first-child]:mt-0 [&>*:last-child]:mb-0"}),s(t),s(Re),s(p),M(()=>Ee(B,1,`shrink-0 flex h-5 w-5 items-center justify-center rounded-full ${e(c).type==="user"?"bg-blue-100 dark:bg-blue-900/50":"bg-purple-100 dark:bg-purple-900/50"}`)),He(3,p,()=>at,()=>({axis:"y",distance:4,tier:"moderate"})),i(Y,p)}),s(se),He(3,se,()=>Oe,()=>({tier:"moderate"})),i(Q,se)};E(ee,Q=>{e(D)&&Q(re)})}s(W),i(a,W)};E(Se,a=>{e(he)&&a(ye)})}var U=n(Se,2);{var j=a=>{var W=an(),X=o(W);it(X,{size:12});var ee=n(X,2),re=O(ee,!0);s(W),M(Q=>C(re,Q),[()=>Ce.codeReview_commentThread_agentResponding_label()]),i(a,W)};E(U,a=>{J()&&a(j)})}var f=n(U,2),H=o(f);{var F=a=>{var W=sn(),X=be(W),ee=o(X);{let c=_(()=>Ce.codeReview_commentThread_followUp_placeholder());Vt(ee,{onkeydown:ae,get placeholder(){return e(c)},get disabled(){return h()},class:"flex-1 h-8 rounded-md border border-border bg-white dark:bg-slate-800 px-3 text-sm placeholder:text-slate-400 disabled:opacity-50",get ref(){return e(de)},set ref(p){I(de,p,!0)},get value(){return e(q)},set value(p){I(q,p,!0)}})}var re=n(ee,2);{let c=_(()=>!e(q).trim()||h());xe(re,{type:"button",variant:"primary",onclick:ce,get disabled(){return e(c)},class:"h-8 w-8 p-0",children:(p,B)=>{var ue=Pt(),Re=be(ue);{var t=g=>{it(g,{size:14})},l=g=>{fe(g,{get icon(){return Wr},class:"h-3 w-3"})};E(Re,g=>{h()?g(t):g(l,-1)})}i(p,ue)},$$slots:{default:!0}})}var Q=n(re,2);xe(Q,{type:"button",variant:"ghost",onclick:()=>{I(w,!1),I(q,"")},class:"h-8 px-2 text-xs text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200 transition-colors",children:(c,p)=>{st();var B=et();M(ue=>C(B,ue),[()=>Ce.codeReview_commentThread_cancel_label()]),i(c,B)},$$slots:{default:!0}}),s(X);var se=n(X,2),Y=O(se,!0);M(c=>C(Y,c),[()=>Ce.codeReview_commentThread_inputHint_label()]),He(3,X,()=>Oe,()=>({tier:"fast"})),i(a,W)},le=a=>{xe(a,{type:"button",variant:"ghost",onclick:()=>I(w,!0),class:"flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400 hover:text-emerald-700 dark:hover:text-emerald-300 transition-colors",children:(W,X)=>{var ee=on(),re=be(ee);fe(re,{get icon(){return Tr},class:"h-3 w-3"});var Q=n(re,2),se=O(Q,!0);M(Y=>C(se,Y),[()=>Ce.codeReview_commentThread_askQuestion_label()]),i(W,ee)},$$slots:{default:!0}})};E(H,a=>{e(w)?a(F):a(le,-1)})}return s(f),s(_e),M(()=>Ee(_e,1,`walkthrough-comment-thread relative flex w-full flex-col bg-white shadow-sm dark:bg-slate-900 ${pe()??""}`)),He(3,_e,()=>Oe,()=>({tier:"moderate"})),i($,_e),qe(Ne)}var dn=x('<span class="text-emerald-600 dark:text-emerald-400 font-medium"> </span>'),cn=x('<!> <svg class="h-4 w-4 text-ghost shrink-0" viewBox="0 0 16 16" fill="currentColor"><path d="M3.5 1.5A1.5 1.5 0 0 1 5 0h6a1.5 1.5 0 0 1 1.5 1.5v12A1.5 1.5 0 0 1 11 15H5a1.5 1.5 0 0 1-1.5-1.5v-12zm2 0v12h6v-12H5.5z"></path></svg> <div class="flex items-baseline gap-2 flex-1 min-w-0"><span class="text-sm font-medium text-foreground truncate"> </span> <span class="text-xs text-subtle truncate hidden sm:inline"> </span></div> <div class="flex items-center gap-1 text-xs shrink-0"><!></div>',1),un=x('<div class="px-4 pb-3 -mt-1"><p class="text-sm text-subtle"> </p></div>'),vn=x('<div><div><span class="w-12 px-2 text-right text-ui text-subtle tabular-nums"> </span></div> <span> </span> <pre class="flex-1 px-1 whitespace-pre overflow-hidden text-ellipsis"><code class="hljs"></code></pre></div>'),gn=x('<div class="border-t border-border"><div class="font-mono text-xs leading-relaxed text-muted-foreground"><!> <!></div></div>'),fn=x('<span class="text-subtle">·</span> <!>',1),hn=x('<div class="flex items-center justify-end gap-2 px-3 py-1.5 bg-muted/20 border-b border-border text-xs"><!> <!></div>'),Gt=x("<!> <span> </span> <!>",1),mn=x('<div class="ml-20"><!></div>'),pn=x('<div class="ml-20 border-l-2 border-primary-ink/50 bg-muted/20"><div class="p-3"><!></div></div>'),_n=x('<div><div><span class="w-10 px-2 text-right text-ui text-subtle tabular-nums"> </span> <span class="w-10 px-2 text-right text-ui text-subtle tabular-nums"> </span></div> <span> </span> <div class="flex-1 flex items-center min-w-0 pr-2"><pre class="flex-1 px-1 whitespace-pre overflow-x-auto"><code class="hljs"></code></pre> <!></div></div> <!> <!> <!>',1),xn=x("<!> <!>",1),bn=x('<div class="relative"><!> <div class="overflow-x-auto"><div class="font-mono text-xs leading-relaxed min-w-full"></div></div></div>'),wn=x('<div><div class="flex flex-col border-b border-border"><!> <!></div> <!> <!></div>');function Lt($,r){if(new.target)return Ke({component:Lt,...$});Je(r,!0);let d=k(r,"fileName",7),m=k(r,"patch",7),b=k(r,"annotations",23,()=>[]),u=k(r,"initialCollapsed",7,!1),T=k(r,"contextLines",7,3),P=k(r,"onSendMessage",7),h=k(r,"isSending",7,!1),J=k(r,"additions",7,0),K=k(r,"deletions",7,0),pe=k(r,"fileDescription",7,""),q=k(r,"class",7,"");const w=_(()=>Yr(m())),D=_(()=>Rr(d())),de=_(()=>{const t=new Map;return!e(D)||e(D)==="text"||e(D)==="plaintext"||!Bt.getLanguage(e(D))||e(w).forEach(l=>{const g=[];if(l.lines.forEach(N=>{const G=N.content||"",V=`${N.oldNum}-${N.newNum}`;g.push({content:G,key:V})}),g.length!==0)try{const N=g.map(ne=>ne.content).join(`
3
3
  `),V=Bt.highlight(N,{language:e(D)}).value.split(`
4
4
  `);g.forEach((ne,oe)=>{oe<V.length&&t.set(ne.key,V[oe])})}catch(N){console.warn("Failed to highlight hunk:",N)}}),t});let ce=we(mt(u())),ae=we(mt(new Set)),te=we(null);const ke=_(()=>{const t=new Map;for(const l of b()){const g=t.get(l.line)||[];g.push(l),t.set(l.line,g)}return t}),L=_(()=>new Set(b().map(t=>t.line)));function he(t){if(t.type==="deletion")return[];const l=t.newNum;return l==null?[]:e(ke).get(l)||[]}function Ne(t,l,g){if(g.type==="addition"||g.type==="deletion")return!0;const N=g.newNum??g.oldNum;if(N!==null&&e(L).has(N))return!0;const G=e(w)[t];if(!G)return!1;for(let V=Math.max(0,l-T());V<=Math.min(G.lines.length-1,l+T());V++){const ne=G.lines[V];if(ne.type==="addition"||ne.type==="deletion")return!0;const oe=ne.newNum??ne.oldNum;if(oe!==null&&e(L).has(oe))return!0}for(const V of e(ae)){const[ne,oe,ve]=V.split("-").map(Number);if(ne===t&&l>=oe&&l<=ve)return!0}return!1}function _e(t){const l=e(w)[t];if(!l)return[];const g=[];let N=null;for(let G=0;G<l.lines.length;G++){const V=Ne(t,G,l.lines[G]);!V&&N===null?N=G:V&&N!==null&&(g.push({startIndex:N,endIndex:G-1,count:G-N}),N=null)}return N!==null&&g.push({startIndex:N,endIndex:l.lines.length-1,count:l.lines.length-N}),g}function S(t,l,g){const N=`${t}-${l}-${g}`;e(ae).add(N),I(ae,new Set(e(ae)),!0)}function z(){for(let t=0;t<e(w).length;t++){const l=e(w)[t];S(t,0,l.lines.length-1)}}function Le(){I(ae,new Set,!0)}function me(t){const l=`${t.oldNum}-${t.newNum}`,g=e(de).get(l);return g!==void 0?g:v(t.content||"")}function v(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R(t){switch(t.type){case"addition":return"bg-emerald-500/5 dark:bg-emerald-500/10";case"deletion":return"bg-red-500/5 dark:bg-red-500/10";default:return""}}function A(t){switch(t.type){case"addition":return"text-emerald-600 dark:text-emerald-400 font-medium";case"deletion":return"text-red-600 dark:text-red-400 font-medium";default:return"text-transparent"}}function Z(t){switch(t.type){case"addition":return"+";case"deletion":return"-";default:return" "}}function ie(t){switch(t.type){case"addition":return"bg-emerald-500/10 dark:bg-emerald-500/15";case"deletion":return"bg-red-500/10 dark:bg-red-500/15";default:return"bg-muted/30"}}function $e(){I(ce,!e(ce))}function Se(t){I(te,t,!0)}function ye(){I(te,null)}function U(t,l,g){P()?.(t,l,g),I(te,null)}const j=_(()=>()=>{const t=d().split("/");return t[t.length-1]}),f=_(()=>()=>{const t=d().split("/");return t.length<=1?"":t.slice(0,-1).join("/")}),H=_(()=>{for(let t=0;t<e(w).length;t++)if(_e(t).length>0)return!0;return!1}),F=_(()=>{const l=[];for(let g=0;g<e(w).length&&l.length<3;g++){const N=e(w)[g];for(let G=0;G<N.lines.length&&l.length<3;G++){const V=N.lines[G];(V.type==="addition"||V.type==="deletion")&&l.push({line:V,hunkIndex:g,lineIndex:G})}}return l}),le=_(()=>{let t=0;for(const l of e(w))for(const g of l.lines)(g.type==="addition"||g.type==="deletion")&&t++;return t});let a=we(mt(new Map));function W(t){return`${t.file}:${t.line}:${t.type}`}function X(t){return e(a).get(W(t))||[]}var ee={get fileName(){return d()},set fileName(t){d(t),y()},get patch(){return m()},set patch(t){m(t),y()},get annotations(){return b()},set annotations(t=[]){b(t),y()},get initialCollapsed(){return u()},set initialCollapsed(t=!1){u(t),y()},get contextLines(){return T()},set contextLines(t=3){T(t),y()},get onSendMessage(){return P()},set onSendMessage(t){P(t),y()},get isSending(){return h()},set isSending(t=!1){h(t),y()},get additions(){return J()},set additions(t=0){J(t),y()},get deletions(){return K()},set deletions(t=0){K(t),y()},get fileDescription(){return pe()},set fileDescription(t=""){pe(t),y()},get class(){return q()},set class(t=""){q(t),y()},$set:Ue,$on:(t,l)=>Ve(r,t,l)},re=wn(),Q=o(re),se=o(Q);xe(se,{type:"button",variant:"ghost",class:"w-full flex items-center gap-2 px-4 py-3 hover:bg-muted/30 transition-colors text-left group",onclick:$e,children:(t,l)=>{var g=cn(),N=be(g);{let Ie=_(()=>e(ce)?pt:ot);fe(N,{get icon(){return e(Ie)},class:"h-3 w-3 text-ghost shrink-0"})}var G=n(N,4),V=o(G),ne=O(V,!0),oe=n(V,2),ve=O(oe,!0);s(G);var Me=n(G,2),Ae=o(Me);{var We=Ie=>{var ze=dn(),Fe=O(ze);M(()=>C(Fe,`+${J()+K()}`)),i(Ie,ze)};E(Ae,Ie=>{(J()>0||K()>0)&&Ie(We)})}s(Me),M((Ie,ze)=>{C(ne,Ie),C(ve,ze)},[()=>e(j)(),()=>e(f)()]),i(t,g)},$$slots:{default:!0}});var Y=n(se,2);{var c=t=>{var l=un(),g=o(l),N=O(g,!0);s(l),M(()=>C(N,pe())),i(t,l)};E(Y,t=>{pe()&&t(c)})}s(Q);var p=n(Q,2);{var B=t=>{var l=gn(),g=o(l),N=o(g);Ge(N,17,()=>e(F),({line:ne,hunkIndex:oe,lineIndex:ve})=>`preview-${oe}-${ve}`,(ne,oe)=>{let ve=()=>e(oe).line;var Me=vn(),Ae=o(Me),We=o(Ae),Ie=O(We,!0);s(Ae);var ze=n(Ae,2),Fe=O(ze,!0),Te=n(ze,2),ge=o(Te);Ft(ge,()=>me(ve()),!0),s(ge),s(Te),s(Me),M((Qe,Ye,Ze,tt)=>{Ee(Me,1,`flex ${Qe??""}`),Ee(Ae,1,`w-12 shrink-0 flex select-none ${Ye??""} border-r border-border`),C(Ie,ve().newNum??ve().oldNum??""),Ee(ze,1,`w-5 shrink-0 text-center select-none ${Ze??""}`),C(Fe,tt)},[()=>R(ve()),()=>ie(ve()),()=>A(ve()),()=>Z(ve())]),i(ne,Me)});var G=n(N,2);{var V=ne=>{xe(ne,{type:"button",variant:"ghost",class:"w-full py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors text-center",onclick:$e,children:(oe,ve)=>{st();var Me=et();M(Ae=>C(Me,Ae),[()=>Ce.codeReview_fileDiff_moreLines_label({count:e(le)-e(F).length})]),i(oe,Me)},$$slots:{default:!0}})};E(G,ne=>{e(le)>e(F).length&&ne(V)})}s(g),s(l),He(3,l,()=>Oe,()=>({tier:"moderate"})),i(t,l)};E(p,t=>{e(ce)&&e(F).length>0&&t(B)})}var ue=n(p,2);{var Re=t=>{var l=bn(),g=o(l);{var N=ne=>{var oe=hn(),ve=o(oe);xe(ve,{type:"button",variant:"ghost",class:"text-muted-foreground hover:text-foreground transition-colors",onclick:z,children:(We,Ie)=>{st();var ze=et();M(Fe=>C(ze,Fe),[()=>Ce.codeReview_fileDiff_expandAll_label()]),i(We,ze)},$$slots:{default:!0}});var Me=n(ve,2);{var Ae=We=>{var Ie=fn(),ze=n(be(Ie),2);xe(ze,{type:"button",variant:"ghost",class:"text-muted-foreground hover:text-foreground transition-colors",onclick:Le,children:(Fe,Te)=>{st();var ge=et();M(Qe=>C(ge,Qe),[()=>Ce.codeReview_fileDiff_collapse_label()]),i(Fe,ge)},$$slots:{default:!0}}),i(We,Ie)};E(Me,We=>{e(ae).size>0&&We(Ae)})}s(oe),i(ne,oe)};E(g,ne=>{e(H)&&ne(N)})}var G=n(g,2),V=o(G);Ge(V,21,()=>e(w),It,(ne,oe,ve)=>{const Me=_(()=>_e(ve)),Ae=_(()=>e(Me).find(Te=>Te.startIndex===0));var We=xn(),Ie=be(We);{var ze=Te=>{xe(Te,{type:"button",variant:"ghost",class:"w-full flex items-center justify-center gap-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors border-b border-border",onclick:()=>S(ve,e(Ae).startIndex,e(Ae).endIndex),children:(ge,Qe)=>{var Ye=Gt(),Ze=be(Ye);fe(Ze,{get icon(){return ot},class:"h-2.5 w-2.5"});var tt=n(Ze,2),xt=O(tt,!0),rt=n(tt,2);fe(rt,{get icon(){return ot},class:"h-2.5 w-2.5"}),M(ut=>C(xt,ut),[()=>Ce.codeReview_fileDiff_showHidden_label({count:e(Ae).count})]),i(ge,Ye)},$$slots:{default:!0}})};E(Ie,Te=>{e(Ae)&&Te(ze)})}var Fe=n(Ie,2);Ge(Fe,19,()=>e(oe).lines,(Te,ge)=>`${ve}-${ge}`,(Te,ge,Qe)=>{const Ye=_(()=>`${e(ge).oldNum}-${e(ge).newNum}`),Ze=_(()=>he(e(ge))),tt=_(()=>e(te)===e(Ye)),xt=_(()=>Ne(ve,e(Qe),e(ge))),rt=_(()=>e(Me).find(lt=>lt.startIndex===e(Qe)+1));var ut=Pt(),er=be(ut);{var tr=lt=>{var At=_n(),vt=be(At),gt=o(vt),zt=o(gt),rr=O(zt,!0),nr=n(zt,2),ar=O(nr,!0);s(gt);var bt=n(gt,2),sr=O(bt,!0),Et=n(bt,2),wt=o(Et),Dt=o(wt);Ft(Dt,()=>me(e(ge)),!0),s(Dt),s(wt);var or=n(wt,2);{var ir=Pe=>{{let De=_(()=>Ce.codeReview_fileDiff_askLine_tooltip());xe(Pe,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,class:"size-5 opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-primary-ink transition-all shrink-0",onclick:()=>Se(e(Ye)),get title(){return e(De)},children:(je,Be)=>{fe(je,{get icon(){return St}})},$$slots:{default:!0}})}};E(or,Pe=>{P()&&Pe(ir)})}s(Et),s(vt);var Ht=n(vt,2);Ge(Ht,19,()=>e(Ze),(Pe,De)=>`${Pe.line}-${De}`,(Pe,De)=>{var je=mn(),Be=o(je);{let nt=_(()=>e(ge).newNum??e(ge).oldNum??0),ft=_(()=>X(e(De)));qt(Be,{get annotation(){return e(De)},get lineNumber(){return e(nt)},get fileName(){return d()},get messages(){return e(ft)},onSendMessage:(kt,yt,$t)=>U(kt,yt,$t),get isSending(){return h()}})}s(je),He(3,je,()=>Oe,()=>({tier:"moderate"})),i(Pe,je)});var Wt=n(Ht,2);{var lr=Pe=>{var De=pn(),je=o(De),Be=o(je);{let nt=_(()=>e(ge).newNum??e(ge).oldNum??0);Jt(Be,{get lineNumber(){return e(nt)},get fileName(){return d()},onSend:U,onClose:ye,get isSending(){return h()}})}s(je),s(De),i(Pe,De)};E(Wt,Pe=>{e(tt)&&e(Ze).length===0&&Pe(lr)})}var dr=n(Wt,2);{var cr=Pe=>{xe(Pe,{type:"button",variant:"ghost",class:"w-full flex items-center justify-center gap-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors border-y border-border bg-muted/10",onclick:()=>S(ve,e(rt).startIndex,e(rt).endIndex),children:(De,je)=>{var Be=Gt(),nt=be(Be);fe(nt,{get icon(){return St},class:"h-2.5 w-2.5"});var ft=n(nt,2),kt=O(ft,!0),yt=n(ft,2);fe(yt,{get icon(){return St},class:"h-2.5 w-2.5"}),M($t=>C(kt,$t),[()=>Ce.codeReview_fileDiff_showHidden_label({count:e(rt).count})]),i(De,Be)},$$slots:{default:!0}})};E(dr,Pe=>{e(rt)&&Pe(cr)})}M((Pe,De,je,Be)=>{Ee(vt,1,`group flex ${Pe??""} hover:bg-accent/30 transition-colors`),Ee(gt,1,`w-20 shrink-0 flex select-none ${De??""} border-r border-border`),C(rr,e(ge).oldNum??""),C(ar,e(ge).newNum??""),Ee(bt,1,`w-5 shrink-0 text-center select-none ${je??""}`),C(sr,Be)},[()=>R(e(ge)),()=>ie(e(ge)),()=>A(e(ge)),()=>Z(e(ge))]),i(lt,At)};E(er,lt=>{e(xt)&&lt(tr)})}i(Te,ut)}),i(ne,We)}),s(V),s(G),s(l),He(3,l,()=>Oe,()=>({tier:"moderate"})),i(t,l)};E(ue,t=>{e(ce)||t(Re)})}return s(re),M(()=>Ee(re,1,`walkthrough-file-diff overflow-hidden bg-card ${q()??""}`)),i($,re),qe(ee)}var kn=x('<div class="flex items-start gap-3"><div class="shrink-0 mt-0.5"><svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M2 6a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1H8a3 3 0 00-3 3v1.5a1.5 1.5 0 01-3 0V6z" clip-rule="evenodd"></path><path d="M6 12a2 2 0 012-2h8a2 2 0 012 2v2a2 2 0 01-2 2H2h2a2 2 0 002-2v-2z"></path></svg></div> <div class="flex-1 min-w-0"><h4 class="text-sm font-medium text-foreground line-clamp-2"> </h4> <p class="text-xs text-subtle mt-1 line-clamp-2"> </p> <div class="flex items-center gap-1 mt-2 text-xs text-subtle"><svg class="h-3.5 w-3.5" viewBox="0 0 16 16" fill="currentColor"><path d="M3.5 1.5A1.5 1.5 0 0 1 5 0h6a1.5 1.5 0 0 1 1.5 1.5v12A1.5 1.5 0 0 1 11 15H5a1.5 1.5 0 0 1-1.5-1.5v-12z"></path></svg> <span> </span></div></div></div>'),yn=x('<div><div class="mb-4"><h3 class="text-sm font-medium text-subtle"> </h3></div> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3"></div></div>');function Qt($,r){if(new.target)return Ke({component:Qt,...$});Je(r,!0);let d=k(r,"categories",7),m=k(r,"onCategoryClick",7),b=k(r,"class",7,"");function u(w){const D=["bg-blue-500/10 border-blue-500/30 hover:border-blue-500/50","bg-purple-500/10 border-purple-500/30 hover:border-purple-500/50","bg-emerald-500/10 border-emerald-500/30 hover:border-emerald-500/50","bg-warning/10 border-warning/30 hover:border-warning/30","bg-rose-500/10 border-rose-500/30 hover:border-rose-500/50","bg-cyan-500/10 border-cyan-500/30 hover:border-cyan-500/50"];return D[w%D.length]}function T(w){const D=["text-blue-500","text-purple-500","text-emerald-500","text-warning-ink","text-rose-500","text-cyan-500"];return D[w%D.length]}var P={get categories(){return d()},set categories(w){d(w),y()},get onCategoryClick(){return m()},set onCategoryClick(w){m(w),y()},get class(){return b()},set class(w=""){b(w),y()},$set:Ue,$on:(w,D)=>Ve(r,w,D)},h=yn(),J=o(h),K=o(J),pe=O(K,!0);s(J);var q=n(J,2);return Ge(q,21,d,It,(w,D,de)=>{{let ce=_(()=>u(de));xe(w,{type:"button",variant:"ghost",get class(){return`text-left p-4 rounded-lg border transition-all duration-spring-moderate ease-spring-moderate motion-reduce:transition-none ${e(ce)??""}`},onclick:()=>m()?.(de),children:(ae,te)=>{var ke=kn(),L=o(ke),he=O(L),Ne=n(L,2),_e=o(Ne),S=O(_e,!0),z=n(_e,2),Le=O(z,!0),me=n(z,2),v=n(o(me),2),R=O(v,!0);s(me),s(Ne),s(ke),M((A,Z)=>{Ee(he,0,`h-5 w-5 ${A??""}`),C(S,e(D).title),C(Le,e(D).description),C(R,Z)},[()=>T(de),()=>e(D).files.length===1?Ce.codeReview_categoriesGrid_fileCount_one({count:e(D).files.length}):Ce.codeReview_categoriesGrid_fileCount_many({count:e(D).files.length})]),i(ae,ke)},$$slots:{default:!0}})}}),s(q),s(h),M(w=>{Ee(h,1,`walkthrough-categories-grid ${b()??""}`),C(pe,w)},[()=>Ce.codeReview_categoriesGrid_whatChanged_title()]),i($,h),qe(P)}var $n=x('<div class="w-0.5 flex-1 bg-border min-h-5"></div>'),Sn=x('<p class="text-sm text-subtle mt-2"> </p>'),Cn=x('<div class="rounded-lg border border-border bg-card p-4"><div class="flex items-center gap-2"><svg class="h-4 w-4 text-ghost" viewBox="0 0 16 16" fill="currentColor"><path d="M3.5 1.5A1.5 1.5 0 0 1 5 0h6a1.5 1.5 0 0 1 1.5 1.5v12A1.5 1.5 0 0 1 11 15H5a1.5 1.5 0 0 1-1.5-1.5v-12z"></path></svg> <span class="text-sm font-medium text-foreground"> </span></div> <!></div>'),Nn=x('<div class="flex gap-4"><div class="relative flex flex-col items-center w-3"><div></div> <div class="absolute top-4 w-2 h-2 rounded-full bg-muted-foreground/30 ring-2 ring-background"></div></div> <div class="flex-1 min-w-0 pb-4"><!></div></div>'),Rn=x('<div><div class="flex items-start gap-4 mb-4"><div class="relative flex flex-col items-center"><div></div> <!></div> <div class="flex-1 min-w-0 -mt-0.5"><h3 class="text-base font-semibold text-foreground"> </h3> <p class="text-sm text-subtle mt-1"> </p></div></div> <div class="relative"></div></div>');function Yt($,r){if(new.target)return Ke({component:Yt,...$});Je(r,!0);let d=k(r,"category",7),m=k(r,"categoryIndex",7),b=k(r,"filePatchMap",7),u=k(r,"isLast",7,!1),T=k(r,"onSendMessage",7),P=k(r,"isSending",7,!1),h=k(r,"class",7,"");function J(S){const z=["bg-blue-500","bg-purple-500","bg-emerald-500","bg-warning","bg-rose-500","bg-cyan-500"];return z[S%z.length]}const K=_(()=>d().files.map(S=>{const z=b().get(S.path);return{...S,patch:z?.patch,additions:z?.additions??0,deletions:z?.deletions??0}}));var pe={get category(){return d()},set category(S){d(S),y()},get categoryIndex(){return m()},set categoryIndex(S){m(S),y()},get filePatchMap(){return b()},set filePatchMap(S){b(S),y()},get isLast(){return u()},set isLast(S=!1){u(S),y()},get onSendMessage(){return T()},set onSendMessage(S){T(S),y()},get isSending(){return P()},set isSending(S=!1){P(S),y()},get class(){return h()},set class(S=""){h(S),y()},$set:Ue,$on:(S,z)=>Ve(r,S,z)},q=Rn(),w=o(q),D=o(w),de=o(D),ce=n(de,2);{var ae=S=>{var z=$n();i(S,z)};E(ce,S=>{(!u()||e(K).length>0)&&S(ae)})}s(D);var te=n(D,2),ke=o(te),L=O(ke,!0),he=n(ke,2),Ne=O(he,!0);s(te),s(w);var _e=n(w,2);return Ge(_e,23,()=>e(K),(S,z)=>`${m()}-${z}`,(S,z,Le)=>{var me=Nn(),v=o(me),R=o(v);st(2),s(v);var A=n(v,2),Z=o(A);{var ie=Se=>{Lt(Se,{get fileName(){return e(z).path},get patch(){return e(z).patch},get annotations(){return e(z).annotations},get additions(){return e(z).additions},get deletions(){return e(z).deletions},get fileDescription(){return e(z).summary},get onSendMessage(){return T()},get isSending(){return P()},class:"rounded-lg border border-border overflow-hidden"})},$e=Se=>{var ye=Cn(),U=o(ye),j=n(o(U),2),f=O(j,!0);s(U);var H=n(U,2);{var F=le=>{var a=Sn(),W=O(a,!0);M(()=>C(W,e(z).summary)),i(le,a)};E(H,le=>{e(z).summary&&le(F)})}s(ye),M(()=>C(f,e(z).path)),i(Se,ye)};E(Z,Se=>{e(z).patch?Se(ie):Se($e,-1)})}s(A),s(me),M(()=>Ee(R,1,`w-0.5 flex-1 bg-border ${e(Le)===e(K).length-1&&u()?"h-1/2":""}`)),i(S,me)}),s(_e),s(q),M(S=>{Ee(q,1,`walkthrough-category-section ${h()??""}`),Er(q,"id",`category-${m()??""}`),Ee(de,1,`w-3 h-3 rounded-full ${S??""} ring-4 ring-background shrink-0`),C(L,d().title),C(Ne,d().description)},[()=>J(m())]),i($,q),qe(pe)}var Mn=x('<!> <!> <span class="text-sm font-medium"> </span> <!>',1),Pn=x('<div class="flex items-center gap-2 text-sm text-subtle py-2"><!> <span> </span></div>'),Ot=x("<!> ",1),In=x('<div class="rounded-lg bg-danger-background/10 border border-danger/20 p-4"><p class="text-sm text-danger"> </p> <!></div>'),Ln=x('<h2 class="text-lg font-semibold text-foreground"> </h2>'),An=x('<p class="text-sm text-subtle italic"> </p>'),Kt=x("<div><!></div>"),zn=x('<div class="space-y-8 pt-4"></div>'),En=x('<!> <!> <span class="text-sm font-medium text-subtle"> </span>',1),Dn=x('<div class="space-y-3 pt-2"></div>'),Hn=x('<div class="pt-4 border-t border-border"><!> <!></div>'),Wn=x('<div class="flex justify-end pt-2"><!></div>'),Tn=x('<div class="space-y-6"><!> <!> <!> <!> <!> <!></div>'),jn=x('<div class="px-4 pb-4"><!> <!> <!></div>'),Fn=x('<div class="border-t border-border"><!> <!></div>');function Zt($,r){if(new.target)return Ke({component:Zt,...$});Je(r,!0);let d=k(r,"walkthrough",7),m=k(r,"status",7),b=k(r,"workspaceId",7),u=k(r,"error",7,""),T=k(r,"workspacePath",7),P=k(r,"changes",23,()=>[]),h=k(r,"onSendMessage",7),J=k(r,"isSending",7,!1),K=k(r,"onRegenerate",7),pe=k(r,"showCategoriesGrid",7,!0);const q=_(()=>m()==="running"),w=_(()=>m()==="complete"),D=_(()=>!!u());let de=we(!0),ce=we(!1),ae=we(mt(new Map));const te=_(()=>{if(d()?.categories&&d().categories.length>0)return d().categories;if(d()?.annotations&&d().annotations.length>0){const v=new Map;for(const R of d().annotations){const A=v.get(R.file)||[];A.push(R),v.set(R.file,A)}return[{title:d().title,description:d().overview,files:Array.from(v.entries()).map(([R,A])=>({path:R,annotations:A.sort((Z,ie)=>Z.line-ie.line)}))}]}return[]}),ke=_(()=>{if(!d()?.annotations)return new Map;const v=new Map;for(const R of d().annotations){const A=v.get(R.file)||[];A.push(R),v.set(R.file,A)}for(const[R,A]of v)v.set(R,A.sort((Z,ie)=>Z.line-ie.line));return v}),L=_(()=>{const v=new Set;for(const R of e(te))for(const A of R.files)v.add(A.path);for(const R of e(ke).keys())v.add(R);return v}),he=_(()=>P().filter(v=>!e(L).has(v.relativePath)));Xe(()=>{if(!d()||!T())return;const v=new Set([...e(L),...e(he).map(R=>R.relativePath)]);for(const R of v)e(ae).has(R)||Jr(b(),!0,R).then(A=>{if(A&&A.oldContent!==void 0&&A.newContent!==void 0){const Z=Ne(R,A.oldContent,A.newContent);if(Z){const ie=P().find($e=>$e.relativePath===R);e(ae).set(R,{patch:Z,additions:ie?.stats?.additions??0,deletions:ie?.stats?.deletions??0}),I(ae,new Map(e(ae)),!0)}}}).catch(A=>{console.warn(`Failed to load diff for ${R}:`,A)})});function Ne(v,R,A){const Z=R.split(`
@@ -1,2 +1,2 @@
1
- import{Ir as g,rm as b,I4 as S}from"./DBkMUdAo.js";import{V as A,bk as _}from"./CUrYTyIw.js";import{bv as k}from"./B10dK85Q.js";import{bM as y,bI as w}from"./B4dLcxdK.js";import{bp as n}from"./Cv-W__h8.js";import{t as I}from"./j0KL2ItM.js";const z=g.createSelector(e=>e.backgroundAgentSettings.defaultModel),B=g.createSelector(e=>e.backgroundAgentSettings.typeOverrides),G=g.createSelector(e=>e.backgroundAgentSettings.defaultReasoningEffort),W=g.createSelector(e=>e.backgroundAgentSettings.typeReasoningEffortOverrides),j=g.createSelector(e=>e.backgroundAgentSettings);function r(e){return{category:"settings",...e}}const f=[{id:"new-workspace",tab:"",label:"New workspace",route:"/workspace/new",category:"navigation",description:"Create-workspace flow."},r({id:"utility-default-model",tab:"providers",hashAliases:["utility-default-model","default-model","quickActions.defaultModel","backgroundAgents.defaultModel"],scrollSelector:"#utility-default-model",highlightSelector:'[data-highlight-id="utility-default-model"]',label:"Settings: Default model",route:"/settings?tab=providers#utility-default-model",description:"Default AI behavior model selection."}),r({id:"global-instructions",tab:"agent-behavior",hashAliases:["global-instructions","agents","specialists","all-agents"],scrollSelector:"#global-instructions",highlightSelector:'[data-highlight-id="global-instructions"]',label:"Settings: Agent Behavior",route:"/settings?tab=agent-behavior#global-instructions",description:"Global agent instructions and defaults."}),r({id:"create-specialist",tab:"specialists",hashAliases:["create-specialist"],scrollSelector:"#create-specialist",highlightSelector:'[data-highlight-id="create-specialist"]',label:"Settings: Create specialist",route:"/settings?tab=specialists&view=create-specialist#create-specialist",description:"Create-specialist entry point."}),r({id:"providers",tab:"providers",hashAliases:["providers"],scrollSelector:"#providers",highlightSelector:'[data-highlight-id="providers"]',label:"Settings: AI coding CLIs",route:"/settings?tab=providers#providers",description:"Provider/account selector settings."}),r({id:"integrations",tab:"connections",hashAliases:["integrations"],scrollSelector:"#integrations",highlightSelector:'[data-highlight-id="integrations"]',label:"Settings: Connections",route:"/settings?tab=connections#integrations",description:"Connected integrations settings."}),r({id:"devices",tab:"devices",hashAliases:["devices","machines"],scrollSelector:"#devices",highlightSelector:"#devices",label:"Settings: Machines",route:"/settings?tab=devices#devices",description:"Saved remote machine settings."}),r({id:"mobile",tab:"mobile",hashAliases:["mobile"],scrollSelector:"#mobile",highlightSelector:'[data-highlight-id="mobile"]',label:"Settings: Mobile",route:"/settings?tab=mobile#mobile",description:"Remote access and Intent Mobile pairing."}),r({id:"guest-sessions",tab:"collaboration",hashAliases:["collaboration","guest-sessions","sharing"],scrollSelector:"#collaboration",highlightSelector:"#collaboration",label:"Settings: Collaboration",route:"/settings?tab=collaboration#collaboration",description:"Host membership, workspace guests and joined hosts."}),r({id:"websocket-api",tab:"mobile",hashAliases:["websocket-api","remote-access"],scrollSelector:"#websocket-api",highlightSelector:'[data-highlight-id="websocket-api"]',label:"Settings: Remote Access",route:"/settings?tab=mobile#websocket-api",description:"Remote access (WebSocket API) settings."}),...[["voice","Voice Dictation","Voice dictation settings.","input"],["keyboard-shortcuts","Keyboard Shortcuts","Keyboard shortcuts reference.","input"],["mcp-servers","MCP Servers","MCP server configuration.","connections"],["plugins","Plugins","App-wide Agent Plugins.","connections"],["git-workspace","Git & Workspace","Git and workspace defaults.","setup"],["git","Git","Git defaults.","setup"],["shell","Shell","Shell and CLI optimization settings.","setup"],["workspace","Workspace","Workspace defaults.","setup"],["cli-optimization","CLI Optimization","RTK/CLI optimization settings.","setup"],["workspace-api","Tool Output & Retention","Tool output size and retention settings.","advanced"],["notifications","Notifications","Notification preferences.","app-behavior"],["updates","Updates","Application update preferences.","app-behavior"],["open-in","Open In","External editor/app launch preferences.","app-behavior"],["github-link-action","GitHub Links","GitHub issue and pull request link behavior.","app-behavior"],["agent-features","Agent Features","Agent feature settings.","agent-behavior"],["font-style","Font style","Font style settings.","display"],["language","Language","Application language settings.","display"],["labs","Labs","Experimental feature switches.","advanced"],["agent-backend","Agent Backend","Agent backend settings.","advanced"],["connection","Connection","Daemon connection details.","advanced"],["hardware","Hardware","Hardware integration settings.","advanced"],["developer","Developer","Development-only settings.","advanced"]].map(([e,t,i,a])=>r({id:e,tab:a,hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=${a}#${e}`,description:i})),r({id:"appearance",tab:"display",hashAliases:["appearance","theme"],scrollSelector:"#theme",highlightSelector:'[data-highlight-id="appearance"]',label:"Settings: Appearance",route:"/settings?tab=display#theme",description:"Theme mode controls."}),...[["color-theme","Color theme","Color theme selection."],["note-font","Notes font","Notes/spec font style."],["agent-chat-font","Agent chat font","Agent chat font style."],["code-font","Code font","Code editor and diff font."]].map(([e,t,i])=>r({id:e,tab:"display",hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=display#${e}`,description:i})),r({id:"general",tab:"advanced",hashAliases:["general","reset"],scrollSelector:"#reset",highlightSelector:'[data-highlight-id="general"]',label:"Settings: Advanced",route:"/settings?tab=advanced#reset",description:"Advanced settings and reset controls."}),{id:"workspace-card",tab:"",hashAliases:["workspace-card"],highlightSelector:'[data-highlight-id^="workspace-"]',label:"Workspace card",category:"workspace",description:"A workspace card on workspace list surfaces.",dynamic:!0,idPattern:"workspace-{workspaceId}"},{id:"specialist-entry",tab:"specialists",highlightSelector:'[data-highlight-id^="specialist-"]',label:"Specialist entry",route:"/settings?tab=specialists&specialist={specialistId}#specialist-{specialistId}",category:"specialist",description:"A specific specialist row in settings.",dynamic:!0,idPattern:"specialist-{specialistId}"}];function m(e){const t=e.indexOf("#"),i=t>=0?e.slice(t+1):e;return decodeURIComponent(i.replace(/^#/,"")).trim()}function P(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(e,t){if(!t.match(/\{[^}]+\}/g)?.length)return e===t;const a=t.split(/\{[^}]+\}/g).map(P).join("[^/]+");return new RegExp(`^${a}$`).test(e)}function R(e){const t=m(e);if(!t)return;const i=f.find(o=>o.id===t||o.hashAliases?.includes(t));if(i)return i;const a=f.find(o=>o.route&&o.dynamic&&o.idPattern&&M(t,o.idPattern));return a?{...a,id:t}:void 0}function T(e){try{return new URL(e,"app://intent").pathname||"/"}catch{const t=e.indexOf("?"),i=e.indexOf("#");let a=e.length;return t>=0&&(a=Math.min(a,t)),i>=0&&(a=Math.min(a,i)),e.slice(0,a)||"/"}}const E=new Set(f.flatMap(e=>e.route?[T(e.route)]:[])),C=[/^\/workspace\/[^/]+$/,/^\/agent\/[^/]+$/];function F(e){if(typeof e!="string")return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("intent://"))return!0;let i,a;try{const o=new URL(t,"app://intent");if(o.protocol!=="app:")return!1;i=o.pathname||"/",a=m(o.hash)}catch{return!1}return E.has(i)?a?!!R(a):!0:C.some(o=>o.test(i))}const U=g.createSelector(e=>{const t=new Map,i=(s,c)=>{const d=t.get(s)??new Set;d.add(c),t.set(s,d)},a=k.select(e),o=A.select(e),h=_.select(e)[o];h&&o&&i(o,n.settings_providers_inUseDefaultModel_label({model:h})),b(o)&&!h&&i(o,n.settings_providers_inUseDefaultProvider_label());const u=e.backgroundAgentSettings?.providerId;u&&b(u)&&i(u,n.settings_providers_inUseQuickActions_label());for(const s of y.select(e)){const c=w.select(e,s.id),d=s.source?{project:n.settings_providers_pinSourceProject_label(),user:n.settings_providers_pinSourceUser_label(),bundled:n.settings_providers_pinSourceBundled_label(),builtin:n.settings_providers_pinSourceBuiltin_label(),"electron-store":n.settings_providers_pinSourceLegacy_label()}[s.source]:void 0,p=l=>d&&c?n.settings_providers_inUseSourcePath_label({reason:l,source:d,path:c}):d?n.settings_providers_inUseSource_label({reason:l,source:d}):c?n.settings_providers_inUsePath_label({reason:l,path:c}):l;if(s.codingAgent&&i(s.codingAgent,p(n.settings_providers_inUseSpecialistAgent_label({name:s.name}))),s.modelOptions?.forEach((l,v)=>{l.provider&&b(l.provider)&&i(l.provider,p(n.settings_providers_inUseSpecialistModelOption_label({name:s.name,position:I(v+1)})))}),s.defaultModel)if(s.defaultModel.includes(":")){const l=S(s.defaultModel).providerId??a;i(l,p(n.settings_providers_inUseSpecialistModel_label({name:s.name,model:s.defaultModel})))}else s.codingAgent||i(a,p(n.settings_providers_inUseSpecialistModel_label({name:s.name,model:s.defaultModel})))}return Object.fromEntries([...t].map(([s,c])=>[s,[...c].join(`
1
+ import{Ir as g,rm as b,I4 as S}from"./DBkMUdAo.js";import{V as A,bk as _}from"./CUrYTyIw.js";import{bv as k}from"./B10dK85Q.js";import{bM as y,bI as w}from"./IISMFCVN.js";import{bp as n}from"./Cv-W__h8.js";import{t as I}from"./j0KL2ItM.js";const z=g.createSelector(e=>e.backgroundAgentSettings.defaultModel),B=g.createSelector(e=>e.backgroundAgentSettings.typeOverrides),G=g.createSelector(e=>e.backgroundAgentSettings.defaultReasoningEffort),W=g.createSelector(e=>e.backgroundAgentSettings.typeReasoningEffortOverrides),j=g.createSelector(e=>e.backgroundAgentSettings);function r(e){return{category:"settings",...e}}const f=[{id:"new-workspace",tab:"",label:"New workspace",route:"/workspace/new",category:"navigation",description:"Create-workspace flow."},r({id:"utility-default-model",tab:"providers",hashAliases:["utility-default-model","default-model","quickActions.defaultModel","backgroundAgents.defaultModel"],scrollSelector:"#utility-default-model",highlightSelector:'[data-highlight-id="utility-default-model"]',label:"Settings: Default model",route:"/settings?tab=providers#utility-default-model",description:"Default AI behavior model selection."}),r({id:"global-instructions",tab:"agent-behavior",hashAliases:["global-instructions","agents","specialists","all-agents"],scrollSelector:"#global-instructions",highlightSelector:'[data-highlight-id="global-instructions"]',label:"Settings: Agent Behavior",route:"/settings?tab=agent-behavior#global-instructions",description:"Global agent instructions and defaults."}),r({id:"create-specialist",tab:"specialists",hashAliases:["create-specialist"],scrollSelector:"#create-specialist",highlightSelector:'[data-highlight-id="create-specialist"]',label:"Settings: Create specialist",route:"/settings?tab=specialists&view=create-specialist#create-specialist",description:"Create-specialist entry point."}),r({id:"providers",tab:"providers",hashAliases:["providers"],scrollSelector:"#providers",highlightSelector:'[data-highlight-id="providers"]',label:"Settings: AI coding CLIs",route:"/settings?tab=providers#providers",description:"Provider/account selector settings."}),r({id:"integrations",tab:"connections",hashAliases:["integrations"],scrollSelector:"#integrations",highlightSelector:'[data-highlight-id="integrations"]',label:"Settings: Connections",route:"/settings?tab=connections#integrations",description:"Connected integrations settings."}),r({id:"devices",tab:"devices",hashAliases:["devices","machines"],scrollSelector:"#devices",highlightSelector:"#devices",label:"Settings: Machines",route:"/settings?tab=devices#devices",description:"Saved remote machine settings."}),r({id:"mobile",tab:"mobile",hashAliases:["mobile"],scrollSelector:"#mobile",highlightSelector:'[data-highlight-id="mobile"]',label:"Settings: Mobile",route:"/settings?tab=mobile#mobile",description:"Remote access and Intent Mobile pairing."}),r({id:"guest-sessions",tab:"collaboration",hashAliases:["collaboration","guest-sessions","sharing"],scrollSelector:"#collaboration",highlightSelector:"#collaboration",label:"Settings: Collaboration",route:"/settings?tab=collaboration#collaboration",description:"Host membership, workspace guests and joined hosts."}),r({id:"websocket-api",tab:"mobile",hashAliases:["websocket-api","remote-access"],scrollSelector:"#websocket-api",highlightSelector:'[data-highlight-id="websocket-api"]',label:"Settings: Remote Access",route:"/settings?tab=mobile#websocket-api",description:"Remote access (WebSocket API) settings."}),...[["voice","Voice Dictation","Voice dictation settings.","input"],["keyboard-shortcuts","Keyboard Shortcuts","Keyboard shortcuts reference.","input"],["mcp-servers","MCP Servers","MCP server configuration.","connections"],["plugins","Plugins","App-wide Agent Plugins.","connections"],["git-workspace","Git & Workspace","Git and workspace defaults.","setup"],["git","Git","Git defaults.","setup"],["shell","Shell","Shell and CLI optimization settings.","setup"],["workspace","Workspace","Workspace defaults.","setup"],["cli-optimization","CLI Optimization","RTK/CLI optimization settings.","setup"],["workspace-api","Tool Output & Retention","Tool output size and retention settings.","advanced"],["notifications","Notifications","Notification preferences.","app-behavior"],["updates","Updates","Application update preferences.","app-behavior"],["open-in","Open In","External editor/app launch preferences.","app-behavior"],["github-link-action","GitHub Links","GitHub issue and pull request link behavior.","app-behavior"],["agent-features","Agent Features","Agent feature settings.","agent-behavior"],["font-style","Font style","Font style settings.","display"],["language","Language","Application language settings.","display"],["labs","Labs","Experimental feature switches.","advanced"],["agent-backend","Agent Backend","Agent backend settings.","advanced"],["connection","Connection","Daemon connection details.","advanced"],["hardware","Hardware","Hardware integration settings.","advanced"],["developer","Developer","Development-only settings.","advanced"]].map(([e,t,i,a])=>r({id:e,tab:a,hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=${a}#${e}`,description:i})),r({id:"appearance",tab:"display",hashAliases:["appearance","theme"],scrollSelector:"#theme",highlightSelector:'[data-highlight-id="appearance"]',label:"Settings: Appearance",route:"/settings?tab=display#theme",description:"Theme mode controls."}),...[["color-theme","Color theme","Color theme selection."],["note-font","Notes font","Notes/spec font style."],["agent-chat-font","Agent chat font","Agent chat font style."],["code-font","Code font","Code editor and diff font."]].map(([e,t,i])=>r({id:e,tab:"display",hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=display#${e}`,description:i})),r({id:"general",tab:"advanced",hashAliases:["general","reset"],scrollSelector:"#reset",highlightSelector:'[data-highlight-id="general"]',label:"Settings: Advanced",route:"/settings?tab=advanced#reset",description:"Advanced settings and reset controls."}),{id:"workspace-card",tab:"",hashAliases:["workspace-card"],highlightSelector:'[data-highlight-id^="workspace-"]',label:"Workspace card",category:"workspace",description:"A workspace card on workspace list surfaces.",dynamic:!0,idPattern:"workspace-{workspaceId}"},{id:"specialist-entry",tab:"specialists",highlightSelector:'[data-highlight-id^="specialist-"]',label:"Specialist entry",route:"/settings?tab=specialists&specialist={specialistId}#specialist-{specialistId}",category:"specialist",description:"A specific specialist row in settings.",dynamic:!0,idPattern:"specialist-{specialistId}"}];function m(e){const t=e.indexOf("#"),i=t>=0?e.slice(t+1):e;return decodeURIComponent(i.replace(/^#/,"")).trim()}function P(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(e,t){if(!t.match(/\{[^}]+\}/g)?.length)return e===t;const a=t.split(/\{[^}]+\}/g).map(P).join("[^/]+");return new RegExp(`^${a}$`).test(e)}function R(e){const t=m(e);if(!t)return;const i=f.find(o=>o.id===t||o.hashAliases?.includes(t));if(i)return i;const a=f.find(o=>o.route&&o.dynamic&&o.idPattern&&M(t,o.idPattern));return a?{...a,id:t}:void 0}function T(e){try{return new URL(e,"app://intent").pathname||"/"}catch{const t=e.indexOf("?"),i=e.indexOf("#");let a=e.length;return t>=0&&(a=Math.min(a,t)),i>=0&&(a=Math.min(a,i)),e.slice(0,a)||"/"}}const E=new Set(f.flatMap(e=>e.route?[T(e.route)]:[])),C=[/^\/workspace\/[^/]+$/,/^\/agent\/[^/]+$/];function F(e){if(typeof e!="string")return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("intent://"))return!0;let i,a;try{const o=new URL(t,"app://intent");if(o.protocol!=="app:")return!1;i=o.pathname||"/",a=m(o.hash)}catch{return!1}return E.has(i)?a?!!R(a):!0:C.some(o=>o.test(i))}const U=g.createSelector(e=>{const t=new Map,i=(s,c)=>{const d=t.get(s)??new Set;d.add(c),t.set(s,d)},a=k.select(e),o=A.select(e),h=_.select(e)[o];h&&o&&i(o,n.settings_providers_inUseDefaultModel_label({model:h})),b(o)&&!h&&i(o,n.settings_providers_inUseDefaultProvider_label());const u=e.backgroundAgentSettings?.providerId;u&&b(u)&&i(u,n.settings_providers_inUseQuickActions_label());for(const s of y.select(e)){const c=w.select(e,s.id),d=s.source?{project:n.settings_providers_pinSourceProject_label(),user:n.settings_providers_pinSourceUser_label(),bundled:n.settings_providers_pinSourceBundled_label(),builtin:n.settings_providers_pinSourceBuiltin_label(),"electron-store":n.settings_providers_pinSourceLegacy_label()}[s.source]:void 0,p=l=>d&&c?n.settings_providers_inUseSourcePath_label({reason:l,source:d,path:c}):d?n.settings_providers_inUseSource_label({reason:l,source:d}):c?n.settings_providers_inUsePath_label({reason:l,path:c}):l;if(s.codingAgent&&i(s.codingAgent,p(n.settings_providers_inUseSpecialistAgent_label({name:s.name}))),s.modelOptions?.forEach((l,v)=>{l.provider&&b(l.provider)&&i(l.provider,p(n.settings_providers_inUseSpecialistModelOption_label({name:s.name,position:I(v+1)})))}),s.defaultModel)if(s.defaultModel.includes(":")){const l=S(s.defaultModel).providerId??a;i(l,p(n.settings_providers_inUseSpecialistModel_label({name:s.name,model:s.defaultModel})))}else s.codingAgent||i(a,p(n.settings_providers_inUseSpecialistModel_label({name:s.name,model:s.defaultModel})))}return Object.fromEntries([...t].map(([s,c])=>[s,[...c].join(`
2
2
  `)]))});g.createSelector((e,t)=>U.select(e)[t]??null);const O=[{id:"dracula",label:"Dracula"},{id:"nord",label:"Nord"},{id:"rose-pine",label:"Rosé Pine"},{id:"tokyo-night",label:"Tokyo Night"},{id:"solarized",label:"Solarized"},{id:"github",label:"GitHub"},{id:"high-contrast",label:"High Contrast"}],q=O.map(({id:e})=>e);export{q as T,O as a,G as b,j as c,B as d,W as e,U as f,F as i,R as r,z as s};