@intent-hq/web 2.327.0 → 2.327.1

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/{Bx77RH2D.js → -M5ArFu9.js} +1 -1
  3. package/web/app/immutable/chunks/{DiU_67YU.js → 0GcDPFAS.js} +1 -1
  4. package/web/app/immutable/chunks/{DG_DKtEi.js → 3ltPZd_n.js} +1 -1
  5. package/web/app/immutable/chunks/{DzgG9d04.js → 4MDpT4VG.js} +1 -1
  6. package/web/app/immutable/chunks/{BsxzjRia.js → 64lOi4Xe.js} +1 -1
  7. package/web/app/immutable/chunks/{Bxb00R27.js → 7Nb-tEer.js} +1 -1
  8. package/web/app/immutable/chunks/{CZ3gqcH0.js → 7t1XfqI3.js} +1 -1
  9. package/web/app/immutable/chunks/{CHtnIE14.js → A8xzSidY.js} +1 -1
  10. package/web/app/immutable/chunks/{dSxiKw5u.js → B-r2QfY2.js} +1 -1
  11. package/web/app/immutable/chunks/{Ovgvmxzk.js → B30-sYDS.js} +1 -1
  12. package/web/app/immutable/chunks/{D88AXVkV.js → B7bvyyYD.js} +1 -1
  13. package/web/app/immutable/chunks/{B3sypLPs.js → B7ookV3M.js} +1 -1
  14. package/web/app/immutable/chunks/{CECd-ew5.js → BB6ApKQZ.js} +1 -1
  15. package/web/app/immutable/chunks/{x_2obwKo.js → BBkcKcU8.js} +1 -1
  16. package/web/app/immutable/chunks/{BX_AS4NO.js → BCLA-ClZ.js} +1 -1
  17. package/web/app/immutable/chunks/{ChbqD4nY.js → BEWET3uQ.js} +2 -2
  18. package/web/app/immutable/chunks/{BHt8Cv_F.js → BIlDYPC_.js} +1 -1
  19. package/web/app/immutable/chunks/{DyVs3tqq.js → BLE555FN.js} +4 -4
  20. package/web/app/immutable/chunks/{C7QVfuKS.js → BPU4W-ai.js} +1 -1
  21. package/web/app/immutable/chunks/{cEpdukj-.js → BRua-6UM.js} +1 -1
  22. package/web/app/immutable/chunks/{MFRf7XsP.js → BSGuytEP.js} +1 -1
  23. package/web/app/immutable/chunks/{BuxJaWiM.js → BTBcxnN8.js} +4 -4
  24. package/web/app/immutable/chunks/{shMIdOXY.js → BTS44Ia3.js} +4 -4
  25. package/web/app/immutable/chunks/{1vv2LgJU.js → BV2NfA3h.js} +1 -1
  26. package/web/app/immutable/chunks/{kD3RPqIy.js → BVSo0mI7.js} +1 -1
  27. package/web/app/immutable/chunks/{AyNqjFrC.js → BWUOkr40.js} +1 -1
  28. package/web/app/immutable/chunks/{jkLGgu1-.js → BX1HymTE.js} +3 -3
  29. package/web/app/immutable/chunks/{C46AGI2o.js → BX3vzTpn.js} +1 -1
  30. package/web/app/immutable/chunks/{Bw_y1gSr.js → BXYIlyr0.js} +1 -1
  31. package/web/app/immutable/chunks/{DBZtPAw6.js → BYcS-OAO.js} +1 -1
  32. package/web/app/immutable/chunks/{L34ozHWW.js → Bay8SY9e.js} +1 -1
  33. package/web/app/immutable/chunks/{Cw90TeMe.js → BcdAyX4K.js} +2 -2
  34. package/web/app/immutable/chunks/{giU_rdFX.js → BdSGNHEM.js} +1 -1
  35. package/web/app/immutable/chunks/{C2jgF35o.js → Be_ON1DI.js} +1 -1
  36. package/web/app/immutable/chunks/{BRqn1o3u.js → BkFZSZBw.js} +1 -1
  37. package/web/app/immutable/chunks/{DJwbeAP3.js → BkHD8RFf.js} +1 -1
  38. package/web/app/immutable/chunks/{D9xO6S0s.js → BkbuDEW6.js} +1 -1
  39. package/web/app/immutable/chunks/{Btvd3YqX.js → BsC5Vdmg.js} +2 -2
  40. package/web/app/immutable/chunks/{DywqqPBY.js → BsOdwfJ2.js} +1 -1
  41. package/web/app/immutable/chunks/{CchLUU-A.js → BuVVc2l9.js} +1 -1
  42. package/web/app/immutable/chunks/{BNn8Ec2v.js → Bwb9opno.js} +1 -1
  43. package/web/app/immutable/chunks/{CZ2HrVJB.js → BwfrxhET.js} +1 -1
  44. package/web/app/immutable/chunks/{CEB0BOhp.js → C1vG2W_v.js} +1 -1
  45. package/web/app/immutable/chunks/{CrgKSEA9.js → C2eGBEPE.js} +4 -4
  46. package/web/app/immutable/chunks/{dHhYWIBz.js → C3DbH19I.js} +1 -1
  47. package/web/app/immutable/chunks/{CCTMo-Up.js → C6HefDtf.js} +1 -1
  48. package/web/app/immutable/chunks/{C_P93GWd.js → C6ibAYOP.js} +1 -1
  49. package/web/app/immutable/chunks/{Bpv_7NSe.js → CAKIN9jR.js} +1 -1
  50. package/web/app/immutable/chunks/{D7CVY9y_.js → CARGil7N.js} +1 -1
  51. package/web/app/immutable/chunks/{7DG8yVyI.js → CAqh5rmU.js} +1 -1
  52. package/web/app/immutable/chunks/{C2u3n3wb.js → CCqeKXhI.js} +1 -1
  53. package/web/app/immutable/chunks/{DttEjUfQ.js → CE6SftSb.js} +2 -2
  54. package/web/app/immutable/chunks/{BGS5RHiS.js → CFMVBWPg.js} +3 -3
  55. package/web/app/immutable/chunks/{D1TG5G7m.js → CIdiIwVr.js} +1 -1
  56. package/web/app/immutable/chunks/{Ca70R1oc.js → COC8ycoj.js} +1 -1
  57. package/web/app/immutable/chunks/{Bgx4jaT-.js → COhk9eQe.js} +3 -3
  58. package/web/app/immutable/chunks/{DhMntDzP.js → COyOtekU.js} +1 -1
  59. package/web/app/immutable/chunks/{Dv5eIHFX.js → CS6MUgvJ.js} +1 -1
  60. package/web/app/immutable/chunks/{Dz2fLbdn.js → CTygu5pv.js} +1 -1
  61. package/web/app/immutable/chunks/{BoLnGk3G.js → CUBPdQc3.js} +1 -1
  62. package/web/app/immutable/chunks/{DM-tQz5k.js → CUNfV-oG.js} +1 -1
  63. package/web/app/immutable/chunks/{CGyfJ3wZ.js → CY7bNGyv.js} +12 -12
  64. package/web/app/immutable/chunks/{CnMWAn59.js → C_rSlxHm.js} +1 -1
  65. package/web/app/immutable/chunks/{CV8S2_aN.js → CbNg55gb.js} +1 -1
  66. package/web/app/immutable/chunks/{gAYIZ12J.js → CfMhquYs.js} +1 -1
  67. package/web/app/immutable/chunks/{T-K_7EnC.js → Cg5C1MrF.js} +1 -1
  68. package/web/app/immutable/chunks/{D3JfjJlO.js → ChHo_2Kq.js} +1 -1
  69. package/web/app/immutable/chunks/{QbsT67gn.js → CiOl9c9q.js} +1 -1
  70. package/web/app/immutable/chunks/{DG0gPQWA.js → CnoeAOCE.js} +1 -1
  71. package/web/app/immutable/chunks/{CMGTMc9v.js → Ct-dlzru.js} +1 -1
  72. package/web/app/immutable/chunks/{BTHiTKPc.js → CtSt73sJ.js} +1 -1
  73. package/web/app/immutable/chunks/{OJckcu3J.js → Ct_B1TOh.js} +1 -1
  74. package/web/app/immutable/chunks/{B1ohiv8G.js → CveDKSFg.js} +1 -1
  75. package/web/app/immutable/chunks/{MvsbJRbe.js → CwaJlHvl.js} +1 -1
  76. package/web/app/immutable/chunks/{C28yvyOi.js → Cy-COy2y.js} +1 -1
  77. package/web/app/immutable/chunks/{B07w1Xvt.js → D2jjmu4v.js} +1 -1
  78. package/web/app/immutable/chunks/{D-RJNO4X.js → DA0d2_fu.js} +1 -1
  79. package/web/app/immutable/chunks/{-y8aRUXK.js → DDbIukDL.js} +1 -1
  80. package/web/app/immutable/chunks/{BawcAaK2.js → DEylYCps.js} +1 -1
  81. package/web/app/immutable/chunks/{DStHpf1P.js → DGOeaTcp.js} +1 -1
  82. package/web/app/immutable/chunks/{TthnIsvT.js → DJ4-kbB4.js} +1 -1
  83. package/web/app/immutable/chunks/{Cq8Jt7n-.js → DOb8Kchl.js} +1 -1
  84. package/web/app/immutable/chunks/{CIas9vXT.js → DPkc4abw.js} +6 -6
  85. package/web/app/immutable/chunks/{COzH17cB.js → DPsk7Xmu.js} +1 -1
  86. package/web/app/immutable/chunks/{VGIN_p1t.js → DQW3vv7z.js} +2 -2
  87. package/web/app/immutable/chunks/{5cZ8f6NM.js → DRWb3sje.js} +1 -1
  88. package/web/app/immutable/chunks/{gTEq_pBM.js → DSTlg4w0.js} +1 -1
  89. package/web/app/immutable/chunks/{exWdi0_e.js → DSXweTPQ.js} +3 -3
  90. package/web/app/immutable/chunks/{CfbNoxr9.js → DSks1Sd3.js} +1 -1
  91. package/web/app/immutable/chunks/{CQs3nGye.js → DTWWM1mF.js} +1 -1
  92. package/web/app/immutable/chunks/{CI_vWjAX.js → DY34YAUg.js} +1 -1
  93. package/web/app/immutable/chunks/{Ctnx9l23.js → DYv6YVU6.js} +1 -1
  94. package/web/app/immutable/chunks/{DnFiaMvl.js → Dbo0LK0t.js} +1 -1
  95. package/web/app/immutable/chunks/{Cufju0io.js → Ddd4tibk.js} +1 -1
  96. package/web/app/immutable/chunks/{ifFNiH_Q.js → DdwmoVU4.js} +1 -1
  97. package/web/app/immutable/chunks/{CmKBHt37.js → Dfqtr6u5.js} +1 -1
  98. package/web/app/immutable/chunks/{BxbB0_fE.js → Dh9hsi3V.js} +2 -2
  99. package/web/app/immutable/chunks/{DRs_Vsjz.js → Dhe30u3B.js} +1 -1
  100. package/web/app/immutable/chunks/{wWvgnlMJ.js → DkUbh_iD.js} +2 -2
  101. package/web/app/immutable/chunks/{DNHsSCes.js → DlJbQHTT.js} +2 -2
  102. package/web/app/immutable/chunks/{DWPjXtoT.js → Dml3pCbo.js} +1 -1
  103. package/web/app/immutable/chunks/{BfxuxK8H.js → Dqktyx17.js} +1 -1
  104. package/web/app/immutable/chunks/{BotIyjuf.js → Duo9To9j.js} +1 -1
  105. package/web/app/immutable/chunks/{WfmfYu3F.js → DwfohDpO.js} +1 -1
  106. package/web/app/immutable/chunks/{BqIts_L0.js → DxO0RaOm.js} +1 -1
  107. package/web/app/immutable/chunks/{Cz7lWcpW.js → EsKpz1xg.js} +1 -1
  108. package/web/app/immutable/chunks/{Ct_6Kn0V.js → HNL944mw.js} +1 -1
  109. package/web/app/immutable/chunks/{1eeMnGBt.js → He8rzvWn.js} +1 -1
  110. package/web/app/immutable/chunks/{B7-qYhrK.js → IN5H29V-.js} +1 -1
  111. package/web/app/immutable/chunks/{wtQc1nfb.js → JKgT3h6U.js} +1 -1
  112. package/web/app/immutable/chunks/{BCH_5tMO.js → O0uPRDIU.js} +3 -3
  113. package/web/app/immutable/chunks/{CT-tNtwL.js → QHP8cHaW.js} +1 -1
  114. package/web/app/immutable/chunks/{D16bMDoO.js → UyxlQTVj.js} +1 -1
  115. package/web/app/immutable/chunks/{CtrcoLr_.js → VU4R1gKj.js} +1 -1
  116. package/web/app/immutable/chunks/{CWf45qwn.js → cP091E7D.js} +1 -1
  117. package/web/app/immutable/chunks/{O_PsNJaQ.js → fqXfkYA3.js} +1 -1
  118. package/web/app/immutable/chunks/{aYTkKC29.js → nWTC446c.js} +1 -1
  119. package/web/app/immutable/chunks/{BwA79r4u.js → om7e-2Da.js} +1 -1
  120. package/web/app/immutable/chunks/{CJfy0DGd.js → u2JaOdc9.js} +1 -1
  121. package/web/app/immutable/chunks/{FVYA7zYF.js → w57SWl6G.js} +1 -1
  122. package/web/app/immutable/chunks/{CAGE-6rK.js → xMXcl1K_.js} +1 -1
  123. package/web/app/immutable/chunks/{ComHdR-u.js → zfZ9LSKu.js} +1 -1
  124. package/web/app/immutable/entry/{app.D13wouTF.js → app.C8ZhaB4m.js} +2 -2
  125. package/web/app/immutable/entry/start.CcpVYiXq.js +1 -0
  126. package/web/app/immutable/nodes/{0.4_Enqr75.js → 0.BDAB8VWB.js} +1 -1
  127. package/web/app/immutable/nodes/{1.0GDoH7pL.js → 1.CVUy-46P.js} +1 -1
  128. package/web/app/immutable/nodes/{10.BLmBSn8S.js → 10.B-f9eiav.js} +1 -1
  129. package/web/app/immutable/nodes/{14.D9wSVPA8.js → 14.BvXwRXk_.js} +1 -1
  130. package/web/app/immutable/nodes/{17.D8qEGYSE.js → 17.2vxzrHyO.js} +2 -2
  131. package/web/app/immutable/nodes/{2.Bb9M8Sb_.js → 2.Bqgsv7WD.js} +4 -4
  132. package/web/app/immutable/nodes/{3.3kLveQ--.js → 3.BMV3o2AW.js} +1 -1
  133. package/web/app/immutable/nodes/{4.Di28fdFS.js → 4.DS2WiQYi.js} +1 -1
  134. package/web/app/immutable/nodes/{5.DFuaA1cK.js → 5.Cev1tKbw.js} +1 -1
  135. package/web/app/immutable/nodes/{6.CSKX9gfc.js → 6.Cx-CL8qG.js} +1 -1
  136. package/web/app/immutable/nodes/{7.pjH2istV.js → 7.DQIGXkGA.js} +1 -1
  137. package/web/app/immutable/nodes/{8.JlRHumI8.js → 8.CwodZ6Q4.js} +4 -4
  138. package/web/app/immutable/nodes/{9.Dfi2ySix.js → 9.BqamPD8c.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.CNSNzsXg.js +0 -1
@@ -1,4 +1,4 @@
1
- import{g as gt}from"./CHtnIE14.js";import{d as mt,g as lt,f as xt,e as kt}from"./kD3RPqIy.js";import{U as _t,aZ as vt,V as bt,a_ as wt,Y as Tt,b0 as St,b as s,X as R,aW as H,B as $t,r as Mt,d as it}from"./BuxJaWiM.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,W;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var X="";W=[];for(N in v[A])this.terminals_[N]&&N>yt&&W.push("'"+this.terminals_[N]+"'");_.showPosition?X="Parse error on line "+(C+1)+`:
1
+ import{g as gt}from"./A8xzSidY.js";import{d as mt,g as lt,f as xt,e as kt}from"./BVSo0mI7.js";import{U as _t,aZ as vt,V as bt,a_ as wt,Y as Tt,b0 as St,b as s,X as R,aW as H,B as $t,r as Mt,d as it}from"./BTBcxnN8.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,W;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var X="";W=[];for(N in v[A])this.terminals_[N]&&N>yt&&W.push("'"+this.terminals_[N]+"'");_.showPosition?X="Parse error on line "+(C+1)+`:
2
2
  `+_.showPosition()+`
3
3
  Expecting `+W.join(", ")+", got '"+(this.terminals_[b]||b)+"'":X="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:W})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- var $s=Object.defineProperty;var Fs=(f,r,l)=>r in f?$s(f,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):f[r]=l;var q=(f,r,l)=>Fs(f,typeof r!="symbol"?r+"":r,l);import{t as dn,bq as S,a_ as M,bo as P,by as un,bs as On,b as hn,bu as je}from"./syxE6N1N.js";import{ai as xr,bs as gn,ca as Be,aD as e,bH as m,a5 as N,bA as H,b_ as z,aw as sn,aj as ln,W as w,bn as fn,bV as Y,aA as x,ay as ne,bS as y,bl as de,bO as K,aB as T,c9 as u,a7 as nt,br as tt,bj as sr,c5 as gt,c0 as Ln,a as Us,be as Tt,b$ as ft,bf as or}from"./DYhIMPy1.js";import{v as En,u as Ve,n as Pt,p as Hn,I as ir,g as ar,w as lr}from"./XNWMykPO.js";import{I as cn,F as Ws,c as Bs,t as Rt}from"./1cW9cCot.js";import{b as on}from"./BaIAhI85.js";import{Ig as Me,eD as Vs,eu as Ks,ev as js,oA as qs,np as Vt,nt as cr,ns as In,ex as Gs,uO as Qs,uP as Xs,uR as Ys,Gk as Zs,Il as Js,re as eo,eC as to}from"./CpBlZvWi.js";import{c as no}from"./Df216rki.js";import{F as Ne,Z as ro,a4 as An,as as dr,at as ur,bN as so,aL as oo,c7 as hr,bU as gr,cj as fr}from"./DLGpFr8e.js";import{dp as io,bd as ao,M as lo,aC as mr,i as co}from"./CNJgwoNk.js";import{L as pr}from"./CRTNdBBv.js";import{C as an}from"./DypB-Dwi.js";import{b5 as kr,bK as uo,bN as ho}from"./C46AGI2o.js";import{q as $e,d as go,g as fo}from"./B7-qYhrK.js";import"./g2wqtBd2.js";import{f as ke}from"./BgtLN2kD.js";import{e as mo}from"./ChbqD4nY.js";import{T as Pr}from"./B1ohiv8G.js";import{g as Nn}from"./D4V2xQ2J.js";import{C as po}from"./-YfVx6Lr.js";import{C as vo}from"./CToUKfVS.js";import{s as vr}from"./BHt8Cv_F.js";import{t as Dt}from"./BOAArWys.js";import{P as _o,k as _r}from"./shMIdOXY.js";import{g as wo}from"./vpJZSAdN.js";import{a3 as bo,T as Co}from"./CfbNoxr9.js";import{av as yo}from"./BCH_5tMO.js";import{C as wr}from"./Bgx4jaT-.js";import{ah as So,ag as xo,ai as ko}from"./CGyfJ3wZ.js";function br({scrollTop:f,scrollHeight:r,height:l,fitPerfectly:a=!1,fitPerfectlyOverscroll:c=0,overscrollSize:p}){const b=l+p*2,C=a?l+c*2:b;if(r=Math.max(r,C),b>=r||a){const G=Math.max(f-c,0),h=Math.min(f+C,r);return{top:G,bottom:Math.max(h,G)}}let A=f+l/2-b/2,F=A+b;return A<0&&(A=0),F>r&&(F=r),A=Math.floor(Math.max(A,0)),{top:A,bottom:Math.ceil(Math.max(Math.min(F,r),A))}}function Po(f,r){return f==null||r==null?f===r:f.top===r.top&&f.bottom===r.bottom}const Rr=1e3,Ro=Rr*4,Lo=[0,1e-6,.99999,1],Ho={overscrollSize:Rr,intersectionObserverMargin:Ro,resizeDebugging:!1};let rn=0,Io=-1;var Pe,Ao=(Pe=class{constructor(r){q(this,"__id",`virtualizer-${++Io}`);q(this,"config");q(this,"type","simple");q(this,"intersectionObserver");q(this,"scrollTop",0);q(this,"height",0);q(this,"scrollHeight",0);q(this,"windowSpecs",{top:0,bottom:0});q(this,"root");q(this,"contentContainer");q(this,"resizeObserver");q(this,"observers",new Map);q(this,"visibleInstances",new Map);q(this,"visibleInstancesDirty",!1);q(this,"instancesChanged",new Set);q(this,"reconcileQueue",new Set);q(this,"scrollDirty",!0);q(this,"heightDirty",!0);q(this,"scrollHeightDirty",!0);q(this,"renderedObservers",0);q(this,"connectQueue",new Map);q(this,"handleContainerResize",r=>{if(this.root==null)return;let l=!1;for(const a of r){const c=a.borderBoxSize[0].blockSize;this.root instanceof Document?c!==this.scrollHeight&&(this.scrollHeightDirty=!0,l=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:c-rn,newSize:c}),rn=c)):a.target===this.root?c!==this.height&&(this.heightDirty=!0,l=!0):a.target===this.contentContainer&&(this.scrollHeightDirty=!0,l=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:c-rn,newSize:c}),rn=c))}l&&$e(this.computeRenderRangeAndEmit)});q(this,"handleWindowResize",()=>{Pe.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,$e(this.computeRenderRangeAndEmit))});q(this,"handleWindowScroll",()=>{Pe.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,$e(this.computeRenderRangeAndEmit))});q(this,"handleElementScroll",()=>{Pe.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,$e(this.computeRenderRangeAndEmit))});q(this,"computeRenderRangeAndEmit",()=>{if(Pe.__STOP)return;const r=this.heightDirty||this.scrollHeightDirty;let l=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const p=br({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!r&&Po(this.windowSpecs,p)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=p}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const a=this.getScrollAnchor(this.height),c=new Set;for(const p of r?this.observers.values():this.visibleInstances.values())p.onRender(r)&&c.add(p);for(const p of this.instancesChanged)c.has(p)||p.onRender(r)&&c.add(p);this.scrollFix(a);for(const p of c)this.reconcileQueue.delete(p),p.reconcileHeights();for(const p of this.reconcileQueue)p.reconcileHeights()&&(l=!0);this.reconcileQueue.clear(),l||=this.instancesChanged.size>0,l&&this.markDOMDirty(),(l||r)&&$e(this.computeRenderRangeAndEmit),c.clear(),this.instancesChanged.clear()});q(this,"handleIntersectionChange",r=>{this.scrollDirty=!0;for(const{target:l,isIntersecting:a}of r){if(!(l instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const c=this.observers.get(l);c!=null&&(a&&!this.visibleInstances.has(l)?(c.setVisibility(!0),this.visibleInstances.set(l,c),this.visibleInstancesDirty=!0):!a&&this.visibleInstances.has(l)&&(c.setVisibility(!1),this.visibleInstances.delete(l),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&$e(this.computeRenderRangeAndEmit)});this.config={...Ho,...r}}setup(r,l){if(this.root==null){this.root=r,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Lo,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),r instanceof Document?this.setupWindow():this.setupElement(l),window.__INSTANCE=this,window.__TOGGLE=()=>{Pe.__STOP?(Pe.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:Pe.__lastScrollPosition}),$e(this.computeRenderRangeAndEmit)):(Pe.__lastScrollPosition=this.getScrollTop(),Pe.__STOP=!0)};for(const[a,c]of this.connectQueue.entries())this.connect(a,c);this.connectQueue.clear(),this.markDOMDirty(),$e(this.computeRenderRangeAndEmit)}}instanceChanged(r,l){this.instancesChanged.add(r),l&&this.markDOMDirty(),$e(this.computeRenderRangeAndEmit)}requestHeightReconcile(r){this.reconcileQueue.add(r),$e(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=br({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(r,l){const a=this.getScrollTop(),c=this.getHeight(),p=this.config.intersectionObserverMargin,b=a-p,C=a+c+p;return!(r<b-l||r>C)}setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(r){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),r??=this.root.firstElementChild??void 0,r instanceof HTMLElement&&(this.contentContainer=r,this.resizeObserver?.observe(r))}cleanUp(){go(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(r){return this.getScrollTop()+Kt(r,this.getScrollContainerElement())}connect(r,l){if(this.observers.has(r))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(r,l):(this.intersectionObserver.observe(r),this.observers.set(r,l),this.instancesChanged.add(l),this.markDOMDirty(),$e(this.computeRenderRangeAndEmit)),()=>this.disconnect(r)}disconnect(r){const l=this.observers.get(r);this.connectQueue.delete(r),l!=null&&(this.intersectionObserver?.unobserve(r),this.observers.delete(r),this.instancesChanged.delete(l),this.reconcileQueue.delete(l),this.visibleInstances.delete(r)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),$e(this.computeRenderRangeAndEmit))}scrollFix(r){if(r==null)return;const l=this.getScrollContainerElement(),{lineIndex:a,lineOffset:c,fileElement:p,fileOffset:b,fileTypeOffset:C}=r;if(a!=null&&c!=null){const F=p.shadowRoot?.querySelector(`[data-line][data-line-index="${a}"]`);if(F instanceof HTMLElement){const G=Kt(F,l);if(G!==c){const h=G-c;this.applyScrollFix(h)}return}}const A=Kt(p,l);if(C==="top")A!==b&&this.applyScrollFix(A-b);else{const F=A+p.getBoundingClientRect().height;F!==b&&this.applyScrollFix(F-b)}}applyScrollFix(r){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+r,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+r,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(r){const l=this.getScrollContainerElement();let a;for(const[c]of this.visibleInstances.entries()){const p=Kt(c,l),b=p+c.offsetHeight;let C,A;b<=0?(C=b,A="bottom"):(C=p,A="top");let F,G;if(b>0&&p<r)for(const oe of c.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(oe instanceof HTMLElement))continue;const Te=oe.dataset.lineIndex;if(Te==null)continue;const ue=Kt(oe,l);if(!(ue<0)){F=Te,G=ue;break}}if(a?.lineOffset!=null&&G==null)continue;let h=!1;(a==null||G!=null&&(a.lineOffset==null||G<a.lineOffset)||G==null&&a.lineOffset==null&&(C>=0&&(a.fileOffset<0||C<a.fileOffset)||C<0&&a.fileOffset<0&&C>a.fileOffset))&&(h=!0),h&&(a={fileElement:c,fileTypeOffset:A,fileOffset:C,lineIndex:F,lineOffset:G})}return a}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let r=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return r=this.clampScrollTop(r),this.scrollTop=r,r}scrollTo({top:r,behavior:l="auto"}){const{root:a}=this;if(a==null)return;const c=this.clampScrollTop(r);a instanceof Document?window.scrollTo({top:c,behavior:l}):a.scrollTo({top:c,behavior:l}),this.scrollDirty=!0,$e(this.computeRenderRangeAndEmit)}clampScrollTop(r){return Math.max(0,Math.min(r,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}},q(Pe,"__STOP",!1),q(Pe,"__lastScrollPosition",0),Pe);function Kt(f,r){const l=f.getBoundingClientRect(),a=r?.getBoundingClientRect().top??0;return l.top-a}var Eo=T('<div class="absolute inset-0 flex items-center justify-center rounded-lg bg-background/60 backdrop-blur-[2px] transition-opacity duration-spring-moderate ease-spring-moderate motion-reduce:transition-none z-10 pointer-events-none"><div class="flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-xs font-medium text-subtle shadow-lg"><!> </div></div>'),Oo=T("<!> <!>",1),No=T('<div class="flex h-24 items-center justify-start text-left text-subtle"> </div>'),To=T('<div role="region"><!></div>');function Lr(f,r){if(new.target)return dn({component:Lr,...f});gn(r,!0);const l=()=>je(ve,"$sideBySide",a),[a,c]=On(),p=Nn()?.workspaceId??void 0;let b=S(r,"change",7),C=S(r,"foldUnchanged",7,!0),A=S(r,"allowHeadReads",7,!0),F=S(r,"canReadHeadFiles",7),G=S(r,"lineWrapping",7,!1),h=S(r,"scrollToLine",7),oe=S(r,"isAggregate",7,!1),Te=S(r,"showScrollHint",7,!1),ue=S(r,"onStageHunk",7),Q=S(r,"onUnstageHunk",7),at=S(r,"onOpenCommit",7),pt=S(r,"virtualizer",7),vt=S(r,"gitRootId",7,void 0),_t=S(r,"gitRootPath",7,void 0);const ve=kr();let Re=Y(!1),Ce=Y(!1),Fe=Y(!1),Ue=Y(0),qe=Y(void 0);const $=80;function ie(){m(Ce,!0)}function De(){m(Ce,!1),m(Fe,!1),m(Ue,0)}function Le(v){!e(Ce)||e(Re)||(m(Ue,e(Ue)+Math.abs(v.deltaY)),e(Ue)>=$&&!e(Fe)&&m(Fe,!0))}function jt(){m(Re,!0),m(Fe,!1),m(Ue,0)}function qt(v){e(qe)&&!e(qe).contains(v.relatedTarget)&&m(Re,!1)}Be(()=>{(e(Re)||!e(Ce))&&(m(Fe,!1),m(Ue,0))});let Lt=u(()=>{const{toolCallId:v,filePath:_e,additions:Qe,deletions:Ct,oldContent:re,newContent:Xe}=b(),rt="staged"in b()&&b().staged===!0,Ke="category"in b()?b().category:void 0,At="commitHash"in b()?b().commitHash:void 0,zt="gitlink"in b()?b().gitlink:void 0,Mt="isFullFileContent"in b()?b().isFullFileContent:!1;let yt;return Ke==="committed"?yt=an.Committed:rt?yt=an.Staged:yt=an.Unstaged,{id:v,file:_e,relativePath:_e,stage:yt,commitHash:At,gitlink:zt,stats:{additions:Qe,deletions:Ct},attribution:{timestamp:0},content:re!==void 0||Xe!==void 0?{oldContent:re??"",newContent:Xe??"",isFullFileContent:Mt}:void 0}});const D=u(()=>b().isFullFileContent?1:("chunks"in b()?b().chunks?.[0]?.newStart:void 0)??b().startLineNumber??1);var Ht={get change(){return b()},set change(v){b(v),x()},get foldUnchanged(){return C()},set foldUnchanged(v=!0){C(v),x()},get allowHeadReads(){return A()},set allowHeadReads(v=!0){A(v),x()},get canReadHeadFiles(){return F()},set canReadHeadFiles(v){F(v),x()},get lineWrapping(){return G()},set lineWrapping(v=!1){G(v),x()},get scrollToLine(){return h()},set scrollToLine(v){h(v),x()},get isAggregate(){return oe()},set isAggregate(v=!1){oe(v),x()},get showScrollHint(){return Te()},set showScrollHint(v=!1){Te(v),x()},get onStageHunk(){return ue()},set onStageHunk(v){ue(v),x()},get onUnstageHunk(){return Q()},set onUnstageHunk(v){Q(v),x()},get onOpenCommit(){return at()},set onOpenCommit(v){at(v),x()},get virtualizer(){return pt()},set virtualizer(v){pt(v),x()},get gitRootId(){return vt()},set gitRootId(v=void 0){vt(v),x()},get gitRootPath(){return _t()},set gitRootPath(v=void 0){_t(v),x()},$set:un,$on:(v,_e)=>hn(r,v,_e)},He=To();let wt;var It=N(He);{var Ge=v=>{var _e=Oo(),Qe=ne(_e);{let Xe=u(()=>l()?"split":"unified");Pr(Qe,{get change(){return e(Lt)},get workspaceId(){return p},get viewMode(){return e(Xe)},get foldUnchanged(){return C()},get lineWrapping(){return G()},get onStageHunk(){return ue()},get onUnstageHunk(){return Q()},useProvidedContent:!0,get allowHeadReads(){return A()},get canReadHeadFiles(){return F()},get lineOffset(){return e(D)},get virtualizer(){return pt()},get gitRootId(){return vt()},get gitRootPath(){return _t()}})}var Ct=y(Qe,2);{var re=Xe=>{var rt=Eo(),Ke=N(rt),At=N(Ke);Ne(At,{get icon(){return ro},class:"w-3 h-3"});var zt=y(At);H(Ke),H(rt),z(Mt=>K(zt,` ${Mt??""}`),[()=>P.chat_inlineDiffItem_clickToScroll_label()]),cn(1,rt,()=>Ws,()=>({tier:"fast",y:0,scale:1})),cn(2,rt,()=>Bs,()=>({tier:"fast"})),w(Xe,rt)};M(Ct,Xe=>{Te()&&e(Fe)&&Xe(re)})}w(v,_e)},bt=v=>{var _e=No(),Qe=de(_e,!0);z(Ct=>K(Qe,Ct),[()=>P.chat_inlineDiffItem_noWorkspace_label()]),w(v,_e)};M(It,v=>{p?v(Ge):v(bt,-1)})}H(He),on(He,v=>m(qe,v),()=>e(qe)),z(v=>{wt=En(He,1,"inline-diff-container relative",null,wt,{focused:e(Re)}),Ve(He,"aria-label",v)},[()=>P.chat_inlineDiffItem_viewer_ariaLabel()]),sn("mouseenter",He,ie),sn("mouseleave",He,De),sn("wheel",He,Le),ln("focusin",He,jt),ln("focusout",He,qt),w(f,He);var mn=fn(Ht);return c(),mn}xr(["focusin","focusout"]);function Cr(f){return[f.stage,f.type,f.oldLineNumber??"",f.newLineNumber??"",f.content].join("\0")}function Do(f){let r=f.oldStart,l=f.newStart;return f.lines.map(a=>{const c={...a,oldLineNumber:a.oldLineNumber??a.oldNumber,newLineNumber:a.newLineNumber??a.newNumber};return c.oldLineNumber===void 0&&c.newLineNumber===void 0?a.type==="Context"?(c.oldLineNumber=r++,c.newLineNumber=l++):a.type==="Deletion"?c.oldLineNumber=r++:a.type==="Addition"&&(c.newLineNumber=l++):a.type==="Context"?(r=(c.oldLineNumber??r)+1,l=(c.newLineNumber??l)+1):a.type==="Deletion"?r=(c.oldLineNumber??r)+1:a.type==="Addition"&&(l=(c.newLineNumber??l)+1),c})}function zo(f,r){const l=f?f.split(`
1
+ var $s=Object.defineProperty;var Fs=(f,r,l)=>r in f?$s(f,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):f[r]=l;var q=(f,r,l)=>Fs(f,typeof r!="symbol"?r+"":r,l);import{t as dn,bq as S,a_ as M,bo as P,by as un,bs as On,b as hn,bu as je}from"./syxE6N1N.js";import{ai as xr,bs as gn,ca as Be,aD as e,bH as m,a5 as N,bA as H,b_ as z,aw as sn,aj as ln,W as w,bn as fn,bV as Y,aA as x,ay as ne,bS as y,bl as de,bO as K,aB as T,c9 as u,a7 as nt,br as tt,bj as sr,c5 as gt,c0 as Ln,a as Us,be as Tt,b$ as ft,bf as or}from"./DYhIMPy1.js";import{v as En,u as Ve,n as Pt,p as Hn,I as ir,g as ar,w as lr}from"./XNWMykPO.js";import{I as cn,F as Ws,c as Bs,t as Rt}from"./1cW9cCot.js";import{b as on}from"./BaIAhI85.js";import{Ig as Me,eD as Vs,eu as Ks,ev as js,oA as qs,np as Vt,nt as cr,ns as In,ex as Gs,uO as Qs,uP as Xs,uR as Ys,Gk as Zs,Il as Js,re as eo,eC as to}from"./CpBlZvWi.js";import{c as no}from"./Df216rki.js";import{F as Ne,Z as ro,a4 as An,as as dr,at as ur,bN as so,aL as oo,c7 as hr,bU as gr,cj as fr}from"./DLGpFr8e.js";import{dp as io,bd as ao,M as lo,aC as mr,i as co}from"./CNJgwoNk.js";import{L as pr}from"./CRTNdBBv.js";import{C as an}from"./DypB-Dwi.js";import{b5 as kr,bK as uo,bN as ho}from"./BX3vzTpn.js";import{q as $e,d as go,g as fo}from"./IN5H29V-.js";import"./g2wqtBd2.js";import{f as ke}from"./BgtLN2kD.js";import{e as mo}from"./BEWET3uQ.js";import{T as Pr}from"./CveDKSFg.js";import{g as Nn}from"./D4V2xQ2J.js";import{C as po}from"./-YfVx6Lr.js";import{C as vo}from"./CToUKfVS.js";import{s as vr}from"./BIlDYPC_.js";import{t as Dt}from"./BOAArWys.js";import{P as _o,k as _r}from"./BTS44Ia3.js";import{g as wo}from"./vpJZSAdN.js";import{a3 as bo,T as Co}from"./DSks1Sd3.js";import{av as yo}from"./O0uPRDIU.js";import{C as wr}from"./COhk9eQe.js";import{ah as So,ag as xo,ai as ko}from"./CY7bNGyv.js";function br({scrollTop:f,scrollHeight:r,height:l,fitPerfectly:a=!1,fitPerfectlyOverscroll:c=0,overscrollSize:p}){const b=l+p*2,C=a?l+c*2:b;if(r=Math.max(r,C),b>=r||a){const G=Math.max(f-c,0),h=Math.min(f+C,r);return{top:G,bottom:Math.max(h,G)}}let A=f+l/2-b/2,F=A+b;return A<0&&(A=0),F>r&&(F=r),A=Math.floor(Math.max(A,0)),{top:A,bottom:Math.ceil(Math.max(Math.min(F,r),A))}}function Po(f,r){return f==null||r==null?f===r:f.top===r.top&&f.bottom===r.bottom}const Rr=1e3,Ro=Rr*4,Lo=[0,1e-6,.99999,1],Ho={overscrollSize:Rr,intersectionObserverMargin:Ro,resizeDebugging:!1};let rn=0,Io=-1;var Pe,Ao=(Pe=class{constructor(r){q(this,"__id",`virtualizer-${++Io}`);q(this,"config");q(this,"type","simple");q(this,"intersectionObserver");q(this,"scrollTop",0);q(this,"height",0);q(this,"scrollHeight",0);q(this,"windowSpecs",{top:0,bottom:0});q(this,"root");q(this,"contentContainer");q(this,"resizeObserver");q(this,"observers",new Map);q(this,"visibleInstances",new Map);q(this,"visibleInstancesDirty",!1);q(this,"instancesChanged",new Set);q(this,"reconcileQueue",new Set);q(this,"scrollDirty",!0);q(this,"heightDirty",!0);q(this,"scrollHeightDirty",!0);q(this,"renderedObservers",0);q(this,"connectQueue",new Map);q(this,"handleContainerResize",r=>{if(this.root==null)return;let l=!1;for(const a of r){const c=a.borderBoxSize[0].blockSize;this.root instanceof Document?c!==this.scrollHeight&&(this.scrollHeightDirty=!0,l=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:c-rn,newSize:c}),rn=c)):a.target===this.root?c!==this.height&&(this.heightDirty=!0,l=!0):a.target===this.contentContainer&&(this.scrollHeightDirty=!0,l=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:c-rn,newSize:c}),rn=c))}l&&$e(this.computeRenderRangeAndEmit)});q(this,"handleWindowResize",()=>{Pe.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,$e(this.computeRenderRangeAndEmit))});q(this,"handleWindowScroll",()=>{Pe.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,$e(this.computeRenderRangeAndEmit))});q(this,"handleElementScroll",()=>{Pe.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,$e(this.computeRenderRangeAndEmit))});q(this,"computeRenderRangeAndEmit",()=>{if(Pe.__STOP)return;const r=this.heightDirty||this.scrollHeightDirty;let l=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const p=br({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!r&&Po(this.windowSpecs,p)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=p}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const a=this.getScrollAnchor(this.height),c=new Set;for(const p of r?this.observers.values():this.visibleInstances.values())p.onRender(r)&&c.add(p);for(const p of this.instancesChanged)c.has(p)||p.onRender(r)&&c.add(p);this.scrollFix(a);for(const p of c)this.reconcileQueue.delete(p),p.reconcileHeights();for(const p of this.reconcileQueue)p.reconcileHeights()&&(l=!0);this.reconcileQueue.clear(),l||=this.instancesChanged.size>0,l&&this.markDOMDirty(),(l||r)&&$e(this.computeRenderRangeAndEmit),c.clear(),this.instancesChanged.clear()});q(this,"handleIntersectionChange",r=>{this.scrollDirty=!0;for(const{target:l,isIntersecting:a}of r){if(!(l instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const c=this.observers.get(l);c!=null&&(a&&!this.visibleInstances.has(l)?(c.setVisibility(!0),this.visibleInstances.set(l,c),this.visibleInstancesDirty=!0):!a&&this.visibleInstances.has(l)&&(c.setVisibility(!1),this.visibleInstances.delete(l),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&$e(this.computeRenderRangeAndEmit)});this.config={...Ho,...r}}setup(r,l){if(this.root==null){this.root=r,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Lo,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),r instanceof Document?this.setupWindow():this.setupElement(l),window.__INSTANCE=this,window.__TOGGLE=()=>{Pe.__STOP?(Pe.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:Pe.__lastScrollPosition}),$e(this.computeRenderRangeAndEmit)):(Pe.__lastScrollPosition=this.getScrollTop(),Pe.__STOP=!0)};for(const[a,c]of this.connectQueue.entries())this.connect(a,c);this.connectQueue.clear(),this.markDOMDirty(),$e(this.computeRenderRangeAndEmit)}}instanceChanged(r,l){this.instancesChanged.add(r),l&&this.markDOMDirty(),$e(this.computeRenderRangeAndEmit)}requestHeightReconcile(r){this.reconcileQueue.add(r),$e(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=br({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(r,l){const a=this.getScrollTop(),c=this.getHeight(),p=this.config.intersectionObserverMargin,b=a-p,C=a+c+p;return!(r<b-l||r>C)}setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(r){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),r??=this.root.firstElementChild??void 0,r instanceof HTMLElement&&(this.contentContainer=r,this.resizeObserver?.observe(r))}cleanUp(){go(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(r){return this.getScrollTop()+Kt(r,this.getScrollContainerElement())}connect(r,l){if(this.observers.has(r))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(r,l):(this.intersectionObserver.observe(r),this.observers.set(r,l),this.instancesChanged.add(l),this.markDOMDirty(),$e(this.computeRenderRangeAndEmit)),()=>this.disconnect(r)}disconnect(r){const l=this.observers.get(r);this.connectQueue.delete(r),l!=null&&(this.intersectionObserver?.unobserve(r),this.observers.delete(r),this.instancesChanged.delete(l),this.reconcileQueue.delete(l),this.visibleInstances.delete(r)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),$e(this.computeRenderRangeAndEmit))}scrollFix(r){if(r==null)return;const l=this.getScrollContainerElement(),{lineIndex:a,lineOffset:c,fileElement:p,fileOffset:b,fileTypeOffset:C}=r;if(a!=null&&c!=null){const F=p.shadowRoot?.querySelector(`[data-line][data-line-index="${a}"]`);if(F instanceof HTMLElement){const G=Kt(F,l);if(G!==c){const h=G-c;this.applyScrollFix(h)}return}}const A=Kt(p,l);if(C==="top")A!==b&&this.applyScrollFix(A-b);else{const F=A+p.getBoundingClientRect().height;F!==b&&this.applyScrollFix(F-b)}}applyScrollFix(r){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+r,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+r,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(r){const l=this.getScrollContainerElement();let a;for(const[c]of this.visibleInstances.entries()){const p=Kt(c,l),b=p+c.offsetHeight;let C,A;b<=0?(C=b,A="bottom"):(C=p,A="top");let F,G;if(b>0&&p<r)for(const oe of c.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(oe instanceof HTMLElement))continue;const Te=oe.dataset.lineIndex;if(Te==null)continue;const ue=Kt(oe,l);if(!(ue<0)){F=Te,G=ue;break}}if(a?.lineOffset!=null&&G==null)continue;let h=!1;(a==null||G!=null&&(a.lineOffset==null||G<a.lineOffset)||G==null&&a.lineOffset==null&&(C>=0&&(a.fileOffset<0||C<a.fileOffset)||C<0&&a.fileOffset<0&&C>a.fileOffset))&&(h=!0),h&&(a={fileElement:c,fileTypeOffset:A,fileOffset:C,lineIndex:F,lineOffset:G})}return a}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let r=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return r=this.clampScrollTop(r),this.scrollTop=r,r}scrollTo({top:r,behavior:l="auto"}){const{root:a}=this;if(a==null)return;const c=this.clampScrollTop(r);a instanceof Document?window.scrollTo({top:c,behavior:l}):a.scrollTo({top:c,behavior:l}),this.scrollDirty=!0,$e(this.computeRenderRangeAndEmit)}clampScrollTop(r){return Math.max(0,Math.min(r,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}},q(Pe,"__STOP",!1),q(Pe,"__lastScrollPosition",0),Pe);function Kt(f,r){const l=f.getBoundingClientRect(),a=r?.getBoundingClientRect().top??0;return l.top-a}var Eo=T('<div class="absolute inset-0 flex items-center justify-center rounded-lg bg-background/60 backdrop-blur-[2px] transition-opacity duration-spring-moderate ease-spring-moderate motion-reduce:transition-none z-10 pointer-events-none"><div class="flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-xs font-medium text-subtle shadow-lg"><!> </div></div>'),Oo=T("<!> <!>",1),No=T('<div class="flex h-24 items-center justify-start text-left text-subtle"> </div>'),To=T('<div role="region"><!></div>');function Lr(f,r){if(new.target)return dn({component:Lr,...f});gn(r,!0);const l=()=>je(ve,"$sideBySide",a),[a,c]=On(),p=Nn()?.workspaceId??void 0;let b=S(r,"change",7),C=S(r,"foldUnchanged",7,!0),A=S(r,"allowHeadReads",7,!0),F=S(r,"canReadHeadFiles",7),G=S(r,"lineWrapping",7,!1),h=S(r,"scrollToLine",7),oe=S(r,"isAggregate",7,!1),Te=S(r,"showScrollHint",7,!1),ue=S(r,"onStageHunk",7),Q=S(r,"onUnstageHunk",7),at=S(r,"onOpenCommit",7),pt=S(r,"virtualizer",7),vt=S(r,"gitRootId",7,void 0),_t=S(r,"gitRootPath",7,void 0);const ve=kr();let Re=Y(!1),Ce=Y(!1),Fe=Y(!1),Ue=Y(0),qe=Y(void 0);const $=80;function ie(){m(Ce,!0)}function De(){m(Ce,!1),m(Fe,!1),m(Ue,0)}function Le(v){!e(Ce)||e(Re)||(m(Ue,e(Ue)+Math.abs(v.deltaY)),e(Ue)>=$&&!e(Fe)&&m(Fe,!0))}function jt(){m(Re,!0),m(Fe,!1),m(Ue,0)}function qt(v){e(qe)&&!e(qe).contains(v.relatedTarget)&&m(Re,!1)}Be(()=>{(e(Re)||!e(Ce))&&(m(Fe,!1),m(Ue,0))});let Lt=u(()=>{const{toolCallId:v,filePath:_e,additions:Qe,deletions:Ct,oldContent:re,newContent:Xe}=b(),rt="staged"in b()&&b().staged===!0,Ke="category"in b()?b().category:void 0,At="commitHash"in b()?b().commitHash:void 0,zt="gitlink"in b()?b().gitlink:void 0,Mt="isFullFileContent"in b()?b().isFullFileContent:!1;let yt;return Ke==="committed"?yt=an.Committed:rt?yt=an.Staged:yt=an.Unstaged,{id:v,file:_e,relativePath:_e,stage:yt,commitHash:At,gitlink:zt,stats:{additions:Qe,deletions:Ct},attribution:{timestamp:0},content:re!==void 0||Xe!==void 0?{oldContent:re??"",newContent:Xe??"",isFullFileContent:Mt}:void 0}});const D=u(()=>b().isFullFileContent?1:("chunks"in b()?b().chunks?.[0]?.newStart:void 0)??b().startLineNumber??1);var Ht={get change(){return b()},set change(v){b(v),x()},get foldUnchanged(){return C()},set foldUnchanged(v=!0){C(v),x()},get allowHeadReads(){return A()},set allowHeadReads(v=!0){A(v),x()},get canReadHeadFiles(){return F()},set canReadHeadFiles(v){F(v),x()},get lineWrapping(){return G()},set lineWrapping(v=!1){G(v),x()},get scrollToLine(){return h()},set scrollToLine(v){h(v),x()},get isAggregate(){return oe()},set isAggregate(v=!1){oe(v),x()},get showScrollHint(){return Te()},set showScrollHint(v=!1){Te(v),x()},get onStageHunk(){return ue()},set onStageHunk(v){ue(v),x()},get onUnstageHunk(){return Q()},set onUnstageHunk(v){Q(v),x()},get onOpenCommit(){return at()},set onOpenCommit(v){at(v),x()},get virtualizer(){return pt()},set virtualizer(v){pt(v),x()},get gitRootId(){return vt()},set gitRootId(v=void 0){vt(v),x()},get gitRootPath(){return _t()},set gitRootPath(v=void 0){_t(v),x()},$set:un,$on:(v,_e)=>hn(r,v,_e)},He=To();let wt;var It=N(He);{var Ge=v=>{var _e=Oo(),Qe=ne(_e);{let Xe=u(()=>l()?"split":"unified");Pr(Qe,{get change(){return e(Lt)},get workspaceId(){return p},get viewMode(){return e(Xe)},get foldUnchanged(){return C()},get lineWrapping(){return G()},get onStageHunk(){return ue()},get onUnstageHunk(){return Q()},useProvidedContent:!0,get allowHeadReads(){return A()},get canReadHeadFiles(){return F()},get lineOffset(){return e(D)},get virtualizer(){return pt()},get gitRootId(){return vt()},get gitRootPath(){return _t()}})}var Ct=y(Qe,2);{var re=Xe=>{var rt=Eo(),Ke=N(rt),At=N(Ke);Ne(At,{get icon(){return ro},class:"w-3 h-3"});var zt=y(At);H(Ke),H(rt),z(Mt=>K(zt,` ${Mt??""}`),[()=>P.chat_inlineDiffItem_clickToScroll_label()]),cn(1,rt,()=>Ws,()=>({tier:"fast",y:0,scale:1})),cn(2,rt,()=>Bs,()=>({tier:"fast"})),w(Xe,rt)};M(Ct,Xe=>{Te()&&e(Fe)&&Xe(re)})}w(v,_e)},bt=v=>{var _e=No(),Qe=de(_e,!0);z(Ct=>K(Qe,Ct),[()=>P.chat_inlineDiffItem_noWorkspace_label()]),w(v,_e)};M(It,v=>{p?v(Ge):v(bt,-1)})}H(He),on(He,v=>m(qe,v),()=>e(qe)),z(v=>{wt=En(He,1,"inline-diff-container relative",null,wt,{focused:e(Re)}),Ve(He,"aria-label",v)},[()=>P.chat_inlineDiffItem_viewer_ariaLabel()]),sn("mouseenter",He,ie),sn("mouseleave",He,De),sn("wheel",He,Le),ln("focusin",He,jt),ln("focusout",He,qt),w(f,He);var mn=fn(Ht);return c(),mn}xr(["focusin","focusout"]);function Cr(f){return[f.stage,f.type,f.oldLineNumber??"",f.newLineNumber??"",f.content].join("\0")}function Do(f){let r=f.oldStart,l=f.newStart;return f.lines.map(a=>{const c={...a,oldLineNumber:a.oldLineNumber??a.oldNumber,newLineNumber:a.newLineNumber??a.newNumber};return c.oldLineNumber===void 0&&c.newLineNumber===void 0?a.type==="Context"?(c.oldLineNumber=r++,c.newLineNumber=l++):a.type==="Deletion"?c.oldLineNumber=r++:a.type==="Addition"&&(c.newLineNumber=l++):a.type==="Context"?(r=(c.oldLineNumber??r)+1,l=(c.newLineNumber??l)+1):a.type==="Deletion"?r=(c.oldLineNumber??r)+1:a.type==="Addition"&&(l=(c.newLineNumber??l)+1),c})}function zo(f,r){const l=f?f.split(`
2
2
  `):[],a=r?r.split(`
3
3
  `):[];if(l.length===0&&a.length===0)return[];const c=[];for(const p of l)c.push({type:"Deletion",content:p});for(const p of a)c.push({type:"Addition",content:p});return[{oldStart:1,oldLines:l.length,newStart:1,newLines:a.length,lines:c}]}function Mo(f){if(!f||f.length===0)return[];const r=[];for(const a of f){let c=a.change.chunks||[];c.length===0&&(a.change.oldContent!=null||a.change.newContent!=null)&&(c=zo(a.change.oldContent??"",a.change.newContent??"")),c.forEach((p,b)=>{r.push({hunk:p,stage:a.category,part:a,hunkIndex:b})})}if(r.length===0)return[];r.sort((a,c)=>a.hunk.newStart-c.hunk.newStart);const l=[];for(const{hunk:a,stage:c,hunkIndex:p}of r){const C=Do(a).map(A=>({type:A.type,content:A.content,oldLineNumber:A.oldLineNumber,newLineNumber:A.newLineNumber,stage:c,hunkIndex:p}));l.push({headStart:a.oldStart,headLines:a.oldLines,wtStart:a.newStart,wtLines:a.newLines,lines:C,stages:new Set([c])})}return $o(l)}function $o(f){if(f.length<=1)return f;const r=[];let l=f[0];for(let a=1;a<f.length;a++){const c=f[a],p=l.wtStart+l.wtLines;c.wtStart<=p+3?l=Fo(l,c):(r.push(l),l=c)}return r.push(l),r}function Fo(f,r){const l=new Map,a=new Map,c=new Set;for(const h of f.lines)c.add(Cr(h)),h.newLineNumber!==void 0&&l.set(h.newLineNumber,h),h.oldLineNumber!==void 0&&h.type!=="Addition"&&a.set(h.oldLineNumber,h);const p=[...f.lines];for(const h of r.lines){const oe=Cr(h);if(!c.has(oe)){if(h.type==="Context"){const Te=h.newLineNumber!==void 0?l.get(h.newLineNumber):void 0,ue=h.oldLineNumber!==void 0?a.get(h.oldLineNumber):void 0;if(Te?.type==="Context"||ue?.type==="Context"){c.add(oe);continue}}p.push(h),c.add(oe),h.newLineNumber!==void 0&&l.set(h.newLineNumber,h),h.oldLineNumber!==void 0&&h.type!=="Addition"&&a.set(h.oldLineNumber,h)}}p.sort((h,oe)=>{const Te=h.newLineNumber??h.oldLineNumber??0,ue=oe.newLineNumber??oe.oldLineNumber??0;return Te-ue});const b=new Set([...f.stages,...r.stages]),C=Math.min(f.headStart,r.headStart),A=Math.min(f.wtStart,r.wtStart),F=Math.max(f.headStart+f.headLines,r.headStart+r.headLines),G=Math.max(f.wtStart+f.wtLines,r.wtStart+r.wtLines);return{headStart:C,headLines:F-C,wtStart:A,wtLines:G-A,lines:p,stages:b}}function Uo(f){const r=[],l=[];let a=f[0]?.headStart??1,c=f[0]?.wtStart??1;const p=(b,C,A)=>{let F=C;for(;F<A;)b.push(""),F++;return F};for(const b of f){a=p(r,a,b.headStart),c=p(l,c,b.wtStart);for(const C of b.lines)C.type==="Context"?(C.oldLineNumber!==void 0&&(a=p(r,a,C.oldLineNumber)),C.newLineNumber!==void 0&&(c=p(l,c,C.newLineNumber)),r.push(C.content),l.push(C.content),a++,c++):C.type==="Deletion"?(C.oldLineNumber!==void 0&&(a=p(r,a,C.oldLineNumber)),r.push(C.content),a++):C.type==="Addition"&&(C.newLineNumber!==void 0&&(c=p(l,c,C.newLineNumber)),l.push(C.content),c++)}return{oldContent:r.join(`
4
4
  `),newContent:l.join(`
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/1eeMnGBt.js","/app/immutable/chunks/CToUKfVS.js","/app/immutable/chunks/CdmW6laI.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/syxE6N1N.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/XNWMykPO.js","/app/immutable/chunks/g2wqtBd2.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/BgtLN2kD.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/CrYKIqze.js","/app/immutable/chunks/OcoLTaau.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/1cW9cCot.js","/app/immutable/chunks/SFeFj2Mb.js","/app/immutable/chunks/CpBlZvWi.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BtodRLK5.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/DLGpFr8e.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/CNJgwoNk.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/b9Vr5sSO.js","/app/immutable/chunks/DDBvEq_9.js","/app/immutable/chunks/BACH6cFH.js","/app/immutable/chunks/BJzHxIyr.js","/app/immutable/chunks/BwBvFc9f.js","/app/immutable/chunks/BNaHRmzO.js","/app/immutable/chunks/XEwS43QE.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/Btvd3YqX.js","/app/immutable/chunks/DAJaDZx7.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/DzVbP61K.js","/app/immutable/chunks/CAhkQWjW.js","/app/immutable/chunks/Du-ii3l_.js"])))=>i.map(i=>d[i]);
2
- var Mt=Object.defineProperty;var It=(e,t,n)=>t in e?Mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _e=(e,t,n)=>It(e,typeof t!="symbol"?t+"":t,n);import{B as Tt,O as Ct,dE as De,cE as de,dp as Et,al as _t,b0 as je,z as Dt,dQ as xt}from"./CNJgwoNk.js";import{d as qe,r as Rt,i as Bt,k as Pt,j as $t}from"./D3HFKabi.js";import{b as Ot,F as Ut,y as ue,_ as Ve,e as Lt,G as Nt,C as Ht,W as ze,v as Ft,u as Kt}from"./BtodRLK5.js";import{f as Wt}from"./CM-bTlQg.js";import{bo as _,_ as me}from"./syxE6N1N.js";import{a8 as Ge,az as ee,J as pe,a as Ye,n as Je,cL as Qe,e as Xe,aG as Ze,M as jt,aa as qt,aS as xe,d as re,C as Vt,cM as zt,U as Gt,a5 as Yt,aH as Jt,bU as Qt}from"./C46AGI2o.js";import{bD as Xt,bq as Zt,by as en,bs as tn,ax as nn}from"./BgtLN2kD.js";import{Ig as M,g as ye,ny as x,vA as an,Bh as et,vC as sn,Cu as tt,cx as rn,cy as on,nz as nt,nl as cn,c as we,fF as ln,lO as dn,cF as un}from"./CpBlZvWi.js";import{D as Re,a as mn,d as pn}from"./CQcEqK4G.js";import{x as fn,J as hn,ai as gn,ar as yn}from"./BGS5RHiS.js";import{a as Be,b as wn,g as bn}from"./DypB-Dwi.js";import{y as vn}from"./BwBvFc9f.js";import{C as Sn}from"./BvFAWM27.js";import{q as kn,v as An}from"./1cW9cCot.js";import{i as Mn}from"./CnFIAIdG.js";import{o as $,e as In,l as W,s as C,n as se,b as Tn,d as Cn,c as En}from"./CIyUrgF0.js";import{z as _n}from"./CdmW6laI.js";function ws(e,t){if(e)return e.model}function Dn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function bs({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?Tt(e):!1)&&!Dn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function vs(e){return Ct(e.messageMetadata)}function xn(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 Ss(e){return xn({...e,createdAt:Date.parse(e.queuedAt)})}const Rn=8*1024*1024,Bn=3*1024*1024;function Pn(e){return Math.ceil(Math.max(0,e)/3)*4}function $n(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Bn&&typeof t=="number"&&t===Pn(e.size)?t:null}const be={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function Pe(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function fe(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=Ge(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function On(e){const t=e.video==="full"?_.dock_captureEditor_videoFull_label():_.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?_.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?_.dock_captureEditor_voiceTranscript_label():_.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function Un(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 K=Wt;function ks(e){const{view:t,items:n,local:a,labels:s,copy:i}=e,r=t.speech.error??t.speech.capability?.reason??null,o=Un(t.captureError,t.clips.find(g=>g.status==="failed"&&g.error==="permission")?.error??null,r,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?i?.annotationUnavailable:void 0,c=t.annotationIssue,u=t.captureError==="permission",p=c?.error==="permission"&&c.kind!=="pick",y=c?.error==="permission"&&c.kind==="pick",d=r?.startsWith("speech-permission")?"speech":r?.startsWith("microphone-permission")||r==="permission"?"microphone":void 0,f={},w={},m=(g,D,h)=>{f[g]=D,h&&(w[g]=h)};i&&(u&&(m("capture",i.permission,"screen"),t.recording||m("record",i.permission,"screen")),p&&!t.annotating&&m("annotate",i.permission,"screen"),y&&(m("pick",i.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&m("annotate",i.accessibilityPermission,"accessibility")),d&&!t.dictation&&m("mic",(r&&s.speechError?.(r))??i.speechPermission,d));const b=g=>{const D=w[g];D&&e.actions.onOpenSettings(D)},S=new Set(t.evidenceOwnedItemIds),I=t.clips.find(g=>g.status==="recording"),k=t.clips.length>=Ot.clips,v=t.capabilities,B=t.speech.available,E=new Set(t.clips.filter(g=>g.status==="recording"||g.status==="placing"||!!g.media).flatMap(g=>g.captureHistory?.map(D=>D.image.id)??[])),O=[...t.tiles.filter(({image:g,marks:D})=>!!g.media||g.source!=="annotate"||!E.has(g.id)||D.some(({mark:h})=>!h.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.map(g=>({kind:"clip",id:g.contextItemId??g.id,duration:K(g.status==="recording"?Pe(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:On(g.media.saved)}:{},...g.status==="ready"&&fe(e.workspaceId,g.path)?{url:fe(e.workspaceId,g.path)}:{},owner:"evidence",...g.status==="placing"?{status:"placing"}:{},...g.status==="failed"?{status:"failed",...g.error==="limit"?{error:_.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(g=>!S.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:s.recording}:t.dictation?{kind:"listening",label:s.listening}:t.annotating?{kind:"annotating",label:s.annotating}:void 0,...o?{settingsPane:o}:{},...l?{annotationNotice:l}:{},labels:s,attachments:O,...i?{placeholder:t.dictation?"":i.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!v.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:s.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!v.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!v.annotate,recording:t.recording,recordingDisabled:!t.recording&&(!v.record||k),...k&&!t.recording?{recordingTooltip:s.clipLimit}:{},recordingTime:K(I?Pe(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!f.mic,...t.speech.error&&s.speechError?{dictationTooltip:s.speechError(t.speech.error)}:{},dictationTime:t.dictation?K(a.now-t.dictation.startedAt):K(0),inputLevels:t.speech.levels,...Object.keys(f).length?{alerts:f}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:b,beforeSubmit:e.beforeSubmit}}const ve=()=>globalThis.electronAPI,Ln=["image/png","image/jpeg","image/webp"],$e=e=>Ln.includes(e??"")?e:null;function Oe(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 As(e,t){const{view:n,items:a,previews:s}=t,i=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(i){const c=a.find(d=>d.id===i.image.contextItemId),u=i.image.media;if(i.image.mediaError)return null;if(u?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const d={...u,saved:u.saved},f=await t.createSavedPreviewUrl(t.workspaceId,d);try{const w=await t.fetchBytes(f),m=d.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:w,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(m?.w??d.source.width)),height:Math.max(1,Math.round(m?.h??d.source.height)),displayScale:i.image.displayScale,capturedAt:i.image.capturedAt},raw:w,marks:[]}}}finally{t.revokeUrl(f)}}const p=$e(c?.imageMimeType),y=s[i.image.id];return!c?.imageData||!p||!y?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(y),intent:{pixels:{mimeType:p,width:i.image.width,height:i.image.height,displayScale:i.image.displayScale,capturedAt:i.image.capturedAt,...i.image.hash?{hash:i.image.hash}:{}},raw:Oe(c.imageData),marks:i.marks.map(({mark:d})=>({tool:d.tool,geometry:d.geometry,bounds:d.bounds,element:d.element}))}}}const r=n.clips.find(c=>c.id===e||c.contextItemId===e);if(r){const c=r.status==="ready"?fe(t.workspaceId,r.path):null;if(!c)return null;const u=a.find(y=>y.id===r.contextItemId),p=await t.fetchBytes(c);if(!Hn(p))throw new Error("Not a recording file");return{kind:"clip",name:u?.label||`recording-${r.id.slice(0,8)}.mp4`,mimeType:u?.attachmentMimeType||"video/mp4",bytes:p,durationMs:r.durationMs,hasMicAudio:r.hasMicAudio}}const o=a.find(c=>c.id===e),l=$e(o?.imageMimeType);return o?.imageData&&l?{kind:"image",name:o.label||"image",mimeType:l,bytes:Oe(o.imageData)}:null}async function Nn(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 Hn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Ms(e){try{return(await ve()?.invoke(be.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Fn(){try{return await ve()?.invoke(be.CLIPBOARD_READ,{})??null}catch{return null}}async function Is(e){try{const t=await ve()?.invoke(be.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Ue=new WeakSet;async function Kn(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),i=>i.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function Ts(e,{onIntentMedia:t,isCurrent:n,read:a=Fn}){const s=e.clipboardData;if(Ue.has(e)||!s||s.files.length===0)return!1;const i=e.target,r=Array.from(s.files),o=s.types.filter(l=>l!=="Files").map(l=>[l,s.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await Kn(r,l)){n()&&t(l);return}if(!n()||!(i instanceof Node)||!i.isConnected)return;const c=new DataTransfer;for(const p of r)c.items.add(p);for(const[p,y]of o)c.setData(p,y);const u=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Ue.add(u),i.dispatchEvent(u)}),!0}function Wn(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 jn(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function at(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function qn(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 st={placeAttachment:Ze,beginAttachmentUpload:Xe,sendAttachmentUploadChunk:Qe,commitAttachmentUpload:Je,abortAttachmentUpload:Ye,getAttachmentInfo:pe,mintIdempotencyKey:ee};async function Se(e,t,n,a=st){const{idempotencyKey:s}=n,i={...s!==void 0?{idempotencyKey:s}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},r=async f=>zt(f,s)?xe(e,s,a.getAttachmentInfo):void 0;if(at(n.data)<=jt)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...i})}catch(f){const w=await r(f);if(w)return w;throw f}const o=Wn(n.data),l=await qn(o);let c,u;try{({uploadId:c,maxChunkBytes:u}=await a.beginAttachmentUpload(e,t,o.byteLength,l,{mimeType:n.mimeType,...i}))}catch(f){if(s!==void 0&&qt(f)){const w=await xe(e,s,a.getAttachmentInfo);if(w)return w}throw f}const p=Math.min(Gt,u),y=Math.ceil(o.byteLength/p);let d=!1;try{for(let f=0;f<y;f++){const w=o.subarray(f*p,(f+1)*p);await a.sendAttachmentUploadChunk(c,f,jn(w),e)}return d=!0,await a.commitAttachmentUpload(c,e)}catch(f){const w=d?await r(f):void 0;if(w)return w;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),f}}function Vn(e,t){return Yt(e,`image-${Date.now()}-${t+1}`)}class ke extends Error{constructor(n,a){super(n);_e(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function zn(e,t){return e instanceof ke?e.retryBlocks:t}async function Gn(e,t,n=st,a=()=>!0){const s=l=>(...c)=>(re(a),l(...c));n={placeAttachment:s(n.placeAttachment),beginAttachmentUpload:s(n.beginAttachmentUpload),sendAttachmentUploadChunk:s(n.sendAttachmentUploadChunk),commitAttachmentUpload:s(n.commitAttachmentUpload),abortAttachmentUpload:s(n.abortAttachmentUpload),getAttachmentInfo:s(n.getAttachmentInfo),mintIdempotencyKey:s(n.mintIdempotencyKey)};const i=[],r=[],o=[];for(let l=0;l<t.length;l++){re(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const d={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};i.push(d),r.push(d);continue}const u=c,p=u.placementFileName??Vn(u.mimeType,l),y=n.mintIdempotencyKey(u.placementIdempotencyKey);try{const d=await Se(e,p,{data:u.data,mimeType:u.mimeType,...y!==void 0?{idempotencyKey:y}:{}},n),f={type:"image",attachmentId:d.attachmentId,...d.mimeType??u.mimeType?{mimeType:d.mimeType??u.mimeType}:{}};i.push(f),r.push(f)}catch(d){const f=Vt(d);o.push(f?`${p} (${f})`:p),r.push(y!==void 0?{...u,placementIdempotencyKey:y,placementFileName:p}:u)}}if(o.length>0)throw new ke(_.chat_imagePlacement_failed_error({names:o.join(", ")}),r);return re(a),i}const Cs=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:ke,base64DecodedBytes:at,imageRetryBlocks:zn,placeImageAttachment:Se,toImageReferenceBlocks:Gn},Symbol.toStringTag,{value:"Module"}));function it(){try{return Xt()}catch{return null}}function Yn(){return{backendId:M.state.connections.windowBackendId??null,generation:M.state.daemonHealth.connectionGeneration,transport:it()}}class Ae extends Error{constructor(){super("dock-evidence-backend-changed")}}function L(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const N={current:e=>it()===e.transport&&M.state.daemonHealth.connectionGeneration===e.generation&&(M.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>Zt(),placeImage:(e,t,n,a)=>Se(e,t,n,{placeAttachment:L(a,Ze),beginAttachmentUpload:L(a,Xe),sendAttachmentUploadChunk:L(a,Qe),commitAttachmentUpload:L(a,Je),abortAttachmentUpload:L(a,Ye),getAttachmentInfo:L(a,pe),mintIdempotencyKey:ee}),lookup:(e,t)=>pe({workspaceId:e,idempotencyKey:t}),mintKey:ee};function te(e){return N.current(e)}function Jn(e,t){const n=M.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:x(n.drafts,Ut(e,t))?.clearRevision??0,binding:Yn()}}function Es(e,t,n){const a=Jn(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&te(n.binding)}function rt(e,t){return()=>{if(!e.current(t))throw new Ae}}const ot=Object.freeze({rawRetention:!1,chiefAttachments:!1});function _s(e){return e!==ot}const oe=new Map;function ct(e,t=N){const n=`${e.backendId}:${e.generation}`;let a=oe.get(n);if(!a){const s=rt(t,e);a=(async()=>{s();const r=await t.capabilities();s();const o=r?.server?.capabilities;if(!o||typeof o!="object")throw new Error("unobserved");return{rawRetention:o.rawScreenshotRetention===1,chiefAttachments:o.chiefAttachments===1}})().catch(()=>(oe.delete(n),ot)),oe.set(n,a)}return a}class J extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function lt(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function Qn(e){const t=String(e?.message??"");return lt(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function Xn(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const s=Date.parse(a.expiresAt);return Number.isFinite(s)?a.expired||s<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Le(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 Zn extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const Ne=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function ea(e){const t=e.api??N,n=e.now??Date.now,a=rt(t,e.binding);a();const s=await ct(e.binding,t);a();const i=s.rawRetention&&(e.workspaceId!==ye||s.chiefAttachments),r=[];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 u=p=>{c=p,e.onRecord(p)};try{if(!c.composite){const y=c.compositeKey,d=t.mintKey(y??void 0)??null;d!==c.compositeKey&&u({...c,compositeKey:d});let f;y&&d===y&&(a(),f=await t.lookup(e.workspaceId,d).then(Le).catch(()=>{}),a()),f||(a(),f=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}.${Ne(o.composite.mimeType)}`,{data:o.composite.base64,mimeType:o.composite.mimeType,...d?{idempotencyKey:d}:{}},a),a()),u({...c,composite:{attachmentId:f.attachmentId,mimeType:f.mimeType??o.composite.mimeType}})}const p=c.composite.attachmentId;if(i&&o.raw&&!c.raw&&!c.rawSettled){const y=c.rawKey,d=t.mintKey(y??void 0);if(d){d!==c.rawKey&&u({...c,rawKey:d});let f;y&&d===y&&(a(),f=await t.lookup(e.workspaceId,d).then(Le).catch(()=>{}),a());try{f||(a(),f=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}-original.${Ne(o.raw.mimeType)}`,{data:o.raw.base64,mimeType:o.raw.mimeType,idempotencyKey:d,rawScreenshot:{compositeAttachmentId:p}},a),a());const w=Xn(f,p,n());if(w==="expired")u({...c,rawSettled:!0});else if(w)u({...c,raw:w});else throw new J("echo")}catch(w){if(Qn(w))u({...c,rawSettled:!0});else throw w instanceof J?w:lt(w)?new J("refused"):w}}else throw new J("unkeyed")}}catch(p){throw p instanceof Ae?p:new Zn(o.image.id,p)}r.push(c)}return r}async function Ds(e,t,n,a){const s=()=>{if(!N.current(a))throw new Ae};s();const i=await N.placeImage(e,t,{...n,idempotencyKey:N.mintKey()},s);return s(),i}const ta=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"]),na=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class P extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function ne(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!ta.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(s=>na.has(s)?s:"other")].join(":")}function xs(e,t){return e instanceof P?{stage:e.stage,code:ne(e.code)}:{stage:t,code:ne(e)}}function q(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??ue(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(s=>s.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 aa(e,t,n,a,s){const i={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let r="validate";try{const o=()=>{if(!s()||!te(n))throw new Error("media-send-retired")};for(const l of[...t.images,...t.clips]){if(r="validate",l.mediaError)throw new Error("invalid-saved-edit");if(!l.media||q(l.media))continue;o();const c=structuredClone(l.media),u=c.source;let p=c.saved??ue(u,u.capturedMarks??[],c.transcript);const y=crypto.randomUUID();try{if(u.kind==="recording"&&p.voice==="transcript"&&c.transcript?.status!=="ready"){if(r="transcribe",!a?.transcribeMedia)throw new Error("transcript-unavailable");const w=await a.transcribeMedia({jobId:y,media:c});if(o(),!w.ok)throw new Error("transcript-unavailable");c.transcript=w.value,c.saved||(p=ue(u,u.capturedMarks??[],c.transcript))}r="plan";const d=Ve(p,u,c.transcript);if(d.errors.length)throw new Error(d.errors[0]);const f={id:l.id,kind:u.kind,video:p.video,voice:p.voice,transcript:d.transcript,batches:u.batches,marks:d.marks.map(({n:w,mark:m,frameAtMs:b})=>({n:w,id:m.id,at_ms:b,kind:m.kind,label:m.label,note:m.note,context:m.context,geometry:m.geometry}))};if(u.kind==="screenshot"){r="screenshot-source";const w=u.path.split("/").map(encodeURIComponent).join("/"),m=Ge(`intent://local/file/${w}`,e);if(!m||m.kind!=="image")throw new Error("media-source-unavailable");const b=await Nn(m.url);o();const S={base64:qe(b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};r="screenshot-render",i.images[l.id]=await Rt(u,p,S),o()}else{if(!d.clips.length){f.video_attachment_id=null,f.frames=[],f.kept_ms=[],i.metadata.push(f);continue}if(r="overlay-render",!a?.exportMedia)throw new Error("media-export-unavailable");const w=Bt(u,p);if(w.length>1e4)throw new Error("media-animation-layer-limit");const m=[];for(const k of w)o(),m.push({...k,png:await Pt(u,p,k.atMs)});r="export";const b=await a.exportMedia({outputVersion:Lt,jobId:y,media:{...c,saved:p},layers:m});if(o(),!b.ok)throw new Error(["media-export-failed",b.error].filter(Boolean).join(":"));r="placement";const S=[b.value.video,...b.value.frames],I=[];for(let k=0;k<S.length;k++){o();const v=S[k],B=`capture-${l.id.slice(0,12)}-${k}.${k===0?"mp4":v.mimeType==="image/jpeg"?"jpg":"png"}`,E=await Jt(e,B,{sourcePath:v.sourcePath,mimeType:v.mimeType,idempotencyKey:ee()},void 0,void 0,()=>s()&&te(n));o(),k===0?i.files.push({type:"file",attachmentId:E.attachmentId,fileName:B,mimeType:E.mimeType??v.mimeType,size:E.size}):(i.frames.push({type:"image",attachmentId:E.attachmentId,mimeType:v.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),i.framePromptBytes.push($n(v))),I.push(E.attachmentId)}f.video_attachment_id=I[0],f.frames=b.value.frames.map((k,v)=>({mark_id:k.markId,attachment_id:I[v+1]})),f.kept_ms=d.clips}i.metadata.push(f)}finally{await a?.releaseMediaJob?.(y).catch(()=>{})}}return i}catch(o){throw o instanceof P?o:new P(r,ne(o))}}const ce=1568,sa=.85;async function ia(e,t){const n=Math.round(e.length*3/4/1024),a=await ra(e,t),{width:s,height:i}=a,r=s>ce||i>ce;let o=s,l=i;if(r){const m=ce/Math.max(s,i);o=Math.round(s*m),l=Math.round(i*m)}const c=new OffscreenCanvas(o,l),u=c.getContext("2d");if(!u)throw new Error("Failed to get 2D canvas context for image resize");u.drawImage(a,0,0,o,l);let p=t;oa(u,o,l)||(p="image/jpeg");const y=await c.convertToBlob({type:p,quality:p==="image/jpeg"?sa:void 0}),d=y.type||p,f=await ca(y),w=Math.round(f.length*3/4/1024);return console.debug(`[image-resize] ${s}×${i} → ${o}×${l} | ${t} → ${d} | ${n} KB → ${w} KB`),{base64:f,mimeType:d}}async function ra(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let i=0;i<n.length;i++)a[i]=n.charCodeAt(i);const s=new Blob([a],{type:t});return createImageBitmap(s)}function oa(e,t,n){const s=e.getImageData(0,0,t,n).data;for(let i=3;i<s.length;i+=4)if(s[i]<255)return!0;return!1}async function ca(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let s=0;s<n.length;s++)a+=String.fromCharCode(n[s]);return btoa(a)}const T={...Re,badge:Re.badgeRadius*2};function la(e,t,n=1,a=0){const s=Math.max(1,e.displayScale)*n,i=[],r=o=>o*n;for(const{n:o,mark:l}of t){const c=l.geometry;if(c.kind==="rect")i.push({kind:"rect",x:r(c.x),y:r(c.y),w:r(c.w),h:r(c.h),width:T.stroke*s});else if(c.kind==="path")i.push({kind:"path",points:c.points.map(f=>({x:r(f.x),y:r(f.y)})),width:T.pen*s});else{const f={x:r(c.from.x),y:r(c.from.y)},w={x:r(c.to.x),y:r(c.to.y)};i.push({kind:"arrow",from:f,to:w,head:fa(f,w,T.arrowHead*s),width:T.stroke*s})}if(!T.showNumbers)continue;const u=Math.max(a,T.badge/2*s),p=r(l.bounds.x+l.bounds.w),y=r(l.bounds.y),d=pn({x:r(l.bounds.x),y,w:p-r(l.bounds.x),h:r(l.bounds.h)},{x:0,y:0,w:r(e.width),h:r(e.height)},s,u);i.push({kind:"badge",...d,radius:u,label:String(o),font:u*T.badgeTextScale})}return i}function da(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,s,i)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*s,i(),e.strokeStyle=T.accent,e.lineWidth=a,i()};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 s=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&s.forEach((r,o)=>o?e.lineTo(r.x,r.y):e.moveTo(r.x,r.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 i=a.kind==="path"?new Path2D(mn(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>i?e.stroke(i):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 ua(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function ma(e){const t=await e.convertToBlob({type:"image/png"});return qe(await t.arrayBuffer())}async function dt(e,t,n,a,s=0){await $t();const i=await ua(e.base64,e.mimeType);try{const r=Math.min(1,a/Math.max(t.width,t.height)),o=new OffscreenCanvas(Math.max(1,Math.round(t.width*r)),Math.max(1,Math.round(t.height*r))),l=o.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(i,0,0,o.width,o.height),da(l,la(t,n,r,s)),o}finally{i.close()}}async function pa(e,t,n){const a=await dt(e,t,n,Math.max(t.width,t.height));return ia(await ma(a),"image/png")}async function Rs(e,t,n,a=384){const s=await dt(e,t,n,a,a/32);return URL.createObjectURL(await s.convertToBlob({type:"image/png"}))}function fa(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),s=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-s),y:t.y-n*Math.sin(a-s)},right:{x:t.x-n*Math.cos(a+s),y:t.y-n*Math.sin(a+s)}}}function Bs(e,t){const n=Nt(t??void 0),a=new Set(t?.clips.filter(s=>!!s.media&&!q(s.media)).map(s=>s.contextItemId));return e.filter(s=>!n.has(s.id)&&!a.has(s.id))}async function Ps({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:s,clickedPayload:i,binding:r,service:o,current:l,onRecord:c}){const u=()=>{if(!l()||!te(r))throw new P("validate","media-send-retired")};if(u(),n?.images.some(h=>h.mediaError)||n?.clips.some(h=>h.mediaError))throw new P("validate","invalid-saved-edit");const p=h=>!!h.media&&!q(h.media),y=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(h=>[h.id,a.find(A=>A.id===h.contextItemId)?.attachmentId??null]))}:null;for(const h of n?.clips??[]){if(!h.media||!q(h.media))continue;const A=a.find(G=>G.id===h.contextItemId);if(!A||A.attachmentId!==h.media.source.attachmentId||A.path!==h.media.source.path||A.placementStatus!==void 0&&A.placementStatus!=="placed")throw new P("validate","legacy-original-unavailable")}const d=n?await aa(e,n,r,o,l):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},f=new Set(n?.clips.filter(h=>p(h)||!!h.media&&q(h.media)).map(h=>h.id)),w=new Set(n?.clips.filter(h=>f.has(h.id)).flatMap(h=>(h.captureHistory??[]).map(A=>A.image.id))),m=(n?.images??[]).filter(h=>h.source!=="annotate"||!!h.media||!w.has(h.id)||n.marks.some(A=>A.imageId===h.id&&!(A.clipId&&f.has(A.clipId))));let b=[];try{b=n?await ha({...n,images:m},a,d.images):[]}catch(h){throw new P("burn",ne(h))}if(d.framePromptBytes.reduce((h,A)=>h+(A??0),0)>Rn)throw new P("validate","image-budget-exceeded");const I=new Set(n?.images.filter(h=>h.media).map(h=>h.id)),k=n?{...n,images:m.map(h=>d.images[h.id]?{...h,width:d.images[h.id].width,height:d.images[h.id].height}:h),clips:n.clips.filter(h=>!p(h)),marks:n.marks.filter(h=>!I.has(h.imageId)&&!n.clips.some(A=>p(A)&&A.id===h.clipId))}:null;u();const v=d.metadata.some(h=>typeof h.transcript=="string"&&h.transcript.trim());if(!i.text.trim()&&!s.length&&!i.workspaceContextStr?.trim()&&!b.length&&!d.files.length&&!d.frames.length&&!i.imageBlocks?.length&&!i.fileBlocks?.length&&!v)return null;let B=b,E=null;const O=n?await ct(r):null;if(u(),n&&(e!==ye||O?.chiefAttachments)){const h=await ea({workspaceId:e,binding:r,images:m.map((A,G)=>{const Y=a.find(At=>At.id===A.contextItemId);return{image:A,signature:Ht(n,A.id),composite:{base64:b[G].data,mimeType:b[G].mimeType},raw:!A.media&&Y?.imageData&&Y.imageMimeType?{base64:Y.imageData,mimeType:Y.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),B=h.map(A=>({type:"image",attachmentId:A.composite.attachmentId,mimeType:A.composite.mimeType})),E=Object.fromEntries(h.map(A=>[A.imageId,{attachmentId:A.composite.attachmentId,raw:A.raw}]))}const ie=new Map(n?ze(n).map(({n:h,mark:A})=>[A.id,h]):[]),g=y&&E?{...y,imageAttachments:E,markNumbers:ie}:y&&{...y,markNumbers:ie},D=n&&g?{...i,imageBlocks:[...B,...d.frames,...i.imageBlocks??[]],fileBlocks:[...i.fileBlocks??[],...d.files],workspaceContextStr:[Kt(k,g),d.metadata.length?`[Edited capture outputs]
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/He8rzvWn.js","/app/immutable/chunks/CToUKfVS.js","/app/immutable/chunks/CdmW6laI.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/syxE6N1N.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/XNWMykPO.js","/app/immutable/chunks/g2wqtBd2.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/BgtLN2kD.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/CrYKIqze.js","/app/immutable/chunks/OcoLTaau.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/1cW9cCot.js","/app/immutable/chunks/SFeFj2Mb.js","/app/immutable/chunks/CpBlZvWi.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BtodRLK5.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/DLGpFr8e.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/CNJgwoNk.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/b9Vr5sSO.js","/app/immutable/chunks/DDBvEq_9.js","/app/immutable/chunks/BACH6cFH.js","/app/immutable/chunks/BJzHxIyr.js","/app/immutable/chunks/BwBvFc9f.js","/app/immutable/chunks/BNaHRmzO.js","/app/immutable/chunks/XEwS43QE.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/BsC5Vdmg.js","/app/immutable/chunks/DAJaDZx7.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/DzVbP61K.js","/app/immutable/chunks/CAhkQWjW.js","/app/immutable/chunks/Du-ii3l_.js"])))=>i.map(i=>d[i]);
2
+ var Mt=Object.defineProperty;var It=(e,t,n)=>t in e?Mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _e=(e,t,n)=>It(e,typeof t!="symbol"?t+"":t,n);import{B as Tt,O as Ct,dE as De,cE as de,dp as Et,al as _t,b0 as je,z as Dt,dQ as xt}from"./CNJgwoNk.js";import{d as qe,r as Rt,i as Bt,k as Pt,j as $t}from"./D3HFKabi.js";import{b as Ot,F as Ut,y as ue,_ as Ve,e as Lt,G as Nt,C as Ht,W as ze,v as Ft,u as Kt}from"./BtodRLK5.js";import{f as Wt}from"./CM-bTlQg.js";import{bo as _,_ as me}from"./syxE6N1N.js";import{a8 as Ge,az as ee,J as pe,a as Ye,n as Je,cL as Qe,e as Xe,aG as Ze,M as jt,aa as qt,aS as xe,d as re,C as Vt,cM as zt,U as Gt,a5 as Yt,aH as Jt,bU as Qt}from"./BX3vzTpn.js";import{bD as Xt,bq as Zt,by as en,bs as tn,ax as nn}from"./BgtLN2kD.js";import{Ig as M,g as ye,ny as x,vA as an,Bh as et,vC as sn,Cu as tt,cx as rn,cy as on,nz as nt,nl as cn,c as we,fF as ln,lO as dn,cF as un}from"./CpBlZvWi.js";import{D as Re,a as mn,d as pn}from"./CQcEqK4G.js";import{x as fn,J as hn,ai as gn,ar as yn}from"./CFMVBWPg.js";import{a as Be,b as wn,g as bn}from"./DypB-Dwi.js";import{y as vn}from"./BwBvFc9f.js";import{C as Sn}from"./BvFAWM27.js";import{q as kn,v as An}from"./1cW9cCot.js";import{i as Mn}from"./CnFIAIdG.js";import{o as $,e as In,l as W,s as C,n as se,b as Tn,d as Cn,c as En}from"./CIyUrgF0.js";import{z as _n}from"./CdmW6laI.js";function ws(e,t){if(e)return e.model}function Dn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function bs({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?Tt(e):!1)&&!Dn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function vs(e){return Ct(e.messageMetadata)}function xn(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 Ss(e){return xn({...e,createdAt:Date.parse(e.queuedAt)})}const Rn=8*1024*1024,Bn=3*1024*1024;function Pn(e){return Math.ceil(Math.max(0,e)/3)*4}function $n(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Bn&&typeof t=="number"&&t===Pn(e.size)?t:null}const be={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function Pe(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function fe(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=Ge(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function On(e){const t=e.video==="full"?_.dock_captureEditor_videoFull_label():_.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?_.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?_.dock_captureEditor_voiceTranscript_label():_.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function Un(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 K=Wt;function ks(e){const{view:t,items:n,local:a,labels:s,copy:i}=e,r=t.speech.error??t.speech.capability?.reason??null,o=Un(t.captureError,t.clips.find(g=>g.status==="failed"&&g.error==="permission")?.error??null,r,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?i?.annotationUnavailable:void 0,c=t.annotationIssue,u=t.captureError==="permission",p=c?.error==="permission"&&c.kind!=="pick",y=c?.error==="permission"&&c.kind==="pick",d=r?.startsWith("speech-permission")?"speech":r?.startsWith("microphone-permission")||r==="permission"?"microphone":void 0,f={},w={},m=(g,D,h)=>{f[g]=D,h&&(w[g]=h)};i&&(u&&(m("capture",i.permission,"screen"),t.recording||m("record",i.permission,"screen")),p&&!t.annotating&&m("annotate",i.permission,"screen"),y&&(m("pick",i.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&m("annotate",i.accessibilityPermission,"accessibility")),d&&!t.dictation&&m("mic",(r&&s.speechError?.(r))??i.speechPermission,d));const b=g=>{const D=w[g];D&&e.actions.onOpenSettings(D)},S=new Set(t.evidenceOwnedItemIds),I=t.clips.find(g=>g.status==="recording"),k=t.clips.length>=Ot.clips,v=t.capabilities,B=t.speech.available,E=new Set(t.clips.filter(g=>g.status==="recording"||g.status==="placing"||!!g.media).flatMap(g=>g.captureHistory?.map(D=>D.image.id)??[])),O=[...t.tiles.filter(({image:g,marks:D})=>!!g.media||g.source!=="annotate"||!E.has(g.id)||D.some(({mark:h})=>!h.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.map(g=>({kind:"clip",id:g.contextItemId??g.id,duration:K(g.status==="recording"?Pe(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:On(g.media.saved)}:{},...g.status==="ready"&&fe(e.workspaceId,g.path)?{url:fe(e.workspaceId,g.path)}:{},owner:"evidence",...g.status==="placing"?{status:"placing"}:{},...g.status==="failed"?{status:"failed",...g.error==="limit"?{error:_.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(g=>!S.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:s.recording}:t.dictation?{kind:"listening",label:s.listening}:t.annotating?{kind:"annotating",label:s.annotating}:void 0,...o?{settingsPane:o}:{},...l?{annotationNotice:l}:{},labels:s,attachments:O,...i?{placeholder:t.dictation?"":i.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!v.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:s.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!v.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!v.annotate,recording:t.recording,recordingDisabled:!t.recording&&(!v.record||k),...k&&!t.recording?{recordingTooltip:s.clipLimit}:{},recordingTime:K(I?Pe(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!f.mic,...t.speech.error&&s.speechError?{dictationTooltip:s.speechError(t.speech.error)}:{},dictationTime:t.dictation?K(a.now-t.dictation.startedAt):K(0),inputLevels:t.speech.levels,...Object.keys(f).length?{alerts:f}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:b,beforeSubmit:e.beforeSubmit}}const ve=()=>globalThis.electronAPI,Ln=["image/png","image/jpeg","image/webp"],$e=e=>Ln.includes(e??"")?e:null;function Oe(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 As(e,t){const{view:n,items:a,previews:s}=t,i=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(i){const c=a.find(d=>d.id===i.image.contextItemId),u=i.image.media;if(i.image.mediaError)return null;if(u?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const d={...u,saved:u.saved},f=await t.createSavedPreviewUrl(t.workspaceId,d);try{const w=await t.fetchBytes(f),m=d.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:w,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(m?.w??d.source.width)),height:Math.max(1,Math.round(m?.h??d.source.height)),displayScale:i.image.displayScale,capturedAt:i.image.capturedAt},raw:w,marks:[]}}}finally{t.revokeUrl(f)}}const p=$e(c?.imageMimeType),y=s[i.image.id];return!c?.imageData||!p||!y?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(y),intent:{pixels:{mimeType:p,width:i.image.width,height:i.image.height,displayScale:i.image.displayScale,capturedAt:i.image.capturedAt,...i.image.hash?{hash:i.image.hash}:{}},raw:Oe(c.imageData),marks:i.marks.map(({mark:d})=>({tool:d.tool,geometry:d.geometry,bounds:d.bounds,element:d.element}))}}}const r=n.clips.find(c=>c.id===e||c.contextItemId===e);if(r){const c=r.status==="ready"?fe(t.workspaceId,r.path):null;if(!c)return null;const u=a.find(y=>y.id===r.contextItemId),p=await t.fetchBytes(c);if(!Hn(p))throw new Error("Not a recording file");return{kind:"clip",name:u?.label||`recording-${r.id.slice(0,8)}.mp4`,mimeType:u?.attachmentMimeType||"video/mp4",bytes:p,durationMs:r.durationMs,hasMicAudio:r.hasMicAudio}}const o=a.find(c=>c.id===e),l=$e(o?.imageMimeType);return o?.imageData&&l?{kind:"image",name:o.label||"image",mimeType:l,bytes:Oe(o.imageData)}:null}async function Nn(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 Hn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Ms(e){try{return(await ve()?.invoke(be.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Fn(){try{return await ve()?.invoke(be.CLIPBOARD_READ,{})??null}catch{return null}}async function Is(e){try{const t=await ve()?.invoke(be.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Ue=new WeakSet;async function Kn(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),i=>i.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function Ts(e,{onIntentMedia:t,isCurrent:n,read:a=Fn}){const s=e.clipboardData;if(Ue.has(e)||!s||s.files.length===0)return!1;const i=e.target,r=Array.from(s.files),o=s.types.filter(l=>l!=="Files").map(l=>[l,s.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await Kn(r,l)){n()&&t(l);return}if(!n()||!(i instanceof Node)||!i.isConnected)return;const c=new DataTransfer;for(const p of r)c.items.add(p);for(const[p,y]of o)c.setData(p,y);const u=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Ue.add(u),i.dispatchEvent(u)}),!0}function Wn(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 jn(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function at(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function qn(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 st={placeAttachment:Ze,beginAttachmentUpload:Xe,sendAttachmentUploadChunk:Qe,commitAttachmentUpload:Je,abortAttachmentUpload:Ye,getAttachmentInfo:pe,mintIdempotencyKey:ee};async function Se(e,t,n,a=st){const{idempotencyKey:s}=n,i={...s!==void 0?{idempotencyKey:s}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},r=async f=>zt(f,s)?xe(e,s,a.getAttachmentInfo):void 0;if(at(n.data)<=jt)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...i})}catch(f){const w=await r(f);if(w)return w;throw f}const o=Wn(n.data),l=await qn(o);let c,u;try{({uploadId:c,maxChunkBytes:u}=await a.beginAttachmentUpload(e,t,o.byteLength,l,{mimeType:n.mimeType,...i}))}catch(f){if(s!==void 0&&qt(f)){const w=await xe(e,s,a.getAttachmentInfo);if(w)return w}throw f}const p=Math.min(Gt,u),y=Math.ceil(o.byteLength/p);let d=!1;try{for(let f=0;f<y;f++){const w=o.subarray(f*p,(f+1)*p);await a.sendAttachmentUploadChunk(c,f,jn(w),e)}return d=!0,await a.commitAttachmentUpload(c,e)}catch(f){const w=d?await r(f):void 0;if(w)return w;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),f}}function Vn(e,t){return Yt(e,`image-${Date.now()}-${t+1}`)}class ke extends Error{constructor(n,a){super(n);_e(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function zn(e,t){return e instanceof ke?e.retryBlocks:t}async function Gn(e,t,n=st,a=()=>!0){const s=l=>(...c)=>(re(a),l(...c));n={placeAttachment:s(n.placeAttachment),beginAttachmentUpload:s(n.beginAttachmentUpload),sendAttachmentUploadChunk:s(n.sendAttachmentUploadChunk),commitAttachmentUpload:s(n.commitAttachmentUpload),abortAttachmentUpload:s(n.abortAttachmentUpload),getAttachmentInfo:s(n.getAttachmentInfo),mintIdempotencyKey:s(n.mintIdempotencyKey)};const i=[],r=[],o=[];for(let l=0;l<t.length;l++){re(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const d={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};i.push(d),r.push(d);continue}const u=c,p=u.placementFileName??Vn(u.mimeType,l),y=n.mintIdempotencyKey(u.placementIdempotencyKey);try{const d=await Se(e,p,{data:u.data,mimeType:u.mimeType,...y!==void 0?{idempotencyKey:y}:{}},n),f={type:"image",attachmentId:d.attachmentId,...d.mimeType??u.mimeType?{mimeType:d.mimeType??u.mimeType}:{}};i.push(f),r.push(f)}catch(d){const f=Vt(d);o.push(f?`${p} (${f})`:p),r.push(y!==void 0?{...u,placementIdempotencyKey:y,placementFileName:p}:u)}}if(o.length>0)throw new ke(_.chat_imagePlacement_failed_error({names:o.join(", ")}),r);return re(a),i}const Cs=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:ke,base64DecodedBytes:at,imageRetryBlocks:zn,placeImageAttachment:Se,toImageReferenceBlocks:Gn},Symbol.toStringTag,{value:"Module"}));function it(){try{return Xt()}catch{return null}}function Yn(){return{backendId:M.state.connections.windowBackendId??null,generation:M.state.daemonHealth.connectionGeneration,transport:it()}}class Ae extends Error{constructor(){super("dock-evidence-backend-changed")}}function L(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const N={current:e=>it()===e.transport&&M.state.daemonHealth.connectionGeneration===e.generation&&(M.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>Zt(),placeImage:(e,t,n,a)=>Se(e,t,n,{placeAttachment:L(a,Ze),beginAttachmentUpload:L(a,Xe),sendAttachmentUploadChunk:L(a,Qe),commitAttachmentUpload:L(a,Je),abortAttachmentUpload:L(a,Ye),getAttachmentInfo:L(a,pe),mintIdempotencyKey:ee}),lookup:(e,t)=>pe({workspaceId:e,idempotencyKey:t}),mintKey:ee};function te(e){return N.current(e)}function Jn(e,t){const n=M.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:x(n.drafts,Ut(e,t))?.clearRevision??0,binding:Yn()}}function Es(e,t,n){const a=Jn(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&te(n.binding)}function rt(e,t){return()=>{if(!e.current(t))throw new Ae}}const ot=Object.freeze({rawRetention:!1,chiefAttachments:!1});function _s(e){return e!==ot}const oe=new Map;function ct(e,t=N){const n=`${e.backendId}:${e.generation}`;let a=oe.get(n);if(!a){const s=rt(t,e);a=(async()=>{s();const r=await t.capabilities();s();const o=r?.server?.capabilities;if(!o||typeof o!="object")throw new Error("unobserved");return{rawRetention:o.rawScreenshotRetention===1,chiefAttachments:o.chiefAttachments===1}})().catch(()=>(oe.delete(n),ot)),oe.set(n,a)}return a}class J extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function lt(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function Qn(e){const t=String(e?.message??"");return lt(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function Xn(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const s=Date.parse(a.expiresAt);return Number.isFinite(s)?a.expired||s<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Le(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 Zn extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const Ne=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function ea(e){const t=e.api??N,n=e.now??Date.now,a=rt(t,e.binding);a();const s=await ct(e.binding,t);a();const i=s.rawRetention&&(e.workspaceId!==ye||s.chiefAttachments),r=[];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 u=p=>{c=p,e.onRecord(p)};try{if(!c.composite){const y=c.compositeKey,d=t.mintKey(y??void 0)??null;d!==c.compositeKey&&u({...c,compositeKey:d});let f;y&&d===y&&(a(),f=await t.lookup(e.workspaceId,d).then(Le).catch(()=>{}),a()),f||(a(),f=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}.${Ne(o.composite.mimeType)}`,{data:o.composite.base64,mimeType:o.composite.mimeType,...d?{idempotencyKey:d}:{}},a),a()),u({...c,composite:{attachmentId:f.attachmentId,mimeType:f.mimeType??o.composite.mimeType}})}const p=c.composite.attachmentId;if(i&&o.raw&&!c.raw&&!c.rawSettled){const y=c.rawKey,d=t.mintKey(y??void 0);if(d){d!==c.rawKey&&u({...c,rawKey:d});let f;y&&d===y&&(a(),f=await t.lookup(e.workspaceId,d).then(Le).catch(()=>{}),a());try{f||(a(),f=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}-original.${Ne(o.raw.mimeType)}`,{data:o.raw.base64,mimeType:o.raw.mimeType,idempotencyKey:d,rawScreenshot:{compositeAttachmentId:p}},a),a());const w=Xn(f,p,n());if(w==="expired")u({...c,rawSettled:!0});else if(w)u({...c,raw:w});else throw new J("echo")}catch(w){if(Qn(w))u({...c,rawSettled:!0});else throw w instanceof J?w:lt(w)?new J("refused"):w}}else throw new J("unkeyed")}}catch(p){throw p instanceof Ae?p:new Zn(o.image.id,p)}r.push(c)}return r}async function Ds(e,t,n,a){const s=()=>{if(!N.current(a))throw new Ae};s();const i=await N.placeImage(e,t,{...n,idempotencyKey:N.mintKey()},s);return s(),i}const ta=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"]),na=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class P extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function ne(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!ta.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(s=>na.has(s)?s:"other")].join(":")}function xs(e,t){return e instanceof P?{stage:e.stage,code:ne(e.code)}:{stage:t,code:ne(e)}}function q(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??ue(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(s=>s.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 aa(e,t,n,a,s){const i={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let r="validate";try{const o=()=>{if(!s()||!te(n))throw new Error("media-send-retired")};for(const l of[...t.images,...t.clips]){if(r="validate",l.mediaError)throw new Error("invalid-saved-edit");if(!l.media||q(l.media))continue;o();const c=structuredClone(l.media),u=c.source;let p=c.saved??ue(u,u.capturedMarks??[],c.transcript);const y=crypto.randomUUID();try{if(u.kind==="recording"&&p.voice==="transcript"&&c.transcript?.status!=="ready"){if(r="transcribe",!a?.transcribeMedia)throw new Error("transcript-unavailable");const w=await a.transcribeMedia({jobId:y,media:c});if(o(),!w.ok)throw new Error("transcript-unavailable");c.transcript=w.value,c.saved||(p=ue(u,u.capturedMarks??[],c.transcript))}r="plan";const d=Ve(p,u,c.transcript);if(d.errors.length)throw new Error(d.errors[0]);const f={id:l.id,kind:u.kind,video:p.video,voice:p.voice,transcript:d.transcript,batches:u.batches,marks:d.marks.map(({n:w,mark:m,frameAtMs:b})=>({n:w,id:m.id,at_ms:b,kind:m.kind,label:m.label,note:m.note,context:m.context,geometry:m.geometry}))};if(u.kind==="screenshot"){r="screenshot-source";const w=u.path.split("/").map(encodeURIComponent).join("/"),m=Ge(`intent://local/file/${w}`,e);if(!m||m.kind!=="image")throw new Error("media-source-unavailable");const b=await Nn(m.url);o();const S={base64:qe(b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};r="screenshot-render",i.images[l.id]=await Rt(u,p,S),o()}else{if(!d.clips.length){f.video_attachment_id=null,f.frames=[],f.kept_ms=[],i.metadata.push(f);continue}if(r="overlay-render",!a?.exportMedia)throw new Error("media-export-unavailable");const w=Bt(u,p);if(w.length>1e4)throw new Error("media-animation-layer-limit");const m=[];for(const k of w)o(),m.push({...k,png:await Pt(u,p,k.atMs)});r="export";const b=await a.exportMedia({outputVersion:Lt,jobId:y,media:{...c,saved:p},layers:m});if(o(),!b.ok)throw new Error(["media-export-failed",b.error].filter(Boolean).join(":"));r="placement";const S=[b.value.video,...b.value.frames],I=[];for(let k=0;k<S.length;k++){o();const v=S[k],B=`capture-${l.id.slice(0,12)}-${k}.${k===0?"mp4":v.mimeType==="image/jpeg"?"jpg":"png"}`,E=await Jt(e,B,{sourcePath:v.sourcePath,mimeType:v.mimeType,idempotencyKey:ee()},void 0,void 0,()=>s()&&te(n));o(),k===0?i.files.push({type:"file",attachmentId:E.attachmentId,fileName:B,mimeType:E.mimeType??v.mimeType,size:E.size}):(i.frames.push({type:"image",attachmentId:E.attachmentId,mimeType:v.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),i.framePromptBytes.push($n(v))),I.push(E.attachmentId)}f.video_attachment_id=I[0],f.frames=b.value.frames.map((k,v)=>({mark_id:k.markId,attachment_id:I[v+1]})),f.kept_ms=d.clips}i.metadata.push(f)}finally{await a?.releaseMediaJob?.(y).catch(()=>{})}}return i}catch(o){throw o instanceof P?o:new P(r,ne(o))}}const ce=1568,sa=.85;async function ia(e,t){const n=Math.round(e.length*3/4/1024),a=await ra(e,t),{width:s,height:i}=a,r=s>ce||i>ce;let o=s,l=i;if(r){const m=ce/Math.max(s,i);o=Math.round(s*m),l=Math.round(i*m)}const c=new OffscreenCanvas(o,l),u=c.getContext("2d");if(!u)throw new Error("Failed to get 2D canvas context for image resize");u.drawImage(a,0,0,o,l);let p=t;oa(u,o,l)||(p="image/jpeg");const y=await c.convertToBlob({type:p,quality:p==="image/jpeg"?sa:void 0}),d=y.type||p,f=await ca(y),w=Math.round(f.length*3/4/1024);return console.debug(`[image-resize] ${s}×${i} → ${o}×${l} | ${t} → ${d} | ${n} KB → ${w} KB`),{base64:f,mimeType:d}}async function ra(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let i=0;i<n.length;i++)a[i]=n.charCodeAt(i);const s=new Blob([a],{type:t});return createImageBitmap(s)}function oa(e,t,n){const s=e.getImageData(0,0,t,n).data;for(let i=3;i<s.length;i+=4)if(s[i]<255)return!0;return!1}async function ca(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let s=0;s<n.length;s++)a+=String.fromCharCode(n[s]);return btoa(a)}const T={...Re,badge:Re.badgeRadius*2};function la(e,t,n=1,a=0){const s=Math.max(1,e.displayScale)*n,i=[],r=o=>o*n;for(const{n:o,mark:l}of t){const c=l.geometry;if(c.kind==="rect")i.push({kind:"rect",x:r(c.x),y:r(c.y),w:r(c.w),h:r(c.h),width:T.stroke*s});else if(c.kind==="path")i.push({kind:"path",points:c.points.map(f=>({x:r(f.x),y:r(f.y)})),width:T.pen*s});else{const f={x:r(c.from.x),y:r(c.from.y)},w={x:r(c.to.x),y:r(c.to.y)};i.push({kind:"arrow",from:f,to:w,head:fa(f,w,T.arrowHead*s),width:T.stroke*s})}if(!T.showNumbers)continue;const u=Math.max(a,T.badge/2*s),p=r(l.bounds.x+l.bounds.w),y=r(l.bounds.y),d=pn({x:r(l.bounds.x),y,w:p-r(l.bounds.x),h:r(l.bounds.h)},{x:0,y:0,w:r(e.width),h:r(e.height)},s,u);i.push({kind:"badge",...d,radius:u,label:String(o),font:u*T.badgeTextScale})}return i}function da(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,s,i)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*s,i(),e.strokeStyle=T.accent,e.lineWidth=a,i()};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 s=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&s.forEach((r,o)=>o?e.lineTo(r.x,r.y):e.moveTo(r.x,r.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 i=a.kind==="path"?new Path2D(mn(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>i?e.stroke(i):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 ua(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function ma(e){const t=await e.convertToBlob({type:"image/png"});return qe(await t.arrayBuffer())}async function dt(e,t,n,a,s=0){await $t();const i=await ua(e.base64,e.mimeType);try{const r=Math.min(1,a/Math.max(t.width,t.height)),o=new OffscreenCanvas(Math.max(1,Math.round(t.width*r)),Math.max(1,Math.round(t.height*r))),l=o.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(i,0,0,o.width,o.height),da(l,la(t,n,r,s)),o}finally{i.close()}}async function pa(e,t,n){const a=await dt(e,t,n,Math.max(t.width,t.height));return ia(await ma(a),"image/png")}async function Rs(e,t,n,a=384){const s=await dt(e,t,n,a,a/32);return URL.createObjectURL(await s.convertToBlob({type:"image/png"}))}function fa(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),s=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-s),y:t.y-n*Math.sin(a-s)},right:{x:t.x-n*Math.cos(a+s),y:t.y-n*Math.sin(a+s)}}}function Bs(e,t){const n=Nt(t??void 0),a=new Set(t?.clips.filter(s=>!!s.media&&!q(s.media)).map(s=>s.contextItemId));return e.filter(s=>!n.has(s.id)&&!a.has(s.id))}async function Ps({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:s,clickedPayload:i,binding:r,service:o,current:l,onRecord:c}){const u=()=>{if(!l()||!te(r))throw new P("validate","media-send-retired")};if(u(),n?.images.some(h=>h.mediaError)||n?.clips.some(h=>h.mediaError))throw new P("validate","invalid-saved-edit");const p=h=>!!h.media&&!q(h.media),y=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(h=>[h.id,a.find(A=>A.id===h.contextItemId)?.attachmentId??null]))}:null;for(const h of n?.clips??[]){if(!h.media||!q(h.media))continue;const A=a.find(G=>G.id===h.contextItemId);if(!A||A.attachmentId!==h.media.source.attachmentId||A.path!==h.media.source.path||A.placementStatus!==void 0&&A.placementStatus!=="placed")throw new P("validate","legacy-original-unavailable")}const d=n?await aa(e,n,r,o,l):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},f=new Set(n?.clips.filter(h=>p(h)||!!h.media&&q(h.media)).map(h=>h.id)),w=new Set(n?.clips.filter(h=>f.has(h.id)).flatMap(h=>(h.captureHistory??[]).map(A=>A.image.id))),m=(n?.images??[]).filter(h=>h.source!=="annotate"||!!h.media||!w.has(h.id)||n.marks.some(A=>A.imageId===h.id&&!(A.clipId&&f.has(A.clipId))));let b=[];try{b=n?await ha({...n,images:m},a,d.images):[]}catch(h){throw new P("burn",ne(h))}if(d.framePromptBytes.reduce((h,A)=>h+(A??0),0)>Rn)throw new P("validate","image-budget-exceeded");const I=new Set(n?.images.filter(h=>h.media).map(h=>h.id)),k=n?{...n,images:m.map(h=>d.images[h.id]?{...h,width:d.images[h.id].width,height:d.images[h.id].height}:h),clips:n.clips.filter(h=>!p(h)),marks:n.marks.filter(h=>!I.has(h.imageId)&&!n.clips.some(A=>p(A)&&A.id===h.clipId))}:null;u();const v=d.metadata.some(h=>typeof h.transcript=="string"&&h.transcript.trim());if(!i.text.trim()&&!s.length&&!i.workspaceContextStr?.trim()&&!b.length&&!d.files.length&&!d.frames.length&&!i.imageBlocks?.length&&!i.fileBlocks?.length&&!v)return null;let B=b,E=null;const O=n?await ct(r):null;if(u(),n&&(e!==ye||O?.chiefAttachments)){const h=await ea({workspaceId:e,binding:r,images:m.map((A,G)=>{const Y=a.find(At=>At.id===A.contextItemId);return{image:A,signature:Ht(n,A.id),composite:{base64:b[G].data,mimeType:b[G].mimeType},raw:!A.media&&Y?.imageData&&Y.imageMimeType?{base64:Y.imageData,mimeType:Y.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),B=h.map(A=>({type:"image",attachmentId:A.composite.attachmentId,mimeType:A.composite.mimeType})),E=Object.fromEntries(h.map(A=>[A.imageId,{attachmentId:A.composite.attachmentId,raw:A.raw}]))}const ie=new Map(n?ze(n).map(({n:h,mark:A})=>[A.id,h]):[]),g=y&&E?{...y,imageAttachments:E,markNumbers:ie}:y&&{...y,markNumbers:ie},D=n&&g?{...i,imageBlocks:[...B,...d.frames,...i.imageBlocks??[]],fileBlocks:[...i.fileBlocks??[],...d.files],workspaceContextStr:[Kt(k,g),d.metadata.length?`[Edited capture outputs]
3
3
  ${JSON.stringify(d.metadata)}`:"",i.workspaceContextStr].filter(Boolean).join(`
4
4
 
5
5
  `),messageMetadata:{...i.messageMetadata,...Ft(k,g),edited_captures:d.metadata}}:i;return u(),D}async function ha(e,t,n={}){const a=ze(e);return Promise.all(e.images.map(async s=>{if(n[s.id])return{type:"image",...n[s.id]};const i=t.find(o=>o.id===s.contextItemId);if(!i?.imageData||!i.imageMimeType)throw new Error("dock-evidence-missing-pixels");const r=await pa({base64:i.imageData,mimeType:i.imageMimeType},s,a.filter(({mark:o})=>o.imageId===s.id));return{type:"image",data:r.base64,mimeType:r.mimeType}}))}function ga(e){try{return new URL(e.pageUrl).hostname||e.pageUrl}catch{return e.pageUrl}}function $s(e,t){return e.targetAgentId===t}function Os(e){const t=e.element,n=e.viewport,a=ga(e),s=t?`<${t.tagName.toLowerCase()}> · ${a}`:e.title||a,i=["<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(d.metadata)}`:"",i.workspaceContextStr].filter(Boolean).join(`
8
8
  \`\`\`
9
9
  ${r}
10
10
  \`\`\`]`)}return ya(a.join(`
11
- `),e)}function Us(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const a=n(),{imageBlocks:s,fileBlocks:i}=wa(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:ba(a.contextItems,a.checkedPanels,a.checkedSelections),noteIds:a.noteIds,...s.length>0?{imageBlocks:s}:{},...i.length>0?{fileBlocks:i}:{},...a.pickedMentions?{messageMetadata:a.pickedMentions}:{}},hasAttachments:s.length>0||i.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}const va="chat-read:",H=new Map,he=new Set;function Ls(e,t){let n=H.get(e);n||(n=new Set,H.set(e,n)),n.add(t)}function Ns(e,t){const n=H.get(e);if(!(!n||!n.delete(t))&&n.size===0){H.delete(e);for(const a of[...he])a(e)}}function Hs(e){return he.add(e),()=>he.delete(e)}function Fs(e){return H.has(e)}function Ks(e){const t=H.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(va))return!0;return!1}function Sa(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!et(a.scope,t))return null;const s={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(sn(t,s));const i=e.state.pendingSubmissions.byAgentId[t.agentId];return i&&x(i.submissions,s.id)?s:null}function ka(e,t,n,a,s){const i=De.select(e.state,n),r=de.select(e.state)?.principal.id,o=Be(e.state);if(!i||!r||!o)return null;const l=fn(t,n),c={agentId:t,workspaceId:n,principalId:r,participation:i,authority:o,owner:l.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},u=()=>l.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&De.select(e.state,n)===i&&de.select(e.state)?.principal.id===r&&Be(e.state)===o;if(!u())return null;e.dispatch(an(c,a,Et.select(e.state,n)));const p=Sa(e,c,s);return p?{scope:c,submission:p,isCurrent:()=>{const y=e.state.pendingSubmissions.byAgentId[t];return u()&&!!y&&et(y.scope,c)&&(!!x(y.operations,p.id)||!!x(y.submissions,p.id))}}:null}function ge(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??hn();return ka(e,t,n.wsId,de.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&_t.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Aa(e,t,n){const a=ge(e,t,n);return a?(e.dispatch(tt(t,{...n,userAppMessageId:a.submission.appMessageId,submission:{scope:a.scope,id:a.submission.id}})),!0):!1}async function Ma(e,t,n,a){const s=n.submission;if(!s)return"legacy";const i=s.reference,r=()=>i.scope.agentId===e&&i.scope.workspaceId===t&&je.select(M.state,e)===n?Qt.select(M.state,i.scope):void 0,o=r();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(s.outcome==="rejected"){const d=x(o.tombstones,i.id);return x(o.submissions,i.id)||d&&d.reason!=="rejected"?null:ge(M,e,l)}if(s.outcome==="accepted")return ge(M,e,l);await Promise.all([gn(e,t).catch(()=>{}),yn(e,t).catch(()=>{})]);const c=r();if(!c||x(c.submissions,i.id)?.status!=="uncertain")return null;const{notify:u}=await me(async()=>{const{notify:d}=await import("./1eeMnGBt.js").then(f=>f.C);return{notify:d}},__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(r()!==c)return null;let p=!1;const y=()=>{p=!0};return u.warning(_.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${i.id}`,duration:Number.POSITIVE_INFINITY,action:{label:_.agent_chatSend_resend_label(),onClick:()=>{if(p)return;p=!0;const d=r();!d||d.generation!==c.generation||d.submissions!==c.submissions||d.observationVersion!==c.observationVersion||x(d.submissions,i.id)?.status!=="uncertain"||Aa(M,e,l)}},cancel:{label:_.chat_richInput_cancel_label(),onClick:y},onDismiss:y}),null}async function Ws(e,t,n){const a=je.select(M.state,e),s=a?.submission?await Ma(e,t,a,n):"legacy";if(s){if(s==="legacy"){await M.dispatch(n===void 0?rn(e,t):on(e,t,n));return}!s.isCurrent()||!a||M.dispatch(tt(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:s.submission.appMessageId,submission:{scope:s.scope,id:s.submission.id}}))}}const js=M.createSelector((e,t)=>{const n=x(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:nt(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Ia(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==we.Deleted&&!t.notificationsMuted&&ln(t)==="topLevel"}function Ta(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!vn(e.metadata,t)?t:null}function Ca(e){return e.status===we.Error&&!Dt(xt(e))}function qs(e,t){return t.filter(n=>Ia(e,n)).flatMap(n=>{const a=cn(n),s=Ta(n),i=n.status===we.Error;if(!a&&!s&&!i)return[];const r=a?.timestamp??(i?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:a?.kind??(i?"failed":"question"),reason:a?.reason,timestamp:r&&Number.isFinite(Date.parse(r))?r:void 0,questionMessageId:s,canRetry:Ca(n)}]})}function Vs(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 zs(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 Me(e){const t=en(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 Gs(e,t,n,a){const s=e.filter(i=>a?a.includes(i.id):n?i.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(r=>r.owner?.toLowerCase()===i.repositoryOwner?.toLowerCase()&&r.name.toLowerCase()===i.repositoryName?.toLowerCase()));return[...new Map(s.flatMap(i=>[...(i.pullRequests??[]).map(r=>r.url),i.activePullRequest?.url,i.prUrl]).flatMap(i=>{const r=i?Me(i):null;return r?[[r.id,{owner:r.owner,repo:r.repo,number:r.number}]]:[]})).values()].sort((i,r)=>`${i.owner}/${i.repo}#${i.number}`.localeCompare(`${r.owner}/${r.repo}#${r.number}`))}function Ys(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const Js=M.createSelector(e=>e.homeIntegrations),Qs=M.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??""))}}),ut=M.createSelector(e=>nt(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:Me(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),Xs=M.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?Me(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return ut.select(e).find(a=>a.url===n)??null}),Zs=M.createSelector(e=>ut.select(e).map(t=>t.url));let Q=null;function ei(e){return Q=e,()=>{Q===e&&(Q=null)}}function ti(){return Q}function ni(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 ai(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 X=null;function si(e){return X=e,()=>{X===e&&(X=null)}}function ii(){return X}function ri(e){return An(e)}function Ea(e){return kn(e)}function _a(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function le(e){if(e.length===0)return[];const t=[];let n=null;for(const a of e){const s=a.timestamp?typeof a.timestamp=="string"?new Date(a.timestamp):a.timestamp:new Date;(!n||!_a(n.date,s))&&(n={date:s,label:Ea(s),messages:[]},t.push(n)),n.messages.push(a)}return t}function oi(e){const t=new Map;return e.map(({date:n})=>{const a=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,s=t.get(a)??0;return t.set(a,s+1),s===0?a:`${a}#${s}`})}function ci(e,t){const n=new Map;let a=t?null:void 0;for(const s of e.groups)for(const i of s.messages)a!==void 0&&n.set(i.id,a),i.role==="user"&&!Mn(i)&&(a=i);return n}function Da(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function He(e,t){const n=new Map;return e.map(a=>{const s=`${t}-${Da(a.date)}`,i=(n.get(s)??0)+1;return n.set(s,i),{...a,groupKey:i===1?s:`${s}-${i}`}})}function xa(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(i=>i.id)),a=new Set(t.map(i=>i.appMessageId).filter(i=>typeof i=="string"&&i.length>0)),s=e.filter(i=>!n.has(i.id)&&!(typeof i.appMessageId=="string"&&i.appMessageId.length>0&&a.has(i.appMessageId)));return s.length===e.length?e:s}function li(e,t,n){return e=xa(e,t),e.length===0?{groups:le(t),detached:!1,hiddenTail:[]}:n?{groups:He(le(e),"h"),detached:!0,hiddenTail:t}:{groups:He(le([...e,...t]),"d"),detached:!1,hiddenTail:[]}}function di(e){const{scrollTop:t,threshold:n,fetching:a,exhausted:s,historyCount:i,tailCount:r,tailTruncated:o,totalMessages:l,spacerAbove:c=0}=e;return t>n+c||a||s?!1:i>0||o||l>r+i}const ui=300;function mi(e){const{fetching:t,chainEvaluationPending:n,visible:a,hideArmed:s}=e;return t||n?a&&!s?"none":"show":a&&!s?"arm-hide":"none"}const Fe=24,Ra=320;function Ie(e){return Number.isFinite(e)?Math.min(Ra,Math.max(Fe,e)):Fe}const Ba=.2,Pa=.12;function $a(e,t,n=Ba){const a=Ie(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function pi(e,t){const n=Ie(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function fi(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:s,currentSpacerHeight:i,viewportHeight:r}=e;let o=e.rowHeightEma;n>0&&s>0&&(o=$a(o,s/n));const l=e.unloadedRows??t-n,u=a||t<=0||n<=0||l<=0||o===null?0:Math.round(l*o),p=Math.abs(u-i);return p===0?{spacerHeight:i,rowHeightEma:o,applied:!1,scrollTopDelta:0}:u===0||i===0||p>i*Pa||r>0&&p>r?{spacerHeight:u,rowHeightEma:o,applied:!0,scrollTopDelta:u-i}:{spacerHeight:i,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const Oa=Sn,Ua=2;function hi(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:s=Oa,nearPages:i=Ua}=e;if(n<=0||t>=n)return"serial";const r=Ie(a??Number.NaN);return(n-Math.max(0,t))/r>i*s?"seek":"serial"}const mt=200,La=1;function gi(e,t,n=mt){const a=t.timestamp-n;return[...e.filter(s=>s.timestamp>=a),t]}function yi(e){const{samples:t,viewportHeight:n,windowMs:a=mt,viewportFactor:s=La}=e;if(n<=0||t.length<2)return"gentle";const i=t[t.length-1].timestamp-a,r=t.filter(l=>l.timestamp>=i);if(r.length<2)return"gentle";let o=0;for(let l=1;l<r.length;l+=1)o+=Math.abs(r[l].scrollTop-r[l-1].scrollTop);return o>n*s?"rapid":"gentle"}function wi(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:a}=e;if(a<=0||n<=0)return 0;const s=Math.min(1,Math.max(0,t/n));return Math.min(a-1,Math.max(0,Math.floor(s*a)))}function bi(e){const{totalMessages:t,residentCount:n,exhausted:a,startOrdinalEstimate:s,detachedFromTail:i}=e,r=Math.max(0,t-n);if(!i)return{above:a?0:r,below:0};const o=Math.max(0,e.hiddenTailCount??0);if(a)return{above:0,below:r+o};if(s!==null){const c=Math.min(r,Math.max(0,Math.round(s)));return{above:c,below:r-c+o}}const l=Math.min(r,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:r-l,below:l+o}}function vi(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:s,totalMessages:i}=e;return t?!0:n>0?!1:!s&&i<=a}const Na="intent.drafts.sync",Ha="intent.drafts.changed",Fa=$({id:C(),type:C(),label:C(),description:C().optional(),content:C().optional(),path:C().optional(),imageData:C().optional(),imageMimeType:C().optional(),attachmentId:C().optional(),attachmentMimeType:C().optional(),attachmentSize:se().optional(),sourcePath:C().optional(),placementStatus:W("failed").optional(),screen:In().optional()}),pt=$({text:C(),attachments:Tn(Fa)}),j={provenance:C().min(1),workspaceId:C().min(1),agentId:C().min(1)},Z={lifetime:C(),revision:se().int().nonnegative()};Cn("kind",[$({...j,kind:W("read")}),$({...j,...Z,kind:W("edit"),origin:C().min(1),sequence:se().int().positive(),snapshot:pt}),$({...j,...Z,kind:W("flush")}),$({...j,...Z,kind:W("clear"),origin:C().min(1)})]);const ft=$({...j,...Z,origin:C(),sequence:se().int().nonnegative(),snapshot:pt}),Ka=$({accepted:En(),draft:ft});function Wa(e,t,n=t){const a=new Map,s=new Set,i=crypto.randomUUID();let r=0,o=!1;const l=()=>{const m=t();if(o||!m)throw new Error("draft-authority-unavailable");return m},c=()=>{const m=n();if(!m||o)throw new Error("draft-authority-unavailable");return()=>{if(o||n()!==m)throw new Error("draft-authority-changed")}},u=(m,b,S)=>{const I=JSON.stringify([m,b,S]);let k=a.get(I);return k||(k={dirty:0},a.set(I,k)),k},p=(m,b)=>{if(o||m.provenance!==t())return;const S=u(m.provenance,m.workspaceId,m.agentId);if(!(S.value?.lifetime===m.lifetime&&S.value.revision>m.revision)&&(S.value=m,b&&S.dirty===0))for(const I of s)I(m)},y=e.subscribe(m=>{const b=ft.safeParse(m);b.success&&p(b.data,!0)}),d=async(m,b)=>{b();const S=Ka.parse(await e.request(m));if(b(),m.provenance!==l()||S.draft.provenance!==m.provenance)throw new Error("draft-authority-changed");if(!S.accepted)throw p(S.draft,!1),new Error("draft-changed-in-another-editor");return S.draft},f=async(m,b)=>{const S=l(),I=c(),k=u(S,m,b);k.tail&&await k.tail;const v=await d({kind:"read",provenance:S,workspaceId:m,agentId:b},I);return p(v,!1),v},w=(m,b,S)=>{const I=l(),k=c(),v=u(I,m,b),B=v.tail??(v.value?Promise.resolve(v.value):d({kind:"read",provenance:I,workspaceId:m,agentId:b},k));v.dirty+=1;const E=B.then(O=>d(S(O),k));return v.tail=E,E.then(O=>{v.dirty-=1,v.tail===E&&(v.tail=void 0),p(O,!0)},()=>{v.dirty-=1,v.tail===E&&(v.tail=void 0)}),E};return{authority:()=>o?null:n(),read:f,async edit(m,b,S,I){const k=++r;return w(b,S,v=>({kind:"edit",provenance:v.provenance,workspaceId:b,agentId:S,lifetime:v.lifetime,revision:v.revision,origin:m,sequence:k,snapshot:I}))},async flush(m,b){const S=l(),I=c(),k=u(S,m,b),v=await(k.tail??(k.value?Promise.resolve(k.value):f(m,b)));await d({kind:"flush",provenance:S,workspaceId:m,agentId:b,lifetime:v.lifetime,revision:v.revision},I)},async clear(m,b){await w(m,b,S=>({kind:"clear",provenance:S.provenance,workspaceId:m,agentId:b,lifetime:S.lifetime,revision:S.revision,origin:i}))},subscribe(m){return s.add(m),()=>{s.delete(m)}},dispose(){o=!0,y(),s.clear(),a.clear()}}}let U=null;async function Si(e,t,n,a,s){const i=U;if(!i)throw new Error("draft-shared-transport-unavailable");const r=()=>{if(U!==i||i.authority()!==s)throw new Error("draft-authority-changed")};r(),await i.edit(e,t,n,a),r(),await i.flush(t,n),r()}async function ki(e,t){await Promise.resolve(),U&&await U.flush(e,t)}function Ai(){if(!_n())return null;const e=Wa({request:n=>nn(Na,n),subscribe:n=>tn(a=>{a.method===Ha&&n(a.params)})},()=>wn(M.state),()=>bn(M.state));U=e;const t=e.dispose;return e.dispose=()=>{U===e&&(U=null),t()},e}const ht=new Map;function gt(e,t){return`${e}\0${t}`}function Mi(e,t){return ht.get(gt(e,t))}function Ii(e,t,n){ht.set(gt(e,t),n)}const Ti=M.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.userMessageIndexes,n):void 0}),Ci=M.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.retryAgents,n):void 0});function ja(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const i=e/1e3,r=i.toFixed(1);return r.endsWith(".0")?`${Math.round(i)}s`:`${r}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),a=Math.floor(t%3600/60),s=t%60;return n>0?`${n}h ${a}m ${s}s`:`${a}m ${s}s`}function Ei(e){return ja(Math.max(1e3,Math.round(e/1e3)*1e3))}const qa=new Set(["launch","init","session-create","session-load","prompt"]),Va=new Set(["tool-call","tool-waiting"]);function za(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function _i(e){return e&&qa.has(e)?"pulse":e&&Va.has(e)?"twist":"bloom"}const yt="stalled";function Di(e,t){const n=za(e);return!n||n.phase!==yt||typeof t=="number"&&t>n.timestamp?null:n}function xi(e){let t=null;for(const n of e)n.phase!==yt&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const Ke={get title(){return _.chat_streamingStatus_sessionCorrupted_title()},get message(){return _.chat_streamingStatus_sessionCorrupted_message()}};function Ri(e,t){return e?t===!0?{corrupted:!0,title:Ke.title,message:Ke.message,detail:e}:{corrupted:!1,title:_.chat_streamingStatus_responseFailed_label(),message:e,detail:null}:null}const Bi=M.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Pi=M.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),$i=M.createSelector(e=>{const t=[];for(const i of Object.values(e.panelLayout.byWorkspaceId))for(const r of Object.values(i.panels))for(const o of r.tabs)o.type==="agent"&&o.agentId&&t.push(o.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[ye]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(i=>a.has(i)),dividerSessionAgentIds:n,openAgentTabIds:t}}),Oi=M.createSelector((e,t)=>x(e.questionUi.consumers,t)),Ga=3e4,V=new Map;function Ui(e,t){const n=V.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>V.delete(e),Ga);V.set(e,{value:t,timer:a})}function Li(e){const t=V.get(e);if(t)return clearTimeout(t.timer),V.delete(e),t.value}const wt=M.createSelector((e,t,n)=>e.agentWorkers?.byKey[un(t,n)]??dn),Ya=M.createSelector((e,t,n)=>{const a=wt.select(e,t,n);return a.status==="unsupported"?[]:(a.snapshot?.workers??[]).filter(s=>s.status==="running"||s.status==="unknown")}),Ni=M.createSelector((e,t,n)=>{const a=wt.select(e,t,n);return a.status==="failed"?!0:a.status!=="ready"||!a.snapshot?!1:a.snapshot.truncated?!0:a.snapshot.support.status!=="supported"&&Ya.select(e,t,n).length>0}),Ja=1e3,bt={requireViewedAndFocused:!0,requireAssistantTail:!0},z=new Map,R=new Map;let F=null;function Te(e){(e===void 0||F===e)&&(F=null)}const Qa=200;function Xa(e,t){if(R.delete(e),R.set(e,t),R.size>Qa){const n=R.keys().next().value;n!==void 0&&R.delete(n)}}function vt(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 Hi(e){return vt(e)?.id??null}function Fi(e){Ce(e,{requireViewedAndFocused:!0})}function Ki(e){Ce(e,{requireViewedAndFocused:!1})}function Wi(e){Te(),Ce(e,bt)}function ji(e){F===e&&(z.has(e)||(F=null,Ee(e,bt)))}function qi(e){for(const t of e)typeof t!="string"||t.length===0||(St(t),Te(t),Ee(t,{requireViewedAndFocused:!1}))}function St(e){const t=z.get(e);t&&(clearTimeout(t.timer),z.delete(e))}function Ce(e,t){St(e),Te(e);const n=setTimeout(()=>{z.delete(e),Ee(e,t)},Ja);z.set(e,{timer:n,gates:t})}let We=null;function Za(){return We??=Promise.all([me(()=>import("./DAJaDZx7.js"),__vite__mapDeps([38,17,18,3,19,20,5,7,4,21,13,2,39,40]),import.meta.url),me(()=>import("./CAhkQWjW.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})),We}async function Ee(e,t){let n=null;try{const{appStore:a,appClient:s}=await Za(),i=a.state;if(t.requireViewedAndFocused&&(i.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const r=i.agentSessions?.byAgentId[e];if(!r)return;const o=typeof r.workspaceId=="string"?r.workspaceId:"";if(o.length===0)return;if(t.requireAssistantTail&&i.chatState?.byAgentId[e]?.initialHistoryPending){F=e;return}const l=vt(r.messages??[]);if(!l){t.requireAssistantTail&&(F=e);return}if(t.requireAssistantTail&&l.role!=="assistant")return;const c=l.id;if(R.get(e)===c)return;Xa(e,c),n=c,!(await s.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 ae=new Map;function kt(e,t){return`${e}\0${t}`}function Vi(e,t){return ae.get(kt(e,t))}function zi(e,t,n){ae.set(kt(e,t),n)}function Gi(e){if(e.length===0)return;const t=new Set(e);for(const n of[...ae.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&ae.delete(n)}}export{_s as $,ki as A,Ei as B,ri as C,P as D,Di as E,Vi as F,Mi as G,va as H,ii as I,qs as J,ti as K,Vs as L,Ja as M,xi as N,ui as O,_i as P,Fs as Q,mt as R,Ks as S,ni as T,Cs as U,Fe as V,zn as W,ci as X,Ts as Y,vi as Z,te as _,Ls as a,Es as a0,vs as a1,wi as a2,qi as a3,ji as a4,Fi as a5,Ki as a6,Wi as a7,Hi as a8,mi as a9,Qs as aA,Zs as aB,ut as aC,Oi as aD,Ci as aE,Ti as aF,zi as aG,Ii as aH,di as aI,Is as aJ,Ys as aK,bi as aL,Ui as aM,ai as aN,Aa as aO,Li as aP,Gn as aQ,Ms as aR,Hs as aa,xn as ab,Si as ac,Ds as ad,Us as ae,Ps as af,Ma as ag,ct as ah,Ss as ai,si as aj,fi as ak,ei as al,Ns as am,Te as an,Ws as ao,ws as ap,pi as aq,Ya as ar,wt as as,Ni as at,js as au,Pi as av,$i as aw,Bi as ax,Js as ay,Xs as az,ge as b,gi as c,$s as d,Os as e,oi as f,ks as g,ba as h,bs as i,Jn as j,Yn as k,yi as l,hi as m,Gi as n,Gs as o,li as p,Rs as q,Ai as r,Ri as s,zs as t,As as u,xs as v,xa as w,Bs as x,wa as y,Nn as z};
11
+ `),e)}function Us(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const a=n(),{imageBlocks:s,fileBlocks:i}=wa(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:ba(a.contextItems,a.checkedPanels,a.checkedSelections),noteIds:a.noteIds,...s.length>0?{imageBlocks:s}:{},...i.length>0?{fileBlocks:i}:{},...a.pickedMentions?{messageMetadata:a.pickedMentions}:{}},hasAttachments:s.length>0||i.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}const va="chat-read:",H=new Map,he=new Set;function Ls(e,t){let n=H.get(e);n||(n=new Set,H.set(e,n)),n.add(t)}function Ns(e,t){const n=H.get(e);if(!(!n||!n.delete(t))&&n.size===0){H.delete(e);for(const a of[...he])a(e)}}function Hs(e){return he.add(e),()=>he.delete(e)}function Fs(e){return H.has(e)}function Ks(e){const t=H.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(va))return!0;return!1}function Sa(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!et(a.scope,t))return null;const s={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(sn(t,s));const i=e.state.pendingSubmissions.byAgentId[t.agentId];return i&&x(i.submissions,s.id)?s:null}function ka(e,t,n,a,s){const i=De.select(e.state,n),r=de.select(e.state)?.principal.id,o=Be(e.state);if(!i||!r||!o)return null;const l=fn(t,n),c={agentId:t,workspaceId:n,principalId:r,participation:i,authority:o,owner:l.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},u=()=>l.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&De.select(e.state,n)===i&&de.select(e.state)?.principal.id===r&&Be(e.state)===o;if(!u())return null;e.dispatch(an(c,a,Et.select(e.state,n)));const p=Sa(e,c,s);return p?{scope:c,submission:p,isCurrent:()=>{const y=e.state.pendingSubmissions.byAgentId[t];return u()&&!!y&&et(y.scope,c)&&(!!x(y.operations,p.id)||!!x(y.submissions,p.id))}}:null}function ge(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??hn();return ka(e,t,n.wsId,de.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&_t.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Aa(e,t,n){const a=ge(e,t,n);return a?(e.dispatch(tt(t,{...n,userAppMessageId:a.submission.appMessageId,submission:{scope:a.scope,id:a.submission.id}})),!0):!1}async function Ma(e,t,n,a){const s=n.submission;if(!s)return"legacy";const i=s.reference,r=()=>i.scope.agentId===e&&i.scope.workspaceId===t&&je.select(M.state,e)===n?Qt.select(M.state,i.scope):void 0,o=r();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(s.outcome==="rejected"){const d=x(o.tombstones,i.id);return x(o.submissions,i.id)||d&&d.reason!=="rejected"?null:ge(M,e,l)}if(s.outcome==="accepted")return ge(M,e,l);await Promise.all([gn(e,t).catch(()=>{}),yn(e,t).catch(()=>{})]);const c=r();if(!c||x(c.submissions,i.id)?.status!=="uncertain")return null;const{notify:u}=await me(async()=>{const{notify:d}=await import("./He8rzvWn.js").then(f=>f.C);return{notify:d}},__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(r()!==c)return null;let p=!1;const y=()=>{p=!0};return u.warning(_.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${i.id}`,duration:Number.POSITIVE_INFINITY,action:{label:_.agent_chatSend_resend_label(),onClick:()=>{if(p)return;p=!0;const d=r();!d||d.generation!==c.generation||d.submissions!==c.submissions||d.observationVersion!==c.observationVersion||x(d.submissions,i.id)?.status!=="uncertain"||Aa(M,e,l)}},cancel:{label:_.chat_richInput_cancel_label(),onClick:y},onDismiss:y}),null}async function Ws(e,t,n){const a=je.select(M.state,e),s=a?.submission?await Ma(e,t,a,n):"legacy";if(s){if(s==="legacy"){await M.dispatch(n===void 0?rn(e,t):on(e,t,n));return}!s.isCurrent()||!a||M.dispatch(tt(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:s.submission.appMessageId,submission:{scope:s.scope,id:s.submission.id}}))}}const js=M.createSelector((e,t)=>{const n=x(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:nt(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Ia(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==we.Deleted&&!t.notificationsMuted&&ln(t)==="topLevel"}function Ta(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!vn(e.metadata,t)?t:null}function Ca(e){return e.status===we.Error&&!Dt(xt(e))}function qs(e,t){return t.filter(n=>Ia(e,n)).flatMap(n=>{const a=cn(n),s=Ta(n),i=n.status===we.Error;if(!a&&!s&&!i)return[];const r=a?.timestamp??(i?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:a?.kind??(i?"failed":"question"),reason:a?.reason,timestamp:r&&Number.isFinite(Date.parse(r))?r:void 0,questionMessageId:s,canRetry:Ca(n)}]})}function Vs(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 zs(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 Me(e){const t=en(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 Gs(e,t,n,a){const s=e.filter(i=>a?a.includes(i.id):n?i.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(r=>r.owner?.toLowerCase()===i.repositoryOwner?.toLowerCase()&&r.name.toLowerCase()===i.repositoryName?.toLowerCase()));return[...new Map(s.flatMap(i=>[...(i.pullRequests??[]).map(r=>r.url),i.activePullRequest?.url,i.prUrl]).flatMap(i=>{const r=i?Me(i):null;return r?[[r.id,{owner:r.owner,repo:r.repo,number:r.number}]]:[]})).values()].sort((i,r)=>`${i.owner}/${i.repo}#${i.number}`.localeCompare(`${r.owner}/${r.repo}#${r.number}`))}function Ys(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const Js=M.createSelector(e=>e.homeIntegrations),Qs=M.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??""))}}),ut=M.createSelector(e=>nt(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:Me(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),Xs=M.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?Me(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return ut.select(e).find(a=>a.url===n)??null}),Zs=M.createSelector(e=>ut.select(e).map(t=>t.url));let Q=null;function ei(e){return Q=e,()=>{Q===e&&(Q=null)}}function ti(){return Q}function ni(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 ai(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 X=null;function si(e){return X=e,()=>{X===e&&(X=null)}}function ii(){return X}function ri(e){return An(e)}function Ea(e){return kn(e)}function _a(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function le(e){if(e.length===0)return[];const t=[];let n=null;for(const a of e){const s=a.timestamp?typeof a.timestamp=="string"?new Date(a.timestamp):a.timestamp:new Date;(!n||!_a(n.date,s))&&(n={date:s,label:Ea(s),messages:[]},t.push(n)),n.messages.push(a)}return t}function oi(e){const t=new Map;return e.map(({date:n})=>{const a=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,s=t.get(a)??0;return t.set(a,s+1),s===0?a:`${a}#${s}`})}function ci(e,t){const n=new Map;let a=t?null:void 0;for(const s of e.groups)for(const i of s.messages)a!==void 0&&n.set(i.id,a),i.role==="user"&&!Mn(i)&&(a=i);return n}function Da(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function He(e,t){const n=new Map;return e.map(a=>{const s=`${t}-${Da(a.date)}`,i=(n.get(s)??0)+1;return n.set(s,i),{...a,groupKey:i===1?s:`${s}-${i}`}})}function xa(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(i=>i.id)),a=new Set(t.map(i=>i.appMessageId).filter(i=>typeof i=="string"&&i.length>0)),s=e.filter(i=>!n.has(i.id)&&!(typeof i.appMessageId=="string"&&i.appMessageId.length>0&&a.has(i.appMessageId)));return s.length===e.length?e:s}function li(e,t,n){return e=xa(e,t),e.length===0?{groups:le(t),detached:!1,hiddenTail:[]}:n?{groups:He(le(e),"h"),detached:!0,hiddenTail:t}:{groups:He(le([...e,...t]),"d"),detached:!1,hiddenTail:[]}}function di(e){const{scrollTop:t,threshold:n,fetching:a,exhausted:s,historyCount:i,tailCount:r,tailTruncated:o,totalMessages:l,spacerAbove:c=0}=e;return t>n+c||a||s?!1:i>0||o||l>r+i}const ui=300;function mi(e){const{fetching:t,chainEvaluationPending:n,visible:a,hideArmed:s}=e;return t||n?a&&!s?"none":"show":a&&!s?"arm-hide":"none"}const Fe=24,Ra=320;function Ie(e){return Number.isFinite(e)?Math.min(Ra,Math.max(Fe,e)):Fe}const Ba=.2,Pa=.12;function $a(e,t,n=Ba){const a=Ie(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function pi(e,t){const n=Ie(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function fi(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:s,currentSpacerHeight:i,viewportHeight:r}=e;let o=e.rowHeightEma;n>0&&s>0&&(o=$a(o,s/n));const l=e.unloadedRows??t-n,u=a||t<=0||n<=0||l<=0||o===null?0:Math.round(l*o),p=Math.abs(u-i);return p===0?{spacerHeight:i,rowHeightEma:o,applied:!1,scrollTopDelta:0}:u===0||i===0||p>i*Pa||r>0&&p>r?{spacerHeight:u,rowHeightEma:o,applied:!0,scrollTopDelta:u-i}:{spacerHeight:i,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const Oa=Sn,Ua=2;function hi(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:s=Oa,nearPages:i=Ua}=e;if(n<=0||t>=n)return"serial";const r=Ie(a??Number.NaN);return(n-Math.max(0,t))/r>i*s?"seek":"serial"}const mt=200,La=1;function gi(e,t,n=mt){const a=t.timestamp-n;return[...e.filter(s=>s.timestamp>=a),t]}function yi(e){const{samples:t,viewportHeight:n,windowMs:a=mt,viewportFactor:s=La}=e;if(n<=0||t.length<2)return"gentle";const i=t[t.length-1].timestamp-a,r=t.filter(l=>l.timestamp>=i);if(r.length<2)return"gentle";let o=0;for(let l=1;l<r.length;l+=1)o+=Math.abs(r[l].scrollTop-r[l-1].scrollTop);return o>n*s?"rapid":"gentle"}function wi(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:a}=e;if(a<=0||n<=0)return 0;const s=Math.min(1,Math.max(0,t/n));return Math.min(a-1,Math.max(0,Math.floor(s*a)))}function bi(e){const{totalMessages:t,residentCount:n,exhausted:a,startOrdinalEstimate:s,detachedFromTail:i}=e,r=Math.max(0,t-n);if(!i)return{above:a?0:r,below:0};const o=Math.max(0,e.hiddenTailCount??0);if(a)return{above:0,below:r+o};if(s!==null){const c=Math.min(r,Math.max(0,Math.round(s)));return{above:c,below:r-c+o}}const l=Math.min(r,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:r-l,below:l+o}}function vi(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:s,totalMessages:i}=e;return t?!0:n>0?!1:!s&&i<=a}const Na="intent.drafts.sync",Ha="intent.drafts.changed",Fa=$({id:C(),type:C(),label:C(),description:C().optional(),content:C().optional(),path:C().optional(),imageData:C().optional(),imageMimeType:C().optional(),attachmentId:C().optional(),attachmentMimeType:C().optional(),attachmentSize:se().optional(),sourcePath:C().optional(),placementStatus:W("failed").optional(),screen:In().optional()}),pt=$({text:C(),attachments:Tn(Fa)}),j={provenance:C().min(1),workspaceId:C().min(1),agentId:C().min(1)},Z={lifetime:C(),revision:se().int().nonnegative()};Cn("kind",[$({...j,kind:W("read")}),$({...j,...Z,kind:W("edit"),origin:C().min(1),sequence:se().int().positive(),snapshot:pt}),$({...j,...Z,kind:W("flush")}),$({...j,...Z,kind:W("clear"),origin:C().min(1)})]);const ft=$({...j,...Z,origin:C(),sequence:se().int().nonnegative(),snapshot:pt}),Ka=$({accepted:En(),draft:ft});function Wa(e,t,n=t){const a=new Map,s=new Set,i=crypto.randomUUID();let r=0,o=!1;const l=()=>{const m=t();if(o||!m)throw new Error("draft-authority-unavailable");return m},c=()=>{const m=n();if(!m||o)throw new Error("draft-authority-unavailable");return()=>{if(o||n()!==m)throw new Error("draft-authority-changed")}},u=(m,b,S)=>{const I=JSON.stringify([m,b,S]);let k=a.get(I);return k||(k={dirty:0},a.set(I,k)),k},p=(m,b)=>{if(o||m.provenance!==t())return;const S=u(m.provenance,m.workspaceId,m.agentId);if(!(S.value?.lifetime===m.lifetime&&S.value.revision>m.revision)&&(S.value=m,b&&S.dirty===0))for(const I of s)I(m)},y=e.subscribe(m=>{const b=ft.safeParse(m);b.success&&p(b.data,!0)}),d=async(m,b)=>{b();const S=Ka.parse(await e.request(m));if(b(),m.provenance!==l()||S.draft.provenance!==m.provenance)throw new Error("draft-authority-changed");if(!S.accepted)throw p(S.draft,!1),new Error("draft-changed-in-another-editor");return S.draft},f=async(m,b)=>{const S=l(),I=c(),k=u(S,m,b);k.tail&&await k.tail;const v=await d({kind:"read",provenance:S,workspaceId:m,agentId:b},I);return p(v,!1),v},w=(m,b,S)=>{const I=l(),k=c(),v=u(I,m,b),B=v.tail??(v.value?Promise.resolve(v.value):d({kind:"read",provenance:I,workspaceId:m,agentId:b},k));v.dirty+=1;const E=B.then(O=>d(S(O),k));return v.tail=E,E.then(O=>{v.dirty-=1,v.tail===E&&(v.tail=void 0),p(O,!0)},()=>{v.dirty-=1,v.tail===E&&(v.tail=void 0)}),E};return{authority:()=>o?null:n(),read:f,async edit(m,b,S,I){const k=++r;return w(b,S,v=>({kind:"edit",provenance:v.provenance,workspaceId:b,agentId:S,lifetime:v.lifetime,revision:v.revision,origin:m,sequence:k,snapshot:I}))},async flush(m,b){const S=l(),I=c(),k=u(S,m,b),v=await(k.tail??(k.value?Promise.resolve(k.value):f(m,b)));await d({kind:"flush",provenance:S,workspaceId:m,agentId:b,lifetime:v.lifetime,revision:v.revision},I)},async clear(m,b){await w(m,b,S=>({kind:"clear",provenance:S.provenance,workspaceId:m,agentId:b,lifetime:S.lifetime,revision:S.revision,origin:i}))},subscribe(m){return s.add(m),()=>{s.delete(m)}},dispose(){o=!0,y(),s.clear(),a.clear()}}}let U=null;async function Si(e,t,n,a,s){const i=U;if(!i)throw new Error("draft-shared-transport-unavailable");const r=()=>{if(U!==i||i.authority()!==s)throw new Error("draft-authority-changed")};r(),await i.edit(e,t,n,a),r(),await i.flush(t,n),r()}async function ki(e,t){await Promise.resolve(),U&&await U.flush(e,t)}function Ai(){if(!_n())return null;const e=Wa({request:n=>nn(Na,n),subscribe:n=>tn(a=>{a.method===Ha&&n(a.params)})},()=>wn(M.state),()=>bn(M.state));U=e;const t=e.dispose;return e.dispose=()=>{U===e&&(U=null),t()},e}const ht=new Map;function gt(e,t){return`${e}\0${t}`}function Mi(e,t){return ht.get(gt(e,t))}function Ii(e,t,n){ht.set(gt(e,t),n)}const Ti=M.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.userMessageIndexes,n):void 0}),Ci=M.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?x(a.retryAgents,n):void 0});function ja(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const i=e/1e3,r=i.toFixed(1);return r.endsWith(".0")?`${Math.round(i)}s`:`${r}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),a=Math.floor(t%3600/60),s=t%60;return n>0?`${n}h ${a}m ${s}s`:`${a}m ${s}s`}function Ei(e){return ja(Math.max(1e3,Math.round(e/1e3)*1e3))}const qa=new Set(["launch","init","session-create","session-load","prompt"]),Va=new Set(["tool-call","tool-waiting"]);function za(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function _i(e){return e&&qa.has(e)?"pulse":e&&Va.has(e)?"twist":"bloom"}const yt="stalled";function Di(e,t){const n=za(e);return!n||n.phase!==yt||typeof t=="number"&&t>n.timestamp?null:n}function xi(e){let t=null;for(const n of e)n.phase!==yt&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const Ke={get title(){return _.chat_streamingStatus_sessionCorrupted_title()},get message(){return _.chat_streamingStatus_sessionCorrupted_message()}};function Ri(e,t){return e?t===!0?{corrupted:!0,title:Ke.title,message:Ke.message,detail:e}:{corrupted:!1,title:_.chat_streamingStatus_responseFailed_label(),message:e,detail:null}:null}const Bi=M.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Pi=M.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),$i=M.createSelector(e=>{const t=[];for(const i of Object.values(e.panelLayout.byWorkspaceId))for(const r of Object.values(i.panels))for(const o of r.tabs)o.type==="agent"&&o.agentId&&t.push(o.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[ye]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(i=>a.has(i)),dividerSessionAgentIds:n,openAgentTabIds:t}}),Oi=M.createSelector((e,t)=>x(e.questionUi.consumers,t)),Ga=3e4,V=new Map;function Ui(e,t){const n=V.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>V.delete(e),Ga);V.set(e,{value:t,timer:a})}function Li(e){const t=V.get(e);if(t)return clearTimeout(t.timer),V.delete(e),t.value}const wt=M.createSelector((e,t,n)=>e.agentWorkers?.byKey[un(t,n)]??dn),Ya=M.createSelector((e,t,n)=>{const a=wt.select(e,t,n);return a.status==="unsupported"?[]:(a.snapshot?.workers??[]).filter(s=>s.status==="running"||s.status==="unknown")}),Ni=M.createSelector((e,t,n)=>{const a=wt.select(e,t,n);return a.status==="failed"?!0:a.status!=="ready"||!a.snapshot?!1:a.snapshot.truncated?!0:a.snapshot.support.status!=="supported"&&Ya.select(e,t,n).length>0}),Ja=1e3,bt={requireViewedAndFocused:!0,requireAssistantTail:!0},z=new Map,R=new Map;let F=null;function Te(e){(e===void 0||F===e)&&(F=null)}const Qa=200;function Xa(e,t){if(R.delete(e),R.set(e,t),R.size>Qa){const n=R.keys().next().value;n!==void 0&&R.delete(n)}}function vt(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 Hi(e){return vt(e)?.id??null}function Fi(e){Ce(e,{requireViewedAndFocused:!0})}function Ki(e){Ce(e,{requireViewedAndFocused:!1})}function Wi(e){Te(),Ce(e,bt)}function ji(e){F===e&&(z.has(e)||(F=null,Ee(e,bt)))}function qi(e){for(const t of e)typeof t!="string"||t.length===0||(St(t),Te(t),Ee(t,{requireViewedAndFocused:!1}))}function St(e){const t=z.get(e);t&&(clearTimeout(t.timer),z.delete(e))}function Ce(e,t){St(e),Te(e);const n=setTimeout(()=>{z.delete(e),Ee(e,t)},Ja);z.set(e,{timer:n,gates:t})}let We=null;function Za(){return We??=Promise.all([me(()=>import("./DAJaDZx7.js"),__vite__mapDeps([38,17,18,3,19,20,5,7,4,21,13,2,39,40]),import.meta.url),me(()=>import("./CAhkQWjW.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})),We}async function Ee(e,t){let n=null;try{const{appStore:a,appClient:s}=await Za(),i=a.state;if(t.requireViewedAndFocused&&(i.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const r=i.agentSessions?.byAgentId[e];if(!r)return;const o=typeof r.workspaceId=="string"?r.workspaceId:"";if(o.length===0)return;if(t.requireAssistantTail&&i.chatState?.byAgentId[e]?.initialHistoryPending){F=e;return}const l=vt(r.messages??[]);if(!l){t.requireAssistantTail&&(F=e);return}if(t.requireAssistantTail&&l.role!=="assistant")return;const c=l.id;if(R.get(e)===c)return;Xa(e,c),n=c,!(await s.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 ae=new Map;function kt(e,t){return`${e}\0${t}`}function Vi(e,t){return ae.get(kt(e,t))}function zi(e,t,n){ae.set(kt(e,t),n)}function Gi(e){if(e.length===0)return;const t=new Set(e);for(const n of[...ae.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&ae.delete(n)}}export{_s as $,ki as A,Ei as B,ri as C,P as D,Di as E,Vi as F,Mi as G,va as H,ii as I,qs as J,ti as K,Vs as L,Ja as M,xi as N,ui as O,_i as P,Fs as Q,mt as R,Ks as S,ni as T,Cs as U,Fe as V,zn as W,ci as X,Ts as Y,vi as Z,te as _,Ls as a,Es as a0,vs as a1,wi as a2,qi as a3,ji as a4,Fi as a5,Ki as a6,Wi as a7,Hi as a8,mi as a9,Qs as aA,Zs as aB,ut as aC,Oi as aD,Ci as aE,Ti as aF,zi as aG,Ii as aH,di as aI,Is as aJ,Ys as aK,bi as aL,Ui as aM,ai as aN,Aa as aO,Li as aP,Gn as aQ,Ms as aR,Hs as aa,xn as ab,Si as ac,Ds as ad,Us as ae,Ps as af,Ma as ag,ct as ah,Ss as ai,si as aj,fi as ak,ei as al,Ns as am,Te as an,Ws as ao,ws as ap,pi as aq,Ya as ar,wt as as,Ni as at,js as au,Pi as av,$i as aw,Bi as ax,Js as ay,Xs as az,ge as b,gi as c,$s as d,Os as e,oi as f,ks as g,ba as h,bs as i,Jn as j,Yn as k,yi as l,hi as m,Gi as n,Gs as o,li as p,Rs as q,Ai as r,Ri as s,zs as t,As as u,xs as v,xa as w,Bs as x,wa as y,Nn as z};
@@ -1 +1 @@
1
- import{C as M}from"./BvFAWM27.js";import{a as v}from"./BJzHxIyr.js";import{d as E}from"./CAhkQWjW.js";import{Ig as o,Db as _,CD as C,g as y,uy as D,u8 as O,fY as H,BV as L,Cb as P,Eb as R,BZ as B}from"./CpBlZvWi.js";import{aY as p}from"./CNJgwoNk.js";import{d as x}from"./B0Z-1lwJ.js";import{n as F}from"./Btvd3YqX.js";import{o as W,e as Y}from"./O_PsNJaQ.js";const u=new v("OpenMessage"),A=150,S=15e3,q=2,N=[150,400,800,1500,3e3],G=M;let g;function b(e){return new Promise(t=>setTimeout(t,e))}function m(e,t){const s=o.state,n=s.agentSessions?.byAgentId[e]?.messages,a=s.agentSessions?.historySegmentsByAgentId?.[e]?.messages;return!!(n?.some(r=>r.id===t)||a?.some(r=>r.id===t))}function k(e,t){const s=o.state,n=s.agentSessions?.historySegmentsByAgentId?.[e];n?.detachedFromTail!==!0||n.messages.some(r=>r.id===t)||!s.agentSessions?.byAgentId[e]?.messages?.some(r=>r.id===t)||o.dispatch(H(e))}function I(e){return o.state.chatState?.byAgentId[e]?.transcriptHydration}async function K(e,t,s){const n=Date.now()+S;let a=0;for(;Date.now()<n;){if(s.aborted)return!1;if(m(e,t))return!0;if(a>=q&&I(e)==="settled"&&!p.select(o.state,e).initialHistoryPending)return!1;a++,await b(A)}return!s.aborted&&m(e,t)}async function V(e,t,s,n){const a=Date.now()+S;for(;p.select(o.state,e).initialHistoryPending;){if(n?.aborted||Date.now()>=a)return!1;await b(A)}const r=o.state.agentSessions?.byAgentId[e];if(!r||n?.aborted)return!1;if(m(e,t))return k(e,t),!0;s??=r.workspaceId;const l=p.select(o.state,e);let c={nextToken:l.scrollbackOlderToken,prevToken:l.scrollbackGapToken,olderAnchorId:l.scrollbackOlderTokenAnchorId};o.dispatch(L(e,"seek"));const d=p.select(o.state,e).scrollbackDiscardEpoch,f=()=>!!o.state.agentSessions?.byAgentId[e]&&p.select(o.state,e).scrollbackDiscardEpoch===d;try{const i=await E.agents.getConversation(e,G,void 0,t,void 0,s);return n?.aborted||!f()||!i.messages.some(h=>h.id===t)?!1:(o.dispatch(P(e,i.messages,i.messages[0]?.seq)),i.nextToken===null&&o.dispatch(R(e)),c={nextToken:i.nextToken,prevToken:i.prevToken,olderAnchorId:i.messages[0]?.id??null},m(e,t))}catch(i){return u.warn("[seekConversationToMessage] Seek fetch failed (message may no longer exist)",{agentId:e,messageId:t,error:i}),!1}finally{f()&&o.dispatch(B(e,c))}}async function ee(e){if(e.signal?.aborted)return;g?.abort(),g=new AbortController;const t=e.signal?AbortSignal.any([g.signal,e.signal]):g.signal,{workspaceId:s,agentId:n,messageId:a,query:r,targetTabId:l}=e;u.info("[openMessage] Deep-opening conversation at message",{workspaceId:s,agentId:n,messageId:a});const c=s===y;c&&!e.contentAlreadyOpen&&(o.dispatch(_(n)),o.dispatch(C(y,n)),o.dispatch(D("chief")));const d=c?"/":Y(s);if(!e.contentAlreadyOpen&&typeof window<"u"&&window.location.pathname!==d){try{c?await F(d):await W(s)}catch(w){u.warn("[openMessage] Workspace navigation failed",{workspaceId:s,error:w});return}if(t.aborted)return;if(window.location.pathname!==d){u.warn("[openMessage] Workspace navigation was not confirmed",{workspaceId:s});return}}!e.contentAlreadyOpen&&!c&&o.dispatch(O(s,{agentId:n}));const f=await K(n,a,t);f&&k(n,a);const i=f||await V(n,a,s,t);if(t.aborted)return;if(!i){u.warn("[openMessage] Message not found; conversation opened at tail",{agentId:n,messageId:a});return}const h=`open-message-${Date.now()}-${Math.random().toString(36).slice(2)}`,T={agentId:n,messageId:a,query:r,targetTabId:l,requestId:h,signal:t};for(const w of N)setTimeout(()=>{t.aborted||x("chat:open-message",T)},w)}export{ee as openMessage,V as seekConversationToMessage};
1
+ import{C as M}from"./BvFAWM27.js";import{a as v}from"./BJzHxIyr.js";import{d as E}from"./CAhkQWjW.js";import{Ig as o,Db as _,CD as C,g as y,uy as D,u8 as O,fY as H,BV as L,Cb as P,Eb as R,BZ as B}from"./CpBlZvWi.js";import{aY as p}from"./CNJgwoNk.js";import{d as x}from"./B0Z-1lwJ.js";import{n as F}from"./BsC5Vdmg.js";import{o as W,e as Y}from"./fqXfkYA3.js";const u=new v("OpenMessage"),A=150,S=15e3,q=2,N=[150,400,800,1500,3e3],G=M;let g;function b(e){return new Promise(t=>setTimeout(t,e))}function m(e,t){const s=o.state,n=s.agentSessions?.byAgentId[e]?.messages,a=s.agentSessions?.historySegmentsByAgentId?.[e]?.messages;return!!(n?.some(r=>r.id===t)||a?.some(r=>r.id===t))}function k(e,t){const s=o.state,n=s.agentSessions?.historySegmentsByAgentId?.[e];n?.detachedFromTail!==!0||n.messages.some(r=>r.id===t)||!s.agentSessions?.byAgentId[e]?.messages?.some(r=>r.id===t)||o.dispatch(H(e))}function I(e){return o.state.chatState?.byAgentId[e]?.transcriptHydration}async function K(e,t,s){const n=Date.now()+S;let a=0;for(;Date.now()<n;){if(s.aborted)return!1;if(m(e,t))return!0;if(a>=q&&I(e)==="settled"&&!p.select(o.state,e).initialHistoryPending)return!1;a++,await b(A)}return!s.aborted&&m(e,t)}async function V(e,t,s,n){const a=Date.now()+S;for(;p.select(o.state,e).initialHistoryPending;){if(n?.aborted||Date.now()>=a)return!1;await b(A)}const r=o.state.agentSessions?.byAgentId[e];if(!r||n?.aborted)return!1;if(m(e,t))return k(e,t),!0;s??=r.workspaceId;const l=p.select(o.state,e);let c={nextToken:l.scrollbackOlderToken,prevToken:l.scrollbackGapToken,olderAnchorId:l.scrollbackOlderTokenAnchorId};o.dispatch(L(e,"seek"));const d=p.select(o.state,e).scrollbackDiscardEpoch,f=()=>!!o.state.agentSessions?.byAgentId[e]&&p.select(o.state,e).scrollbackDiscardEpoch===d;try{const i=await E.agents.getConversation(e,G,void 0,t,void 0,s);return n?.aborted||!f()||!i.messages.some(h=>h.id===t)?!1:(o.dispatch(P(e,i.messages,i.messages[0]?.seq)),i.nextToken===null&&o.dispatch(R(e)),c={nextToken:i.nextToken,prevToken:i.prevToken,olderAnchorId:i.messages[0]?.id??null},m(e,t))}catch(i){return u.warn("[seekConversationToMessage] Seek fetch failed (message may no longer exist)",{agentId:e,messageId:t,error:i}),!1}finally{f()&&o.dispatch(B(e,c))}}async function ee(e){if(e.signal?.aborted)return;g?.abort(),g=new AbortController;const t=e.signal?AbortSignal.any([g.signal,e.signal]):g.signal,{workspaceId:s,agentId:n,messageId:a,query:r,targetTabId:l}=e;u.info("[openMessage] Deep-opening conversation at message",{workspaceId:s,agentId:n,messageId:a});const c=s===y;c&&!e.contentAlreadyOpen&&(o.dispatch(_(n)),o.dispatch(C(y,n)),o.dispatch(D("chief")));const d=c?"/":Y(s);if(!e.contentAlreadyOpen&&typeof window<"u"&&window.location.pathname!==d){try{c?await F(d):await W(s)}catch(w){u.warn("[openMessage] Workspace navigation failed",{workspaceId:s,error:w});return}if(t.aborted)return;if(window.location.pathname!==d){u.warn("[openMessage] Workspace navigation was not confirmed",{workspaceId:s});return}}!e.contentAlreadyOpen&&!c&&o.dispatch(O(s,{agentId:n}));const f=await K(n,a,t);f&&k(n,a);const i=f||await V(n,a,s,t);if(t.aborted)return;if(!i){u.warn("[openMessage] Message not found; conversation opened at tail",{agentId:n,messageId:a});return}const h=`open-message-${Date.now()}-${Math.random().toString(36).slice(2)}`,T={agentId:n,messageId:a,query:r,targetTabId:l,requestId:h,signal:t};for(const w of N)setTimeout(()=>{t.aborted||x("chat:open-message",T)},w)}export{ee as openMessage,V as seekConversationToMessage};
@@ -1 +1 @@
1
- import{t as lt,bq as $,a_ as x,by as pt,bs as dt,b as mt,bu as S,bo as T}from"./syxE6N1N.js";import{bs as ut,ca as A,aD as e,bj as ft,a7 as f,ay as l,W as p,bn as _t,c9 as _,cd as q,aA as k,bS as gt,aB as vt}from"./DYhIMPy1.js";import{G as H}from"./CdmW6laI.js";import{c as L}from"./CrYKIqze.js";import{as as bt,cL as It}from"./DLGpFr8e.js";import{dj as $t,dI as St}from"./CNJgwoNk.js";import{S as kt,c as Ct}from"./C28yvyOi.js";import{selectScriptById as yt,selectCanDeleteScript as ht}from"./CMGTMc9v.js";import"./XNWMykPO.js";import"./g2wqtBd2.js";import"./BgtLN2kD.js";import"./CloK0EEY.js";import{M as N}from"./CXJnOaE2.js";import{g as wt}from"./DfN8_dcw.js";import{T as xt}from"./DyVs3tqq.js";import{Ig as D,Cm as Tt,uG as At,gN as Dt}from"./CpBlZvWi.js";var Bt=vt("<!> <!>",1);function Wt(B,c){if(new.target)return lt({component:Wt,...B});ut(c,!0);const g=()=>S(F,"$fullContext$",v),P=()=>S(Q,"$canDeleteScript$",v),R=()=>S(J,"$scriptContext$",v),V=()=>S(K,"$script$",v),[v,z]=dt(),E=t=>{var r=f(),n=l(r);{var m=h=>{var M=Bt(),O=l(M);{let u=_(()=>T.workspace_shell_showInBottomBar_tooltip());L(O,()=>N,(I,w)=>{w(I,{get icon(){return bt},get label(){return e(u)},onclick:X,"data-move-to-bottom-bar":!0})})}var at=gt(O,2);{var st=u=>{var I=f(),w=l(I);{let ot=_(()=>T.scripts_delete_label()),nt=_(()=>P()?void 0:T.scripts_delete_disabled_description());L(w,()=>N,(ct,it)=>{it(ct,{get icon(){return It},get label(){return e(ot)},destructive:!0,get disabledReason(){return e(nt)},onclick:U})})}p(u,I)};x(at,u=>{e(s)&&u(st)})}p(h,M)};x(n,h=>{g()&&h(m)})}p(t,r)};let o=$(c,"tab",7),a=$(c,"workspaceId",7),C=$(c,"layoutId",7),i=$(c,"isActive",7);const b=_(()=>o().terminalId),s=_(()=>o().scriptId),W=wt(),d=q(""),y=q("");A(()=>d.set(a())),A(()=>y.set(e(s)??""));const F=$t(d),J=St(d),K=yt(d,y),Q=ht(d,y);let j=!0;ft(()=>{j=!1});function U(){if(!e(s))return;const t=a(),r=e(s),n=o().id;return Ct(t,r,()=>j&&i()&&a()===t&&e(s)===r&&o().id===n)}function X(){g()&&(e(s)&&D.dispatch(Tt(a(),e(s))),D.dispatch(At(a(),e(b))),D.dispatch(Dt(C()??a(),o().id)))}A(()=>{if(!(!W||!i()))return W.registerActions({actions:E})});var Y={get tab(){return o()},set tab(t){o(t),k()},get workspaceId(){return a()},set workspaceId(t){a(t),k()},get layoutId(){return C()},set layoutId(t){C(t),k()},get isActive(){return i()},set isActive(t){i(t),k()},$set:pt,$on:(t,r)=>mt(c,t,r)},G=f(),Z=l(G);{var tt=t=>{var r=f(),n=l(r);H(n,()=>e(s),m=>{kt(m,{get scriptId(){return e(s)},get workspaceId(){return a()},class:"h-full"})}),p(t,r)},et=t=>{var r=f(),n=l(r);H(n,()=>e(b),m=>{xt(m,{get terminalId(){return e(b)},get workspaceId(){return a()},class:"h-full"})}),p(t,r)};x(Z,t=>{e(s)&&i()&&R()&&(g()||V())?t(tt):e(b)&&i()&&g()&&t(et,1)})}p(B,G);var rt=_t(Y);return z(),rt}export{Wt as default};
1
+ import{t as lt,bq as $,a_ as x,by as pt,bs as dt,b as mt,bu as S,bo as T}from"./syxE6N1N.js";import{bs as ut,ca as A,aD as e,bj as ft,a7 as f,ay as l,W as p,bn as _t,c9 as _,cd as q,aA as k,bS as gt,aB as vt}from"./DYhIMPy1.js";import{G as H}from"./CdmW6laI.js";import{c as L}from"./CrYKIqze.js";import{as as bt,cL as It}from"./DLGpFr8e.js";import{dj as $t,dI as St}from"./CNJgwoNk.js";import{S as kt,c as Ct}from"./Cy-COy2y.js";import{selectScriptById as yt,selectCanDeleteScript as ht}from"./Ct-dlzru.js";import"./XNWMykPO.js";import"./g2wqtBd2.js";import"./BgtLN2kD.js";import"./CloK0EEY.js";import{M as N}from"./CXJnOaE2.js";import{g as wt}from"./DfN8_dcw.js";import{T as xt}from"./BLE555FN.js";import{Ig as D,Cm as Tt,uG as At,gN as Dt}from"./CpBlZvWi.js";var Bt=vt("<!> <!>",1);function Wt(B,c){if(new.target)return lt({component:Wt,...B});ut(c,!0);const g=()=>S(F,"$fullContext$",v),P=()=>S(Q,"$canDeleteScript$",v),R=()=>S(J,"$scriptContext$",v),V=()=>S(K,"$script$",v),[v,z]=dt(),E=t=>{var r=f(),n=l(r);{var m=h=>{var M=Bt(),O=l(M);{let u=_(()=>T.workspace_shell_showInBottomBar_tooltip());L(O,()=>N,(I,w)=>{w(I,{get icon(){return bt},get label(){return e(u)},onclick:X,"data-move-to-bottom-bar":!0})})}var at=gt(O,2);{var st=u=>{var I=f(),w=l(I);{let ot=_(()=>T.scripts_delete_label()),nt=_(()=>P()?void 0:T.scripts_delete_disabled_description());L(w,()=>N,(ct,it)=>{it(ct,{get icon(){return It},get label(){return e(ot)},destructive:!0,get disabledReason(){return e(nt)},onclick:U})})}p(u,I)};x(at,u=>{e(s)&&u(st)})}p(h,M)};x(n,h=>{g()&&h(m)})}p(t,r)};let o=$(c,"tab",7),a=$(c,"workspaceId",7),C=$(c,"layoutId",7),i=$(c,"isActive",7);const b=_(()=>o().terminalId),s=_(()=>o().scriptId),W=wt(),d=q(""),y=q("");A(()=>d.set(a())),A(()=>y.set(e(s)??""));const F=$t(d),J=St(d),K=yt(d,y),Q=ht(d,y);let j=!0;ft(()=>{j=!1});function U(){if(!e(s))return;const t=a(),r=e(s),n=o().id;return Ct(t,r,()=>j&&i()&&a()===t&&e(s)===r&&o().id===n)}function X(){g()&&(e(s)&&D.dispatch(Tt(a(),e(s))),D.dispatch(At(a(),e(b))),D.dispatch(Dt(C()??a(),o().id)))}A(()=>{if(!(!W||!i()))return W.registerActions({actions:E})});var Y={get tab(){return o()},set tab(t){o(t),k()},get workspaceId(){return a()},set workspaceId(t){a(t),k()},get layoutId(){return C()},set layoutId(t){C(t),k()},get isActive(){return i()},set isActive(t){i(t),k()},$set:pt,$on:(t,r)=>mt(c,t,r)},G=f(),Z=l(G);{var tt=t=>{var r=f(),n=l(r);H(n,()=>e(s),m=>{kt(m,{get scriptId(){return e(s)},get workspaceId(){return a()},class:"h-full"})}),p(t,r)},et=t=>{var r=f(),n=l(r);H(n,()=>e(b),m=>{xt(m,{get terminalId(){return e(b)},get workspaceId(){return a()},class:"h-full"})}),p(t,r)};x(Z,t=>{e(s)&&i()&&R()&&(g()||V())?t(tt):e(b)&&i()&&g()&&t(et,1)})}p(B,G);var rt=_t(Y);return z(),rt}export{Wt as default};
@@ -1,4 +1,4 @@
1
- import{bo as b,t as wt,bq as H,a_ as D,by as Tt,bs as xt,b as kt,bu as N}from"./syxE6N1N.js";import{bs as It,ca as Q,aD as t,a7 as At,ay as X,W as w,bn as Pt,bS as F,c9 as f,aA as R,aB as x,a5 as I,bA as A,bl as P,b_ as B,bO as S}from"./DYhIMPy1.js";import{G as St}from"./CdmW6laI.js";import{c as Wt}from"./CrYKIqze.js";import{C as q}from"./DypB-Dwi.js";import{L as $t}from"./D8dE5NKO.js";import"./B7-qYhrK.js";import"./XNWMykPO.js";import"./g2wqtBd2.js";import{bc as Dt}from"./DLGpFr8e.js";import"./BgtLN2kD.js";import"./ChbqD4nY.js";import{Ig as E,IM as Nt,J1 as Ft,IR as Bt,uF as Et}from"./CpBlZvWi.js";import{T as Lt}from"./B1ohiv8G.js";import{g as Ut}from"./DfN8_dcw.js";import{dp as Ot}from"./CNJgwoNk.js";import{bN as jt,bK as Mt,b5 as Ht}from"./C46AGI2o.js";import"./CloK0EEY.js";import{M as Rt}from"./CXJnOaE2.js";import{V as Vt}from"./DVTqQKPY.js";import{O as qt}from"./BX_AS4NO.js";import{c as Gt}from"./ChTqQfQN.js";import{i as Jt}from"./H2jLkRRS.js";const T=new $t({category:"change-converters"});function V(e,n){return e.path||e.file||e.filePath||e.relativePath||n?.filePath}function Y(e,n){return{additions:e.additions??n?.additions??0,deletions:e.deletions??n?.deletions??0,binary:e.binary??!1}}function Kt(e,n){if(n.actor?.type==="agent"&&n.actor.id){const r=n.actor;return{agentId:r.id,agentName:r.name||b.fileTracking_changeTimeline_agent_fallback(),sessionId:r.sessionId||e.sessionId||"",turnNumber:r.turnNumber??e.turnNumber??0,messageId:r.messageId,timestamp:new Date(n.timestamp).getTime()}}if(e.agentId)return{agentId:e.agentId,agentName:e.agentName||b.fileTracking_changeTimeline_agent_fallback(),sessionId:e.sessionId||"",turnNumber:e.turnNumber||0,timestamp:new Date(n.timestamp).getTime()}}function Z(e,n){return{timestamp:new Date(e.timestamp).getTime(),manual:e.actor?.type==="user",agent:Kt(n,e)}}function tt(e,n){return{oldContent:n?.oldContent??e.oldContent,newContent:n?.newContent??e.newContent,diff:e.diff??n?.diff}}function et(e,n,r){return r!==void 0?`${e}-${n}-${r}`:`${e}-${n}`}function zt(e){try{const n=e.data||{},r=e.codeChange;T.debug("Converting event to TrackedChange",{eventType:e.type,eventId:e.id,hasData:!!n,hasCodeChange:!!r});const c=V(n,r);if(e.type.startsWith("file:")&&c){const d=Y(n,r);return T.debug("Creating TrackedChange for file event",{filePath:c,stats:d,hasDiff:!!(n.diff||r?.diff)}),[{id:et("event",e.id),file:c,relativePath:c,stage:q.Unstaged,stats:d,attribution:Z(e,n),content:tt(n,r)}]}return(e.type==="agent:completed"||e.type.startsWith("agent:"))&&n.fileChanges&&Array.isArray(n.fileChanges)?(T.debug("Creating TrackedChanges for agent event",{eventType:e.type,fileChangesCount:n.fileChanges.length,agentId:n.agentId}),n.fileChanges.filter(d=>V(d)?!0:(T.warn("Skipping file change without path",{change:d}),!1)).map((d,s)=>{const v=V(d);if(!v)throw new Error("file change without path");return{id:et("event",e.id,s),file:v,relativePath:v,stage:q.Unstaged,stats:Y(d),attribution:Z(e,n),content:tt(d)}})):(T.debug("No TrackedChanges created for event",{eventType:e.type,eventId:e.id,hasFilePath:!!c,hasFileChanges:!!(n.fileChanges&&Array.isArray(n.fileChanges))}),[])}catch(n){return T.error("Error converting event to TrackedChange",n instanceof Error?n:new Error(String(n)),{eventType:e.type,eventId:e.id}),[]}}function Qt(e){if(!e)return{oldContent:"",newContent:""};const n=[],r=[],c=e.split(`
1
+ import{bo as b,t as wt,bq as H,a_ as D,by as Tt,bs as xt,b as kt,bu as N}from"./syxE6N1N.js";import{bs as It,ca as Q,aD as t,a7 as At,ay as X,W as w,bn as Pt,bS as F,c9 as f,aA as R,aB as x,a5 as I,bA as A,bl as P,b_ as B,bO as S}from"./DYhIMPy1.js";import{G as St}from"./CdmW6laI.js";import{c as Wt}from"./CrYKIqze.js";import{C as q}from"./DypB-Dwi.js";import{L as $t}from"./D8dE5NKO.js";import"./IN5H29V-.js";import"./XNWMykPO.js";import"./g2wqtBd2.js";import{bc as Dt}from"./DLGpFr8e.js";import"./BgtLN2kD.js";import"./BEWET3uQ.js";import{Ig as E,IM as Nt,J1 as Ft,IR as Bt,uF as Et}from"./CpBlZvWi.js";import{T as Lt}from"./CveDKSFg.js";import{g as Ut}from"./DfN8_dcw.js";import{dp as Ot}from"./CNJgwoNk.js";import{bN as jt,bK as Mt,b5 as Ht}from"./BX3vzTpn.js";import"./CloK0EEY.js";import{M as Rt}from"./CXJnOaE2.js";import{V as Vt}from"./DVTqQKPY.js";import{O as qt}from"./BCLA-ClZ.js";import{c as Gt}from"./ChTqQfQN.js";import{i as Jt}from"./H2jLkRRS.js";const T=new $t({category:"change-converters"});function V(e,n){return e.path||e.file||e.filePath||e.relativePath||n?.filePath}function Y(e,n){return{additions:e.additions??n?.additions??0,deletions:e.deletions??n?.deletions??0,binary:e.binary??!1}}function Kt(e,n){if(n.actor?.type==="agent"&&n.actor.id){const r=n.actor;return{agentId:r.id,agentName:r.name||b.fileTracking_changeTimeline_agent_fallback(),sessionId:r.sessionId||e.sessionId||"",turnNumber:r.turnNumber??e.turnNumber??0,messageId:r.messageId,timestamp:new Date(n.timestamp).getTime()}}if(e.agentId)return{agentId:e.agentId,agentName:e.agentName||b.fileTracking_changeTimeline_agent_fallback(),sessionId:e.sessionId||"",turnNumber:e.turnNumber||0,timestamp:new Date(n.timestamp).getTime()}}function Z(e,n){return{timestamp:new Date(e.timestamp).getTime(),manual:e.actor?.type==="user",agent:Kt(n,e)}}function tt(e,n){return{oldContent:n?.oldContent??e.oldContent,newContent:n?.newContent??e.newContent,diff:e.diff??n?.diff}}function et(e,n,r){return r!==void 0?`${e}-${n}-${r}`:`${e}-${n}`}function zt(e){try{const n=e.data||{},r=e.codeChange;T.debug("Converting event to TrackedChange",{eventType:e.type,eventId:e.id,hasData:!!n,hasCodeChange:!!r});const c=V(n,r);if(e.type.startsWith("file:")&&c){const d=Y(n,r);return T.debug("Creating TrackedChange for file event",{filePath:c,stats:d,hasDiff:!!(n.diff||r?.diff)}),[{id:et("event",e.id),file:c,relativePath:c,stage:q.Unstaged,stats:d,attribution:Z(e,n),content:tt(n,r)}]}return(e.type==="agent:completed"||e.type.startsWith("agent:"))&&n.fileChanges&&Array.isArray(n.fileChanges)?(T.debug("Creating TrackedChanges for agent event",{eventType:e.type,fileChangesCount:n.fileChanges.length,agentId:n.agentId}),n.fileChanges.filter(d=>V(d)?!0:(T.warn("Skipping file change without path",{change:d}),!1)).map((d,s)=>{const v=V(d);if(!v)throw new Error("file change without path");return{id:et("event",e.id,s),file:v,relativePath:v,stage:q.Unstaged,stats:Y(d),attribution:Z(e,n),content:tt(d)}})):(T.debug("No TrackedChanges created for event",{eventType:e.type,eventId:e.id,hasFilePath:!!c,hasFileChanges:!!(n.fileChanges&&Array.isArray(n.fileChanges))}),[])}catch(n){return T.error("Error converting event to TrackedChange",n instanceof Error?n:new Error(String(n)),{eventType:e.type,eventId:e.id}),[]}}function Qt(e){if(!e)return{oldContent:"",newContent:""};const n=[],r=[],c=e.split(`
2
2
  `);c.length>0&&c[c.length-1]===""&&c.pop();let d=!1;for(const s of c)if(!(s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")||s.startsWith("\"))){if(s.startsWith("@@")){d=!0;continue}d&&(s.startsWith("+")?r.push(s.slice(1)):s.startsWith("-")?n.push(s.slice(1)):s.startsWith(" ")?(n.push(s.slice(1)),r.push(s.slice(1))):s===""&&(n.push(""),r.push("")))}return{oldContent:n.join(`
3
3
  `),newContent:r.join(`
4
4
  `)}}var Xt=x("<!> <!>",1),Yt=x('<div class="flex items-center gap-1.5 px-3 py-1.5 text-xs text-subtle bg-muted/50 border-b border-border"><span> </span></div>'),Zt=x('<div class="flex flex-col h-full"><!> <div class="flex-1 min-h-0"><!></div></div>'),te=x('<div class="flex flex-col items-center justify-center h-full text-subtle gap-4"><p class="text-sm"> </p> <p class="text-xs opacity-70"> </p></div>'),ee=x('<p class="text-xs opacity-70"> </p>'),ne=x('<div class="flex flex-col items-center justify-center h-full text-subtle gap-4"><p class="text-sm"> </p> <!></div>');function ae(e,n){if(new.target)return wt({component:ae,...e});It(n,!0);const r=()=>N(lt,"$workspace",v),c=()=>N(st,"$foldUnchanged",v),d=()=>N(rt,"$lineWrapping",v),s=()=>N(ot,"$diffSideBySide",v),[v,nt]=xt(),at=a=>{Vt(a,{embedded:!0,get foldEnabled(){return c()},onToggleFold:()=>E.dispatch(Bt()),get wrapEnabled(){return d()},onToggleWrap:()=>E.dispatch(Ft()),get splitEnabled(){return s()},onToggleSplit:()=>E.dispatch(Nt())})},it=a=>{var i=Xt(),g=X(i);{let m=f(()=>b.layout_diffHeader_goToFile_tooltip());Wt(g,()=>Rt,(l,h)=>{h(l,{get icon(){return Dt},get label(){return t(m)},onclick:$=>ut()})})}var y=F(g,2);{var C=m=>{qt(m,{get filePath(){return t(J)},get workspaceId(){return _()},isDirectory:!1,embedded:!0,get workspaceFolderPath(){return t(O)}})};D(y,m=>{t(J)&&m(C)})}w(a,i)},rt=jt(),st=Mt(),ot=Ht(),dt=Gt("ActivityChangesTabType");let L=H(n,"tab",7),_=H(n,"workspaceId",7),U=H(n,"isActive",7);const G=Ut(),lt=Ot(_()),O=f(()=>r()?.worktreePath||r()?.repositoryPath||void 0),o=f(()=>L().data?.event),ct=f(()=>t(o)?zt(t(o)):[]),u=f(()=>t(ct)[0]),p=f(()=>t(u)?.relativePath||t(u)?.file||null),J=f(()=>t(p)&&t(O)?Jt(t(p))?t(p):`${t(O)}/${t(p)}`:null),j=f(()=>()=>{if(!t(o))return null;const a=t(o).data,i=t(o).codeChange;return a?.diff||i?.diff||t(u)?.content?.diff||null}),K=f(()=>()=>t(u)?.content?!!(t(u).content.oldContent&&t(u).content.newContent):!1);function ft(a){if(!a)return;const i=a.match(/@@ -(\d+)/);return i?parseInt(i[1],10):void 0}const k=f(()=>{if(t(K)()&&t(u)?.content)return{oldContent:t(u).content.oldContent??"",newContent:t(u).content.newContent??""};const a=t(j)();return a?Qt(a):null}),W=f(()=>ft(t(j)())),pt=f(()=>t(W)!==void 0&&t(W)>1),gt=f(()=>{const a=t(p)||"",i=t(o)?.data||{};return{id:`activity-${t(o)?.id||"unknown"}-${a}`,file:a,relativePath:a,stage:q.Committed,status:t(u)?.status||"modified",stats:{additions:i?.additions||t(u)?.stats?.additions||0,deletions:i?.deletions||t(u)?.stats?.deletions||0},attribution:{timestamp:t(o)?.timestamp?new Date(t(o).timestamp).getTime():Date.now()},content:t(k)?{oldContent:t(k).oldContent,newContent:t(k).newContent}:void 0}});function ut(a){if(!t(p))return;const g={type:"file",title:t(p).split("/").pop()||t(p),closable:!0,filePath:t(p),workspaceId:_()};E.dispatch(Et(_(),g))}Q(()=>{!G||!U()||G.registerActions({display:at,actions:it})}),Q(()=>{if(t(o)){const a=t(o).data;dt.debug("Activity event diff info",{eventType:t(o).type,eventId:t(o).id,filePath:t(p),hasDiffString:!!t(j)(),hasOldNewContent:t(K)(),hasDiffContents:!!t(k),dataAdditions:a?.additions,dataDeletions:a?.deletions})}});var ht={get tab(){return L()},set tab(a){L(a),R()},get workspaceId(){return _()},set workspaceId(a){_(a),R()},get isActive(){return U()},set isActive(a){U(a),R()},$set:Tt,$on:(a,i)=>kt(n,a,i)},z=At(),mt=X(z);{var vt=a=>{var i=Zt(),g=I(i);{var y=l=>{var h=Yt(),$=I(h),M=P($,!0);A(h),B(_t=>S(M,_t),[()=>b.layout_activityChanges_partialDiff_label({line:t(W)??0})]),w(l,h)};D(g,l=>{t(pt)&&l(y)})}var C=F(g,2),m=I(C);St(m,()=>`${t(o)?.id}-${t(p)}`,l=>{{let h=f(()=>s()?"split":"unified");Lt(l,{get change(){return t(gt)},get workspaceId(){return _()},get viewMode(){return t(h)},get foldUnchanged(){return c()},get lineWrapping(){return d()},get lineOffset(){return t(W)}})}}),A(C),A(i),w(a,i)},yt=a=>{var i=te(),g=I(i),y=P(g,!0),C=F(g,2),m=P(C,!0);A(i),B((l,h)=>{S(y,l),S(m,h)},[()=>b.layout_activityChanges_noDiffStored_label(),()=>b.layout_activityChanges_diffNotCaptured_description()]),w(a,i)},Ct=a=>{var i=ne(),g=I(i),y=P(g,!0),C=F(g,2);{var m=l=>{var h=ee(),$=P(h,!0);B(M=>S($,M),[()=>b.layout_activityChanges_eventType_label({type:t(o).type})]),w(l,h)};D(C,l=>{t(o)&&l(m)})}A(i),B(l=>S(y,l),[()=>b.layout_activityChanges_noChanges_label()]),w(a,i)};D(mt,a=>{t(p)&&t(k)?a(vt):t(p)?a(yt,1):a(Ct,-1)})}w(e,z);var bt=Pt(ht);return nt(),bt}export{ae as default};
@@ -1 +1 @@
1
- import{b as a,B as w,ay as x}from"./BuxJaWiM.js";var g=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=B(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),B=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{g as s};
1
+ import{b as a,B as w,ay as x}from"./BTBcxnN8.js";var g=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=B(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),B=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{g as s};
@@ -1,4 +1,4 @@
1
- import{t as Ge,bq as m,bo as d,a_ as me,by as qe,b as He,bt as Fr,bu as mt,bs as Sr}from"./syxE6N1N.js";import{bs as je,ay as q,be as dt,b$ as tt,b_ as V,bO as G,W as h,bS as g,aD as e,a7 as _t,bl as he,bn as Ze,c9 as b,aA as _,aB as Z,ca as Pe,c0 as ht,bH as i,a5 as Q,bA as ee,bV as M,br as xt,bk as Tr,bj as $r,bf as Co,c5 as Ct,aw as Yt,bz as ko,cd as qt}from"./DYhIMPy1.js";import{c as J}from"./CrYKIqze.js";import{n as br,p as Io,v as Pt,u as Xe,w as Eo,I as Po,g as kt}from"./XNWMykPO.js";import{b as vt}from"./BaIAhI85.js";import{d as mr}from"./DyVs3tqq.js";import{H as Lo,G as Ro,I as Fo}from"./CdmW6laI.js";import{c as or}from"./ChTqQfQN.js";import{a as So}from"./CC7to1B5.js";import{f as Re,bc as To}from"./BgtLN2kD.js";import{k as at}from"./CToUKfVS.js";import{s as $o}from"./g2wqtBd2.js";import{ci as Ur,F as ve,a4 as Uo,aV as No,an as Ao,cD as Bo,aI as Oo,aW as Jt,Y as nr,_ as ar,aZ as Mo,as as Do,cc as Nr,bN as Ar,b6 as Ko,cM as Br,cg as Or,au as Vo}from"./DLGpFr8e.js";import"./SFeFj2Mb.js";import{Ig as Ee,fN as Wo,br as zo,y_ as Go,ym as qo,Ke as _r,dI as Ho,bL as jo,Kd as Zo,u8 as Xo,Kb as hr,gt as Yo,tv as Jo,Kc as Qo,JT as yr,Ka as xr}from"./CpBlZvWi.js";import{a as Mr,B as It}from"./BvFAWM27.js";import{cp as en}from"./1eeMnGBt.js";import{a0 as tn}from"./CfbNoxr9.js";import{w as rn,K as on}from"./BNaHRmzO.js";import{I as $t}from"./D7UcpeiI.js";import{d as nn}from"./C43voWK4.js";import{aa as an}from"./shMIdOXY.js";import{i as Qt}from"./DDBvEq_9.js";import{i as sn,a as ln}from"./CWc2npkj.js";import{R as dn,k as Ht,l as lt,j as un,i as ze,p as Dr,h as Kr,K as cn,m as fn,o as gn,n as vn,M as Vr}from"./BOAArWys.js";import{B as pn}from"./ChbqD4nY.js";import"./CloK0EEY.js";import{t as Ne}from"./1cW9cCot.js";import{M as Wr}from"./CXJnOaE2.js";import"./91je9Py3.js";import"./BhpvRaEf.js";import{b as wn}from"./BjM8_HSR.js";import"./BIJpUOPV.js";import{o as Cr,s as it,n as St}from"./CIyUrgF0.js";import{g as bn}from"./DfN8_dcw.js";import{f as mn}from"./DRs_Vsjz.js";import{aD as _n,a1 as hn,Q as yn}from"./BCH_5tMO.js";import{aO as xn}from"./CNJgwoNk.js";function Cn(o,r){return o.loadURL(r)}function kn(o){return{previousUrlProp:o||null}}function kr(o,r){o.previousUrlProp=r}function In(o,r,a){const v=a||r;return o.previousUrlProp===v?null:(o.previousUrlProp=v,v)}function En(o,r,a){return r?o.previousUrlProp===null?(o.previousUrlProp=r,{shouldLoad:!1,targetUrl:null}):r===o.previousUrlProp?{shouldLoad:!1,targetUrl:null}:a.webviewReady?(o.previousUrlProp=r,a.isValidBrowserUrl(r)?{shouldLoad:!0,targetUrl:r}:{shouldLoad:!1,targetUrl:null}):{shouldLoad:!1,targetUrl:null}:{shouldLoad:!1,targetUrl:null}}const zr=or("TabBoundsReporter"),Pn=150;function jt(o,r,a){!(r>0)||!(a>0)||window.electronAPI?.invoke("browser:report-tab-bounds",{tabId:o,width:r,height:a}).catch(v=>{zr.debug("Failed to report tab bounds",{tabId:o,error:v})})}function Ir(o){window.electronAPI?.invoke("browser:report-tab-bounds",{tabId:o}).catch(r=>{zr.debug("Failed to clear tab bounds",{tabId:o,error:r})})}function Ln(o,r){let a=r,v;const P=typeof ResizeObserver>"u"?void 0:new ResizeObserver(L=>{if(!a)return;const E=L[L.length-1]?.contentRect;if(!E)return;const w=a;clearTimeout(v),v=setTimeout(()=>{jt(w,E.width,E.height)},Pn)});if(P?.observe(o),a){const L=o.getBoundingClientRect();jt(a,L.width,L.height)}return{update(L){if(L!==a&&(clearTimeout(v),a&&Ir(a),a=L,a)){const E=o.getBoundingClientRect();jt(a,E.width,E.height)}},destroy(){clearTimeout(v),P?.disconnect(),a&&Ir(a)}}}function Gr(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 st(o,r=typeof window<"u"?window.location.origin:""){return o==="about:blank"||qr(o,r)}function qr(o,r=typeof window<"u"?window.location.origin:""){if(!o)return!1;try{const a=new URL(o);return Mr.NAVIGATION_ALLOWED.includes(a.protocol)&&a.origin!==r}catch{return!1}}const er="__INTENT_PANEL_BRACKET__:",Rn=`
1
+ import{t as Ge,bq as m,bo as d,a_ as me,by as qe,b as He,bt as Fr,bu as mt,bs as Sr}from"./syxE6N1N.js";import{bs as je,ay as q,be as dt,b$ as tt,b_ as V,bO as G,W as h,bS as g,aD as e,a7 as _t,bl as he,bn as Ze,c9 as b,aA as _,aB as Z,ca as Pe,c0 as ht,bH as i,a5 as Q,bA as ee,bV as M,br as xt,bk as Tr,bj as $r,bf as Co,c5 as Ct,aw as Yt,bz as ko,cd as qt}from"./DYhIMPy1.js";import{c as J}from"./CrYKIqze.js";import{n as br,p as Io,v as Pt,u as Xe,w as Eo,I as Po,g as kt}from"./XNWMykPO.js";import{b as vt}from"./BaIAhI85.js";import{d as mr}from"./BLE555FN.js";import{H as Lo,G as Ro,I as Fo}from"./CdmW6laI.js";import{c as or}from"./ChTqQfQN.js";import{a as So}from"./CC7to1B5.js";import{f as Re,bc as To}from"./BgtLN2kD.js";import{k as at}from"./CToUKfVS.js";import{s as $o}from"./g2wqtBd2.js";import{ci as Ur,F as ve,a4 as Uo,aV as No,an as Ao,cD as Bo,aI as Oo,aW as Jt,Y as nr,_ as ar,aZ as Mo,as as Do,cc as Nr,bN as Ar,b6 as Ko,cM as Br,cg as Or,au as Vo}from"./DLGpFr8e.js";import"./SFeFj2Mb.js";import{Ig as Ee,fN as Wo,br as zo,y_ as Go,ym as qo,Ke as _r,dI as Ho,bL as jo,Kd as Zo,u8 as Xo,Kb as hr,gt as Yo,tv as Jo,Kc as Qo,JT as yr,Ka as xr}from"./CpBlZvWi.js";import{a as Mr,B as It}from"./BvFAWM27.js";import{cp as en}from"./He8rzvWn.js";import{a0 as tn}from"./DSks1Sd3.js";import{w as rn,K as on}from"./BNaHRmzO.js";import{I as $t}from"./D7UcpeiI.js";import{d as nn}from"./C43voWK4.js";import{aa as an}from"./BTS44Ia3.js";import{i as Qt}from"./DDBvEq_9.js";import{i as sn,a as ln}from"./CWc2npkj.js";import{R as dn,k as Ht,l as lt,j as un,i as ze,p as Dr,h as Kr,K as cn,m as fn,o as gn,n as vn,M as Vr}from"./BOAArWys.js";import{B as pn}from"./BEWET3uQ.js";import"./CloK0EEY.js";import{t as Ne}from"./1cW9cCot.js";import{M as Wr}from"./CXJnOaE2.js";import"./91je9Py3.js";import"./BhpvRaEf.js";import{b as wn}from"./BjM8_HSR.js";import"./BIJpUOPV.js";import{o as Cr,s as it,n as St}from"./CIyUrgF0.js";import{g as bn}from"./DfN8_dcw.js";import{f as mn}from"./Dhe30u3B.js";import{aD as _n,a1 as hn,Q as yn}from"./O0uPRDIU.js";import{aO as xn}from"./CNJgwoNk.js";function Cn(o,r){return o.loadURL(r)}function kn(o){return{previousUrlProp:o||null}}function kr(o,r){o.previousUrlProp=r}function In(o,r,a){const v=a||r;return o.previousUrlProp===v?null:(o.previousUrlProp=v,v)}function En(o,r,a){return r?o.previousUrlProp===null?(o.previousUrlProp=r,{shouldLoad:!1,targetUrl:null}):r===o.previousUrlProp?{shouldLoad:!1,targetUrl:null}:a.webviewReady?(o.previousUrlProp=r,a.isValidBrowserUrl(r)?{shouldLoad:!0,targetUrl:r}:{shouldLoad:!1,targetUrl:null}):{shouldLoad:!1,targetUrl:null}:{shouldLoad:!1,targetUrl:null}}const zr=or("TabBoundsReporter"),Pn=150;function jt(o,r,a){!(r>0)||!(a>0)||window.electronAPI?.invoke("browser:report-tab-bounds",{tabId:o,width:r,height:a}).catch(v=>{zr.debug("Failed to report tab bounds",{tabId:o,error:v})})}function Ir(o){window.electronAPI?.invoke("browser:report-tab-bounds",{tabId:o}).catch(r=>{zr.debug("Failed to clear tab bounds",{tabId:o,error:r})})}function Ln(o,r){let a=r,v;const P=typeof ResizeObserver>"u"?void 0:new ResizeObserver(L=>{if(!a)return;const E=L[L.length-1]?.contentRect;if(!E)return;const w=a;clearTimeout(v),v=setTimeout(()=>{jt(w,E.width,E.height)},Pn)});if(P?.observe(o),a){const L=o.getBoundingClientRect();jt(a,L.width,L.height)}return{update(L){if(L!==a&&(clearTimeout(v),a&&Ir(a),a=L,a)){const E=o.getBoundingClientRect();jt(a,E.width,E.height)}},destroy(){clearTimeout(v),P?.disconnect(),a&&Ir(a)}}}function Gr(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 st(o,r=typeof window<"u"?window.location.origin:""){return o==="about:blank"||qr(o,r)}function qr(o,r=typeof window<"u"?window.location.origin:""){if(!o)return!1;try{const a=new URL(o);return Mr.NAVIGATION_ALLOWED.includes(a.protocol)&&a.origin!==r}catch{return!1}}const er="__INTENT_PANEL_BRACKET__:",Rn=`
2
2
  (function() {
3
3
  if (window.__augmentKeyboardInterceptorInstalled) return;
4
4
  window.__augmentKeyboardInterceptorInstalled = true;