wherdr 1.3.3 → 1.3.4

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 (136) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{CP8o925U.js → BEJHMUrj.js} +1 -1
  3. package/.output/public/_nuxt/BOtcEDnA.js +1 -0
  4. package/.output/public/_nuxt/BUaYhQ2r.js +6 -0
  5. package/.output/public/_nuxt/{yzABg5xl.js → Bpoxvzh6.js} +1 -1
  6. package/.output/public/_nuxt/C25ROUa9.js +3 -0
  7. package/.output/public/_nuxt/CDWjMk9C.js +2 -0
  8. package/.output/public/_nuxt/CJKsMzIp.js +1 -0
  9. package/.output/public/_nuxt/CJNhn9sA.js +36 -0
  10. package/.output/public/_nuxt/COCvtdHN.js +89 -0
  11. package/.output/public/_nuxt/{Ci8N4mWR.js → CXJnLmWv.js} +1 -1
  12. package/.output/public/_nuxt/{DT8qZ0Wv.js → Cl45J6_Q.js} +1 -1
  13. package/.output/public/_nuxt/CndPDbMI.js +2 -0
  14. package/.output/public/_nuxt/Ctbx58Um.js +23 -0
  15. package/.output/public/_nuxt/{CKhgznq4.js → DMLmW6JM.js} +43 -39
  16. package/.output/public/_nuxt/Dl1PHLOB.js +1 -0
  17. package/.output/public/_nuxt/{DaaJIRB3.js → Nhex3_iH.js} +1 -1
  18. package/.output/public/_nuxt/OpWX45i7.js +89 -0
  19. package/.output/public/_nuxt/builds/latest.json +1 -1
  20. package/.output/public/_nuxt/builds/meta/4994f3a4-4126-4f57-a9e5-c7ebb25850bc.json +1 -0
  21. package/.output/public/_nuxt/dTj21DMs.js +1 -0
  22. package/.output/public/_nuxt/entry.BohTWE-n.css +2 -0
  23. package/.output/public/_nuxt/{Cr3SrGky.js → kwSoIiM7.js} +1 -1
  24. package/.output/public/_nuxt/mkEwYka4.js +1 -0
  25. package/.output/public/_nuxt/pdf.min.t82Z80JU.mjs +28 -0
  26. package/.output/public/_nuxt/pdf.worker.min.wgc6bjNh.mjs +28 -0
  27. package/.output/public/_nuxt/w7Rm7unj.js +1 -0
  28. package/.output/public/sw.js +1 -1
  29. package/.output/server/chunks/_/branding.mjs +1 -1
  30. package/.output/server/chunks/_/files.mjs +19 -6
  31. package/.output/server/chunks/_/machineOrder.mjs +1 -1
  32. package/.output/server/chunks/_/onboarding.mjs +1 -1
  33. package/.output/server/chunks/_/package.mjs +3 -1
  34. package/.output/server/chunks/_/plugins.mjs +6 -3
  35. package/.output/server/chunks/_/projectBoard.mjs +4 -7
  36. package/.output/server/chunks/_/projectsActions.mjs +1 -1
  37. package/.output/server/chunks/_/projectsPlugin.mjs +24 -50
  38. package/.output/server/chunks/_/projectsPlugin2.mjs +57 -0
  39. package/.output/server/chunks/_/restart.mjs +1 -1
  40. package/.output/server/chunks/_/reveal.mjs +1 -1
  41. package/.output/server/chunks/_/selfupdate.mjs +1 -1
  42. package/.output/server/chunks/_/settingstabs.mjs +36 -0
  43. package/.output/server/chunks/_/updates.mjs +1 -1
  44. package/.output/server/chunks/_/worktrees.mjs +1 -1
  45. package/.output/server/chunks/_/ws.mjs +1 -1
  46. package/.output/server/chunks/nitro/nitro.mjs +840 -367
  47. package/.output/server/chunks/routes/api/board.get.mjs +1 -0
  48. package/.output/server/chunks/routes/api/chat/image.get.mjs +1 -1
  49. package/.output/server/chunks/routes/api/chat.get.mjs +25 -5
  50. package/.output/server/chunks/routes/api/choose.post.mjs +14 -14
  51. package/.output/server/chunks/routes/api/claude-statusline.post.mjs +1 -1
  52. package/.output/server/chunks/routes/api/codex-update.post.mjs +1 -1
  53. package/.output/server/chunks/routes/api/commands.get.mjs +3 -2
  54. package/.output/server/chunks/routes/api/config.get.mjs +1 -1
  55. package/.output/server/chunks/routes/api/dirs.get.mjs +1 -1
  56. package/.output/server/chunks/routes/api/dismiss-stopped.post.mjs +1 -1
  57. package/.output/server/chunks/routes/api/dismiss.post.mjs +1 -1
  58. package/.output/server/chunks/routes/api/effort.post.mjs +1 -1
  59. package/.output/server/chunks/routes/api/efforts.get.mjs +1 -1
  60. package/.output/server/chunks/routes/api/file.post.mjs +1 -1
  61. package/.output/server/chunks/routes/api/files/download.get.mjs +10 -3
  62. package/.output/server/chunks/routes/api/gitroot.get.mjs +1 -1
  63. package/.output/server/chunks/routes/api/index.get.mjs +1 -0
  64. package/.output/server/chunks/routes/api/input.post.mjs +27 -10
  65. package/.output/server/chunks/routes/api/interrupt.post.mjs +1 -1
  66. package/.output/server/chunks/routes/api/isgit.get.mjs +1 -1
  67. package/.output/server/chunks/routes/api/machine/awake.get.mjs +1 -1
  68. package/.output/server/chunks/routes/api/machine/awake.post.mjs +1 -1
  69. package/.output/server/chunks/routes/api/machine/rename.post.mjs +1 -1
  70. package/.output/server/chunks/routes/api/menu.post.mjs +4 -1
  71. package/.output/server/chunks/routes/api/model.post.mjs +1 -1
  72. package/.output/server/chunks/routes/api/models.get.mjs +1 -1
  73. package/.output/server/chunks/routes/api/nav.post.mjs +34 -21
  74. package/.output/server/chunks/routes/api/phone.get.mjs +1 -1
  75. package/.output/server/chunks/routes/api/phone.post.mjs +1 -1
  76. package/.output/server/chunks/routes/api/plugins/actions.get.mjs +2 -0
  77. package/.output/server/chunks/routes/api/plugins/invoke.post.mjs +2 -0
  78. package/.output/server/chunks/routes/api/plugins/profiles.get.mjs +2 -0
  79. package/.output/server/chunks/routes/api/plugins/projects.get.mjs +3 -2
  80. package/.output/server/chunks/routes/api/plugins/projects.post.mjs +3 -2
  81. package/.output/server/chunks/routes/api/plugins/thread-limits.post.mjs +1 -1
  82. package/.output/server/chunks/routes/api/project/inbox.get.mjs +1 -0
  83. package/.output/server/chunks/routes/api/project/inbox.post.mjs +1 -0
  84. package/.output/server/chunks/routes/api/project/memory.get.mjs +1 -0
  85. package/.output/server/chunks/routes/api/project/report.get.mjs +1 -0
  86. package/.output/server/chunks/routes/api/project/routines.get.mjs +1 -0
  87. package/.output/server/chunks/routes/api/project/settings.get.mjs +1 -0
  88. package/.output/server/chunks/routes/api/project/thread.get.mjs +1 -0
  89. package/.output/server/chunks/routes/api/project/thread.post.mjs +2 -0
  90. package/.output/server/chunks/routes/api/prompt.post.mjs +1 -1
  91. package/.output/server/chunks/routes/api/push/quiet.post.mjs +1 -1
  92. package/.output/server/chunks/routes/api/push/subscribe.post.mjs +1 -1
  93. package/.output/server/chunks/routes/api/push/test.post.mjs +1 -1
  94. package/.output/server/chunks/routes/api/push/unsubscribe.post.mjs +1 -1
  95. package/.output/server/chunks/routes/api/quotas.get.mjs +1 -1
  96. package/.output/server/chunks/routes/api/requeue.post.mjs +1 -1
  97. package/.output/server/chunks/routes/api/screen-key.post.mjs +13 -10
  98. package/.output/server/chunks/routes/api/screen.get.mjs +2 -35
  99. package/.output/server/chunks/routes/api/search.get.mjs +1 -1
  100. package/.output/server/chunks/routes/api/seen.post.mjs +1 -1
  101. package/.output/server/chunks/routes/api/sessions.get.mjs +1 -1
  102. package/.output/server/chunks/routes/api/sessions.post.mjs +1 -1
  103. package/.output/server/chunks/routes/api/settings-tab.post.mjs +89 -0
  104. package/.output/server/chunks/routes/api/space.post.mjs +1 -1
  105. package/.output/server/chunks/routes/api/unqueue.post.mjs +1 -1
  106. package/.output/server/chunks/routes/api/update.get.mjs +1 -1
  107. package/.output/server/chunks/routes/api/update.post.mjs +1 -1
  108. package/.output/server/chunks/routes/api/upload.post.mjs +1 -1
  109. package/.output/server/chunks/routes/icons/_name_.get.mjs +1 -1
  110. package/.output/server/chunks/routes/renderer.mjs +2 -2
  111. package/.output/server/chunks/routes/uploads/_...name_.get.mjs +1 -1
  112. package/.output/server/chunks/routes/ws/_..._.mjs +1 -1
  113. package/.output/server/chunks/routes/ws/events.mjs +1 -1
  114. package/.output/server/chunks/routes/ws/term.mjs +1 -1
  115. package/.output/server/chunks/virtual/precomputed.mjs +1 -1
  116. package/.output/server/index.mjs +1 -1
  117. package/.output/server/package.json +1 -1
  118. package/README.md +44 -23
  119. package/package.json +3 -1
  120. package/skills/wherdr/SKILL.md +9 -3
  121. package/.output/public/_nuxt/B4Yk2tB1.js +0 -23
  122. package/.output/public/_nuxt/BBw_0a4M.js +0 -6
  123. package/.output/public/_nuxt/BSy6OCIY.js +0 -1
  124. package/.output/public/_nuxt/BX5PM2JQ.js +0 -1
  125. package/.output/public/_nuxt/BgPDnf2S.js +0 -1
  126. package/.output/public/_nuxt/BkOxQzbS.js +0 -2
  127. package/.output/public/_nuxt/CWwyK2XK.js +0 -2
  128. package/.output/public/_nuxt/CkbmecwS.js +0 -1
  129. package/.output/public/_nuxt/DAg9fiVh.js +0 -89
  130. package/.output/public/_nuxt/DcJi16XA.js +0 -1
  131. package/.output/public/_nuxt/SiL1FJ5s.js +0 -3
  132. package/.output/public/_nuxt/VpjCgSXu.js +0 -36
  133. package/.output/public/_nuxt/builds/meta/c735b6c0-1bd0-47d7-a208-d310f0a06287.json +0 -1
  134. package/.output/public/_nuxt/dPxB2L94.js +0 -89
  135. package/.output/public/_nuxt/entry.CGWKmYU3.css +0 -2
  136. package/.output/public/_nuxt/xYX85SPI.js +0 -1
@@ -1,34 +1,34 @@
1
- import{t as e}from"./hePW80VL.js";import{$ as t,A as n,An as r,At as i,B as a,Bn as o,Dn as s,Dt as c,Et as l,Fn as u,Ft as d,Hn as f,Jt as p,M as m,Mn as h,N as g,Ot as _,P as v,Pt as y,Qt as b,R as x,Rn as S,Rt as C,St as w,U as T,V as E,Yt as D,Zt as O,b as k,ct as A,dr as j,hr as M,ht as N,in as P,j as F,ln as I,mr as L,mt as R,nn as z,pr as B,pt as V,sn as H,vt as U,w as ee,wn as te,zn as W}from"./SiL1FJ5s.js";import{_t as G,dt as ne,ht as re,vt as K}from"./CWwyK2XK.js";import{$r as ie,$t as q,An as ae,Ar as oe,B as se,Bn as ce,C as le,Cn as ue,Ct as de,Dn as fe,Dt as pe,En as me,Et as he,Ft as ge,G as _e,Gt as ve,Jr as ye,Jt as be,K as xe,Kn as Se,Kt as Ce,L as we,Ln as Te,Lr as Ee,M as De,O as Oe,Ot as ke,P as Ae,Pn as je,Pr as Me,Pt as Ne,Qt as Pe,R as Fe,S as Ie,St as Le,T as Re,Tn as ze,V as Be,Vt as Ve,Wr as He,Xr as Ue,Xt as We,Yr as Ge,Yt as Ke,Zt as qe,_ as Je,_n as Ye,a as Xe,ai as Ze,an as Qe,ar as $e,b as et,bn as tt,c as nt,cn as rt,cr as it,ct as at,d as ot,dn as st,dr as ct,en as lt,f as ut,fn as dt,ft,g as pt,gn as mt,gr as ht,h as gt,hn as _t,hr as vt,i as yt,ii as bt,ir as xt,j as St,jn as Ct,kn as wt,l as Tt,ln as Et,lr as Dt,lt as Ot,m as kt,mr as At,mt as jt,n as Mt,ni as Nt,nn as Pt,nr as Ft,on as It,or as Lt,p as Rt,pr as zt,q as Bt,qt as Vt,r as Ht,ri as Ut,rn as Wt,s as Gt,sn as Kt,sr as qt,st as Jt,t as Yt,ti as Xt,tn as Zt,u as Qt,un as $t,v as en,w as tn,wn as nn,wt as rn,xt as an,z as on}from"./dPxB2L94.js";import{f as sn,m as cn,p as ln,u as un}from"./Ci8N4mWR.js";import{t as dn}from"./yzABg5xl.js";import{c as J}from"./BBw_0a4M.js";import{$ as fn,$r as pn,At as mn,B as hn,Br as Y,Bt as gn,C as _n,Cr as vn,Ct as yn,Dr as bn,Dt as xn,Er as X,Et as Sn,F as Cn,Ft as wn,G as Tn,Gr as En,H as Dn,Hr as On,I as kn,In as An,It as jn,Jr as Mn,K as Nn,Kn as Pn,Lt as Fn,Mr as In,Mt as Ln,N as Rn,Nt as zn,O as Bn,Or as Vn,Ot as Hn,Pr as Un,Qn as Wn,Qr as Gn,Rr as Kn,Rt as qn,Sr as Jn,St as Yn,T as Xn,Tr as Zn,Tt as Qn,U as $n,Un as er,Ur as tr,V as nr,Vr as Z,W as rr,Wn as ir,Wr as ar,Y as or,Yn as sr,Yr as cr,Z as lr,Zr as ur,_ as dr,ar as fr,b as Q,br as pr,bt as mr,cn as hr,er as gr,et as _r,g as vr,hn as yr,ht as br,ir as xr,it as Sr,jr as Cr,jt as wr,kr as Tr,kt as Er,mt as $,n as Dr,nt as Or,on as kr,ot as Ar,pt as jr,q as Mr,qn as Nr,qr as Pr,rr as Fr,s as Ir,si as Lr,v as Rr,vt as zr,w as Br,wr as Vr,wt as Hr,xr as Ur,xt as Wr,yr as Gr,yt as Kr,zt as qr}from"./DAg9fiVh.js";import{a as Jr,d as Yr,f as Xr,h as Zr,o as Qr,r as $r,t as ei,v as ti,y as ni}from"./BkOxQzbS.js";import{_ as ri,a as ii,f as ai,h as oi,m as si,n as ci,p as li,r as ui,t as di}from"./BgPDnf2S.js";import{i as fi,n as pi,o as mi,s as hi,t as gi}from"./DaaJIRB3.js";import{$ as _i,A as vi,D as yi,E as bi,F as xi,J as Si,L as Ci,M as wi,O as Ti,P as Ei,Q as Di,R as Oi,S as ki,T as Ai,X as ji,Y as Mi,Z as Ni,_ as Pi,a as Fi,at as Ii,b as Li,c as Ri,ct as zi,dt as Bi,et as Vi,g as Hi,i as Ui,it as Wi,j as Gi,k as Ki,l as qi,lt as Ji,n as Yi,nt as Xi,o as Zi,ot as Qi,r as $i,rt as ea,s as ta,st as na,t as ra,tt as ia,ut as aa,v as oa,w as sa,y as ca}from"#entry";import{a as la,c as ua,d as da,i as fa,l as pa,n as ma,o as ha,r as ga,s as _a,t as va,u as ya}from"./CkbmecwS.js";var[ba,xa]=ve(`CollapsibleRoot`),Sa=T({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=ke(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=W(r);return xa({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),ft(),(e,t)=>(_(),m(f(Jt),{as:e.as,"as-child":r.asChild,"data-state":f(i)?`open`:`closed`,"data-disabled":f(a)?``:void 0},{default:H(()=>[d(e.$slots,`default`,{open:f(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),Ca=T({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let r=e,i=t,a=ba();a.contentId||=Ot(void 0,`reka-collapsible-content`);let o=h(),{forwardRef:s,currentElement:c}=ft(),l=h(0),u=h(0),p=n(()=>a.open.value),v=h(p.value),y=h();z(()=>[p.value,o.value?.present],async()=>{await N();let e=c.value;if(!e)return;y.value=y.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();u.value=t.height,l.value=t.width,v.value||(e.style.transitionDuration=y.value.transitionDuration,e.style.animationName=y.value.animationName)},{immediate:!0});let b=n(()=>v.value&&a.open.value);return w(()=>{requestAnimationFrame(()=>{v.value=!1})}),Le(c,`beforematch`,e=>{requestAnimationFrame(()=>{a.onOpenToggle(),i(`contentFound`)})}),(e,t)=>(_(),m(f(at),{ref_key:`presentRef`,ref:o,present:e.forceMount||f(a).open.value,"force-mount":!0},{default:H(({present:t})=>[E(f(Jt),R(e.$attrs,{id:f(a).contentId,ref:f(s),"as-child":r.asChild,as:e.as,hidden:t?void 0:f(a).unmountOnHide.value?``:`until-found`,"data-state":b.value?void 0:f(a).open.value?`open`:`closed`,"data-disabled":f(a).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${u.value}px`,"--reka-collapsible-content-width":`${l.value}px`}}),{default:H(()=>[!f(a).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),wa=T({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;ft();let n=ba();return(e,r)=>(_(),m(f(Jt),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":f(n).contentId,"aria-expanded":f(n).open.value,"data-state":f(n).open.value?`open`:`closed`,"data-disabled":f(n).disabled?.value?``:void 0,disabled:f(n).disabled?.value,onClick:f(n).onOpenToggle},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}}),[Ta,Ea]=ve(`TabsRoot`),Da=T({__name:`TabsRoot`,props:{defaultValue:{type:null,required:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},activationMode:{type:String,required:!1,default:`automatic`},modelValue:{type:null,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{orientation:i,unmountOnHide:a,dir:o}=W(n),s=jt(o);ft();let c=ke(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),l=h(),p=u(new Set);return Ea({modelValue:c,changeModelValue:e=>{c.value=e},orientation:i,dir:s,unmountOnHide:a,activationMode:n.activationMode,baseId:Ot(void 0,`reka-tabs`),tabsList:l,contentIds:p,registerContent:e=>{p.value=new Set([...p.value,e])},unregisterContent:e=>{let t=new Set(p.value);t.delete(e),p.value=t}}),(e,t)=>(_(),m(f(Jt),{dir:f(s),"data-orientation":f(i),"as-child":e.asChild,as:e.as},{default:H(()=>[d(e.$slots,`default`,{modelValue:f(c)})]),_:3},8,[`dir`,`data-orientation`,`as-child`,`as`]))}});function Oa(e,t){return`${e}-trigger-${t}`}function ka(e,t){return`${e}-content-${t}`}var Aa=T({__name:`TabsContent`,props:{value:{type:[String,Number],required:!0},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:r}=ft(),i=Ta(),a=n(()=>Oa(i.baseId,t.value)),o=n(()=>ka(i.baseId,t.value)),s=n(()=>t.value===i.modelValue.value),c=h(s.value);return w(()=>{i.registerContent(t.value),requestAnimationFrame(()=>{c.value=!1})}),U(()=>{i.unregisterContent(t.value)}),(e,t)=>(_(),m(f(at),{present:e.forceMount||s.value,"force-mount":``},{default:H(({present:t})=>[E(f(Jt),{id:o.value,ref:f(r),"as-child":e.asChild,as:e.as,role:`tabpanel`,"data-state":s.value?`active`:`inactive`,"data-orientation":f(i).orientation.value,"aria-labelledby":a.value,hidden:!t,tabindex:`0`,style:L({animationDuration:c.value?`0s`:void 0})},{default:H(()=>[!f(i).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1032,[`id`,`as-child`,`as`,`data-state`,`data-orientation`,`aria-labelledby`,`hidden`,`style`])]),_:3},8,[`present`]))}}),ja=T({__name:`TabsIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:t}){let r=e,i=Ta();t({updateIndicatorStyle:c}),ft();let a=de(),o=h({size:null,thickness:null,position:null}),s=h([]);z(()=>[i.modelValue.value,i?.dir.value],()=>{c()},{immediate:!0,flush:`post`}),P(()=>{s.value=Array.from(i.tabsList.value?.querySelectorAll(`[role="tab"]`)||[])}),he(n(()=>[i.tabsList.value,...s.value]),c);function c(){let e=i.tabsList.value?.querySelector(`[role="tab"][data-state="active"]`);e&&(i.orientation.value===`horizontal`?o.value={size:e.offsetWidth,thickness:e.offsetHeight,position:e.offsetLeft}:o.value={size:e.offsetHeight,thickness:e.offsetWidth,position:e.offsetTop})}return(e,t)=>f(a)&&typeof o.value.size==`number`?(_(),m(f(Jt),R({key:0},r,{style:{"--reka-tabs-indicator-size":`${o.value.size}px`,"--reka-tabs-indicator-thickness":`${o.value.thickness}px`,"--reka-tabs-indicator-position":`${o.value.position}px`}}),{default:H(()=>[d(e.$slots,`default`)]),_:3},16,[`style`])):g(`v-if`,!0)}}),Ma=T({__name:`TabsList`,props:{loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let{loop:t}=W(e),{forwardRef:n,currentElement:r}=ft(),i=Ta();return i.tabsList=r,(e,r)=>(_(),m(f(Bt),{"as-child":``,orientation:f(i).orientation.value,dir:f(i).dir.value,loop:f(t)},{default:H(()=>[E(f(Jt),{ref:f(n),role:`tablist`,"as-child":e.asChild,as:e.as,"aria-orientation":f(i).orientation.value},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`aria-orientation`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),Na=T({__name:`TabsTrigger`,props:{value:{type:[String,Number],required:!0},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,{forwardRef:r}=ft(),i=Ta(),a=n(()=>Oa(i.baseId,t.value)),o=n(()=>i.contentIds.value.has(t.value)?ka(i.baseId,t.value):void 0),s=n(()=>t.value===i.modelValue.value);return(e,t)=>(_(),m(f(hi),{"as-child":``,focusable:!e.disabled,active:s.value},{default:H(()=>[E(f(Jt),{id:a.value,ref:f(r),role:`tab`,type:e.as===`button`?`button`:void 0,as:e.as,"as-child":e.asChild,"aria-selected":s.value?`true`:`false`,"aria-controls":o.value,"data-state":s.value?`active`:`inactive`,disabled:e.disabled,"data-disabled":e.disabled?``:void 0,"data-orientation":f(i).orientation.value,onMousedown:t[0]||=K(t=>{!e.disabled&&t.ctrlKey===!1?f(i).changeModelValue(e.value):t.preventDefault()},[`left`]),onKeydown:t[1]||=G(t=>f(i).changeModelValue(e.value),[`enter`,`space`]),onFocus:t[2]||=()=>{let t=f(i).activationMode!==`manual`;!s.value&&!e.disabled&&t&&f(i).changeModelValue(e.value)}},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`id`,`type`,`as`,`as-child`,`aria-selected`,`aria-controls`,`data-state`,`disabled`,`data-disabled`,`data-orientation`])]),_:3},8,[`focusable`,`active`]))}}),Pa=[`aria-label`],Fa=[`title`,`data-tab`,`aria-current`,`onPointerdown`,`onClick`],Ia={key:1,class:`tab-chip-dot`},La={class:`tab-chip-label`},Ra=[`title`,`aria-label`,`disabled`],za=Object.assign(T({__name:`SpaceTabs`,props:{workspace:{},current:{}},setup(e){let t=e,r=n(()=>Xt(t.workspace).map(e=>{let t=yr(e.panes);return{...e,label:e.tab.label||String(e.tab.number),tone:t&&t.agent?Wt(t):``,title:e.panes.map(e=>Cr(e)).join(` · `)}}));z(()=>t.current,e=>{e&&Ue(e)},{immediate:!0});let i=e=>`${Y(`Tab`)} ${e}`,a=null,o=wi({onPress:()=>{a&&(X(),nn(He(a.id),i(a.label)))}});function s(e,t,n){Ar.value&&(a={id:t,label:n},o.down(e))}function c(e){o.swallowClick()||e===t.current||Ut(e)}return(t,n)=>{let i=Ci,a=Oi,l=De;return(`spaceTabControls`in t?t.spaceTabControls:f(Fn))(f(r).length).row?(_(),v(`nav`,{key:0,class:`tab-chips space-tabs`,"aria-label":(`t`in t?t.t:f(Y))(`Tabs`)},[(_(!0),v(k,null,y(f(r),r=>(_(),m(a,{key:r.tab.id,disabled:`sheetMenus`in t?t.sheetMenus:f(Ar),items:(`sheetMenus`in t?t.sheetMenus:f(Ar))?[]:(`toDropdown`in t?t.toDropdown:f(wt))((`tabItems`in t?t.tabItems:f(He))(r.tab.id)),ui:{content:`hw-dropdown`}},{default:H(()=>[F(`button`,{type:`button`,class:j([`tab-chip`,r.tone]),title:r.title,"data-tab":r.tab.id,"aria-current":r.tab.id===e.current?`page`:void 0,onPointerdown:e=>s(e,r.tab.id,r.label),onPointermove:n[0]||=(...e)=>f(o).move&&f(o).move(...e),onPointerup:n[1]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onPointercancel:n[2]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onContextmenu:n[3]||=e=>(`sheetMenus`in t?t.sheetMenus:f(Ar))&&e.preventDefault(),onClick:e=>c(r.tab.id)},[r.panes.length>1?(_(),m(i,{key:0,layout:r.layout,panes:r.panes},null,8,[`layout`,`panes`])):(_(),v(`i`,Ia)),F(`span`,La,M(r.label),1)],42,Fa)]),_:2},1032,[`disabled`,`items`]))),128)),F(`button`,{type:`button`,class:`tab-chip tab-add`,title:(`t`in t?t.t:f(Y))(`New tab`),"aria-label":(`t`in t?t.t:f(Y))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(Dn),onClick:n[4]||=n=>(`newTab`in t?t.newTab:f(Me))(e.workspace)},[E(l,{name:`i-lucide-plus`})],8,Ra)],8,Pa)):g(``,!0)}}}),{__name:`SpaceTabs`}),Ba={slots:{base:`font-medium inline-flex items-center`,label:`truncate`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailingIcon:`shrink-0`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{solid:``,outline:``,soft:``,subtle:``},size:{xs:{base:`text-[8px]/3 px-1 py-0.5 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},sm:{base:`text-[10px]/3 px-1.5 py-1 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},md:{base:`text-xs px-2 py-1 gap-1 rounded-md`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`},lg:{base:`text-sm px-2 py-1 gap-1.5 rounded-md`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`},xl:{base:`text-base px-2.5 py-1 gap-1.5 rounded-md`,leadingIcon:`size-6`,leadingAvatarSize:`2xs`,trailingIcon:`size-6`}},square:{true:``}},compoundVariants:[{color:`primary`,variant:`solid`,class:`bg-primary text-inverted`},{color:`neutral`,variant:`solid`,class:`bg-neutral text-inverted`},{color:`success`,variant:`solid`,class:`bg-success text-inverted`},{color:`warning`,variant:`solid`,class:`bg-warning text-inverted`},{color:`error`,variant:`solid`,class:`bg-error text-inverted`},{color:`info`,variant:`solid`,class:`bg-info text-inverted`},{color:`primary`,variant:`outline`,class:`text-primary ring ring-inset ring-primary/50`},{color:`neutral`,variant:`outline`,class:`text-neutral ring ring-inset ring-neutral/50`},{color:`success`,variant:`outline`,class:`text-success ring ring-inset ring-success/50`},{color:`warning`,variant:`outline`,class:`text-warning ring ring-inset ring-warning/50`},{color:`error`,variant:`outline`,class:`text-error ring ring-inset ring-error/50`},{color:`info`,variant:`outline`,class:`text-info ring ring-inset ring-info/50`},{color:`primary`,variant:`soft`,class:`bg-primary/10 text-primary`},{color:`neutral`,variant:`soft`,class:`bg-neutral/10 text-neutral`},{color:`success`,variant:`soft`,class:`bg-success/10 text-success`},{color:`warning`,variant:`soft`,class:`bg-warning/10 text-warning`},{color:`error`,variant:`soft`,class:`bg-error/10 text-error`},{color:`info`,variant:`soft`,class:`bg-info/10 text-info`},{color:`primary`,variant:`subtle`,class:`bg-primary/10 text-primary ring ring-inset ring-primary/25`},{color:`neutral`,variant:`subtle`,class:`bg-neutral/10 text-neutral ring ring-inset ring-neutral/25`},{color:`success`,variant:`subtle`,class:`bg-success/10 text-success ring ring-inset ring-success/25`},{color:`warning`,variant:`subtle`,class:`bg-warning/10 text-warning ring ring-inset ring-warning/25`},{color:`error`,variant:`subtle`,class:`bg-error/10 text-error ring ring-inset ring-error/25`},{color:`info`,variant:`subtle`,class:`bg-info/10 text-info ring ring-inset ring-info/25`},{color:`neutral`,variant:`solid`,class:`text-inverted bg-inverted`},{color:`neutral`,variant:`outline`,class:`ring ring-inset ring-accented text-default bg-default`},{color:`neutral`,variant:`soft`,class:`text-default bg-elevated`},{color:`neutral`,variant:`subtle`,class:`ring ring-inset ring-accented text-default bg-elevated`},{size:`xs`,square:!0,class:`p-0.5`},{size:`sm`,square:!0,class:`p-1`},{size:`md`,square:!0,class:`p-1`},{size:`lg`,square:!0,class:`p-1`},{size:`xl`,square:!0,class:`p-1`}],defaultVariants:{color:`primary`,variant:`solid`,size:`md`}},Va={__name:`UBadge`,props:{as:{type:null,required:!1,default:`span`},label:{type:[String,Number],required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1}},setup(e){let t=e,r=O(),i=se(`badge`,t),a=J(),{orientation:o,size:s}=we(t),{isLeading:c,isTrailing:l,leadingIconName:u,trailingIconName:p}=Fe(i),h=n(()=>Ae({extend:Ba,...a.ui?.badge||{}})({color:i.color,variant:i.variant,size:s.value??i.size,square:i.square||!r.default&&!i.label,fieldGroup:o.value}));return(e,t)=>(_(),m(f(Jt),{as:f(i).as,"data-slot":`base`,class:j(h.value.base({class:[f(i).ui?.base,f(i).class]}))},{default:H(()=>[d(e.$slots,`leading`,{ui:h.value},()=>[f(c)&&f(u)?(_(),m(De,{key:0,name:f(u),"data-slot":`leadingIcon`,class:j(h.value.leadingIcon({class:f(i).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(i).avatar?(_(),m(St,R({key:1,size:f(i).ui?.leadingAvatarSize||h.value.leadingAvatarSize()},f(i).avatar,{"data-slot":`leadingAvatar`,class:h.value.leadingAvatar({class:f(i).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)]),d(e.$slots,`default`,{ui:h.value},()=>[f(i).label!==void 0&&f(i).label!==null?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(h.value.label({class:f(i).ui?.label}))},M(f(i).label),3)):g(``,!0)]),d(e.$slots,`trailing`,{ui:h.value},()=>[f(l)&&f(p)?(_(),m(De,{key:0,name:f(p),"data-slot":`trailingIcon`,class:j(h.value.trailingIcon({class:f(i).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)])]),_:3},8,[`as`,`class`]))}},Ha={slots:{root:`flex items-center gap-2`,list:`relative flex p-1 group`,indicator:`absolute transition-[translate,width] duration-200 ease-out motion-reduce:transition-none`,trigger:[`group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75`,`transition-colors`],leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,label:`truncate`,trailingBadge:`shrink-0`,trailingBadgeSize:`sm`,content:`w-full rounded-md focus-visible:outline-3`},variants:{color:{primary:{content:`outline-primary/25`},neutral:{content:`outline-inverted/25`},success:{content:`outline-success/25`},warning:{content:`outline-warning/25`},error:{content:`outline-error/25`},info:{content:`outline-info/25`}},variant:{pill:{list:`bg-elevated rounded-lg`,trigger:[`grow`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:inset-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:rounded-md in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:shadow-xs in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:-z-10 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:isolate`],indicator:`rounded-md shadow-xs`},link:{list:`border-default`,indicator:`rounded-full`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:rounded-full`}},orientation:{horizontal:{root:`flex-col`,list:`w-full`,indicator:`left-0 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position)`,trigger:`justify-center`},vertical:{list:`flex-col`,indicator:`top-0 h-(--reka-tabs-indicator-size) translate-y-(--reka-tabs-indicator-position)`}},size:{xs:{trigger:`px-2 py-1 text-xs gap-1`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},sm:{trigger:`px-2.5 py-1.5 text-xs gap-1.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},md:{trigger:`px-3 py-1.5 text-sm gap-1.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},lg:{trigger:`px-3 py-2 text-sm gap-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},xl:{trigger:`px-3 py-2 text-base gap-2`,leadingIcon:`size-6`,leadingAvatarSize:`xs`}}},compoundVariants:[{orientation:`horizontal`,variant:`pill`,class:{indicator:`inset-y-1`}},{orientation:`horizontal`,variant:`link`,class:{list:`border-b -mb-px`,indicator:`-bottom-px h-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-x-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-bottom-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:h-px`}},{orientation:`vertical`,variant:`pill`,class:{indicator:`inset-x-1`,list:`items-center`,trigger:`w-full justify-center`}},{orientation:`vertical`,variant:`link`,class:{list:`border-s -ms-px`,indicator:`-start-px w-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-y-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-start-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:w-px`}},{color:`primary`,variant:`pill`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-inverted outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-primary`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-inverted outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-neutral`]}},{color:`success`,variant:`pill`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-inverted outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-success`]}},{color:`warning`,variant:`pill`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-inverted outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-warning`]}},{color:`error`,variant:`pill`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-inverted outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-error`]}},{color:`info`,variant:`pill`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-inverted outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-info`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-inverted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-inverted`]}},{color:`primary`,variant:`link`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-primary outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-primary`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-neutral outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-neutral`]}},{color:`success`,variant:`link`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-success outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-success`]}},{color:`warning`,variant:`link`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-warning outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-warning`]}},{color:`error`,variant:`link`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-error outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-error`]}},{color:`info`,variant:`link`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-info outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-info`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-highlighted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-inverted`]}}],defaultVariants:{color:`primary`,variant:`pill`,size:`md`}},Ua={__name:`UTabs`,props:{as:{type:null,required:!1},items:{type:Array,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:`horizontal`},content:{type:Boolean,required:!1,default:!0},valueKey:{type:null,required:!1,default:`value`},labelKey:{type:null,required:!1,default:`label`},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultValue:{type:[String,Number],required:!1,default:`0`},modelValue:{type:[String,Number],required:!1},activationMode:{type:String,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,o=r,s=O(),c=se(`tabs`,i),l=J(),u=on(ge(c,`as`,`unmountOnHide`),o),p=n(()=>Ae({extend:Ha,...l.ui?.tabs||{}})({color:c.color,variant:c.variant,size:c.size,orientation:c.orientation})),b=h([]);function x(e,t){b.value[e]=t}return t({triggersRef:b}),(e,t)=>(_(),m(f(Da),R(f(u),{"model-value":f(c).modelValue,"default-value":f(c).defaultValue,orientation:f(c).orientation,"activation-mode":f(c).activationMode,"data-slot":`root`,class:p.value.root({class:[f(c).ui?.root,f(c).class]})}),{default:H(()=>[E(f(Ma),{"data-slot":`list`,class:j(p.value.list({class:f(c).ui?.list}))},{default:H(()=>[E(f(ja),{"data-slot":`indicator`,class:j(p.value.indicator({class:f(c).ui?.indicator}))},null,8,[`class`]),d(e.$slots,`list-leading`),(_(!0),v(k,null,y(f(c).items,(t,n)=>(_(),m(f(Na),{key:f(Be)(t,f(c).valueKey)??n,ref_for:!0,ref:e=>x(n,e),value:f(Be)(t,f(c).valueKey)??String(n),disabled:t.disabled,"data-slot":`trigger`,class:j(p.value.trigger({class:[f(c).ui?.trigger,t.ui?.trigger]}))},{default:H(()=>[d(e.$slots,`leading`,{item:t,index:n,ui:p.value},()=>[t.icon?(_(),m(De,{key:0,name:t.icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:[f(c).ui?.leadingIcon,t.ui?.leadingIcon]}))},null,8,[`name`,`class`])):t.avatar?(_(),m(St,R({key:1,size:t.ui?.leadingAvatarSize||f(c).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},{ref_for:!0},t.avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:[f(c).ui?.leadingAvatar,t.ui?.leadingAvatar]})}),null,16,[`size`,`class`])):g(``,!0)]),f(Be)(t,f(c).labelKey)||s.default?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(p.value.label({class:[f(c).ui?.label,t.ui?.label]}))},[d(e.$slots,`default`,{item:t,index:n},()=>[a(M(f(Be)(t,f(c).labelKey)),1)])],2)):g(``,!0),d(e.$slots,`trailing`,{item:t,index:n,ui:p.value},()=>[t.badge||t.badge===0?(_(),m(Va,R({key:0,color:`neutral`,variant:`outline`,size:t.ui?.trailingBadgeSize||f(c).ui?.trailingBadgeSize||p.value.trailingBadgeSize()},{ref_for:!0},typeof t.badge==`string`||typeof t.badge==`number`?{label:t.badge}:t.badge,{"data-slot":`trailingBadge`,class:p.value.trailingBadge({class:[f(c).ui?.trailingBadge,t.ui?.trailingBadge]})}),null,16,[`size`,`class`])):g(``,!0)])]),_:2},1032,[`value`,`disabled`,`class`]))),128)),d(e.$slots,`list-trailing`)]),_:3},8,[`class`]),f(c).content?(_(!0),v(k,{key:0},y(f(c).items,(t,n)=>(_(),m(f(Aa),{key:f(Be)(t,f(c).valueKey)??n,value:f(Be)(t,f(c).valueKey)??String(n),"data-slot":`content`,class:j(p.value.content({class:[f(c).ui?.content,t.ui?.content,t.class]}))},{default:H(()=>[d(e.$slots,t.slot||`content`,{item:t,index:n,ui:p.value},()=>[a(M(t.content),1)])]),_:2},1032,[`value`,`class`]))),128)):g(``,!0)]),_:3},16,[`model-value`,`default-value`,`orientation`,`activation-mode`,`class`]))}},Wa=`input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .term, .chat-list, .msg`,Ga=`button, a, [role="tab"], [role="button"]:not(.plan-cell), .cell-grip, ${Wa}`;function Ka(e){return!!e?.closest?.(Wa)}function qa(e){return!!e?.closest?.(Ga)}var Ja=Object.assign(vi(T({__name:`HeaderMenu`,props:{items:{type:Function},title:{},disabled:{type:Boolean},manualPress:{type:Boolean}},setup(e){let t=e,n=h([]);function r(){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0}))}function i(e){e?(n.value=wt(t.items()),window.addEventListener(`scroll`,r,{capture:!0,passive:!0})):window.removeEventListener(`scroll`,r,{capture:!0})}l(()=>window.removeEventListener(`scroll`,r,{capture:!0}));let a=``;function o(e){Ka(e.target)?e.stopPropagation():Ar.value&&(e.preventDefault(),a===`mouse`&&!t.disabled&&nn(t.items(),t.title))}let s=wi({onPress:()=>{X(),nn(t.items(),t.title)}});function c(e){a=e.pointerType,!(!Ar.value||t.disabled||t.manualPress||qa(e.target))&&s.down(e)}return(t,r)=>{let a=Oi;return _(),m(a,{disabled:(`sheetMenus`in t?t.sheetMenus:f(Ar))||e.disabled,items:f(n),ui:{content:`hw-dropdown`},"onUpdate:open":i},{default:H(()=>[F(`div`,{class:`header-menu`,onContextmenuCapture:o,onPointerdown:c,onPointermove:r[0]||=(...e)=>f(s).move&&f(s).move(...e),onPointerup:r[1]||=(...e)=>f(s).cancel&&f(s).cancel(...e),onPointercancel:r[2]||=(...e)=>f(s).cancel&&f(s).cancel(...e)},[d(t.$slots,`default`,{},void 0,!0)],32)]),_:3},8,[`disabled`,`items`])}}}),[[`__scopeId`,`data-v-562a5bfa`]]),{__name:`HeaderMenu`}),Ya=Object.assign(vi(T({__name:`GridBackdrop`,setup(e){let t=h(null),n=h(null),r=h(!1),i,a=!1,o=0,s;function c(){let e=n.value;if(!e||o>=3)return;let t=ni(e.clientWidth,e.clientHeight),r=document.createElement(`i`);r.className=`pkt ${t.vertical?`v`:`h`}${t.reverse?` rev`:``}${t.alt?` alt`:``}`,r.style.left=`${t.left}px`,r.style.top=`${t.top}px`;let i=t.vertical?`Y`:`X`;e.appendChild(r),o++;let a=r.animate([{transform:`translate${i}(${t.reverse?t.dist:0}px)`,opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.7},{transform:`translate${i}(${t.reverse?0:t.dist}px)`,opacity:0}],{duration:t.duration,easing:`cubic-bezier(.4, 0, .6, 1)`});a.onfinish=()=>{r.remove(),o--}}function l(){clearTimeout(s),!a&&Xr.value&&r.value&&!document.hidden&&(s=setTimeout(()=>{c(),l()},ti()))}return z([r,Xr],l),w(()=>{a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,document.addEventListener(`visibilitychange`,l),t.value&&(i=new IntersectionObserver(([e])=>{r.value=!!e?.isIntersecting}),i.observe(t.value))}),U(()=>{i?.disconnect(),document.removeEventListener(`visibilitychange`,l),clearTimeout(s)}),(e,r)=>(_(),v(`div`,{ref_key:`root`,ref:t,class:`grid-backdrop`,"aria-hidden":`true`},[r[0]||=F(`div`,{class:`gbd-dots`},null,-1),F(`div`,{ref_key:`packets`,ref:n,class:`gbd-packets`},null,512),r[1]||=F(`div`,{class:`gbd-vignette`},null,-1)],512))}}),[[`__scopeId`,`data-v-a290ab6b`]]),{__name:`GridBackdrop`}),Xa={key:0,class:`offline-image`},Za=[`src`,`onClick`],Qa=[`aria-label`],$a=[`src`],eo=[`disabled`,`onClick`],to=Object.assign(T({__name:`MsgThumbs`,props:{srcs:{},offline:{type:Boolean},max:{},dupes:{}},setup(e){let t=e,r=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>!t.dupes?.has(e.src))),i=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>t.dupes?.has(e.src))),a=n(()=>ca(r.value.length,t.max));function o(e){ue(t.srcs,e)}return(t,n)=>(_(),v(`span`,{class:j([`thumbs`,{one:f(r).length===1}])},[(_(!0),v(k,null,y(f(r).slice(0,f(a).shown),n=>(_(),v(`span`,{key:n.src},[e.offline?(_(),v(`span`,Xa,M((`t`in t?t.t:f(Y))(`Image unavailable offline`)),1)):(_(),v(`img`,{key:1,class:`msg-img`,src:n.src,alt:``,loading:`lazy`,decoding:`async`,onClick:e=>o(n.i)},null,8,Za))]))),128)),f(a).more?(_(),v(`button`,{key:0,type:`button`,class:`thumb-more`,"aria-label":(`tl`in t?t.tl:f(Z))(`Show all ${f(r).length} images`,`Voir les ${f(r).length} images`),onClick:n[0]||=e=>o(f(r)[f(a).shown].i)},[e.offline?g(``,!0):(_(),v(`img`,{key:0,src:f(r)[f(a).shown].src,alt:``,loading:`lazy`,decoding:`async`},null,8,$a)),F(`span`,null,`+`+M(f(a).more),1)],8,Qa)):g(``,!0),(_(!0),v(k,null,y(f(i),n=>(_(),v(`button`,{key:n.src,type:`button`,class:`thumb-dupe`,disabled:e.offline,onClick:e=>o(n.i)},` ↑ `+M((`tl`in t?t.tl:f(Z))(`Same image as above`,`Image déjà affichée plus haut`)),9,eo))),128))],2))}}),{__name:`MsgThumbs`}),no={class:`file-chip-icon`},ro={key:0,class:`spinner`},io={class:`file-chip-body`},ao={class:`file-chip-name`},oo={class:`file-chip-meta`},so=[`aria-label`],co=Object.assign(T({__name:`FileChip`,props:{name:{},size:{},kind:{},uploading:{type:Boolean},removable:{type:Boolean},clickable:{type:Boolean}},emits:[`remove`,`open`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>Ni(r.name,r.kind)),o=n(()=>Di(r.name).slice(0,6)||(r.kind===`text`?`txt`:``));function s(e){r.clickable&&i(`open`,e.currentTarget)}return(t,n)=>{let r=De;return _(),m(C(e.clickable?`button`:`div`),{type:e.clickable?`button`:void 0,class:j([`file-chip`,{up:e.uploading,clickable:e.clickable}]),title:e.name,onClick:s},{default:H(()=>[F(`span`,no,[e.uploading?(_(),v(`span`,ro)):(_(),m(r,{key:1,name:f(a)},null,8,[`name`]))]),F(`span`,io,[F(`span`,ao,M(e.name),1),F(`span`,oo,M([f(o),e.size?f(_i)(e.size):``].filter(Boolean).join(` · `)),1)]),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`file-chip-x`,"aria-label":(`t`in t?t.t:f(Y))(`Remove`),onClick:n[0]||=K(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,so)):g(``,!0)]),_:1},8,[`type`,`class`,`title`])}}}),{__name:`FileChip`}),lo={key:0,class:`msg-ref-meta`},uo={class:`msg-ref-text`},fo={key:1,class:`msg-q`},po=Object.assign(T({__name:`QuotedText`,props:{text:{}},setup(e){let t=e,r=n(()=>Mn(t.text).map(e=>e.kind===`ref`?e:{...e,text:e.text.replace(/^\n+|\n+$/g,``)}).filter(e=>e.kind===`ref`||e.text)),i=A(`gotoRef`,null),o=e=>e.kind===`task`?e.label.replace(/\s*:$/,``):[e.time,e.n?`#${e.n}`:``].filter(Boolean).join(` · `);return(e,t)=>(_(!0),v(k,null,y(f(r),(n,r)=>(_(),v(k,{key:r},[n.kind===`ref`?(_(),m(C(f(i)&&n.ref.kind!==`task`?`button`:`span`),{key:0,class:`msg-ref`,"data-kind":n.ref.kind,type:f(i)&&n.ref.kind!==`task`?`button`:void 0,"aria-label":f(i)&&n.ref.kind!==`task`?`${(`t`in e?e.t:f(Y))(`Show original message`)}: ${n.ref.excerpt}`:void 0,onClick:e=>f(i)&&n.ref.kind!==`task`&&f(i)(n.ref,e.currentTarget)},{default:H(()=>[t[0]||=F(`span`,{class:`msg-ref-mark`,"aria-hidden":`true`},`↳`,-1),o(n.ref)?(_(),v(`span`,lo,M(o(n.ref)),1)):g(``,!0),F(`span`,uo,M(n.ref.excerpt),1)]),_:2},1032,[`data-kind`,`type`,`aria-label`,`onClick`])):n.kind===`quote`?(_(),v(`span`,fo,M(n.text),1)):(_(),v(k,{key:2},[a(M(n.text),1)],64))],64))),128))}}),{__name:`QuotedText`}),mo=[`aria-expanded`],ho=Object.assign(T({__name:`FoldText`,setup(e){let t=h(null),n=h(!1),r=h(!1),i=null;function a(){let e=t.value;if(!e)return;let r=(Number.parseFloat(getComputedStyle(e).lineHeight)||22.5)*12.5;n.value=e.scrollHeight>r}return w(()=>{a(),i=new ResizeObserver(a),t.value&&i.observe(t.value)}),c(a),U(()=>i?.disconnect()),(e,i)=>(_(),v(k,null,[F(`span`,{ref_key:`box`,ref:t,class:j([`msg-fold`,{folded:f(n)&&!f(r)}]),style:{display:`block`}},[d(e.$slots,`default`)],2),f(n)?(_(),v(`button`,{key:0,type:`button`,class:`msg-fold-btn`,"aria-expanded":f(r),onClick:i[0]||=e=>r.value=!f(r)},M(f(r)?(`tl`in e?e.tl:f(Z))(`Show less`,`Afficher moins`):(`tl`in e?e.tl:f(Z))(`Show more`,`Afficher plus`)),9,mo)):g(``,!0)],64))}}),{__name:`FoldText`}),go=[`aria-label`],_o={class:`pasted-head`},vo=[`aria-label`],yo={class:`pasted-foot`},bo=Object.assign(T({__name:`PastedCard`,props:{text:{},removable:{type:Boolean}},emits:[`remove`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=n(()=>rt(r.text)),c=n(()=>r.text.split(`
2
- `).filter(e=>e.trim()).slice(0,2).map(e=>e.trim())),l=n(()=>Et(r.text)),u=n(()=>Z(`Pasted text · ${s.value} line${s.value>1?`s`:``}`,`Texte collé · ${s.value} ligne${s.value>1?`s`:``}`));async function d(){try{await navigator.clipboard.writeText(r.text),$(Z(`Text copied`,`Texte copié`))}catch{$(Y(`Copy failed`),!0)}}return(t,n)=>{let r=De,s=Oe,p=yi;return _(),v(`div`,{class:j([`pasted-card`,{removable:e.removable}])},[F(`button`,{type:`button`,class:`pasted-open`,"aria-label":(`tl`in t?t.tl:f(Z))(`Open pasted text`,`Ouvrir le texte collé`),onClick:n[0]||=e=>o.value=!0},[F(`span`,_o,[E(r,{name:`i-lucide-clipboard-paste`}),a(M(f(u)),1)]),(_(!0),v(k,null,y(f(c),(e,t)=>(_(),v(`span`,{key:t,class:`pasted-line`},M(e),1))),128))],8,go),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`pasted-x`,"aria-label":(`t`in t?t.t:f(Y))(`Remove`),onClick:n[1]||=K(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,vo)):g(``,!0),E(p,{open:f(o),"onUpdate:open":n[2]||=e=>te(o)?o.value=e:null,title:f(u),wide:``,tall:``},{footer:H(()=>[F(`div`,yo,[E(s,{icon:`i-lucide-copy`,color:`neutral`,variant:`outline`,onClick:d},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`Copy`,`Copier`)),1)]),_:1})])]),default:H(()=>[F(`pre`,{class:j([`pasted-full`,{mono:f(l)}])},M(e.text),3)]),_:1},8,[`open`,`title`])],2)}}}),{__name:`PastedCard`}),xo={key:1,class:`msg-pastes`},So=Object.assign(T({__name:`UserText`,props:{text:{},pasted:{}},setup(e){let t=e,r=n(()=>st(t.text,t.pasted,It.value));return(e,t)=>{let n=po,i=ho,a=bo;return _(),v(k,null,[f(r).text?(_(),m(i,{key:0},{default:H(()=>[E(n,{text:f(r).text},null,8,[`text`])]),_:1})):g(``,!0),f(r).pastes.length?(_(),v(`span`,xo,[(_(!0),v(k,null,y(f(r).pastes,(e,t)=>(_(),m(a,{key:t,text:e},null,8,[`text`]))),128))])):g(``,!0)],64)}}}),{__name:`UserText`}),Co={slots:{root:`group/message relative w-full`,header:`flex mb-1.5`,container:`relative flex items-start`,body:`min-w-0`,leading:`inline-flex items-center justify-center min-h-6`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,files:`flex items-center gap-1.5`,content:`relative text-pretty wrap-break-word *:first:mt-0 *:last:mb-0`,actions:[`[@media(hover:hover)]:opacity-0 group-hover/message:opacity-100 absolute bottom-0 flex items-center`,`transition-opacity ease-out`]},variants:{variant:{solid:``,outline:``,soft:``,subtle:``,naked:``},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},side:{left:{},right:{container:`justify-end ms-auto max-w-[75%]`,header:`justify-end`,actions:`right-0`}},leading:{true:``},actions:{true:``},compact:{true:{root:`scroll-mt-3`,container:`gap-1.5 pb-3`,content:`space-y-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},false:{root:`scroll-mt-4 sm:scroll-mt-6`,container:`gap-3 pb-8`,content:`space-y-4`,leadingIcon:`size-8`,leadingAvatarSize:`md`}}},compoundVariants:[{compact:!0,actions:!0,class:{container:`pb-8`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!1,class:{content:`px-4 py-3 rounded-lg min-h-12`,leading:`mt-2`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!0,class:{content:`px-2 py-1 rounded-lg min-h-8`,leading:`mt-1`}},{variant:`naked`,side:`left`,class:{body:`w-full`,content:`w-full`}},{color:`primary`,variant:`solid`,class:{content:`bg-primary text-inverted`}},{color:`neutral`,variant:`solid`,class:{content:`bg-neutral text-inverted`}},{color:`success`,variant:`solid`,class:{content:`bg-success text-inverted`}},{color:`warning`,variant:`solid`,class:{content:`bg-warning text-inverted`}},{color:`error`,variant:`solid`,class:{content:`bg-error text-inverted`}},{color:`info`,variant:`solid`,class:{content:`bg-info text-inverted`}},{color:`primary`,variant:`outline`,class:{content:`text-primary ring ring-primary/25`}},{color:`neutral`,variant:`outline`,class:{content:`text-neutral ring ring-neutral/25`}},{color:`success`,variant:`outline`,class:{content:`text-success ring ring-success/25`}},{color:`warning`,variant:`outline`,class:{content:`text-warning ring ring-warning/25`}},{color:`error`,variant:`outline`,class:{content:`text-error ring ring-error/25`}},{color:`info`,variant:`outline`,class:{content:`text-info ring ring-info/25`}},{color:`primary`,variant:`soft`,class:{content:`bg-primary/10 text-primary`}},{color:`neutral`,variant:`soft`,class:{content:`bg-neutral/10 text-neutral`}},{color:`success`,variant:`soft`,class:{content:`bg-success/10 text-success`}},{color:`warning`,variant:`soft`,class:{content:`bg-warning/10 text-warning`}},{color:`error`,variant:`soft`,class:{content:`bg-error/10 text-error`}},{color:`info`,variant:`soft`,class:{content:`bg-info/10 text-info`}},{color:`primary`,variant:`subtle`,class:{content:`bg-primary/10 text-primary ring ring-primary/25`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-neutral/10 text-neutral ring ring-neutral/25`}},{color:`success`,variant:`subtle`,class:{content:`bg-success/10 text-success ring ring-success/25`}},{color:`warning`,variant:`subtle`,class:{content:`bg-warning/10 text-warning ring ring-warning/25`}},{color:`error`,variant:`subtle`,class:{content:`bg-error/10 text-error ring ring-error/25`}},{color:`info`,variant:`subtle`,class:{content:`bg-info/10 text-info ring ring-info/25`}},{color:`primary`,variant:`naked`,class:{content:`text-primary`}},{color:`neutral`,variant:`naked`,class:{content:`text-neutral`}},{color:`success`,variant:`naked`,class:{content:`text-success`}},{color:`warning`,variant:`naked`,class:{content:`text-warning`}},{color:`error`,variant:`naked`,class:{content:`text-error`}},{color:`info`,variant:`naked`,class:{content:`text-info`}},{color:`neutral`,variant:`solid`,class:{content:`bg-inverted text-inverted`}},{color:`neutral`,variant:`outline`,class:{content:`bg-default ring ring-default`}},{color:`neutral`,variant:`soft`,class:{content:`bg-elevated/50`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-elevated/50 ring ring-default`}}],defaultVariants:{side:`left`,variant:`naked`,color:`neutral`}},wo={__name:`UChatMessage`,props:{as:{type:null,required:!1,default:`article`},icon:{type:null,required:!1},avatar:{type:Object,required:!1},variant:{type:null,required:!1},color:{type:null,required:!1},side:{type:null,required:!1},actions:{type:Array,required:!1},compact:{type:Boolean,required:!1},content:{type:String,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},id:{type:String,required:!0},role:{type:String,required:!0},metadata:{type:null,required:!1},parts:{type:Array,required:!0}},setup(e){let r=e,i=O(),o=se(`chatMessage`,r),s=J(),c=n(()=>o.parts?.filter(e=>e.type===`file`)??[]),l=n(()=>o.parts?.filter(e=>e.type===`text`)??[]),u=n(()=>_e(o,[`as`,`icon`,`avatar`,`variant`,`color`,`side`,`actions`,`compact`,`class`,`ui`,`content`])),p=n(()=>Ae({extend:Co,...s.ui?.chatMessage||{}})({variant:o.variant,color:o.color,side:o.side,leading:!!o.icon||!!o.avatar||!!i.leading,actions:!!o.actions||!!i.actions,compact:o.compact}));return(e,n)=>(_(),m(f(Jt),{as:f(o).as,"data-role":f(o).role,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]}))},{default:H(()=>[i.files&&c.value.length||i.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(p.value.header({class:f(o).ui?.header}))},[d(e.$slots,`header`,B(t({...u.value})),()=>[i.files&&c.value.length?(_(),v(`div`,{key:0,"data-slot":`files`,class:j(p.value.files({class:f(o).ui?.files}))},[d(e.$slots,`files`,B(t({...u.value,parts:c.value})))],2)):g(``,!0)])],2)):g(``,!0),F(`div`,{"data-slot":`container`,class:j(p.value.container({class:f(o).ui?.container}))},[f(o).icon||f(o).avatar||i.leading?(_(),v(`div`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[d(e.$slots,`leading`,B(t({...u.value,avatar:f(o).avatar,ui:p.value})),()=>[f(o).icon?(_(),m(De,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(o).avatar?(_(),m(St,R({key:1,size:f(o).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},f(o).avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:f(o).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)])],2)):g(``,!0),f(o).content||l.value.length||i.content||f(o).actions||i.actions||i.body?(_(),v(`div`,{key:1,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body}))},[d(e.$slots,`body`,B(t({...u.value})),()=>[f(o).content||l.value.length||i.content?(_(),v(`div`,{key:0,"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},[d(e.$slots,`content`,B(t({...u.value,content:f(o).content})),()=>[f(o).content?(_(),v(k,{key:0},[a(M(f(o).content),1)],64)):(_(!0),v(k,{key:1},y(l.value,(e,t)=>(_(),v(k,{key:`${f(o).id}-${e.type}-${t}`},[a(M(e.text),1)],64))),128))])],2)):g(``,!0),f(o).actions||i.actions?(_(),v(`div`,{key:1,"data-slot":`actions`,class:j(p.value.actions({class:f(o).ui?.actions}))},[d(e.$slots,`actions`,B(t({...u.value,actions:f(o).actions})),()=>[(_(!0),v(k,null,y(f(o).actions,(e,t)=>(_(),m(Qr,{key:t,text:e.label},{default:H(()=>[E(Oe,R({size:`sm`,color:`neutral`,variant:`ghost`},{ref_for:!0},f(_e)(e,[`onClick`]),{label:void 0,onClick:t=>typeof e.onClick==`function`?e.onClick(t,u.value):void 0}),null,16,[`onClick`])]),_:2},1032,[`text`]))),128))])],2)):g(``,!0)])],2)):g(``,!0)],2)]),_:3},8,[`as`,`data-role`,`class`]))}};function To(e,t={}){let{arrivedState:r}=pe(e);return{style:n(()=>{let n=o(e),i=o(t.orientation)??`vertical`,[a,s]=i===`horizontal`?[`left`,`right`]:[`top`,`bottom`],c=!r[a],l=!r[s];if(!c&&!l||!(n&&(i===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight)))return;let u=`${o(t.size)??24}px`,d=i===`horizontal`?`90deg`:`180deg`;return c&&l?{maskImage:`linear-gradient(${d}, transparent, #000 ${u}, #000 calc(100% - ${u}), transparent)`}:c?{maskImage:`linear-gradient(${d}, transparent, #000 ${u})`}:{maskImage:`linear-gradient(${d}, #000, #000 calc(100% - ${u}), transparent)`}}),isOverflowing:n(()=>{r.top,r.bottom,r.left,r.right;let n=o(e);return n?(o(t.orientation)??`vertical`)===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight:!1}),arrivedState:r}}var Eo={base:`text-transparent bg-clip-text bg-no-repeat bg-size-[calc(200%+var(--spread)*2+2px)_100%,auto] bg-[image:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--ui-text-highlighted),#0000_calc(50%+var(--spread))),linear-gradient(var(--ui-text-muted),var(--ui-text-muted))] motion-safe:animate-[shimmer_var(--duration)_linear_infinite] motion-safe:rtl:animate-[shimmer-rtl_var(--duration)_linear_infinite] will-change-[background-position] motion-reduce:bg-none motion-reduce:text-muted`},Do={__name:`UChatShimmer`,props:{as:{type:null,required:!1,default:`span`},text:{type:String,required:!0},duration:{type:Number,required:!1,default:2},spread:{type:Number,required:!1,default:2},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){let t=se(`chatShimmer`,e),r=J(),i=n(()=>Ae({extend:Eo,...r.ui?.chatShimmer||{}})),o=n(()=>t.text.length*t.spread);return(e,n)=>(_(),m(f(Jt),{as:f(t).as,style:L({"--spread":`${o.value}px`,"--duration":`${f(t).duration}s`}),"data-slot":`base`,class:j(i.value({class:[f(t).ui?.base,f(t).class]}))},{default:H(()=>[a(M(f(t).text),1)]),_:1},8,[`as`,`style`,`class`]))}},Oo={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default rounded-sm outline-primary/25 focus-visible:outline-3 min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden rounded-sm outline-primary/25 has-focus-visible:outline-3`,body:`max-h-[200px] pt-2 overflow-y-auto text-sm text-dimmed whitespace-pre-wrap focus:outline-none`},variants:{chevron:{leading:{leadingIcon:`group-hover:opacity-0`},trailing:``},alone:{false:{leadingIcon:[`absolute inset-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},ko={__name:`UChatReasoning`,props:{text:{type:String,required:!1},streaming:{type:Boolean,required:!1,default:!1},duration:{type:Number,required:!1},icon:{type:null,required:!1},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},autoCloseDelay:{type:Number,required:!1,default:500},shimmer:{type:Object,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=se(`chatReasoning`,r),{t:s,code:c}=ri(),u=J(),p=n(()=>Ae({extend:Oo,...u.ui?.chatReasoning||{}})({chevron:o.chevron})),y=n(()=>o.open!==void 0),x=h(o.defaultOpen??o.streaming),S=h(o.streaming?Date.now():null),C=h(void 0),w=h(null);z(()=>o.streaming,(e,t)=>{e?(w.value&&=(clearTimeout(w.value),null),t||(k(!0),S.value=Date.now())):t&&(S.value!==null&&(C.value=Math.ceil((Date.now()-S.value)/1e3),S.value=null),o.autoCloseDelay>0&&(w.value=setTimeout(()=>{k(!1)},o.autoCloseDelay)))},{immediate:!0});let T=n(()=>o.duration??C.value),D=n(()=>{if(o.streaming||T.value===0)return s(`chatReasoning.thinking`);if(T.value===void 0)return s(`chatReasoning.thought`);let e=T.value,t=e<60?`second`:`minute`,n=e<60?e:Math.floor(e/60),r=new Intl.NumberFormat(c.value,{style:`unit`,unit:t,unitDisplay:`long`}).format(n);return s(`chatReasoning.thoughtFor`,{duration:r})}),O=n(()=>y.value?o.open:x.value);function k(e){w.value&&=(clearTimeout(w.value),null),x.value=e,i(`update:open`,e)}l(()=>{w.value&&clearTimeout(w.value)});let A=n(()=>!!o.text||o.streaming),P=n(()=>o.chevronIcon||u.ui.icons?.chevronDown),I=b(`bodyRef`),{style:B}=To(I);return z(()=>o.text,()=>{if(!o.streaming||!I.value)return;let e=I.value;e.scrollHeight-e.scrollTop-e.clientHeight<50&&N(()=>{e.scrollTop=e.scrollHeight})}),(e,t)=>A.value?(_(),m(f(Sa),{key:0,open:O.value,disabled:f(o).disabled,"unmount-on-hide":f(o).unmountOnHide,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]})),"onUpdate:open":k},{default:H(({open:t})=>[E(f(wa),{"as-child":``,disabled:!A.value},{default:H(()=>[F(`button`,{type:`button`,"data-slot":`trigger`,class:j(p.value.trigger({class:f(o).ui?.trigger}))},[f(o).icon||A.value&&f(o).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[f(o).icon?(_(),m(De,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon,alone:!(A.value&&f(o).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),A.value&&f(o).chevron===`leading`?(_(),m(De,{key:1,name:P.value,"data-slot":`chevronIcon`,class:j(p.value.chevronIcon({class:f(o).ui?.chevronIcon,alone:!f(o).icon}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),f(o).streaming?(_(),m(Do,R({key:1,text:D.value},f(o).shimmer,{"data-slot":`label`,class:p.value.label({class:f(o).ui?.label})}),null,16,[`text`,`class`])):(_(),v(`span`,{key:2,"data-slot":`label`,class:j(p.value.label({class:f(o).ui?.label}))},M(D.value),3)),A.value&&f(o).chevron===`trailing`?(_(),m(De,{key:3,name:P.value,"data-slot":`trailingIcon`,class:j(p.value.trailingIcon({class:f(o).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(Ca),{"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},{default:H(()=>[F(`div`,{ref_key:`bodyRef`,ref:I,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body})),style:L(f(B))},[d(e.$slots,`default`,{open:t},()=>[a(M(f(o).text),1)])],6)]),_:2},1032,[`class`])]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`])):g(``,!0)}},Ao=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function jo(e,t=!1){return t?`⠿`:Ao[Math.floor(Math.max(0,e)/80)%Ao.length]}function Mo(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r?`${r}h ${i}m`:i?`${i}m ${n%60}s`:`${n}s`}var No={class:`omp-spinner`,"aria-hidden":`true`},Po={key:0,class:`omp-elapsed`},Fo=Object.assign(T({__name:`OmpSpinner`,props:{since:{}},setup(e){let t=e,r=h(0),i=h(Date.now()),a=n(()=>jo(i.value-r.value,lr.value)),o=n(()=>t.since?Mo(t.since,i.value):``),s;function c(){s&&clearInterval(s),s=void 0}function l(e){c(),r.value=i.value=Date.now(),s=Lr(()=>{i.value=Date.now()},e?1e3:80)}return w(()=>z(lr,l,{immediate:!0})),U(c),(e,t)=>(_(),v(k,null,[F(`span`,No,M(f(a)),1),d(e.$slots,`default`),f(o)?(_(),v(`span`,Po,M(f(o)),1)):g(``,!0)],64))}}),{__name:`OmpSpinner`}),Io=Object.assign(T({__name:`OmpElapsed`,props:{since:{}},setup(e){let t=e,n=h(Date.now()),r;return w(()=>{r=Lr(()=>{n.value=Date.now()},1e3)}),U(()=>{r&&clearInterval(r)}),(e,r)=>(_(),v(`span`,null,M(f(Mo)(t.since,f(n))),1))}}),{__name:`OmpElapsed`});function Lo(e){if(!(e>=0))return``;if(e<6e4)return`${(e/1e3).toFixed(2)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h${r}m`:`${r}m${t%60}s`}var Ro=(e,t,n,r,i)=>`${e} ${e===1?Z(t,r):Z(n,i)}`;function zo(e){let t=[];return typeof e.matches==`number`?t.push(Ro(e.matches,`match`,`matches`,`résultat`,`résultats`)+(e.files&&e.files>1&&e.files<e.matches?` ${Z(`in ${e.files} files`,`dans ${e.files} fichiers`)}`:``)):typeof e.files==`number`&&t.push(Ro(e.files,`file`,`files`,`fichier`,`fichiers`)),e.scope&&t.push(`${Z(`in`,`dans`)} ${e.scope}`),(typeof e.added==`number`||typeof e.removed==`number`)&&t.push(`+${e.added||0}/-${e.removed||0}`),e.job&&t.push(`${Z(`Backgrounded`,`En arrière-plan`)}: ${e.job}`),e.cancelled&&t.push(Z(`cancelled`,`annulée`)),t}function Bo(e){return!e.out||!e.outLines?0:Math.max(0,e.outLines-e.out.split(`
3
- `).length)}function Vo(e){return e.out?Ro(Math.max(e.outLines||0,e.out.split(`
4
- `).length),`line`,`lines`,`ligne`,`lignes`):``}function Ho(e){if(e.title===`Bash`||e.title===`Python`)return e.target||e.title.toLowerCase();let t=e.title.toLowerCase().replace(/\s+/g,`_`);return e.target?`${t} ${e.target}`:t}function Uo(e,t){let n=Bo(e);return{label:e.diff?`Diff`:t?Z(`Error`,`Erreur`):`Output`,earlier:n?`… ${Ro(n,`earlier line`,`earlier lines`,`ligne avant`,`lignes avant`)}`:``}}var Wo=e=>e.reduce((e,t)=>e+(t.omp&&typeof t.omp.ms==`number`?t.omp.ms:0),0),Go=e=>e.length>0&&e.every(e=>e.omp);function Ko(e,t){return t||e.length<=3?{hidden:0,rows:e}:{hidden:e.length-3,rows:e.slice(-3)}}var qo={class:`omp-tool-line`},Jo={class:`omp-tool-glyph`,"aria-hidden":`true`},Yo={class:`omp-tool-cmd`},Xo={key:0,class:`omp-tool-wall`},Zo={key:1,class:`omp-tool-wall`},Qo={class:`omp-tool-sub`},$o={key:1,class:`omp-tool-intent`},es={key:2,class:`omp-tool-result`},ts={class:`omp-tool-exit`},ns={key:0,class:`omp-tool-out`},rs={class:`omp-tool-out-head`},is={class:`omp-tool-out-label`},as={key:0,class:`omp-tool-out-earlier`},os={class:`omp-tool-out-right`},ss={key:0,class:`omp-tool-exit`},cs={key:1},ls=Object.assign(T({__name:`OmpTool`,props:{tool:{},live:{type:Boolean},run:{type:Boolean}},setup(e){let t=e,r=h(!1),i=n(()=>t.tool.omp),o=n(()=>!!t.tool.error),s=n(()=>zo(i.value).concat(t.run?[Vo(i.value)].filter(Boolean):[]).join(` · `)),c=n(()=>i.value.exit?String(i.value.exit):``),l=n(()=>t.live||i.value.ms===void 0?``:Lo(i.value.ms)),u=n(()=>t.live&&t.tool.ts&&Date.parse(t.tool.ts)||null),d=n(()=>i.value.intent||i.value.title),p=n(()=>!!i.value.out),b=n(()=>Uo(i.value,o.value)),x=n(()=>(i.value.out||``).split(`
5
- `).map(e=>({text:e,cls:i.value.diff?/^\+\s*\d*\|/.test(e)?`add`:/^-\s*\d*\|/.test(e)?`del`:``:``})));return(t,n)=>{let h=Fo,S=Io,w=De,T=Do;return _(),v(`div`,{class:j([`omp-tool`,{err:f(o),live:e.live,open:f(r)}])},[(_(),m(C(f(p)?`button`:`div`),{class:`omp-tool-head`,type:f(p)?`button`:void 0,"aria-expanded":f(p)?f(r):void 0,onClick:n[0]||=e=>f(p)&&(r.value=!f(r))},{default:H(()=>[F(`span`,qo,[F(`span`,Jo,[e.live?(_(),m(h,{key:0})):(_(),v(k,{key:1},[a(M(f(o)?`✗`:`❯`),1)],64))]),F(`code`,Yo,M(f(Ho)(f(i))),1),f(u)?(_(),v(`span`,Xo,[E(S,{since:f(u)},null,8,[`since`])])):f(l)?(_(),v(`span`,Zo,M(f(l)),1)):g(``,!0),e.run&&f(p)?(_(),m(w,{key:2,name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`,class:`omp-tool-chev`,"aria-hidden":`true`},null,8,[`name`])):g(``,!0)]),F(`span`,Qo,[e.live?(_(),m(T,{key:0,text:`# ${f(d)}`,duration:2.4,class:`omp-tool-intent`},null,8,[`text`])):f(i).intent?(_(),v(`span`,$o,`# `+M(f(i).intent),1)):g(``,!0),f(s)||f(c)?(_(),v(`span`,es,[a(`→ `+M(f(s)),1),f(c)?(_(),v(k,{key:0},[f(s)?(_(),v(k,{key:0},[a(` · `)],64)):g(``,!0),F(`span`,ts,`exit `+M(f(c)),1)],64)):g(``,!0)])):g(``,!0)])]),_:1},8,[`type`,`aria-expanded`])),f(p)&&f(r)?(_(),v(`div`,ns,[F(`div`,rs,[F(`span`,is,M(f(b).label),1),f(b).earlier?(_(),v(`span`,as,M(f(b).earlier),1)):g(``,!0),F(`span`,os,[f(c)?(_(),v(`span`,ss,`exit `+M(f(c)),1)):g(``,!0),f(l)?(_(),v(`span`,cs,M(f(l)),1)):g(``,!0)])]),F(`pre`,null,[(_(!0),v(k,null,y(f(x),(e,t)=>(_(),v(`span`,{key:t,class:j(e.cls)},M(e.text)+`
6
- `,3))),128))])])):g(``,!0)],2)}}}),{__name:`OmpTool`}),us={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,suffix:`text-dimmed ms-1`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden`,body:`text-sm text-dimmed whitespace-pre-wrap`,actions:`flex items-center justify-end gap-1.5`},variants:{variant:{inline:{trigger:`rounded-sm outline-primary/25 focus-visible:outline-3`,body:`pt-2`,actions:`pt-2`},card:{root:`rounded-md ring ring-default overflow-hidden outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`,trigger:`px-2 py-1 focus:outline-none`,trailingIcon:`ms-auto`,body:`border-t border-default p-2 max-h-[200px] overflow-y-auto focus:outline-none`,actions:`border-t border-default p-2`}},chevron:{leading:``,trailing:``},loading:{true:{leadingIcon:`animate-spin`}},alone:{false:{leadingIcon:[`absolute inset-0 group-hover:opacity-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},ds=[`data-state`],fs={__name:`UChatTool`,props:{text:{type:String,required:!1},suffix:{type:String,required:!1},icon:{type:null,required:!1},loading:{type:Boolean,required:!1,default:!1},loadingIcon:{type:null,required:!1},streaming:{type:Boolean,required:!1,default:!1},variant:{type:null,required:!1,default:`inline`},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},shimmer:{type:Object,required:!1},actions:{type:Array,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=O(),s=se(`chatTool`,r),c=J(),l=n(()=>Ae({extend:us,...c.ui?.chatTool||{}})({variant:s.variant,chevron:s.chevron,loading:s.loading})),u=n(()=>s.open!==void 0),p=h(s.defaultOpen??!1),b=n(()=>u.value?s.open:p.value);function x(e){p.value=e,i(`update:open`,e)}let S=n(()=>!!o.default);z(()=>!!s.actions?.length,e=>{e&&S.value&&s.open===void 0&&s.defaultOpen===void 0&&(p.value=!0)},{immediate:!0});let C=n(()=>s.loadingIcon||c.ui.icons?.loading),w=n(()=>s.loading?C.value:s.icon),T=n(()=>s.chevronIcon||c.ui.icons?.chevronDown);return(e,t)=>(_(),m(f(Sa),{open:b.value,disabled:f(s).disabled,"unmount-on-hide":f(s).unmountOnHide,"data-slot":`root`,class:j(l.value.root({class:[f(s).ui?.root,f(s).class]})),"onUpdate:open":x},{default:H(({open:t})=>[E(f(wa),{"as-child":``,disabled:!S.value},{default:H(()=>[F(`button`,{type:`button`,"data-slot":`trigger`,class:j(l.value.trigger({class:f(s).ui?.trigger}))},[w.value||S.value&&f(s).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(l.value.leading({class:f(s).ui?.leading}))},[w.value?(_(),m(De,{key:0,name:w.value,"data-slot":`leadingIcon`,class:j(l.value.leadingIcon({class:f(s).ui?.leadingIcon,alone:!(S.value&&f(s).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),S.value&&f(s).chevron===`leading`?(_(),m(De,{key:1,name:T.value,"data-slot":`chevronIcon`,class:j(l.value.chevronIcon({class:f(s).ui?.chevronIcon,alone:!w.value}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),F(`span`,{"data-slot":`label`,class:j(l.value.label({class:f(s).ui?.label}))},[f(s).streaming&&f(s).text?(_(),m(Do,R({key:0,text:f(s).text},f(s).shimmer),null,16,[`text`])):(_(),v(k,{key:1},[a(M(f(s).text),1)],64)),f(s).suffix?(_(),v(`span`,{key:2,"data-slot":`suffix`,class:j(l.value.suffix({class:f(s).ui?.suffix}))},M(f(s).suffix),3)):g(``,!0)],2),S.value&&f(s).chevron===`trailing`?(_(),m(De,{key:1,name:T.value,"data-slot":`trailingIcon`,class:j(l.value.trailingIcon({class:f(s).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(Ca),{"data-slot":`content`,class:j(l.value.content({class:f(s).ui?.content}))},{default:H(()=>[F(`div`,{"data-slot":`body`,class:j(l.value.body({class:f(s).ui?.body}))},[d(e.$slots,`default`,{open:t})],2)]),_:2},1032,[`class`]),f(s).actions?.length||o.actions?(_(),v(`div`,{key:0,"data-slot":`actions`,"data-state":S.value&&t?`open`:`closed`,class:j(l.value.actions({class:f(s).ui?.actions}))},[d(e.$slots,`actions`,{},()=>[(_(!0),v(k,null,y(f(s).actions,(e,t)=>(_(),m(Oe,R({key:t,size:`xs`},{ref_for:!0},e),null,16))),128))])],10,ds)):g(``,!0)]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`]))}},ps=[`·`,`✢`,`✳`,`✶`,`✻`,`✽`],ms=[...ps,...[...ps].reverse()];function hs(e,t=!1){return t?`✻`:ms[Math.floor(Math.max(0,e)/120)%ms.length]}var gs={class:`claude-spinner`,"aria-hidden":`true`},_s=Object.assign(T({__name:`ClaudeSpinner`,setup(e){let t=h(0),r=n(()=>hs(t.value,lr.value)),i,a=0;function o(){i&&clearInterval(i),i=void 0}function s(e){o(),!e&&(a=performance.now(),t.value=0,i=Lr(()=>{t.value=performance.now()-a},120))}return w(()=>z(lr,s,{immediate:!0})),U(o),(e,t)=>(_(),v(`span`,gs,M(f(r)),1))}}),{__name:`ClaudeSpinner`}),vs={slots:{root:`w-full flex flex-col gap-1 flex-1 px-2.5 [&>article]:last-of-type:min-h-(--last-message-height)`,indicator:`h-6 flex items-center gap-1 py-3 *:size-2 *:rounded-full *:bg-elevated motion-safe:[&>*:nth-child(1)]:animate-[bounce_1s_infinite] motion-safe:[&>*:nth-child(2)]:animate-[bounce_1s_0.15s_infinite] motion-safe:[&>*:nth-child(3)]:animate-[bounce_1s_0.3s_infinite]`,viewport:`absolute inset-x-0 top-[86%] data-[state=open]:animate-[fade-in_200ms_var(--ease-out)] data-[state=closed]:animate-[fade-out_200ms_var(--ease-out)]`,autoScroll:`rounded-full absolute right-1/2 translate-x-1/2 bottom-0`},variants:{compact:{true:``,false:``}}},ys=[`data-status`],bs=[`data-state`],xs={__name:`UChatMessages`,props:{messages:{type:null,required:!1},status:{type:String,required:!1},shouldAutoScroll:{type:Boolean,required:!1,default:!1},shouldScrollToBottom:{type:Boolean,required:!1,default:!0},autoScroll:{type:[Boolean,Object],required:!1,default:!0},autoScrollIcon:{type:null,required:!1},user:{type:Object,required:!1},assistant:{type:Object,required:!1},compact:{type:Boolean,required:!1},spacingOffset:{type:Number,required:!1,default:0},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e,{expose:t}){let r=e,i=O(),a=se(`chatMessages`,r),o=()=>_e(i,[`default`,`indicator`,`viewport`]);function s(){if(a.status===`submitted`)return!0;if(a.status!==`streaming`)return!1;let e=a.messages?.[a.messages.length-1];return e?.role===`assistant`&&!e.parts?.length}let c=J(),l=S(()=>cn(a.user,{side:`right`,variant:`soft`})),u=S(()=>cn(a.assistant,{side:`left`,variant:`naked`})),p=n(()=>Ae({extend:vs,...c.ui?.chatMessages||{}})({compact:a.compact})),b=h(null),C=h(null),T=h(new Map),D=h(!1),A=h(0),M=h(!1),P=h(0),I=h(!1);function B(e,t){let n=t?.$el;n&&T.value.set(e,n)}function V(e){let t=T.value.get(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}function U(e=!0){C.value&&(e?C.value.scrollTo({top:C.value.scrollHeight,behavior:`smooth`}):C.value.scrollTop=C.value.scrollHeight)}Ve([()=>a.messages,()=>a.status],([e,t])=>{if(!a.messages?.length){D.value=!1,I.value=!1,P.value=0,T.value.clear();return}t===`streaming`&&ee()},{deep:!0,throttle:50,leading:!0}),z(()=>a.status,e=>{if(e!==`submitted`)return;let t=a.messages?.[a.messages.length-1];t&&t.role===`user`&&(I.value=!1,N(()=>{M.value=!0,G(),N(()=>{V(t.id)})}))});function ee(){if(!C.value)return;let e=C.value.scrollTop+C.value.clientHeight,t=C.value.scrollHeight;D.value=t-e>=100,C.value.scrollTop<P.value?I.value=!0:t-e<100&&(I.value=!1),P.value=C.value.scrollTop}function te(){I.value=!1,U()}function W(e){if(!e)return document.documentElement;let t=/auto|scroll/,n=e;for(;n&&n!==document.body&&n!==document.documentElement;){let e=window.getComputedStyle(n);if(t.test(e.overflowY))return n;n=n.parentElement}return document.documentElement}function G(){if(!b.value||!C.value||!a.messages?.length||!M.value)return;let{height:e}=an(C.value),t=a.messages.findLast(e=>e.role===`user`);if(!t)return;let n=T.value.get(t.id);if(!n)return;let r=a.spacingOffset||0,i=window.getComputedStyle(b.value),o=window.getComputedStyle(C.value);r+=Number.parseFloat(i.rowGap)||Number.parseFloat(i.gap)||0,r+=Number.parseFloat(o.paddingTop)||0,r+=Number.parseFloat(o.paddingBottom)||0,A.value=Math.max(e.value-n.offsetHeight-r,0)}return w(()=>{C.value=W(b.value),C.value&&(P.value=C.value.scrollTop,a.shouldScrollToBottom?(U(!1),setTimeout(()=>{U(!1)},100)):N(()=>{ee()}),Le(C,`scroll`,ee),Le(window,`resize`,()=>N(G)),b.value&&rn(b,()=>{a.shouldAutoScroll&&a.status===`streaming`&&!I.value&&U(!1)},{childList:!0,subtree:!0}))}),t({registerMessageRef:B}),(e,t)=>(_(),v(`div`,{ref_key:`el`,ref:b,"data-status":f(a).status,"data-slot":`root`,class:j(p.value.root({class:[f(a).ui?.root,f(a).class]})),style:L({"--last-message-height":`${A.value}px`})},[d(e.$slots,`default`,{registerMessageRef:B},()=>[(_(!0),v(k,null,y(f(a).messages,t=>(_(),v(k,{key:t.id},[t.parts?.length?(_(),m(wo,R({key:0,ref_for:!0},{...t.role===`user`?l.value:u.value,...t},{ref_for:!0,ref:e=>B(t.id,e),compact:f(a).compact}),x({_:2},[y(o(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R({ref_for:!0},{...n,message:t}))])}))]),1040,[`compact`])):g(``,!0)],64))),128))]),s()?(_(),m(wo,R({key:0,id:`indicator`,role:`assistant`},{...u.value,actions:void 0,parts:[]},{compact:f(a).compact}),{content:H(()=>[d(e.$slots,`indicator`,{ui:p.value},()=>[F(`div`,{"data-slot":`indicator`,class:j(p.value.indicator({class:f(a).ui?.indicator}))},[...t[0]||=[F(`span`,null,null,-1),F(`span`,null,null,-1),F(`span`,null,null,-1)]],2)])]),_:3},16,[`compact`])):g(``,!0),E(f(at),{present:D.value},{default:H(()=>[F(`div`,{"data-state":D.value?`open`:`closed`,"data-slot":`viewport`,class:j(p.value.viewport({class:f(a).ui?.viewport}))},[d(e.$slots,`viewport`,{ui:p.value,onClick:te},()=>[f(a).autoScroll?(_(),m(Oe,R({key:0,icon:f(a).autoScrollIcon||f(c).ui.icons.arrowDown,color:`neutral`,variant:`outline`},typeof f(a).autoScroll==`object`?f(a).autoScroll:{},{"data-slot":`autoScroll`,class:p.value.autoScroll({class:f(a).ui?.autoScroll}),onClick:te}),null,16,[`icon`,`class`])):g(``,!0)])],10,bs)]),_:3},8,[`present`])],14,ys))}},Ss=`wherdr.files.hidden`;function Cs(){try{return localStorage.getItem(Ss)!==`0`}catch{return!0}}function ws(e){try{localStorage.setItem(Ss,e?`1`:`0`)}catch{}}function Ts(e){if(e<1e3)return`${e} B`;let t=[`kB`,`MB`,`GB`,`TB`],n=e/1e3,r=0;for(;;){let e=n.toFixed(+(n<10));if(Number(e)<1e3||r===t.length-1)return`${e} ${t[r]}`;n/=1e3,r++}}var Es={class:`changes-view files-view`},Ds={class:`changes-inner`},Os={class:`changes-toolbar`},ks=[`aria-label`],As={key:0,class:`files-sep`},js=[`onClick`],Ms={key:0,class:`files-sep`},Ns={class:`files-crumb current`},Ps={class:`files-actions`},Fs={key:0,class:`changes-notice error`,role:`alert`},Is={key:1,class:`changes-notice`},Ls={class:`changes-location`},Rs={key:0,class:`changes-limit`},zs=[`src`,`alt`],Bs={key:2,class:`changes-notice`},Vs={key:3,class:`changes-notice`},Hs=[`aria-label`],Us={class:`files-num`,"aria-hidden":`true`},Ws={class:`files-text`},Gs={class:`changes-toggle`},Ks={key:0,class:`changes-limit`},qs={key:1,class:`changes-notice`},Js={class:`files-list`},Ys=[`disabled`,`onClick`],Xs={class:`change-path`},Zs={key:0,class:`change-status`},Qs=Object.assign(T({__name:`FilesView`,props:{paneId:{},file:{}},setup(e){let t=e,r=h(null),i=h(null),o=h(!1),s=h(``),c=h(Cs());z(c,ws);let u=0,d=()=>encodeURIComponent(t.paneId);async function p(e,t){let n=++u;o.value=!0,s.value=``;try{let r=await Dr(e);n===u&&t(r)}catch(e){n===u&&(s.value=e.message)}finally{n===u&&(o.value=!1)}}function b(e){let t=e===null?``:`&path=${encodeURIComponent(e)}`;return p(`/api/files?pane=${d()}${t}`,e=>{r.value=e,i.value=null})}let x=e=>`pane=${d()}&path=${encodeURIComponent(e)}${t.file?`&from=chat`:``}`;function S(e){return p(`/api/files/read?${x(e)}`,e=>{i.value=e})}let C=h(!1);async function T(){let e=i.value?.path;if(e&&!C.value){C.value=!0;try{await Or(`/api/files/download?${x(e)}`,e.split(`/`).pop()||e)}catch(e){$(e.message,!0)}finally{C.value=!1}}}let D=e=>r.value?.path?`${r.value.path}/${e}`:e;function O(e){e.kind===`dir`?b(D(e.name)):e.kind===`file`&&S(D(e.name))}function A(){u++,o.value=!1,i.value=null}function N(){t.file?S(t.file):i.value?S(i.value.path):b(r.value?r.value.path:null)}w(()=>t.file?S(t.file):b(null)),l(()=>{u++});let P=n(()=>{let e=r.value;if(!e)return[];let t=e.path?e.path.split(`/`):[];return[{label:e.root.split(`/`).filter(Boolean).pop()||`/`,path:``},...t.map((e,n)=>({label:e,path:t.slice(0,n+1).join(`/`)}))]}),L=n(()=>(r.value?.entries||[]).filter(e=>c.value||!e.name.startsWith(`.`))),R=n(()=>{let e=i.value?.text??``,t=e.endsWith(`
1
+ import{t as e}from"./hePW80VL.js";import{$ as t,A as n,An as r,At as i,B as a,Bn as o,Dn as s,Dt as c,Et as l,Fn as u,Ft as d,Hn as f,Jt as p,M as m,Mn as h,N as g,Ot as _,P as v,Pt as y,Qt as b,R as x,Rn as S,Rt as C,St as w,U as T,V as E,Yt as D,Zt as O,b as k,ct as A,fr as j,gr as M,hr as N,ht as P,in as F,j as I,ln as L,mr as R,mt as z,nn as B,pt as V,sn as H,vt as U,w as ee,wn as W,zn as te}from"./C25ROUa9.js";import{_t as G,dt as K,ht as ne,vt as q}from"./CDWjMk9C.js";import{$t as re,An as ie,B as ae,C as oe,Ct as se,Dn as ce,Dt as le,E as ue,En as de,F as fe,Fn as pe,Fr as me,Ft as he,Gr as ge,H as _e,Ht as ve,It as ye,J as be,Jt as xe,K as Se,Kt as Ce,M as we,Mn as Te,N as Ee,On as De,Ot as Oe,Qt as ke,R as Ae,Rn as je,Rr as Me,St as Ne,T as Pe,Tn as Fe,Tt as Ie,V as Le,Vn as Re,Xr as ze,Xt as Be,Yr as Ve,Yt as He,Zr as Ue,Zt as We,_ as Ge,_n as Ke,_r as qe,a as Je,ai as Ye,ar as Xe,c as Ze,cn as Qe,cr as $e,ct as et,d as tt,dn as nt,ei as rt,en as it,f as at,fn as ot,fr as st,g as ct,gn as lt,gr as ut,h as dt,hr as ft,ht as pt,i as mt,ii as ht,in as gt,jn as _t,jr as vt,k as yt,kt as bt,l as xt,ln as St,lr as Ct,lt as wt,m as Tt,mr as Et,n as Dt,ni as Ot,nn as kt,o as At,oi as jt,on as Mt,or as Nt,p as Pt,pn as Ft,pt as It,q as Lt,qn as Rt,qt as zt,r as Bt,ri as Vt,rn as Ht,rr as Ut,sn as Wt,sr as Gt,t as Kt,tn as qt,u as Jt,un as Yt,ur as Xt,ut as Zt,v as Qt,vn as $t,w as en,wn as tn,wt as nn,x as rn,xn as an,y as on,z as sn}from"./OpWX45i7.js";import{f as cn,m as ln,p as un,u as dn}from"./CXJnLmWv.js";import{t as fn}from"./Bpoxvzh6.js";import{c as pn}from"./BUaYhQ2r.js";import{$ as mn,$r as hn,Ar as gn,At as _n,B as vn,Bt as J,C as yn,Cr as bn,Ct as xn,Dr as Sn,Dt as Cn,Er as wn,Et as Tn,F as En,Fr as Dn,G as On,Gn as kn,Gr as An,H as jn,Ht as Mn,I as Nn,Jr as Pn,K as Fn,Kn as In,Kr as Ln,Lr as Rn,Mr as zn,Mt as Bn,N as Vn,Nt as Hn,O as Un,Or as Wn,Ot as Gn,Pr as Kn,Pt as qn,Qn as Jn,Qr as Yn,Rn as Xn,Rt as Zn,Sr as Qn,St as $n,T as er,Tr as tr,Tt as nr,U as rr,Ur as Y,Ut as ir,V as ar,Vr as or,Vt as sr,W as cr,Wr as X,Xn as lr,Y as ur,Yn as dr,Yr as fr,Z as pr,Zr as mr,_ as hr,_n as gr,b as Z,bt as _r,cr as vr,di as yr,dn as br,et as xr,g as Sr,ht as Cr,it as wr,jr as Tr,jt as Er,kr as Q,kt as Dr,ln as Or,mt as $,n as kr,ni as Ar,nt as jr,or as Mr,ot as Nr,pt as Pr,q as Fr,qr as Ir,ri as Lr,rr as Rr,s as zr,sr as Br,ti as Vr,tr as Hr,v as Ur,vt as Wr,w as Gr,wr as Kr,wt as qr,xt as Jr,yt as Yr,zt as Xr}from"./COCvtdHN.js";import{a as Zr,d as Qr,f as $r,h as ei,o as ti,r as ni,t as ri,v as ii,y as ai}from"./CndPDbMI.js";import{_ as oi,a as si,g as ci,h as li,m as ui,n as di,r as fi,t as pi,y as mi}from"./BOtcEDnA.js";import{i as hi,n as gi,o as _i,s as vi,t as yi}from"./Nhex3_iH.js";import{$ as bi,A as xi,D as Si,E as Ci,F as wi,J as Ti,L as Ei,M as Di,O as Oi,P as ki,Q as Ai,R as ji,S as Mi,T as Ni,X as Pi,Y as Fi,Z as Ii,_ as Li,a as Ri,at as zi,b as Bi,c as Vi,ct as Hi,dt as Ui,et as Wi,g as Gi,i as Ki,it as qi,j as Ji,k as Yi,l as Xi,lt as Zi,n as Qi,nt as $i,o as ea,ot as ta,pt as na,r as ra,rt as ia,s as aa,st as oa,t as sa,tt as ca,ut as la,v as ua,w as da,y as fa}from"#entry";import{a as pa,c as ma,d as ha,i as ga,l as _a,n as va,o as ya,r as ba,s as xa,t as Sa,u as Ca}from"./dTj21DMs.js";var[wa,Ta]=Ce(`CollapsibleRoot`),Ea=T({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=bt(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=te(r);return Ta({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),It(),(e,t)=>(_(),m(f(et),{as:e.as,"as-child":r.asChild,"data-state":f(i)?`open`:`closed`,"data-disabled":f(a)?``:void 0},{default:H(()=>[d(e.$slots,`default`,{open:f(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),Da=T({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let r=e,i=t,a=wa();a.contentId||=Zt(void 0,`reka-collapsible-content`);let o=h(),{forwardRef:s,currentElement:c}=It(),l=h(0),u=h(0),p=n(()=>a.open.value),v=h(p.value),y=h();B(()=>[p.value,o.value?.present],async()=>{await P();let e=c.value;if(!e)return;y.value=y.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();u.value=t.height,l.value=t.width,v.value||(e.style.transitionDuration=y.value.transitionDuration,e.style.animationName=y.value.animationName)},{immediate:!0});let b=n(()=>v.value&&a.open.value);return w(()=>{requestAnimationFrame(()=>{v.value=!1})}),se(c,`beforematch`,e=>{requestAnimationFrame(()=>{a.onOpenToggle(),i(`contentFound`)})}),(e,t)=>(_(),m(f(wt),{ref_key:`presentRef`,ref:o,present:e.forceMount||f(a).open.value,"force-mount":!0},{default:H(({present:t})=>[E(f(et),z(e.$attrs,{id:f(a).contentId,ref:f(s),"as-child":r.asChild,as:e.as,hidden:t?void 0:f(a).unmountOnHide.value?``:`until-found`,"data-state":b.value?void 0:f(a).open.value?`open`:`closed`,"data-disabled":f(a).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${u.value}px`,"--reka-collapsible-content-width":`${l.value}px`}}),{default:H(()=>[!f(a).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Oa=T({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;It();let n=wa();return(e,r)=>(_(),m(f(et),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":f(n).contentId,"aria-expanded":f(n).open.value,"data-state":f(n).open.value?`open`:`closed`,"data-disabled":f(n).disabled?.value?``:void 0,disabled:f(n).disabled?.value,onClick:f(n).onOpenToggle},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}}),[ka,Aa]=Ce(`TabsRoot`),ja=T({__name:`TabsRoot`,props:{defaultValue:{type:null,required:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},activationMode:{type:String,required:!1,default:`automatic`},modelValue:{type:null,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{orientation:i,unmountOnHide:a,dir:o}=te(n),s=pt(o);It();let c=bt(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),l=h(),p=u(new Set);return Aa({modelValue:c,changeModelValue:e=>{c.value=e},orientation:i,dir:s,unmountOnHide:a,activationMode:n.activationMode,baseId:Zt(void 0,`reka-tabs`),tabsList:l,contentIds:p,registerContent:e=>{p.value=new Set([...p.value,e])},unregisterContent:e=>{let t=new Set(p.value);t.delete(e),p.value=t}}),(e,t)=>(_(),m(f(et),{dir:f(s),"data-orientation":f(i),"as-child":e.asChild,as:e.as},{default:H(()=>[d(e.$slots,`default`,{modelValue:f(c)})]),_:3},8,[`dir`,`data-orientation`,`as-child`,`as`]))}});function Ma(e,t){return`${e}-trigger-${t}`}function Na(e,t){return`${e}-content-${t}`}var Pa=T({__name:`TabsContent`,props:{value:{type:[String,Number],required:!0},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:r}=It(),i=ka(),a=n(()=>Ma(i.baseId,t.value)),o=n(()=>Na(i.baseId,t.value)),s=n(()=>t.value===i.modelValue.value),c=h(s.value);return w(()=>{i.registerContent(t.value),requestAnimationFrame(()=>{c.value=!1})}),U(()=>{i.unregisterContent(t.value)}),(e,t)=>(_(),m(f(wt),{present:e.forceMount||s.value,"force-mount":``},{default:H(({present:t})=>[E(f(et),{id:o.value,ref:f(r),"as-child":e.asChild,as:e.as,role:`tabpanel`,"data-state":s.value?`active`:`inactive`,"data-orientation":f(i).orientation.value,"aria-labelledby":a.value,hidden:!t,tabindex:`0`,style:N({animationDuration:c.value?`0s`:void 0})},{default:H(()=>[!f(i).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1032,[`id`,`as-child`,`as`,`data-state`,`data-orientation`,`aria-labelledby`,`hidden`,`style`])]),_:3},8,[`present`]))}}),Fa=T({__name:`TabsIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:t}){let r=e,i=ka();t({updateIndicatorStyle:c}),It();let a=nn(),o=h({size:null,thickness:null,position:null}),s=h([]);B(()=>[i.modelValue.value,i?.dir.value],()=>{c()},{immediate:!0,flush:`post`}),F(()=>{s.value=Array.from(i.tabsList.value?.querySelectorAll(`[role="tab"]`)||[])}),le(n(()=>[i.tabsList.value,...s.value]),c);function c(){let e=i.tabsList.value?.querySelector(`[role="tab"][data-state="active"]`);e&&(i.orientation.value===`horizontal`?o.value={size:e.offsetWidth,thickness:e.offsetHeight,position:e.offsetLeft}:o.value={size:e.offsetHeight,thickness:e.offsetWidth,position:e.offsetTop})}return(e,t)=>f(a)&&typeof o.value.size==`number`?(_(),m(f(et),z({key:0},r,{style:{"--reka-tabs-indicator-size":`${o.value.size}px`,"--reka-tabs-indicator-thickness":`${o.value.thickness}px`,"--reka-tabs-indicator-position":`${o.value.position}px`}}),{default:H(()=>[d(e.$slots,`default`)]),_:3},16,[`style`])):g(`v-if`,!0)}}),Ia=T({__name:`TabsList`,props:{loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let{loop:t}=te(e),{forwardRef:n,currentElement:r}=It(),i=ka();return i.tabsList=r,(e,r)=>(_(),m(f(be),{"as-child":``,orientation:f(i).orientation.value,dir:f(i).dir.value,loop:f(t)},{default:H(()=>[E(f(et),{ref:f(n),role:`tablist`,"as-child":e.asChild,as:e.as,"aria-orientation":f(i).orientation.value},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`aria-orientation`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),La=T({__name:`TabsTrigger`,props:{value:{type:[String,Number],required:!0},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,{forwardRef:r}=It(),i=ka(),a=n(()=>Ma(i.baseId,t.value)),o=n(()=>i.contentIds.value.has(t.value)?Na(i.baseId,t.value):void 0),s=n(()=>t.value===i.modelValue.value);return(e,t)=>(_(),m(f(vi),{"as-child":``,focusable:!e.disabled,active:s.value},{default:H(()=>[E(f(et),{id:a.value,ref:f(r),role:`tab`,type:e.as===`button`?`button`:void 0,as:e.as,"as-child":e.asChild,"aria-selected":s.value?`true`:`false`,"aria-controls":o.value,"data-state":s.value?`active`:`inactive`,disabled:e.disabled,"data-disabled":e.disabled?``:void 0,"data-orientation":f(i).orientation.value,onMousedown:t[0]||=q(t=>{!e.disabled&&t.ctrlKey===!1?f(i).changeModelValue(e.value):t.preventDefault()},[`left`]),onKeydown:t[1]||=G(t=>f(i).changeModelValue(e.value),[`enter`,`space`]),onFocus:t[2]||=()=>{let t=f(i).activationMode!==`manual`;!s.value&&!e.disabled&&t&&f(i).changeModelValue(e.value)}},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`id`,`type`,`as`,`as-child`,`aria-selected`,`aria-controls`,`data-state`,`disabled`,`data-disabled`,`data-orientation`])]),_:3},8,[`focusable`,`active`]))}}),Ra=[`aria-label`],za=[`title`,`data-tab`,`aria-current`,`onPointerdown`,`onClick`],Ba={key:1,class:`tab-chip-dot`},Va={class:`tab-chip-label`},Ha=[`title`,`aria-label`,`disabled`],Ua=Object.assign(T({__name:`SpaceTabs`,props:{workspace:{},current:{}},setup(e){let t=e,r=n(()=>Ot(t.workspace).map(e=>{let t=gr(e.panes);return{...e,label:e.tab.label||String(e.tab.number),tone:t&&t.agent?gt(t):``,title:e.panes.map(e=>Kn(e)).join(` · `)}}));B(()=>t.current,e=>{e&&Ue(e)},{immediate:!0});let i=e=>`${Y(`Tab`)} ${e}`,a=null,o=Di({onPress:()=>{a&&(Q(),Fe(ge(a.id),i(a.label)))}});function s(e,t,n){Nr.value&&(a={id:t,label:n},o.down(e))}function c(e){o.swallowClick()||e===t.current||ht(e)}return(t,n)=>{let i=Ei,a=ji,l=Ee;return(`spaceTabControls`in t?t.spaceTabControls:f(J))(f(r).length).row?(_(),v(`nav`,{key:0,class:`tab-chips space-tabs`,"aria-label":(`t`in t?t.t:f(Y))(`Tabs`)},[(_(!0),v(k,null,y(f(r),r=>(_(),m(a,{key:r.tab.id,disabled:`sheetMenus`in t?t.sheetMenus:f(Nr),items:(`sheetMenus`in t?t.sheetMenus:f(Nr))?[]:(`toDropdown`in t?t.toDropdown:f(ie))((`tabItems`in t?t.tabItems:f(ge))(r.tab.id)),ui:{content:`hw-dropdown`}},{default:H(()=>[I(`button`,{type:`button`,class:j([`tab-chip`,r.tone]),title:r.title,"data-tab":r.tab.id,"aria-current":r.tab.id===e.current?`page`:void 0,onPointerdown:e=>s(e,r.tab.id,r.label),onPointermove:n[0]||=(...e)=>f(o).move&&f(o).move(...e),onPointerup:n[1]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onPointercancel:n[2]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onContextmenu:n[3]||=e=>(`sheetMenus`in t?t.sheetMenus:f(Nr))&&e.preventDefault(),onClick:e=>c(r.tab.id)},[r.panes.length>1?(_(),m(i,{key:0,layout:r.layout,panes:r.panes},null,8,[`layout`,`panes`])):(_(),v(`i`,Ba)),I(`span`,Va,M(r.label),1)],42,za)]),_:2},1032,[`disabled`,`items`]))),128)),I(`button`,{type:`button`,class:`tab-chip tab-add`,title:(`t`in t?t.t:f(Y))(`New tab`),"aria-label":(`t`in t?t.t:f(Y))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(jn),onClick:n[4]||=n=>(`newTab`in t?t.newTab:f(me))(e.workspace)},[E(l,{name:`i-lucide-plus`})],8,Ha)],8,Ra)):g(``,!0)}}}),{__name:`SpaceTabs`}),Wa={slots:{base:`font-medium inline-flex items-center`,label:`truncate`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailingIcon:`shrink-0`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{solid:``,outline:``,soft:``,subtle:``},size:{xs:{base:`text-[8px]/3 px-1 py-0.5 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},sm:{base:`text-[10px]/3 px-1.5 py-1 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},md:{base:`text-xs px-2 py-1 gap-1 rounded-md`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`},lg:{base:`text-sm px-2 py-1 gap-1.5 rounded-md`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`},xl:{base:`text-base px-2.5 py-1 gap-1.5 rounded-md`,leadingIcon:`size-6`,leadingAvatarSize:`2xs`,trailingIcon:`size-6`}},square:{true:``}},compoundVariants:[{color:`primary`,variant:`solid`,class:`bg-primary text-inverted`},{color:`neutral`,variant:`solid`,class:`bg-neutral text-inverted`},{color:`success`,variant:`solid`,class:`bg-success text-inverted`},{color:`warning`,variant:`solid`,class:`bg-warning text-inverted`},{color:`error`,variant:`solid`,class:`bg-error text-inverted`},{color:`info`,variant:`solid`,class:`bg-info text-inverted`},{color:`primary`,variant:`outline`,class:`text-primary ring ring-inset ring-primary/50`},{color:`neutral`,variant:`outline`,class:`text-neutral ring ring-inset ring-neutral/50`},{color:`success`,variant:`outline`,class:`text-success ring ring-inset ring-success/50`},{color:`warning`,variant:`outline`,class:`text-warning ring ring-inset ring-warning/50`},{color:`error`,variant:`outline`,class:`text-error ring ring-inset ring-error/50`},{color:`info`,variant:`outline`,class:`text-info ring ring-inset ring-info/50`},{color:`primary`,variant:`soft`,class:`bg-primary/10 text-primary`},{color:`neutral`,variant:`soft`,class:`bg-neutral/10 text-neutral`},{color:`success`,variant:`soft`,class:`bg-success/10 text-success`},{color:`warning`,variant:`soft`,class:`bg-warning/10 text-warning`},{color:`error`,variant:`soft`,class:`bg-error/10 text-error`},{color:`info`,variant:`soft`,class:`bg-info/10 text-info`},{color:`primary`,variant:`subtle`,class:`bg-primary/10 text-primary ring ring-inset ring-primary/25`},{color:`neutral`,variant:`subtle`,class:`bg-neutral/10 text-neutral ring ring-inset ring-neutral/25`},{color:`success`,variant:`subtle`,class:`bg-success/10 text-success ring ring-inset ring-success/25`},{color:`warning`,variant:`subtle`,class:`bg-warning/10 text-warning ring ring-inset ring-warning/25`},{color:`error`,variant:`subtle`,class:`bg-error/10 text-error ring ring-inset ring-error/25`},{color:`info`,variant:`subtle`,class:`bg-info/10 text-info ring ring-inset ring-info/25`},{color:`neutral`,variant:`solid`,class:`text-inverted bg-inverted`},{color:`neutral`,variant:`outline`,class:`ring ring-inset ring-accented text-default bg-default`},{color:`neutral`,variant:`soft`,class:`text-default bg-elevated`},{color:`neutral`,variant:`subtle`,class:`ring ring-inset ring-accented text-default bg-elevated`},{size:`xs`,square:!0,class:`p-0.5`},{size:`sm`,square:!0,class:`p-1`},{size:`md`,square:!0,class:`p-1`},{size:`lg`,square:!0,class:`p-1`},{size:`xl`,square:!0,class:`p-1`}],defaultVariants:{color:`primary`,variant:`solid`,size:`md`}},Ga={__name:`UBadge`,props:{as:{type:null,required:!1,default:`span`},label:{type:[String,Number],required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1}},setup(e){let t=e,r=O(),i=Le(`badge`,t),a=pn(),{orientation:o,size:s}=Ae(t),{isLeading:c,isTrailing:l,leadingIconName:u,trailingIconName:p}=sn(i),h=n(()=>fe({extend:Wa,...a.ui?.badge||{}})({color:i.color,variant:i.variant,size:s.value??i.size,square:i.square||!r.default&&!i.label,fieldGroup:o.value}));return(e,t)=>(_(),m(f(et),{as:f(i).as,"data-slot":`base`,class:j(h.value.base({class:[f(i).ui?.base,f(i).class]}))},{default:H(()=>[d(e.$slots,`leading`,{ui:h.value},()=>[f(c)&&f(u)?(_(),m(Ee,{key:0,name:f(u),"data-slot":`leadingIcon`,class:j(h.value.leadingIcon({class:f(i).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(i).avatar?(_(),m(we,z({key:1,size:f(i).ui?.leadingAvatarSize||h.value.leadingAvatarSize()},f(i).avatar,{"data-slot":`leadingAvatar`,class:h.value.leadingAvatar({class:f(i).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)]),d(e.$slots,`default`,{ui:h.value},()=>[f(i).label!==void 0&&f(i).label!==null?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(h.value.label({class:f(i).ui?.label}))},M(f(i).label),3)):g(``,!0)]),d(e.$slots,`trailing`,{ui:h.value},()=>[f(l)&&f(p)?(_(),m(Ee,{key:0,name:f(p),"data-slot":`trailingIcon`,class:j(h.value.trailingIcon({class:f(i).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)])]),_:3},8,[`as`,`class`]))}},Ka={slots:{root:`flex items-center gap-2`,list:`relative flex p-1 group`,indicator:`absolute transition-[translate,width] duration-200 ease-out motion-reduce:transition-none`,trigger:[`group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75`,`transition-colors`],leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,label:`truncate`,trailingBadge:`shrink-0`,trailingBadgeSize:`sm`,content:`w-full rounded-md focus-visible:outline-3`},variants:{color:{primary:{content:`outline-primary/25`},neutral:{content:`outline-inverted/25`},success:{content:`outline-success/25`},warning:{content:`outline-warning/25`},error:{content:`outline-error/25`},info:{content:`outline-info/25`}},variant:{pill:{list:`bg-elevated rounded-lg`,trigger:[`grow`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:inset-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:rounded-md in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:shadow-xs in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:-z-10 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:isolate`],indicator:`rounded-md shadow-xs`},link:{list:`border-default`,indicator:`rounded-full`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:rounded-full`}},orientation:{horizontal:{root:`flex-col`,list:`w-full`,indicator:`left-0 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position)`,trigger:`justify-center`},vertical:{list:`flex-col`,indicator:`top-0 h-(--reka-tabs-indicator-size) translate-y-(--reka-tabs-indicator-position)`}},size:{xs:{trigger:`px-2 py-1 text-xs gap-1`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},sm:{trigger:`px-2.5 py-1.5 text-xs gap-1.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},md:{trigger:`px-3 py-1.5 text-sm gap-1.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},lg:{trigger:`px-3 py-2 text-sm gap-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},xl:{trigger:`px-3 py-2 text-base gap-2`,leadingIcon:`size-6`,leadingAvatarSize:`xs`}}},compoundVariants:[{orientation:`horizontal`,variant:`pill`,class:{indicator:`inset-y-1`}},{orientation:`horizontal`,variant:`link`,class:{list:`border-b -mb-px`,indicator:`-bottom-px h-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-x-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-bottom-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:h-px`}},{orientation:`vertical`,variant:`pill`,class:{indicator:`inset-x-1`,list:`items-center`,trigger:`w-full justify-center`}},{orientation:`vertical`,variant:`link`,class:{list:`border-s -ms-px`,indicator:`-start-px w-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-y-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-start-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:w-px`}},{color:`primary`,variant:`pill`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-inverted outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-primary`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-inverted outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-neutral`]}},{color:`success`,variant:`pill`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-inverted outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-success`]}},{color:`warning`,variant:`pill`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-inverted outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-warning`]}},{color:`error`,variant:`pill`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-inverted outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-error`]}},{color:`info`,variant:`pill`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-inverted outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-info`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-inverted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-inverted`]}},{color:`primary`,variant:`link`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-primary outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-primary`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-neutral outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-neutral`]}},{color:`success`,variant:`link`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-success outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-success`]}},{color:`warning`,variant:`link`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-warning outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-warning`]}},{color:`error`,variant:`link`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-error outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-error`]}},{color:`info`,variant:`link`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-info outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-info`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-highlighted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-inverted`]}}],defaultVariants:{color:`primary`,variant:`pill`,size:`md`}},qa={__name:`UTabs`,props:{as:{type:null,required:!1},items:{type:Array,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:`horizontal`},content:{type:Boolean,required:!1,default:!0},valueKey:{type:null,required:!1,default:`value`},labelKey:{type:null,required:!1,default:`label`},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultValue:{type:[String,Number],required:!1,default:`0`},modelValue:{type:[String,Number],required:!1},activationMode:{type:String,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,o=r,s=O(),c=Le(`tabs`,i),l=pn(),u=ae(ye(c,`as`,`unmountOnHide`),o),p=n(()=>fe({extend:Ka,...l.ui?.tabs||{}})({color:c.color,variant:c.variant,size:c.size,orientation:c.orientation})),b=h([]);function x(e,t){b.value[e]=t}return t({triggersRef:b}),(e,t)=>(_(),m(f(ja),z(f(u),{"model-value":f(c).modelValue,"default-value":f(c).defaultValue,orientation:f(c).orientation,"activation-mode":f(c).activationMode,"data-slot":`root`,class:p.value.root({class:[f(c).ui?.root,f(c).class]})}),{default:H(()=>[E(f(Ia),{"data-slot":`list`,class:j(p.value.list({class:f(c).ui?.list}))},{default:H(()=>[E(f(Fa),{"data-slot":`indicator`,class:j(p.value.indicator({class:f(c).ui?.indicator}))},null,8,[`class`]),d(e.$slots,`list-leading`),(_(!0),v(k,null,y(f(c).items,(t,n)=>(_(),m(f(La),{key:f(_e)(t,f(c).valueKey)??n,ref_for:!0,ref:e=>x(n,e),value:f(_e)(t,f(c).valueKey)??String(n),disabled:t.disabled,"data-slot":`trigger`,class:j(p.value.trigger({class:[f(c).ui?.trigger,t.ui?.trigger]}))},{default:H(()=>[d(e.$slots,`leading`,{item:t,index:n,ui:p.value},()=>[t.icon?(_(),m(Ee,{key:0,name:t.icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:[f(c).ui?.leadingIcon,t.ui?.leadingIcon]}))},null,8,[`name`,`class`])):t.avatar?(_(),m(we,z({key:1,size:t.ui?.leadingAvatarSize||f(c).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},{ref_for:!0},t.avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:[f(c).ui?.leadingAvatar,t.ui?.leadingAvatar]})}),null,16,[`size`,`class`])):g(``,!0)]),f(_e)(t,f(c).labelKey)||s.default?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(p.value.label({class:[f(c).ui?.label,t.ui?.label]}))},[d(e.$slots,`default`,{item:t,index:n},()=>[a(M(f(_e)(t,f(c).labelKey)),1)])],2)):g(``,!0),d(e.$slots,`trailing`,{item:t,index:n,ui:p.value},()=>[t.badge||t.badge===0?(_(),m(Ga,z({key:0,color:`neutral`,variant:`outline`,size:t.ui?.trailingBadgeSize||f(c).ui?.trailingBadgeSize||p.value.trailingBadgeSize()},{ref_for:!0},typeof t.badge==`string`||typeof t.badge==`number`?{label:t.badge}:t.badge,{"data-slot":`trailingBadge`,class:p.value.trailingBadge({class:[f(c).ui?.trailingBadge,t.ui?.trailingBadge]})}),null,16,[`size`,`class`])):g(``,!0)])]),_:2},1032,[`value`,`disabled`,`class`]))),128)),d(e.$slots,`list-trailing`)]),_:3},8,[`class`]),f(c).content?(_(!0),v(k,{key:0},y(f(c).items,(t,n)=>(_(),m(f(Pa),{key:f(_e)(t,f(c).valueKey)??n,value:f(_e)(t,f(c).valueKey)??String(n),"data-slot":`content`,class:j(p.value.content({class:[f(c).ui?.content,t.ui?.content,t.class]}))},{default:H(()=>[d(e.$slots,t.slot||`content`,{item:t,index:n,ui:p.value},()=>[a(M(t.content),1)])]),_:2},1032,[`value`,`class`]))),128)):g(``,!0)]),_:3},16,[`model-value`,`default-value`,`orientation`,`activation-mode`,`class`]))}},Ja=`input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .term, .chat-list, .msg`,Ya=`button, a, [role="tab"], [role="button"]:not(.plan-cell), .cell-grip, ${Ja}`;function Xa(e){return!!e?.closest?.(Ja)}function Za(e){return!!e?.closest?.(Ya)}var Qa=Object.assign(xi(T({__name:`HeaderMenu`,props:{items:{type:Function},title:{},disabled:{type:Boolean},manualPress:{type:Boolean}},setup(e){let t=e,n=h([]);function r(){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0}))}function i(e){e?(n.value=ie(t.items()),window.addEventListener(`scroll`,r,{capture:!0,passive:!0})):window.removeEventListener(`scroll`,r,{capture:!0})}l(()=>window.removeEventListener(`scroll`,r,{capture:!0}));let a=``;function o(e){Xa(e.target)?e.stopPropagation():Nr.value&&(e.preventDefault(),a===`mouse`&&!t.disabled&&Fe(t.items(),t.title))}let s=Di({onPress:()=>{Q(),Fe(t.items(),t.title)}});function c(e){a=e.pointerType,!(!Nr.value||t.disabled||t.manualPress||Za(e.target))&&s.down(e)}return(t,r)=>{let a=ji;return _(),m(a,{disabled:(`sheetMenus`in t?t.sheetMenus:f(Nr))||e.disabled,items:f(n),ui:{content:`hw-dropdown`},"onUpdate:open":i},{default:H(()=>[I(`div`,{class:`header-menu`,onContextmenuCapture:o,onPointerdown:c,onPointermove:r[0]||=(...e)=>f(s).move&&f(s).move(...e),onPointerup:r[1]||=(...e)=>f(s).cancel&&f(s).cancel(...e),onPointercancel:r[2]||=(...e)=>f(s).cancel&&f(s).cancel(...e)},[d(t.$slots,`default`,{},void 0,!0)],32)]),_:3},8,[`disabled`,`items`])}}}),[[`__scopeId`,`data-v-562a5bfa`]]),{__name:`HeaderMenu`}),$a=Object.assign(xi(T({__name:`GridBackdrop`,setup(e){let t=h(null),n=h(null),r=h(!1),i,a=!1,o=0,s;function c(){let e=n.value;if(!e||o>=3)return;let t=ai(e.clientWidth,e.clientHeight),r=document.createElement(`i`);r.className=`pkt ${t.vertical?`v`:`h`}${t.reverse?` rev`:``}${t.alt?` alt`:``}`,r.style.left=`${t.left}px`,r.style.top=`${t.top}px`;let i=t.vertical?`Y`:`X`;e.appendChild(r),o++;let a=r.animate([{transform:`translate${i}(${t.reverse?t.dist:0}px)`,opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.7},{transform:`translate${i}(${t.reverse?0:t.dist}px)`,opacity:0}],{duration:t.duration,easing:`cubic-bezier(.4, 0, .6, 1)`});a.onfinish=()=>{r.remove(),o--}}function l(){clearTimeout(s),!a&&$r.value&&r.value&&!document.hidden&&(s=setTimeout(()=>{c(),l()},ii()))}return B([r,$r],l),w(()=>{a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,document.addEventListener(`visibilitychange`,l),t.value&&(i=new IntersectionObserver(([e])=>{r.value=!!e?.isIntersecting}),i.observe(t.value))}),U(()=>{i?.disconnect(),document.removeEventListener(`visibilitychange`,l),clearTimeout(s)}),(e,r)=>(_(),v(`div`,{ref_key:`root`,ref:t,class:`grid-backdrop`,"aria-hidden":`true`},[r[0]||=I(`div`,{class:`gbd-dots`},null,-1),I(`div`,{ref_key:`packets`,ref:n,class:`gbd-packets`},null,512),r[1]||=I(`div`,{class:`gbd-vignette`},null,-1)],512))}}),[[`__scopeId`,`data-v-a290ab6b`]]),{__name:`GridBackdrop`}),eo={key:0,class:`offline-image`},to=[`src`,`onClick`],no=[`aria-label`],ro=[`src`],io=[`disabled`,`onClick`],ao=Object.assign(T({__name:`MsgThumbs`,props:{srcs:{},offline:{type:Boolean},max:{},dupes:{}},setup(e){let t=e,r=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>!t.dupes?.has(e.src))),i=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>t.dupes?.has(e.src))),a=n(()=>fa(r.value.length,t.max));function o(e){tn(t.srcs,e)}return(t,n)=>(_(),v(`span`,{class:j([`thumbs`,{one:f(r).length===1}])},[(_(!0),v(k,null,y(f(r).slice(0,f(a).shown),n=>(_(),v(`span`,{key:n.src},[e.offline?(_(),v(`span`,eo,M((`t`in t?t.t:f(Y))(`Image unavailable offline`)),1)):(_(),v(`img`,{key:1,class:`msg-img`,src:n.src,alt:``,loading:`lazy`,decoding:`async`,onClick:e=>o(n.i)},null,8,to))]))),128)),f(a).more?(_(),v(`button`,{key:0,type:`button`,class:`thumb-more`,"aria-label":(`tl`in t?t.tl:f(X))(`Show all ${f(r).length} images`,`Voir les ${f(r).length} images`),onClick:n[0]||=e=>o(f(r)[f(a).shown].i)},[e.offline?g(``,!0):(_(),v(`img`,{key:0,src:f(r)[f(a).shown].src,alt:``,loading:`lazy`,decoding:`async`},null,8,ro)),I(`span`,null,`+`+M(f(a).more),1)],8,no)):g(``,!0),(_(!0),v(k,null,y(f(i),n=>(_(),v(`button`,{key:n.src,type:`button`,class:`thumb-dupe`,disabled:e.offline,onClick:e=>o(n.i)},` ↑ `+M((`tl`in t?t.tl:f(X))(`Same image as above`,`Image déjà affichée plus haut`)),9,io))),128))],2))}}),{__name:`MsgThumbs`}),oo={class:`file-chip-icon`},so={key:0,class:`spinner`},co={class:`file-chip-body`},lo={class:`file-chip-name`},uo={class:`file-chip-meta`},fo=[`aria-label`],po=Object.assign(T({__name:`FileChip`,props:{name:{},size:{},kind:{},uploading:{type:Boolean},removable:{type:Boolean},clickable:{type:Boolean}},emits:[`remove`,`open`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>Ii(r.name,r.kind)),o=n(()=>Ai(r.name).slice(0,6)||(r.kind===`text`?`txt`:``));function s(e){r.clickable&&i(`open`,e.currentTarget)}return(t,n)=>{let r=Ee;return _(),m(C(e.clickable?`button`:`div`),{type:e.clickable?`button`:void 0,class:j([`file-chip`,{up:e.uploading,clickable:e.clickable}]),title:e.name,onClick:s},{default:H(()=>[I(`span`,oo,[e.uploading?(_(),v(`span`,so)):(_(),m(r,{key:1,name:f(a)},null,8,[`name`]))]),I(`span`,co,[I(`span`,lo,M(e.name),1),I(`span`,uo,M([f(o),e.size?f(bi)(e.size):``].filter(Boolean).join(` · `)),1)]),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`file-chip-x`,"aria-label":(`t`in t?t.t:f(Y))(`Remove`),onClick:n[0]||=q(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,fo)):g(``,!0)]),_:1},8,[`type`,`class`,`title`])}}}),{__name:`FileChip`}),mo={key:0,class:`msg-ref-meta`},ho={class:`msg-ref-text`},go={key:1,class:`msg-q`},_o=Object.assign(T({__name:`QuotedText`,props:{text:{}},setup(e){let t=e,r=n(()=>Yn(t.text).map(e=>e.kind===`ref`?e:{...e,text:e.text.replace(/^\n+|\n+$/g,``)}).filter(e=>e.kind===`ref`||e.text)),i=A(`gotoRef`,null),o=e=>e.kind===`task`?e.label.replace(/\s*:$/,``):[e.time,e.n?`#${e.n}`:``].filter(Boolean).join(` · `);return(e,t)=>(_(!0),v(k,null,y(f(r),(n,r)=>(_(),v(k,{key:r},[n.kind===`ref`?(_(),m(C(f(i)&&n.ref.kind!==`task`?`button`:`span`),{key:0,class:`msg-ref`,"data-kind":n.ref.kind,type:f(i)&&n.ref.kind!==`task`?`button`:void 0,"aria-label":f(i)&&n.ref.kind!==`task`?`${(`t`in e?e.t:f(Y))(`Show original message`)}: ${n.ref.excerpt}`:void 0,onClick:e=>f(i)&&n.ref.kind!==`task`&&f(i)(n.ref,e.currentTarget)},{default:H(()=>[t[0]||=I(`span`,{class:`msg-ref-mark`,"aria-hidden":`true`},`↳`,-1),o(n.ref)?(_(),v(`span`,mo,M(o(n.ref)),1)):g(``,!0),I(`span`,ho,M(n.ref.excerpt),1)]),_:2},1032,[`data-kind`,`type`,`aria-label`,`onClick`])):n.kind===`quote`?(_(),v(`span`,go,M(n.text),1)):(_(),v(k,{key:2},[a(M(n.text),1)],64))],64))),128))}}),{__name:`QuotedText`}),vo=[`aria-expanded`],yo=Object.assign(T({__name:`FoldText`,setup(e){let t=h(null),n=h(!1),r=h(!1),i=null;function a(){let e=t.value;if(!e)return;let r=(Number.parseFloat(getComputedStyle(e).lineHeight)||22.5)*12.5;n.value=e.scrollHeight>r}return w(()=>{a(),i=new ResizeObserver(a),t.value&&i.observe(t.value)}),c(a),U(()=>i?.disconnect()),(e,i)=>(_(),v(k,null,[I(`span`,{ref_key:`box`,ref:t,class:j([`msg-fold`,{folded:f(n)&&!f(r)}]),style:{display:`block`}},[d(e.$slots,`default`)],2),f(n)?(_(),v(`button`,{key:0,type:`button`,class:`msg-fold-btn`,"aria-expanded":f(r),onClick:i[0]||=e=>r.value=!f(r)},M(f(r)?(`tl`in e?e.tl:f(X))(`Show less`,`Afficher moins`):(`tl`in e?e.tl:f(X))(`Show more`,`Afficher plus`)),9,vo)):g(``,!0)],64))}}),{__name:`FoldText`}),bo=[`aria-label`],xo={class:`pasted-head`},So=[`aria-label`],Co={class:`pasted-foot`},wo=Object.assign(T({__name:`PastedCard`,props:{text:{},removable:{type:Boolean}},emits:[`remove`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=n(()=>St(r.text)),c=n(()=>r.text.split(`
2
+ `).filter(e=>e.trim()).slice(0,2).map(e=>e.trim())),l=n(()=>Yt(r.text)),u=n(()=>X(`Pasted text · ${s.value} line${s.value>1?`s`:``}`,`Texte collé · ${s.value} ligne${s.value>1?`s`:``}`));async function d(){try{await navigator.clipboard.writeText(r.text),$(X(`Text copied`,`Texte copié`))}catch{$(Y(`Copy failed`),!0)}}return(t,n)=>{let r=Ee,s=yt,p=Si;return _(),v(`div`,{class:j([`pasted-card`,{removable:e.removable}])},[I(`button`,{type:`button`,class:`pasted-open`,"aria-label":(`tl`in t?t.tl:f(X))(`Open pasted text`,`Ouvrir le texte collé`),onClick:n[0]||=e=>o.value=!0},[I(`span`,xo,[E(r,{name:`i-lucide-clipboard-paste`}),a(M(f(u)),1)]),(_(!0),v(k,null,y(f(c),(e,t)=>(_(),v(`span`,{key:t,class:`pasted-line`},M(e),1))),128))],8,bo),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`pasted-x`,"aria-label":(`t`in t?t.t:f(Y))(`Remove`),onClick:n[1]||=q(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,So)):g(``,!0),E(p,{open:f(o),"onUpdate:open":n[2]||=e=>W(o)?o.value=e:null,title:f(u),wide:``,tall:``},{footer:H(()=>[I(`div`,Co,[E(s,{icon:`i-lucide-copy`,color:`neutral`,variant:`outline`,onClick:d},{default:H(()=>[a(M((`tl`in t?t.tl:f(X))(`Copy`,`Copier`)),1)]),_:1})])]),default:H(()=>[I(`pre`,{class:j([`pasted-full`,{mono:f(l)}])},M(e.text),3)]),_:1},8,[`open`,`title`])],2)}}}),{__name:`PastedCard`}),To={key:1,class:`msg-pastes`},Eo=Object.assign(T({__name:`UserText`,props:{text:{},pasted:{}},setup(e){let t=e,r=n(()=>ot(t.text,t.pasted,Wt.value));return(e,t)=>{let n=_o,i=yo,a=wo;return _(),v(k,null,[f(r).text?(_(),m(i,{key:0},{default:H(()=>[E(n,{text:f(r).text},null,8,[`text`])]),_:1})):g(``,!0),f(r).pastes.length?(_(),v(`span`,To,[(_(!0),v(k,null,y(f(r).pastes,(e,t)=>(_(),m(a,{key:t,text:e},null,8,[`text`]))),128))])):g(``,!0)],64)}}}),{__name:`UserText`}),Do={slots:{root:`group/message relative w-full`,header:`flex mb-1.5`,container:`relative flex items-start`,body:`min-w-0`,leading:`inline-flex items-center justify-center min-h-6`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,files:`flex items-center gap-1.5`,content:`relative text-pretty wrap-break-word *:first:mt-0 *:last:mb-0`,actions:[`[@media(hover:hover)]:opacity-0 group-hover/message:opacity-100 absolute bottom-0 flex items-center`,`transition-opacity ease-out`]},variants:{variant:{solid:``,outline:``,soft:``,subtle:``,naked:``},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},side:{left:{},right:{container:`justify-end ms-auto max-w-[75%]`,header:`justify-end`,actions:`right-0`}},leading:{true:``},actions:{true:``},compact:{true:{root:`scroll-mt-3`,container:`gap-1.5 pb-3`,content:`space-y-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},false:{root:`scroll-mt-4 sm:scroll-mt-6`,container:`gap-3 pb-8`,content:`space-y-4`,leadingIcon:`size-8`,leadingAvatarSize:`md`}}},compoundVariants:[{compact:!0,actions:!0,class:{container:`pb-8`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!1,class:{content:`px-4 py-3 rounded-lg min-h-12`,leading:`mt-2`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!0,class:{content:`px-2 py-1 rounded-lg min-h-8`,leading:`mt-1`}},{variant:`naked`,side:`left`,class:{body:`w-full`,content:`w-full`}},{color:`primary`,variant:`solid`,class:{content:`bg-primary text-inverted`}},{color:`neutral`,variant:`solid`,class:{content:`bg-neutral text-inverted`}},{color:`success`,variant:`solid`,class:{content:`bg-success text-inverted`}},{color:`warning`,variant:`solid`,class:{content:`bg-warning text-inverted`}},{color:`error`,variant:`solid`,class:{content:`bg-error text-inverted`}},{color:`info`,variant:`solid`,class:{content:`bg-info text-inverted`}},{color:`primary`,variant:`outline`,class:{content:`text-primary ring ring-primary/25`}},{color:`neutral`,variant:`outline`,class:{content:`text-neutral ring ring-neutral/25`}},{color:`success`,variant:`outline`,class:{content:`text-success ring ring-success/25`}},{color:`warning`,variant:`outline`,class:{content:`text-warning ring ring-warning/25`}},{color:`error`,variant:`outline`,class:{content:`text-error ring ring-error/25`}},{color:`info`,variant:`outline`,class:{content:`text-info ring ring-info/25`}},{color:`primary`,variant:`soft`,class:{content:`bg-primary/10 text-primary`}},{color:`neutral`,variant:`soft`,class:{content:`bg-neutral/10 text-neutral`}},{color:`success`,variant:`soft`,class:{content:`bg-success/10 text-success`}},{color:`warning`,variant:`soft`,class:{content:`bg-warning/10 text-warning`}},{color:`error`,variant:`soft`,class:{content:`bg-error/10 text-error`}},{color:`info`,variant:`soft`,class:{content:`bg-info/10 text-info`}},{color:`primary`,variant:`subtle`,class:{content:`bg-primary/10 text-primary ring ring-primary/25`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-neutral/10 text-neutral ring ring-neutral/25`}},{color:`success`,variant:`subtle`,class:{content:`bg-success/10 text-success ring ring-success/25`}},{color:`warning`,variant:`subtle`,class:{content:`bg-warning/10 text-warning ring ring-warning/25`}},{color:`error`,variant:`subtle`,class:{content:`bg-error/10 text-error ring ring-error/25`}},{color:`info`,variant:`subtle`,class:{content:`bg-info/10 text-info ring ring-info/25`}},{color:`primary`,variant:`naked`,class:{content:`text-primary`}},{color:`neutral`,variant:`naked`,class:{content:`text-neutral`}},{color:`success`,variant:`naked`,class:{content:`text-success`}},{color:`warning`,variant:`naked`,class:{content:`text-warning`}},{color:`error`,variant:`naked`,class:{content:`text-error`}},{color:`info`,variant:`naked`,class:{content:`text-info`}},{color:`neutral`,variant:`solid`,class:{content:`bg-inverted text-inverted`}},{color:`neutral`,variant:`outline`,class:{content:`bg-default ring ring-default`}},{color:`neutral`,variant:`soft`,class:{content:`bg-elevated/50`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-elevated/50 ring ring-default`}}],defaultVariants:{side:`left`,variant:`naked`,color:`neutral`}},Oo={__name:`UChatMessage`,props:{as:{type:null,required:!1,default:`article`},icon:{type:null,required:!1},avatar:{type:Object,required:!1},variant:{type:null,required:!1},color:{type:null,required:!1},side:{type:null,required:!1},actions:{type:Array,required:!1},compact:{type:Boolean,required:!1},content:{type:String,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},id:{type:String,required:!0},role:{type:String,required:!0},metadata:{type:null,required:!1},parts:{type:Array,required:!0}},setup(e){let r=e,i=O(),o=Le(`chatMessage`,r),s=pn(),c=n(()=>o.parts?.filter(e=>e.type===`file`)??[]),l=n(()=>o.parts?.filter(e=>e.type===`text`)??[]),u=n(()=>Se(o,[`as`,`icon`,`avatar`,`variant`,`color`,`side`,`actions`,`compact`,`class`,`ui`,`content`])),p=n(()=>fe({extend:Do,...s.ui?.chatMessage||{}})({variant:o.variant,color:o.color,side:o.side,leading:!!o.icon||!!o.avatar||!!i.leading,actions:!!o.actions||!!i.actions,compact:o.compact}));return(e,n)=>(_(),m(f(et),{as:f(o).as,"data-role":f(o).role,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]}))},{default:H(()=>[i.files&&c.value.length||i.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(p.value.header({class:f(o).ui?.header}))},[d(e.$slots,`header`,R(t({...u.value})),()=>[i.files&&c.value.length?(_(),v(`div`,{key:0,"data-slot":`files`,class:j(p.value.files({class:f(o).ui?.files}))},[d(e.$slots,`files`,R(t({...u.value,parts:c.value})))],2)):g(``,!0)])],2)):g(``,!0),I(`div`,{"data-slot":`container`,class:j(p.value.container({class:f(o).ui?.container}))},[f(o).icon||f(o).avatar||i.leading?(_(),v(`div`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[d(e.$slots,`leading`,R(t({...u.value,avatar:f(o).avatar,ui:p.value})),()=>[f(o).icon?(_(),m(Ee,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(o).avatar?(_(),m(we,z({key:1,size:f(o).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},f(o).avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:f(o).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)])],2)):g(``,!0),f(o).content||l.value.length||i.content||f(o).actions||i.actions||i.body?(_(),v(`div`,{key:1,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body}))},[d(e.$slots,`body`,R(t({...u.value})),()=>[f(o).content||l.value.length||i.content?(_(),v(`div`,{key:0,"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},[d(e.$slots,`content`,R(t({...u.value,content:f(o).content})),()=>[f(o).content?(_(),v(k,{key:0},[a(M(f(o).content),1)],64)):(_(!0),v(k,{key:1},y(l.value,(e,t)=>(_(),v(k,{key:`${f(o).id}-${e.type}-${t}`},[a(M(e.text),1)],64))),128))])],2)):g(``,!0),f(o).actions||i.actions?(_(),v(`div`,{key:1,"data-slot":`actions`,class:j(p.value.actions({class:f(o).ui?.actions}))},[d(e.$slots,`actions`,R(t({...u.value,actions:f(o).actions})),()=>[(_(!0),v(k,null,y(f(o).actions,(e,t)=>(_(),m(ti,{key:t,text:e.label},{default:H(()=>[E(yt,z({size:`sm`,color:`neutral`,variant:`ghost`},{ref_for:!0},f(Se)(e,[`onClick`]),{label:void 0,onClick:t=>typeof e.onClick==`function`?e.onClick(t,u.value):void 0}),null,16,[`onClick`])]),_:2},1032,[`text`]))),128))])],2)):g(``,!0)])],2)):g(``,!0)],2)]),_:3},8,[`as`,`data-role`,`class`]))}};function ko(e,t={}){let{arrivedState:r}=Oe(e);return{style:n(()=>{let n=o(e),i=o(t.orientation)??`vertical`,[a,s]=i===`horizontal`?[`left`,`right`]:[`top`,`bottom`],c=!r[a],l=!r[s];if(!c&&!l||!(n&&(i===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight)))return;let u=`${o(t.size)??24}px`,d=i===`horizontal`?`90deg`:`180deg`;return c&&l?{maskImage:`linear-gradient(${d}, transparent, #000 ${u}, #000 calc(100% - ${u}), transparent)`}:c?{maskImage:`linear-gradient(${d}, transparent, #000 ${u})`}:{maskImage:`linear-gradient(${d}, #000, #000 calc(100% - ${u}), transparent)`}}),isOverflowing:n(()=>{r.top,r.bottom,r.left,r.right;let n=o(e);return n?(o(t.orientation)??`vertical`)===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight:!1}),arrivedState:r}}var Ao={base:`text-transparent bg-clip-text bg-no-repeat bg-size-[calc(200%+var(--spread)*2+2px)_100%,auto] bg-[image:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--ui-text-highlighted),#0000_calc(50%+var(--spread))),linear-gradient(var(--ui-text-muted),var(--ui-text-muted))] motion-safe:animate-[shimmer_var(--duration)_linear_infinite] motion-safe:rtl:animate-[shimmer-rtl_var(--duration)_linear_infinite] will-change-[background-position] motion-reduce:bg-none motion-reduce:text-muted`},jo={__name:`UChatShimmer`,props:{as:{type:null,required:!1,default:`span`},text:{type:String,required:!0},duration:{type:Number,required:!1,default:2},spread:{type:Number,required:!1,default:2},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){let t=Le(`chatShimmer`,e),r=pn(),i=n(()=>fe({extend:Ao,...r.ui?.chatShimmer||{}})),o=n(()=>t.text.length*t.spread);return(e,n)=>(_(),m(f(et),{as:f(t).as,style:N({"--spread":`${o.value}px`,"--duration":`${f(t).duration}s`}),"data-slot":`base`,class:j(i.value({class:[f(t).ui?.base,f(t).class]}))},{default:H(()=>[a(M(f(t).text),1)]),_:1},8,[`as`,`style`,`class`]))}},Mo={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default rounded-sm outline-primary/25 focus-visible:outline-3 min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden rounded-sm outline-primary/25 has-focus-visible:outline-3`,body:`max-h-[200px] pt-2 overflow-y-auto text-sm text-dimmed whitespace-pre-wrap focus:outline-none`},variants:{chevron:{leading:{leadingIcon:`group-hover:opacity-0`},trailing:``},alone:{false:{leadingIcon:[`absolute inset-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},No={__name:`UChatReasoning`,props:{text:{type:String,required:!1},streaming:{type:Boolean,required:!1,default:!1},duration:{type:Number,required:!1},icon:{type:null,required:!1},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},autoCloseDelay:{type:Number,required:!1,default:500},shimmer:{type:Object,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=Le(`chatReasoning`,r),{t:s,code:c}=mi(),u=pn(),p=n(()=>fe({extend:Mo,...u.ui?.chatReasoning||{}})({chevron:o.chevron})),y=n(()=>o.open!==void 0),x=h(o.defaultOpen??o.streaming),S=h(o.streaming?Date.now():null),C=h(void 0),w=h(null);B(()=>o.streaming,(e,t)=>{e?(w.value&&=(clearTimeout(w.value),null),t||(k(!0),S.value=Date.now())):t&&(S.value!==null&&(C.value=Math.ceil((Date.now()-S.value)/1e3),S.value=null),o.autoCloseDelay>0&&(w.value=setTimeout(()=>{k(!1)},o.autoCloseDelay)))},{immediate:!0});let T=n(()=>o.duration??C.value),D=n(()=>{if(o.streaming||T.value===0)return s(`chatReasoning.thinking`);if(T.value===void 0)return s(`chatReasoning.thought`);let e=T.value,t=e<60?`second`:`minute`,n=e<60?e:Math.floor(e/60),r=new Intl.NumberFormat(c.value,{style:`unit`,unit:t,unitDisplay:`long`}).format(n);return s(`chatReasoning.thoughtFor`,{duration:r})}),O=n(()=>y.value?o.open:x.value);function k(e){w.value&&=(clearTimeout(w.value),null),x.value=e,i(`update:open`,e)}l(()=>{w.value&&clearTimeout(w.value)});let A=n(()=>!!o.text||o.streaming),F=n(()=>o.chevronIcon||u.ui.icons?.chevronDown),L=b(`bodyRef`),{style:R}=ko(L);return B(()=>o.text,()=>{if(!o.streaming||!L.value)return;let e=L.value;e.scrollHeight-e.scrollTop-e.clientHeight<50&&P(()=>{e.scrollTop=e.scrollHeight})}),(e,t)=>A.value?(_(),m(f(Ea),{key:0,open:O.value,disabled:f(o).disabled,"unmount-on-hide":f(o).unmountOnHide,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]})),"onUpdate:open":k},{default:H(({open:t})=>[E(f(Oa),{"as-child":``,disabled:!A.value},{default:H(()=>[I(`button`,{type:`button`,"data-slot":`trigger`,class:j(p.value.trigger({class:f(o).ui?.trigger}))},[f(o).icon||A.value&&f(o).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[f(o).icon?(_(),m(Ee,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon,alone:!(A.value&&f(o).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),A.value&&f(o).chevron===`leading`?(_(),m(Ee,{key:1,name:F.value,"data-slot":`chevronIcon`,class:j(p.value.chevronIcon({class:f(o).ui?.chevronIcon,alone:!f(o).icon}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),f(o).streaming?(_(),m(jo,z({key:1,text:D.value},f(o).shimmer,{"data-slot":`label`,class:p.value.label({class:f(o).ui?.label})}),null,16,[`text`,`class`])):(_(),v(`span`,{key:2,"data-slot":`label`,class:j(p.value.label({class:f(o).ui?.label}))},M(D.value),3)),A.value&&f(o).chevron===`trailing`?(_(),m(Ee,{key:3,name:F.value,"data-slot":`trailingIcon`,class:j(p.value.trailingIcon({class:f(o).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(Da),{"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},{default:H(()=>[I(`div`,{ref_key:`bodyRef`,ref:L,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body})),style:N(f(R))},[d(e.$slots,`default`,{open:t},()=>[a(M(f(o).text),1)])],6)]),_:2},1032,[`class`])]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`])):g(``,!0)}},Po=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function Fo(e,t=!1){return t?`⠿`:Po[Math.floor(Math.max(0,e)/80)%Po.length]}function Io(e,t){return t?e?1e3:80:null}function Lo(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r?`${r}h ${i}m`:i?`${i}m ${n%60}s`:`${n}s`}var Ro={class:`omp-spinner`,"aria-hidden":`true`},zo={key:0,class:`omp-elapsed`},Bo=Object.assign(T({__name:`OmpSpinner`,props:{since:{}},setup(e){let t=e,r=h(0),i=h(Date.now()),a=n(()=>Fo(i.value-r.value,pr.value)),o=n(()=>t.since?Lo(t.since,i.value):``),s;function c(){s&&clearInterval(s),s=void 0}function l(){i.value=Date.now()}function u(){c();let e=Io(pr.value,cr.value);e!==null&&(l(),s=yr(l,e))}return w(()=>{B(pr,()=>{r.value=i.value=Date.now(),u()},{immediate:!0}),B(cr,u)}),U(c),(e,t)=>(_(),v(k,null,[I(`span`,Ro,M(f(a)),1),d(e.$slots,`default`),f(o)?(_(),v(`span`,zo,M(f(o)),1)):g(``,!0)],64))}}),{__name:`OmpSpinner`}),Vo=Object.assign(T({__name:`OmpElapsed`,props:{since:{}},setup(e){let t=e,n=h(Date.now()),r;return w(()=>{r=yr(()=>{n.value=Date.now()},1e3)}),U(()=>{r&&clearInterval(r)}),(e,r)=>(_(),v(`span`,null,M(f(Lo)(t.since,f(n))),1))}}),{__name:`OmpElapsed`});function Ho(e){if(!(e>=0))return``;if(e<6e4)return`${(e/1e3).toFixed(2)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h${r}m`:`${r}m${t%60}s`}var Uo=(e,t,n,r,i)=>`${e} ${e===1?X(t,r):X(n,i)}`;function Wo(e){let t=[];return typeof e.matches==`number`?t.push(Uo(e.matches,`match`,`matches`,`résultat`,`résultats`)+(e.files&&e.files>1&&e.files<e.matches?` ${X(`in ${e.files} files`,`dans ${e.files} fichiers`)}`:``)):typeof e.files==`number`&&t.push(Uo(e.files,`file`,`files`,`fichier`,`fichiers`)),e.scope&&t.push(`${X(`in`,`dans`)} ${e.scope}`),(typeof e.added==`number`||typeof e.removed==`number`)&&t.push(`+${e.added||0}/-${e.removed||0}`),e.job&&t.push(`${X(`Backgrounded`,`En arrière-plan`)}: ${e.job}`),e.cancelled&&t.push(X(`cancelled`,`annulée`)),t}function Go(e){return!e.out||!e.outLines?0:Math.max(0,e.outLines-e.out.split(`
3
+ `).length)}function Ko(e){return e.out?Uo(Math.max(e.outLines||0,e.out.split(`
4
+ `).length),`line`,`lines`,`ligne`,`lignes`):``}function qo(e){if(e.title===`Bash`||e.title===`Python`)return e.target||e.title.toLowerCase();let t=e.title.toLowerCase().replace(/\s+/g,`_`);return e.target?`${t} ${e.target}`:t}function Jo(e,t){let n=Go(e);return{label:e.diff?`Diff`:t?X(`Error`,`Erreur`):`Output`,earlier:n?`… ${Uo(n,`earlier line`,`earlier lines`,`ligne avant`,`lignes avant`)}`:``}}var Yo=e=>e.reduce((e,t)=>e+(t.omp&&typeof t.omp.ms==`number`?t.omp.ms:0),0),Xo=e=>e.length>0&&e.every(e=>e.omp);function Zo(e,t){return t||e.length<=3?{hidden:0,rows:e}:{hidden:e.length-3,rows:e.slice(-3)}}var Qo={class:`omp-tool-line`},$o={class:`omp-tool-glyph`,"aria-hidden":`true`},es={class:`omp-tool-cmd`},ts={key:0,class:`omp-tool-wall`},ns={key:1,class:`omp-tool-wall`},rs={class:`omp-tool-sub`},is={key:1,class:`omp-tool-intent`},as={key:2,class:`omp-tool-result`},os={class:`omp-tool-exit`},ss={key:0,class:`omp-tool-out`},cs={class:`omp-tool-out-head`},ls={class:`omp-tool-out-label`},us={key:0,class:`omp-tool-out-earlier`},ds={class:`omp-tool-out-right`},fs={key:0,class:`omp-tool-exit`},ps={key:1},ms=Object.assign(T({__name:`OmpTool`,props:{tool:{},live:{type:Boolean},run:{type:Boolean}},setup(e){let t=e,r=h(!1),i=n(()=>t.tool.omp),o=n(()=>!!t.tool.error),s=n(()=>Wo(i.value).concat(t.run?[Ko(i.value)].filter(Boolean):[]).join(` · `)),c=n(()=>i.value.exit?String(i.value.exit):``),l=n(()=>t.live||i.value.ms===void 0?``:Ho(i.value.ms)),u=n(()=>t.live&&t.tool.ts&&Date.parse(t.tool.ts)||null),d=n(()=>i.value.intent||i.value.title),p=n(()=>!!i.value.out),b=n(()=>Jo(i.value,o.value)),x=n(()=>(i.value.out||``).split(`
5
+ `).map(e=>({text:e,cls:i.value.diff?/^\+\s*\d*\|/.test(e)?`add`:/^-\s*\d*\|/.test(e)?`del`:``:``})));return(t,n)=>{let h=Bo,S=Vo,w=Ee,T=jo;return _(),v(`div`,{class:j([`omp-tool`,{err:f(o),live:e.live,open:f(r)}])},[(_(),m(C(f(p)?`button`:`div`),{class:`omp-tool-head`,type:f(p)?`button`:void 0,"aria-expanded":f(p)?f(r):void 0,onClick:n[0]||=e=>f(p)&&(r.value=!f(r))},{default:H(()=>[I(`span`,Qo,[I(`span`,$o,[e.live?(_(),m(h,{key:0})):(_(),v(k,{key:1},[a(M(f(o)?`✗`:`❯`),1)],64))]),I(`code`,es,M(f(qo)(f(i))),1),f(u)?(_(),v(`span`,ts,[E(S,{since:f(u)},null,8,[`since`])])):f(l)?(_(),v(`span`,ns,M(f(l)),1)):g(``,!0),e.run&&f(p)?(_(),m(w,{key:2,name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`,class:`omp-tool-chev`,"aria-hidden":`true`},null,8,[`name`])):g(``,!0)]),I(`span`,rs,[e.live?(_(),m(T,{key:0,text:`# ${f(d)}`,duration:2.4,class:`omp-tool-intent`},null,8,[`text`])):f(i).intent?(_(),v(`span`,is,`# `+M(f(i).intent),1)):g(``,!0),f(s)||f(c)?(_(),v(`span`,as,[a(`→ `+M(f(s)),1),f(c)?(_(),v(k,{key:0},[f(s)?(_(),v(k,{key:0},[a(` · `)],64)):g(``,!0),I(`span`,os,`exit `+M(f(c)),1)],64)):g(``,!0)])):g(``,!0)])]),_:1},8,[`type`,`aria-expanded`])),f(p)&&f(r)?(_(),v(`div`,ss,[I(`div`,cs,[I(`span`,ls,M(f(b).label),1),f(b).earlier?(_(),v(`span`,us,M(f(b).earlier),1)):g(``,!0),I(`span`,ds,[f(c)?(_(),v(`span`,fs,`exit `+M(f(c)),1)):g(``,!0),f(l)?(_(),v(`span`,ps,M(f(l)),1)):g(``,!0)])]),I(`pre`,null,[(_(!0),v(k,null,y(f(x),(e,t)=>(_(),v(`span`,{key:t,class:j(e.cls)},M(e.text)+`
6
+ `,3))),128))])])):g(``,!0)],2)}}}),{__name:`OmpTool`}),hs={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,suffix:`text-dimmed ms-1`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden`,body:`text-sm text-dimmed whitespace-pre-wrap`,actions:`flex items-center justify-end gap-1.5`},variants:{variant:{inline:{trigger:`rounded-sm outline-primary/25 focus-visible:outline-3`,body:`pt-2`,actions:`pt-2`},card:{root:`rounded-md ring ring-default overflow-hidden outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`,trigger:`px-2 py-1 focus:outline-none`,trailingIcon:`ms-auto`,body:`border-t border-default p-2 max-h-[200px] overflow-y-auto focus:outline-none`,actions:`border-t border-default p-2`}},chevron:{leading:``,trailing:``},loading:{true:{leadingIcon:`animate-spin`}},alone:{false:{leadingIcon:[`absolute inset-0 group-hover:opacity-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},gs=[`data-state`],_s={__name:`UChatTool`,props:{text:{type:String,required:!1},suffix:{type:String,required:!1},icon:{type:null,required:!1},loading:{type:Boolean,required:!1,default:!1},loadingIcon:{type:null,required:!1},streaming:{type:Boolean,required:!1,default:!1},variant:{type:null,required:!1,default:`inline`},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},shimmer:{type:Object,required:!1},actions:{type:Array,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=O(),s=Le(`chatTool`,r),c=pn(),l=n(()=>fe({extend:hs,...c.ui?.chatTool||{}})({variant:s.variant,chevron:s.chevron,loading:s.loading})),u=n(()=>s.open!==void 0),p=h(s.defaultOpen??!1),b=n(()=>u.value?s.open:p.value);function x(e){p.value=e,i(`update:open`,e)}let S=n(()=>!!o.default);B(()=>!!s.actions?.length,e=>{e&&S.value&&s.open===void 0&&s.defaultOpen===void 0&&(p.value=!0)},{immediate:!0});let C=n(()=>s.loadingIcon||c.ui.icons?.loading),w=n(()=>s.loading?C.value:s.icon),T=n(()=>s.chevronIcon||c.ui.icons?.chevronDown);return(e,t)=>(_(),m(f(Ea),{open:b.value,disabled:f(s).disabled,"unmount-on-hide":f(s).unmountOnHide,"data-slot":`root`,class:j(l.value.root({class:[f(s).ui?.root,f(s).class]})),"onUpdate:open":x},{default:H(({open:t})=>[E(f(Oa),{"as-child":``,disabled:!S.value},{default:H(()=>[I(`button`,{type:`button`,"data-slot":`trigger`,class:j(l.value.trigger({class:f(s).ui?.trigger}))},[w.value||S.value&&f(s).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(l.value.leading({class:f(s).ui?.leading}))},[w.value?(_(),m(Ee,{key:0,name:w.value,"data-slot":`leadingIcon`,class:j(l.value.leadingIcon({class:f(s).ui?.leadingIcon,alone:!(S.value&&f(s).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),S.value&&f(s).chevron===`leading`?(_(),m(Ee,{key:1,name:T.value,"data-slot":`chevronIcon`,class:j(l.value.chevronIcon({class:f(s).ui?.chevronIcon,alone:!w.value}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),I(`span`,{"data-slot":`label`,class:j(l.value.label({class:f(s).ui?.label}))},[f(s).streaming&&f(s).text?(_(),m(jo,z({key:0,text:f(s).text},f(s).shimmer),null,16,[`text`])):(_(),v(k,{key:1},[a(M(f(s).text),1)],64)),f(s).suffix?(_(),v(`span`,{key:2,"data-slot":`suffix`,class:j(l.value.suffix({class:f(s).ui?.suffix}))},M(f(s).suffix),3)):g(``,!0)],2),S.value&&f(s).chevron===`trailing`?(_(),m(Ee,{key:1,name:T.value,"data-slot":`trailingIcon`,class:j(l.value.trailingIcon({class:f(s).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(Da),{"data-slot":`content`,class:j(l.value.content({class:f(s).ui?.content}))},{default:H(()=>[I(`div`,{"data-slot":`body`,class:j(l.value.body({class:f(s).ui?.body}))},[d(e.$slots,`default`,{open:t})],2)]),_:2},1032,[`class`]),f(s).actions?.length||o.actions?(_(),v(`div`,{key:0,"data-slot":`actions`,"data-state":S.value&&t?`open`:`closed`,class:j(l.value.actions({class:f(s).ui?.actions}))},[d(e.$slots,`actions`,{},()=>[(_(!0),v(k,null,y(f(s).actions,(e,t)=>(_(),m(yt,z({key:t,size:`xs`},{ref_for:!0},e),null,16))),128))])],10,gs)):g(``,!0)]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`]))}},vs=[`·`,`✢`,`✳`,`✶`,`✻`,`✽`],ys=[...vs,...[...vs].reverse()];function bs(e,t=!1){return t?`✻`:ys[Math.floor(Math.max(0,e)/120)%ys.length]}function xs(e,t){return e||!t?null:120}var Ss={class:`claude-spinner`,"aria-hidden":`true`},Cs=Object.assign(T({__name:`ClaudeSpinner`,setup(e){let t=h(0),r=n(()=>bs(t.value,pr.value)),i,a=0;function o(){i&&clearInterval(i),i=void 0}function s(){t.value=performance.now()-a}function c(){o();let e=xs(pr.value,cr.value);e!==null&&(s(),i=yr(s,e))}return w(()=>{B(pr,()=>{a=performance.now(),c()},{immediate:!0}),B(cr,c)}),U(o),(e,t)=>(_(),v(`span`,Ss,M(f(r)),1))}}),{__name:`ClaudeSpinner`}),ws={slots:{root:`w-full flex flex-col gap-1 flex-1 px-2.5 [&>article]:last-of-type:min-h-(--last-message-height)`,indicator:`h-6 flex items-center gap-1 py-3 *:size-2 *:rounded-full *:bg-elevated motion-safe:[&>*:nth-child(1)]:animate-[bounce_1s_infinite] motion-safe:[&>*:nth-child(2)]:animate-[bounce_1s_0.15s_infinite] motion-safe:[&>*:nth-child(3)]:animate-[bounce_1s_0.3s_infinite]`,viewport:`absolute inset-x-0 top-[86%] data-[state=open]:animate-[fade-in_200ms_var(--ease-out)] data-[state=closed]:animate-[fade-out_200ms_var(--ease-out)]`,autoScroll:`rounded-full absolute right-1/2 translate-x-1/2 bottom-0`},variants:{compact:{true:``,false:``}}},Ts=[`data-status`],Es=[`data-state`],Ds={__name:`UChatMessages`,props:{messages:{type:null,required:!1},status:{type:String,required:!1},shouldAutoScroll:{type:Boolean,required:!1,default:!1},shouldScrollToBottom:{type:Boolean,required:!1,default:!0},autoScroll:{type:[Boolean,Object],required:!1,default:!0},autoScrollIcon:{type:null,required:!1},user:{type:Object,required:!1},assistant:{type:Object,required:!1},compact:{type:Boolean,required:!1},spacingOffset:{type:Number,required:!1,default:0},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e,{expose:t}){let r=e,i=O(),a=Le(`chatMessages`,r),o=()=>Se(i,[`default`,`indicator`,`viewport`]);function s(){if(a.status===`submitted`)return!0;if(a.status!==`streaming`)return!1;let e=a.messages?.[a.messages.length-1];return e?.role===`assistant`&&!e.parts?.length}let c=pn(),l=S(()=>ln(a.user,{side:`right`,variant:`soft`})),u=S(()=>ln(a.assistant,{side:`left`,variant:`naked`})),p=n(()=>fe({extend:ws,...c.ui?.chatMessages||{}})({compact:a.compact})),b=h(null),C=h(null),T=h(new Map),D=h(!1),A=h(0),M=h(!1),F=h(0),L=h(!1);function R(e,t){let n=t?.$el;n&&T.value.set(e,n)}function V(e){let t=T.value.get(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}function U(e=!0){C.value&&(e?C.value.scrollTo({top:C.value.scrollHeight,behavior:`smooth`}):C.value.scrollTop=C.value.scrollHeight)}ve([()=>a.messages,()=>a.status],([e,t])=>{if(!a.messages?.length){D.value=!1,L.value=!1,F.value=0,T.value.clear();return}t===`streaming`&&ee()},{deep:!0,throttle:50,leading:!0}),B(()=>a.status,e=>{if(e!==`submitted`)return;let t=a.messages?.[a.messages.length-1];t&&t.role===`user`&&(L.value=!1,P(()=>{M.value=!0,G(),P(()=>{V(t.id)})}))});function ee(){if(!C.value)return;let e=C.value.scrollTop+C.value.clientHeight,t=C.value.scrollHeight;D.value=t-e>=100,C.value.scrollTop<F.value?L.value=!0:t-e<100&&(L.value=!1),F.value=C.value.scrollTop}function W(){L.value=!1,U()}function te(e){if(!e)return document.documentElement;let t=/auto|scroll/,n=e;for(;n&&n!==document.body&&n!==document.documentElement;){let e=window.getComputedStyle(n);if(t.test(e.overflowY))return n;n=n.parentElement}return document.documentElement}function G(){if(!b.value||!C.value||!a.messages?.length||!M.value)return;let{height:e}=Ne(C.value),t=a.messages.findLast(e=>e.role===`user`);if(!t)return;let n=T.value.get(t.id);if(!n)return;let r=a.spacingOffset||0,i=window.getComputedStyle(b.value),o=window.getComputedStyle(C.value);r+=Number.parseFloat(i.rowGap)||Number.parseFloat(i.gap)||0,r+=Number.parseFloat(o.paddingTop)||0,r+=Number.parseFloat(o.paddingBottom)||0,A.value=Math.max(e.value-n.offsetHeight-r,0)}return w(()=>{C.value=te(b.value),C.value&&(F.value=C.value.scrollTop,a.shouldScrollToBottom?(U(!1),setTimeout(()=>{U(!1)},100)):P(()=>{ee()}),se(C,`scroll`,ee),se(window,`resize`,()=>P(G)),b.value&&Ie(b,()=>{a.shouldAutoScroll&&a.status===`streaming`&&!L.value&&U(!1)},{childList:!0,subtree:!0}))}),t({registerMessageRef:R}),(e,t)=>(_(),v(`div`,{ref_key:`el`,ref:b,"data-status":f(a).status,"data-slot":`root`,class:j(p.value.root({class:[f(a).ui?.root,f(a).class]})),style:N({"--last-message-height":`${A.value}px`})},[d(e.$slots,`default`,{registerMessageRef:R},()=>[(_(!0),v(k,null,y(f(a).messages,t=>(_(),v(k,{key:t.id},[t.parts?.length?(_(),m(Oo,z({key:0,ref_for:!0},{...t.role===`user`?l.value:u.value,...t},{ref_for:!0,ref:e=>R(t.id,e),compact:f(a).compact}),x({_:2},[y(o(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,z({ref_for:!0},{...n,message:t}))])}))]),1040,[`compact`])):g(``,!0)],64))),128))]),s()?(_(),m(Oo,z({key:0,id:`indicator`,role:`assistant`},{...u.value,actions:void 0,parts:[]},{compact:f(a).compact}),{content:H(()=>[d(e.$slots,`indicator`,{ui:p.value},()=>[I(`div`,{"data-slot":`indicator`,class:j(p.value.indicator({class:f(a).ui?.indicator}))},[...t[0]||=[I(`span`,null,null,-1),I(`span`,null,null,-1),I(`span`,null,null,-1)]],2)])]),_:3},16,[`compact`])):g(``,!0),E(f(wt),{present:D.value},{default:H(()=>[I(`div`,{"data-state":D.value?`open`:`closed`,"data-slot":`viewport`,class:j(p.value.viewport({class:f(a).ui?.viewport}))},[d(e.$slots,`viewport`,{ui:p.value,onClick:W},()=>[f(a).autoScroll?(_(),m(yt,z({key:0,icon:f(a).autoScrollIcon||f(c).ui.icons.arrowDown,color:`neutral`,variant:`outline`},typeof f(a).autoScroll==`object`?f(a).autoScroll:{},{"data-slot":`autoScroll`,class:p.value.autoScroll({class:f(a).ui?.autoScroll}),onClick:W}),null,16,[`icon`,`class`])):g(``,!0)])],10,Es)]),_:3},8,[`present`])],14,Ts))}},Os=new URL(`pdf.min.t82Z80JU.mjs`,import.meta.url).href,ks=new URL(`pdf.worker.min.wgc6bjNh.mjs`,import.meta.url).href;function As(e,t,n){return Math.min(Math.max(1,n),Math.sqrt(4194304/(e*t)))}var js=[`aria-label`,`aria-busy`],Ms={key:0,class:`changes-notice`,role:`status`},Ns={key:1,class:`changes-notice error`,role:`alert`},Ps=[`data-page`,`aria-label`],Fs=Object.assign(T({__name:`PdfPreview`,props:{src:{},title:{}},setup(e){let t=e,n=h(),r=h(0),i=h(2/3),a=h(!0),o=h(!1),s,c,l,u,d,p=!1,m=0,b=!1,x=0,S=new Set;async function C(){if(!b&&!p&&s&&x){b=!0;try{for(let e of S){if(p)break;if(e.querySelector(`canvas`))continue;let t=m,n=await s.getPage(Number(e.dataset.page));if(p||t!==m||!S.has(e))continue;let r=n.getViewport({scale:1}),i=n.getViewport({scale:x/r.width});e.style.aspectRatio=`${r.width} / ${r.height}`;let a=window.document.createElement(`canvas`),o=As(i.width,i.height,window.devicePixelRatio||1);a.width=Math.ceil(i.width*o),a.height=Math.ceil(i.height*o);let c=a.getContext(`2d`);l=n.render({canvas:a,canvasContext:c,viewport:i,transform:[o,0,0,o,0,0]});try{await l.promise,!p&&t===m&&S.has(e)?(e.replaceChildren(a),e.dataset.rendered=`true`):a.width=a.height=0}catch(e){if(e.name!==`RenderingCancelledException`)throw e}finally{l=void 0,n.cleanup()}}}catch{p||(o.value=!0)}finally{b=!1,!p&&!o.value&&[...S].some(e=>!e.querySelector(`canvas`))&&C()}}}function T(e){let t=e.querySelector(`canvas`);t&&(t.width=t.height=0,t.remove()),delete e.dataset.rendered}return w(async()=>{try{let e=await na(()=>import(Os),[],import.meta.url);if(p||(e.GlobalWorkerOptions.workerSrc=ks,c=e.getDocument({url:t.src,withCredentials:!0,isEvalSupported:!1}),s=await c.promise,p))return;let o=await s.getPage(1),f=o.getViewport({scale:1});if(i.value=f.height/f.width,o.cleanup(),r.value=s.numPages,a.value=!1,await P(),p||!n.value)return;x=n.value.clientWidth,u=new IntersectionObserver(e=>{for(let t of e){let e=t.target;t.isIntersecting?S.add(e):(S.delete(e),T(e))}C()},{rootMargin:`400px 0px`}),n.value.querySelectorAll(`.pdf-page`).forEach(e=>u.observe(e)),d=new ResizeObserver(()=>{let e=n.value?.clientWidth||0;e&&e!==x&&(x=e,m++,l?.cancel(),S.forEach(T),C())}),d.observe(n.value)}catch{p||(o.value=!0,a.value=!1)}}),U(()=>{p=!0,u?.disconnect(),d?.disconnect(),l?.cancel(),S.forEach(T),S.clear(),c?.destroy()}),(t,s)=>(_(),v(`div`,{ref_key:`root`,ref:n,class:`files-pdf`,role:`region`,"aria-label":e.title,"aria-busy":f(a)},[f(a)?(_(),v(`p`,Ms,M((`t`in t?t.t:f(Y))(`Loading PDF…`)),1)):g(``,!0),f(o)?(_(),v(`p`,Ns,M((`t`in t?t.t:f(Y))(`Could not preview this PDF. Use Open to view it.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(r),e=>(_(),v(`div`,{key:e,class:`pdf-page`,"data-page":e,style:N({aspectRatio:`1 / ${f(i)}`}),role:`img`,"aria-label":`${(`t`in t?t.t:f(Y))(`Page`)} ${e}`},null,12,Ps))),128))],8,js))}}),{__name:`PdfPreview`}),Is=`wherdr.files.hidden`;function Ls(){try{return localStorage.getItem(Is)!==`0`}catch{return!0}}function Rs(e){try{localStorage.setItem(Is,e?`1`:`0`)}catch{}}function zs(e){if(e<1e3)return`${e} B`;let t=[`kB`,`MB`,`GB`,`TB`],n=e/1e3,r=0;for(;;){let e=n.toFixed(+(n<10));if(Number(e)<1e3||r===t.length-1)return`${e} ${t[r]}`;n/=1e3,r++}}var Bs={class:`changes-view files-view`},Vs={class:`changes-inner`},Hs={class:`changes-toolbar`},Us=[`aria-label`],Ws={key:0,class:`files-sep`},Gs=[`onClick`],Ks={key:0,class:`files-sep`},qs={class:`files-crumb current`},Js={class:`files-actions`},Ys={class:`files-label`},Xs={key:0,class:`changes-notice error`,role:`alert`},Zs={key:1,class:`changes-notice`},Qs={class:`changes-location`},$s={key:0,class:`changes-limit`},ec=[`src`,`alt`],tc={key:3,class:`changes-notice`},nc={key:4,class:`changes-notice`},rc=[`aria-label`],ic={class:`files-num`,"aria-hidden":`true`},ac={class:`files-text`},oc={class:`changes-toggle`},sc={key:0,class:`changes-limit`},cc={key:1,class:`changes-notice`},lc={class:`files-list`},uc=[`disabled`,`onClick`],dc={class:`change-path`},fc={key:0,class:`change-status`},pc=Object.assign(T({__name:`FilesView`,props:{paneId:{},file:{}},setup(e){let t=e,r=h(null),i=h(null),o=h(!1),s=h(``),c=h(Ls());B(c,Rs);let u=0,d=()=>encodeURIComponent(t.paneId);async function p(e,t){let n=++u;o.value=!0,s.value=``;try{let r=await kr(e);n===u&&t(r)}catch(e){n===u&&(s.value=e.message)}finally{n===u&&(o.value=!1)}}function b(e){let t=e===null?``:`&path=${encodeURIComponent(e)}`;return p(`/api/files?pane=${d()}${t}`,e=>{r.value=e,i.value=null})}let x=e=>`pane=${d()}&path=${encodeURIComponent(e)}${t.file?`&from=chat`:``}`;function S(e){return p(`/api/files/read?${x(e)}`,e=>{i.value=e})}let C=h(0),T=n(()=>i.value?.kind===`pdf`?`/api/files/download?${x(i.value.path)}&inline=1`:``),D=h(!1);async function O(){let e=i.value?.path;if(e&&!D.value){D.value=!0;try{await jr(`/api/files/download?${x(e)}`,e.split(`/`).pop()||e)}catch(e){$(e.message,!0)}finally{D.value=!1}}}let A=e=>r.value?.path?`${r.value.path}/${e}`:e;function N(e){e.kind===`dir`?b(A(e.name)):e.kind===`file`&&S(A(e.name))}function P(){u++,o.value=!1,i.value=null}function F(){C.value++,t.file?S(t.file):i.value?S(i.value.path):b(r.value?r.value.path:null)}w(()=>t.file?S(t.file):b(null)),l(()=>{u++});let R=n(()=>{let e=r.value;if(!e)return[];let t=e.path?e.path.split(`/`):[];return[{label:e.root.split(`/`).filter(Boolean).pop()||`/`,path:``},...t.map((e,n)=>({label:e,path:t.slice(0,n+1).join(`/`)}))]}),z=n(()=>(r.value?.entries||[]).filter(e=>c.value||!e.name.startsWith(`.`))),V=n(()=>{let e=i.value?.text??``,t=e.endsWith(`
7
7
  `)?e.slice(0,-1):e,n=1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===10&&n++;return{text:t,numbers:Array.from({length:n},(e,t)=>t+1).join(`
8
- `)}});function B(e){return e.kind===`dir`?e.link?`i-lucide-folder-symlink`:`i-lucide-folder`:e.kind===`other`?`i-lucide-file-question`:e.link?`i-lucide-file-symlink`:`i-lucide-file`}return(t,n)=>{let l=Oe,u=De;return _(),v(`div`,Es,[F(`div`,Ds,[F(`div`,Os,[F(`nav`,{class:`files-crumbs`,"aria-label":(`t`in t?t.t:f(Y))(`Folder`)},[f(i)&&!e.file?(_(),m(l,{key:0,icon:`i-lucide-arrow-left`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Y))(`Back to folder`),onClick:A},null,8,[`aria-label`])):g(``,!0),(_(!0),v(k,null,y(f(P),(e,t)=>(_(),v(k,{key:e.path},[t?(_(),v(`span`,As,`/`)):g(``,!0),F(`button`,{type:`button`,class:`files-crumb`,onClick:t=>b(e.path)},M(e.label),9,js)],64))),128)),f(i)?(_(),v(k,{key:1},[f(P).length?(_(),v(`span`,Ms,`/`)):g(``,!0),F(`span`,Ns,M(f(i).path.split(`/`).pop()),1)],64)):g(``,!0)],8,ks),F(`div`,Ps,[f(i)?(_(),m(l,{key:0,icon:`i-lucide-download`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(C),"aria-label":(`t`in t?t.t:f(Y))(`Download`),onClick:T},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Download`)),1)]),_:1},8,[`loading`,`aria-label`])):g(``,!0),E(l,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(o),"aria-label":(`t`in t?t.t:f(Y))(`Refresh`),onClick:N},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])])]),f(s)?(_(),v(`p`,Fs,M(f(s)),1)):g(``,!0),f(o)&&!f(r)&&!f(i)?(_(),v(`p`,Is,[n[1]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in t?t.t:f(Y))(`Reading files…`)),1)])):f(i)?(_(),v(k,{key:2},[F(`p`,Ls,M(f(i).path)+` · `+M((`fmtBytes`in t?t.fmtBytes:f(Ts))(f(i).size)),1),f(i).truncated&&f(i).kind===`text`?(_(),v(`p`,Rs,M((`t`in t?t.t:f(Y))(`File truncated to keep this view responsive.`)),1)):g(``,!0),f(i).kind===`image`?(_(),v(`img`,{key:1,class:`files-image`,src:f(i).dataUrl,alt:f(i).path},null,8,zs)):f(i).kind===`binary`?(_(),v(`p`,Bs,M((`t`in t?t.t:f(Y))(`Binary file`)),1)):f(i).kind===`large`?(_(),v(`p`,Vs,M((`t`in t?t.t:f(Y))(`Image too large to preview.`)),1)):(_(),v(`div`,{key:4,class:`files-code`,role:`region`,"aria-label":f(i).path},[F(`pre`,Us,M(f(R).numbers),1),F(`pre`,Ws,M(f(R).text),1)],8,Hs))],64)):f(r)?(_(),v(k,{key:3},[F(`label`,Gs,[I(F(`input`,{"onUpdate:modelValue":n[0]||=e=>te(c)?c.value=e:null,type:`checkbox`},null,512),[[ne,f(c)]]),n[2]||=a(),F(`span`,null,M((`t`in t?t.t:f(Y))(`Show hidden files`)),1)]),f(r).truncated?(_(),v(`p`,Ks,M((`t`in t?t.t:f(Y))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(L).length?g(``,!0):(_(),v(`p`,qs,M((`t`in t?t.t:f(Y))(`Empty folder.`)),1)),F(`ul`,Js,[(_(!0),v(k,null,y(f(L),e=>(_(),v(`li`,{key:e.name},[F(`button`,{type:`button`,class:`change-file files-entry`,disabled:e.kind===`other`,onClick:t=>O(e)},[E(u,{name:B(e),class:j([`files-icon`,e.kind])},null,8,[`name`,`class`]),F(`span`,Xs,M(e.name),1),e.kind===`file`&&e.size!==null?(_(),v(`span`,Zs,M((`fmtBytes`in t?t.fmtBytes:f(Ts))(e.size)),1)):g(``,!0),e.kind===`dir`?(_(),m(u,{key:1,name:`i-lucide-chevron-right`,class:`files-chevron`})):g(``,!0)],8,Ys)]))),128))])],64)):g(``,!0)])])}}}),{__name:`FilesView`}),$s=`/.cache/herdr-web/uploads/`,ec=e=>e.includes($s);function tc(e){return String(e||``).split(`
9
- `).filter(ec).map(e=>e.trim().split(`/`).pop()).filter(Boolean)}var nc=e=>String(e||``).split(`
10
- `).filter(e=>!ec(e)).join(`
11
- `).trim(),rc=e=>tc(e).length>0&&!nc(e),ic=/\[Image #\d+(?:, \d+x\d+)?\]/g,ac=e=>(String(e||``).match(ic)||[]).length,oc=e=>ac(e)>0&&!String(e||``).replace(ic,``).trim();function sc(e,t){return t.role!==`user`||!rc(e)?!1:tc(e).some(e=>t.text.includes(e))||(t.images||0)>0}var cc=e=>`/uploads/${encodeURIComponent(e)}`,lc=e=>/^\/[^\s/]*(?:\s|$)/.test(String(e||``).trim()),uc=`/.cache/herdr-web/uploads/`,dc=e=>String(e||``).replace(/\[Image #\d+\]/g,` `).replace(/\s+/g,` `).trim().toLowerCase(),fc=e=>dc(String(e||``).split(`
12
- `).filter(e=>!e.includes(uc)).join(`
13
- `));function pc(e,t){let n=e.replace(/\s+/g,``).slice(0,80),r=t.replace(/\s+/g,``).slice(0,80);return!n||!r?!1:n===r||Math.min(n.length,r.length)>=24&&(n.startsWith(r)||r.startsWith(n))}var mc=(e,t)=>!!(e&&t)&&cr(e,t,pc),hc=(e,t)=>oc(t)&&ac(t)===tc(e).length,gc=e=>/^\s*!/.test(e),_c=e=>dc(String(e||``).replace(/^\s*!!?\s*/,``));function vc(e,t){if(!t)return`queued`;if(rc(e))return t.queued.some(t=>hc(e,t))||!t.sent||!hc(e,t.sent)?`queued`:`sent`;let n=fc(e);if(!n||t.queued.some(e=>mc(n,dc(e))))return`queued`;let r=t.shell?t.shell.python?/^\s*\$/.test(e)?dc(e.replace(/^\s*\$\$?\s*/,``)):``:gc(e)?_c(e):``:``;return t.shell&&mc(r,dc(t.shell.command))?`running`:gc(e)?t.sent&&gc(t.sent)&&mc(_c(e),_c(t.sent))?`sent`:`queued`:t.sent&&!gc(t.sent)&&mc(n,dc(t.sent))?`sent`:`queued`}function yc(e,t){let n=e.map(e=>vc(e,t)),r=e.map(e=>!!(t&&t.queued.some(t=>rc(e)?hc(e,t):mc(fc(e),dc(t))))),i=n.reduce((e,t,n)=>t===`queued`?e:n,-1);return n.map((e,t)=>t>i?e:r.slice(0,t+1).some(Boolean)?`queued`:e===`queued`?`sent`:e)}var bc=e=>String(e||``).replace(/\s+/g,` `).trim().toLowerCase(),xc=(e,t)=>cr(bc(e),bc(t),(e,t)=>e.includes(t.slice(0,60))),Sc=new Map;function Cc(e,t){let n=(Sc.get(e)||[]).filter(e=>!t.some(t=>t.id===e.id));return n.push(...t.filter(e=>tc(e.text).length)),Sc.set(e,n.slice(-30)),Sc.get(e)}function wc(e){let t=t=>{let n=e=>!t.at||!e.ts||Date.parse(e.ts)>=t.at-1e4;if(rc(t.text))return e.items.some(e=>n(e)&&sc(t.text,e));let r=nc(t.text),i=bc(t.text.replace(/^\s*(?:!!?|\$\$?)\s*/,``)).slice(0,60);return!!bc(r)&&e.items.some(e=>n(e)&&(e.role===`user`?xc(e.text,r):e.role===`bash`&&!!i&&bc(e.text).includes(i)))},n=[...e.mine].sort((e,t)=>e.at&&t.at?e.at-t.at:0),r=n.filter(e=>!t(e)),i=yc(r.map(e=>e.text),e.screen),a=r.filter((e,t)=>rc(e.text)&&!e.state&&i[t]===`queued`).length,o=(e.memory||[]).filter(e=>rc(e.text)&&!n.some(t=>t.id===e.id));for(let t of e.claude){let i=t.images||0;if(!t.text){if(!i)continue;if(a>0){a--;continue}let e=o.shift(),n=t.sent||e?.text;r.push({id:`cc-${t.ts}`,text:n||``,missing:n?0:i});continue}if(!bc(t.text)||n.some(e=>xc(e.text,t.text)))continue;let s=i?t.sent||[...e.memory||[]].reverse().find(e=>xc(nc(e.text),t.text))?.text:null;r.push({id:`cc-${t.ts}`,text:s||t.text,missing:s?0:i})}let s=yc(r.map(e=>e.text),e.screen);return r.map((e,t)=>({id:e.id,raw:e.text,mine:!e.id.startsWith(`cc-`),phase:e.state?`queued`:s[t],state:e.state||null,...e.local?{local:!0}:{},...e.reason?{reason:e.reason}:{},photos:tc(e.text),missing:e.missing||0,...e.pasted?{pasted:e.pasted}:{}}))}function Tc(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.right-n.left>.5&&n.bottom-n.top>.5)return n}return null}function Ec(e,t,n,r){if(e.bottom<n.top||e.top>n.bottom)return null;let i=n.width-t.width-8,a=Math.min(Math.max(8,e.right-t.width),i),o=r?22:6,s=e.bottom+o;if(!r&&e.right+6<=i){let r=Math.round(e.top+(e.bottom-e.top-t.height)/2);return{top:Math.min(Math.max(r,n.top),n.bottom-t.height),left:e.right+6}}if(s+t.height<=n.bottom)return{top:s,left:a};let c=e.top-6-t.height;return!r&&c>=n.top?{top:c,left:a}:{top:Math.max(n.top,n.bottom-t.height-8),left:a}}function Dc(e){let t=!1,n=null,r=()=>{n&&clearTimeout(n),n=null},i=i=>{r(),n=setTimeout(()=>{n=null,t||e.show()},i)};return{down(){t=!0,r(),e.hide()},up(){t&&(t=!1,i(e.touch()?380:180))},change(n=!1){if(!n){if(e.hide(),t){r();return}i(e.touch()?380:350)}},scroll(){e.hide(),t||i(160)},dispose(){r()}}}function Oc(e){for(let t=e.length-1;t>=0;t--){let n=e[t].replace(/\s+$/u,``).length;if(n>0)return{index:t,offset:n}}return null}function kc(e,t){let n=e.cloneRange();if(!t.contains(n.startContainer)){if(n.comparePoint(t,0)<0)return null;n.setStart(t,0)}t.contains(n.endContainer)||n.setEnd(t,t.childNodes.length);let r=[],i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let e=a.nextNode();e;e=a.nextNode()){if(!n.intersectsNode(e))continue;let t=e===n.startContainer?n.startOffset:0,a=e===n.endContainer?n.endOffset:e.data.length;r.push(e),i.push(e.data.slice(t,a))}let o=Oc(i);if(!o)return null;let s=r[o.index];return n.setEnd(s,(s===n.startContainer?n.startOffset:0)+o.offset),n}function Ac(e,t,n){let r=null;for(let i of t)!e.has(i)&&n&&(r=i),e.add(i);return r}var jc=120,Mc=50,Nc=new Map;function Pc(e,t,n){Nc.delete(e),!(!t||n.scrollHeight-n.scrollTop-n.clientHeight<jc)&&(Nc.set(e,{file:t,fromBottom:n.scrollHeight-n.scrollTop}),Nc.size>Mc&&Nc.delete(Nc.keys().next().value))}function Fc(e,t,n){let r=Nc.get(e);return!r||r.file!==t?null:Math.max(0,n-r.fromBottom)}var Ic=()=>({misses:0,errors:0});function Lc(e,t){if(!t)return{next:Ic(),clear:!0};let n=e.misses+1;return n>=3?{next:Ic(),clear:!0}:{next:{...e,misses:n},clear:!1}}var Rc=e=>({...e,errors:e.errors+1}),zc=e=>e.misses+e.errors>=2;function Bc(e){let t=new Set,n=new Set;for(let r of e)r.hashes&&r.hashes.forEach((e,i)=>{r.role!==`user`&&r.ref&&t.has(e)&&n.add(`${r.ref}:${(r.imageAt||0)+i}`),t.add(e)});return n}var Vc={key:0,class:`search-bar`},Hc={class:`search-count`},Uc={class:`chat-wrap`},Wc={key:0,class:`chat-empty waiting`},Gc={key:0,class:`choices-screen-text`},Kc={key:1,class:`chat-empty`},qc={key:0,class:`chat-more`},Jc={key:1,class:`chat-note`},Yc={key:0,class:`day-sep`},Xc=[`data-hit-key`],Zc=[`aria-label`,`onClick`],Qc={class:`msg-quote-time`},$c={class:`msg-quote-text`},el={key:0,class:`msg-file-chips`},tl=[`title`],nl={key:0,class:`q-bar`},rl={class:`q-bar-h`},il=[`aria-label`,`onClick`,`onMouseenter`,`onMouseleave`,`onFocus`,`onBlur`],al=[`aria-pressed`,`aria-label`,`onClick`],ol=[`aria-pressed`,`onClick`],sl={key:1,class:`msg-actions`},cl=[`onClick`],ll=[`disabled`,`aria-expanded`,`onClick`],ul={class:`omp-job-glyph`},dl={class:`omp-job-label`},fl={key:0,class:`omp-job-wall`},pl={key:0,class:`omp-tool-out`},ml={class:`omp-tool-out-head`},hl={class:`omp-tool-out-label`},gl={key:0,class:`omp-tool-out-right`},_l={class:`msg-shell-cmd`},vl={class:`msg-shell-sign`,"aria-hidden":`true`},yl={key:0,class:`msg-shell-body`},bl={key:0,class:`msg-shell-out`},xl={key:1,class:`msg-shell-out err`},Sl={key:1,class:`msg-shell-empty`},Cl=[`aria-expanded`,`onClick`],wl={key:7,class:`tools omp-console omp-run`},Tl={class:`omp-console-head`},El={class:`omp-console-title`},Dl={key:8,class:`msg-system`},Ol={class:`msg-notice-head`},kl=[`aria-expanded`,`onClick`],Al={key:10,class:`turn-end`},jl=[`onClick`],Ml={class:`omp-console-head`},Nl={key:0,class:`omp-console-total`},Pl=[`aria-expanded`,`onClick`],Fl={key:2,class:`chat-empty`},Il={key:3,class:`chat-empty`},Ll=[`aria-label`],Rl={key:0,class:`queued-list`},zl=[`aria-label`,`onClick`],Bl={class:`msg-quote-time`},Vl={class:`msg-quote-text`},Hl=[`title`],Ul={key:0,class:`msg-file-chips`},Wl={class:`queued-tag sent`},Gl={key:0,class:`msg-user-wrap`},Kl={class:`msg-shell bash running`},ql={class:`msg-shell-cmd`},Jl={class:`msg-shell-sign`,"aria-hidden":`true`},Yl={key:0,class:`msg-shell-body`},Xl={key:0,class:`msg-shell-hidden`},Zl={class:`msg-shell-out`},Ql={key:1,class:`msg-shell-empty`},$l={class:`queued-tag running`},eu=[`aria-label`,`onClick`],tu={class:`msg-quote-time`},nu={class:`msg-quote-text`},ru=[`title`],iu={key:0,class:`msg-file-chips`},au={key:1,class:`queued-tag failed`,role:`alert`},ou=[`disabled`,`onClick`],su=[`disabled`,`onClick`],cu={key:2,class:`queued-tag`},lu=[`disabled`,`onClick`],uu={key:0,class:`claude-verb-line`},du={key:1,class:`omp-step-line`},fu={key:1},pu=6,mu=12,hu=Object.assign(T({__name:`ChatView`,props:V({pane:{},localQueued:{}},{search:{type:Boolean,default:!1},searchModifiers:{}}),emits:V([`gotoTerm`,`restored`,`quote`,`unanswered`,`sent`],[`update:search`]),setup(e,{expose:t,emit:o}){let s=e,c=sn(),d=o,p=D(e,`search`),b=h(null),x=h(null),S=()=>({file:null,token:``,tailStart:null,older:[],olderCursor:0,tail:[],queue:[]}),C=u(S()),T=n(()=>C.value.older.concat(C.value.tail)),O=h(null),A=h(null),P=u(Ic()),I=h(!1),R=h(!1),B=h(null),V=n(()=>Dn.value||Tn(s.pane)),te=n(()=>!V.value&&_n.value&&Mt(s.pane.agent));async function W(){if(!er(ir()))return;let e=(await Pn()).chats.find(e=>e.id===s.pane.id);e&&!T.value.length&&(await re(()=>{C.value={...S(),tail:e.items},B.value=e.at}),sr(s.pane.id))}let G=e=>{let t=b.value;return!t||t.scrollHeight-t.scrollTop-t.clientHeight<e};function ne(e){let t=b.value;t&&(e||q||G(160))&&(q=!0,requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight}))}async function re(e,t=!1){let n=q||G(120),r=!I.value;e(),await N(),I.value=!0;let i=null;ie&&C.value.file&&b.value&&(ie=!1,i=Fc(s.pane.id,C.value.file,b.value.scrollHeight)),!hn&&p.value&&J.q.length>=2?kn(!1):i!==null&&!hn&&b.value?(q=!1,b.value.scrollTop=i):!t&&(n||r)&&ne(!0)}let ie=typeof c.query.hit!=`string`,q=!0,ae=null;w(()=>{ae=new ResizeObserver(()=>{let e=b.value;e&&q&&(e.scrollTop=e.scrollHeight)}),b.value&&ae.observe(b.value),x.value&&ae.observe(x.value)}),U(()=>{b.value&&I.value&&Pc(s.pane.id,C.value.file,b.value)}),l(()=>ae?.disconnect());function oe(){let e=b.value;e&&(Nt.open=!1,q=e.scrollHeight-e.scrollTop-e.clientHeight<120,e.scrollTop<400&&I.value&&Se())}function se(){de.value=null}let ce=new Set,le=new Set,de=h(null),fe=h(null),pe=!1,me=!1;z(rr,e=>{e||(me=!0,se())}),z(Dn,e=>{e&&(me=!0,se())});function he(e){let t=pe&&!me&&br.value&&!p.value&&!V.value,n=pe&&!me&&!p.value&&!V.value,r=Ac(le,e.filter(e=>e.role===`thinking`).map(hr),n);r&&(de.value={id:r,at:Date.now()}),me=!1,pe=!0;let i=kr(ce,e.filter(e=>e.role===`assistant`).map(hr),t&&!r);i&&(fe.value={id:i,at:Date.now()})}let ge=e=>fe.value&&fe.value.id===e?fe.value.at:null;function _e(e){fe.value?.id===e&&(fe.value=null)}z([br,p],([e,t])=>{(!e||t)&&(fe.value=null),t&&se()});function ve(e){return de.value?.id===e?de.value.at:null}function ye(e){de.value?.id===e&&se()}let be=!1;async function xe(){if(be)return;be=!0;let e=s.pane.id;try{let t=new URLSearchParams({pane:e,since:C.value.token});C.value.tailStart!==null&&t.set(`from`,String(C.value.tailStart));let n=await Dr(`/api/chat?${t}`);if(e!==s.pane.id)return;if(!n.available){let e=Lc(P.value,!!C.value.file&&T.value.length>0);if(P.value=e.next,!e.clear)return;C.value=S(),O.value=n.reason||`unsupported`,pe=!0;return}if(O.value=null,A.value=null,(P.value.misses||P.value.errors)&&(P.value=Ic()),n.unchanged)return;if(B.value=null,C.value.file&&n.file!==C.value.file)return C.value=S(),pe=!1,be=!1,xe();await re(()=>{let e={...C.value};e.tailStart===null&&(e.tailStart=n.start??0,e.olderCursor=n.start??0),e.file=n.file||null,e.token=n.token||``,e.tail=n.items||[],e.queue=n.queue||[],C.value=e,he(e.tail)}),Nr(e,T.value)}catch(t){if(e!==s.pane.id)return;T.value.length?P.value=Rc(P.value):A.value=t.message}finally{be=!1}}async function Se(){if(R.value||!(C.value.olderCursor>0))return;R.value=!0;let e=s.pane.id,t=C.value.file,n=C.value.olderCursor;try{let r=await Dr(`/api/chat?pane=${encodeURIComponent(e)}&before=${n}`);if(e!==s.pane.id||r.file!==t||C.value.olderCursor!==n)return;let i=b.value,a=i?i.scrollHeight-i.scrollTop:0;await re(()=>{C.value={...C.value,older:(r.items||[]).concat(C.value.older),olderCursor:(r.start??0)<n?r.start??0:0}},!0),Nr(e,T.value),i&&(i.scrollTop=i.scrollHeight-a)}catch(e){$(e.message,!0)}finally{R.value=!1}}let Ce;w(()=>{W().then(xe).then(Bn),Ce=Lr(()=>{!document.hidden&&!Dn.value&&xe()},1500)}),l(()=>clearInterval(Ce)),z(rr,e=>{e&&xe()});let we=Z(`Command`,`Commande`),Te=Z(`Edit`,`Modif`),Ee=Z(`Subagent`,`Sous-agent`),ke={Bash:we,Read:Z(`Read`,`Lecture`),Write:Z(`Write`,`Écriture`),Edit:Te,MultiEdit:Te,Grep:Z(`Search`,`Recherche`),Glob:Z(`Files`,`Fichiers`),WebFetch:`Web`,WebSearch:Z(`Web search`,`Recherche web`),Task:Ee,Agent:Ee,TodoWrite:Z(`Tasks`,`Tâches`),exec:we,shell:we,apply_patch:Te},Ae={Bash:`i-lucide-terminal`,exec:`i-lucide-terminal`,shell:`i-lucide-terminal`,Read:`i-lucide-file-text`,Write:`i-lucide-file-plus`,Edit:`i-lucide-file-pen`,MultiEdit:`i-lucide-file-pen`,apply_patch:`i-lucide-file-pen`,NotebookEdit:`i-lucide-file-pen`,Grep:`i-lucide-text-search`,Glob:`i-lucide-folder-search`,WebFetch:`i-lucide-globe`,WebSearch:`i-lucide-search`,Task:`i-lucide-bot`,Agent:`i-lucide-bot`,TodoWrite:`i-lucide-list-todo`,AskUserQuestion:`i-lucide-message-circle-question`},je=e=>e.name===`TodoWrite`?Y(e.text||``):e.text,Me=e=>e.name===`exec`&&/^\w+$/.test(e.text||``),Ne=e=>Me(e)?Y(`Tool`):ke[e.name||``]||e.name||``,Pe=e=>e.error?`i-lucide-circle-x`:Me(e)?`i-lucide-wrench`:Ae[e.name||``]||`i-lucide-wrench`,Fe=e=>`${Ne(e)} · ${e.text}`,Ie=e=>Ko(e.list,Ge(e.key)),Le={advisor:[`Advisor`,`i-lucide-lightbulb`],"async-result":[`Background job done`,`i-lucide-circle-check`],"irc:incoming":[`Agent message`,`i-lucide-message-square`],"launch-completion":[`Process`,`i-lucide-cpu`],"lsp-late-diagnostic":[`Diagnostics`,`i-lucide-triangle-alert`],"background-tan-dispatch":[`Background task`,`i-lucide-bot`]},Re=/\/\.cache\/herdr-web\/uploads\/\S+/g;function ze(e){let t=C.value.file,n=[];if(!e.ref||!e.images||!t)return n;for(let r=0;r<e.images;r++)n.push(`/api/chat/image?pane=${encodeURIComponent(s.pane.id)}&file=${encodeURIComponent(t)}&ref=${e.ref}&i=${(e.imageAt||0)+r}`);return n}let Be=n(()=>{let e=Bc(T.value),t=new Set;if(!e.size)return t;for(let n of T.value)n.hashes&&n.role!==`user`&&ze(n).forEach((r,i)=>{e.has(`${n.ref}:${(n.imageAt||0)+i}`)&&t.add(r)});return t});function Ve(e){let t=Go(e.list)?Ie(e).rows:e.list.length<=3||Ge(e.key)?e.list:[];return e.list.filter(e=>e.images&&!t.includes(e)).map(ze).filter(e=>e.length)}let He=r(new Set),Ue=n(()=>!V.value&&s.pane.status===`working`),We=n(()=>{let e=[],t=T.value,n=[],r=new Map,i=()=>{if(!n.length)return;let t=n[0],i=`t:${t.ts}:${t.text}`,a=r.get(i)||0;r.set(i,a+1),e.push({k:`tools`,key:`${i}#${a}`,list:n,live:!1}),n=[]},a=null,o=``,c=!0,l=null,u=null,d=[],f=()=>{if(a&&a.end&&a.start&&(a.tools||a.replies)){let t=Math.max(0,Math.round((Date.parse(a.end)-Date.parse(a.start))/1e3)),n=a.tools?` · ${a.tools} ${Y(a.tools>1?`actions`:`action`)}`:``;u&&(u.endsTurn=!0),e.push({k:`turn`,key:`e:${e.length}`,text:`✓ ${vn(t)}${n}`,copy:l,reply:u?.key||null})}a=null,l=null,u=null};t.forEach((t,r)=>{if(t.ts){let n=new Date(t.ts).toDateString();n!==o&&(t.role!==`tool`&&(i(),t.role===`user`&&f()),o&&e.push({k:`day`,key:`d:${n}`,label:Ur(t.ts)}),o=n)}if(t.role===`user`||t.role===`cmd`||t.role===`bash`?(i(),f(),c=!0,t.role!==`cmd`&&(a={start:t.ts,end:null,tools:0,replies:0})):a&&t.ts&&t.role!==`notice`&&t.role!==`job`&&(a.end=t.ts,t.role===`tool`?a.tools++:t.role===`assistant`&&a.replies++),(t.role===`tool`||t.role===`assistant`||t.role===`thinking`)&&c&&(c=!1,e.push({k:`who`,key:`w:${t.ts}:${r}`})),t.role===`tool`){n.push(t);return}i();let s=`${t.role}:${t.ts}:${r}`;if(t.role===`user`){let n=t.text.match(Re)||[],r=t.text.split(`
14
- `).map(ia).filter(e=>!!e),i=t.text.replace(/^.*\/\.cache\/herdr-web\/uploads\/\S+\s*$/gm,``).split(`
15
- `).filter(e=>!Vi(e)).join(`
16
- `).trim(),a=ze(t);for(let e of n)a.push(`/uploads/${encodeURIComponent(e.split(`/`).pop())}`);let o=pn(i),c=o&&Gn(d,o.reply)?.key||null;e.push({k:`user`,key:s,text:o?o.body:i,pasted:t.pasted,srcs:a,files:r,time:t.ts?Vr(t.ts):null,at:t.ts?Jn(t.ts):null,reply:o?.reply||null,origin:c})}else if(t.role===`assistant`){l=t.text;let n=t.ts?Vr(t.ts):null;u={k:`assistant`,key:s,id:hr(t),rid:On(t),text:t.text,html:zn(Yt(t.text),{reply:Y(`Reply`),quoted:Y(`Quoted`),discuss:Y(`Discuss`),yes:Y(`Yes`),no:Y(`No`),okAll:Y(`OK to all`),decisions:Y(`Decisions`)}),time:n,endsTurn:!1},e.push(u),d.push({key:s,time:n,text:t.text,rid:u.rid})}else if(t.role===`thinking`)e.push({k:`thinking`,key:s,id:hr(t),text:t.text,html:Yt(t.text),ms:t.ms});else if(t.role===`job`&&t.job)e.push({k:`job`,key:s,id:t.job.id,tool:t.job.tool,out:t.job.out,ms:t.ms,error:!!t.error});else if(t.role===`bash`&&t.omp)e.push({k:`ompRun`,key:`s:${t.ts}:${t.text.slice(0,40)}`,tool:{...t,omp:t.omp}});else if(t.role===`bash`){let n=t.out||``,r=t.err||``,i=(n?n.split(`
8
+ `)}});function U(e){return e.kind===`dir`?e.link?`i-lucide-folder-symlink`:`i-lucide-folder`:e.kind===`other`?`i-lucide-file-question`:e.link?`i-lucide-file-symlink`:`i-lucide-file`}return(t,n)=>{let l=yt,u=Fs,d=Ee;return _(),v(`div`,Bs,[I(`div`,Vs,[I(`div`,Hs,[I(`nav`,{class:`files-crumbs`,"aria-label":(`t`in t?t.t:f(Y))(`Folder`)},[f(i)&&!e.file?(_(),m(l,{key:0,icon:`i-lucide-arrow-left`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Y))(`Back to folder`),onClick:P},null,8,[`aria-label`])):g(``,!0),(_(!0),v(k,null,y(f(R),(e,t)=>(_(),v(k,{key:e.path},[t?(_(),v(`span`,Ws,`/`)):g(``,!0),I(`button`,{type:`button`,class:`files-crumb`,onClick:t=>b(e.path)},M(e.label),9,Gs)],64))),128)),f(i)?(_(),v(k,{key:1},[f(R).length?(_(),v(`span`,Ks,`/`)):g(``,!0),I(`span`,qs,M(f(i).path.split(`/`).pop()),1)],64)):g(``,!0)],8,Us),I(`div`,Js,[f(T)?(_(),m(l,{key:0,icon:`i-lucide-external-link`,color:`neutral`,variant:`outline`,size:`sm`,to:f(T),target:`_blank`,external:``,"aria-label":(`t`in t?t.t:f(Y))(`Open`)},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Open`)),1)]),_:1},8,[`to`,`aria-label`])):g(``,!0),f(i)?(_(),m(l,{key:1,icon:`i-lucide-download`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(D),"aria-label":(`t`in t?t.t:f(Y))(`Download`),onClick:O},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Download`)),1)]),_:1},8,[`loading`,`aria-label`])):g(``,!0),E(l,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(o),"aria-label":(`t`in t?t.t:f(Y))(`Refresh`),onClick:F},{default:H(()=>[I(`span`,Ys,M((`t`in t?t.t:f(Y))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])])]),f(s)?(_(),v(`p`,Xs,M(f(s)),1)):g(``,!0),f(o)&&!f(r)&&!f(i)?(_(),v(`p`,Zs,[n[1]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in t?t.t:f(Y))(`Reading files…`)),1)])):f(i)?(_(),v(k,{key:2},[I(`p`,Qs,M(f(i).path)+` · `+M((`fmtBytes`in t?t.fmtBytes:f(zs))(f(i).size)),1),f(i).truncated&&f(i).kind===`text`?(_(),v(`p`,$s,M((`t`in t?t.t:f(Y))(`File truncated to keep this view responsive.`)),1)):g(``,!0),f(i).kind===`image`?(_(),v(`img`,{key:1,class:`files-image`,src:f(i).dataUrl,alt:f(i).path},null,8,ec)):f(i).kind===`pdf`?(_(),m(u,{key:`${f(T)}:${f(C)}`,src:f(T),title:f(i).path},null,8,[`src`,`title`])):f(i).kind===`binary`?(_(),v(`p`,tc,M((`t`in t?t.t:f(Y))(`Binary file`)),1)):f(i).kind===`large`?(_(),v(`p`,nc,M(/\.pdf$/i.test(f(i).path)?(`t`in t?t.t:f(Y))(`PDF too large to preview (50 MB max).`):(`t`in t?t.t:f(Y))(`Image too large to preview.`)),1)):(_(),v(`div`,{key:5,class:`files-code`,role:`region`,"aria-label":f(i).path},[I(`pre`,ic,M(f(V).numbers),1),I(`pre`,ac,M(f(V).text),1)],8,rc))],64)):f(r)?(_(),v(k,{key:3},[I(`label`,oc,[L(I(`input`,{"onUpdate:modelValue":n[0]||=e=>W(c)?c.value=e:null,type:`checkbox`},null,512),[[K,f(c)]]),n[2]||=a(),I(`span`,null,M((`t`in t?t.t:f(Y))(`Show hidden files`)),1)]),f(r).truncated?(_(),v(`p`,sc,M((`t`in t?t.t:f(Y))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(z).length?g(``,!0):(_(),v(`p`,cc,M((`t`in t?t.t:f(Y))(`Empty folder.`)),1)),I(`ul`,lc,[(_(!0),v(k,null,y(f(z),e=>(_(),v(`li`,{key:e.name},[I(`button`,{type:`button`,class:`change-file files-entry`,disabled:e.kind===`other`,onClick:t=>N(e)},[E(d,{name:U(e),class:j([`files-icon`,e.kind])},null,8,[`name`,`class`]),I(`span`,dc,M(e.name),1),e.kind===`file`&&e.size!==null?(_(),v(`span`,fc,M((`fmtBytes`in t?t.fmtBytes:f(zs))(e.size)),1)):g(``,!0),e.kind===`dir`?(_(),m(d,{key:1,name:`i-lucide-chevron-right`,class:`files-chevron`})):g(``,!0)],8,uc)]))),128))])],64)):g(``,!0)])])}}}),{__name:`FilesView`}),mc=`/.cache/herdr-web/uploads/`,hc=e=>e.includes(mc);function gc(e){return String(e||``).split(`
9
+ `).filter(hc).map(e=>e.trim().split(`/`).pop()).filter(Boolean)}var _c=e=>String(e||``).split(`
10
+ `).filter(e=>!hc(e)).join(`
11
+ `).trim(),vc=e=>gc(e).length>0&&!_c(e),yc=/\[Image #\d+(?:, \d+x\d+)?\]/g,bc=e=>(String(e||``).match(yc)||[]).length,xc=e=>bc(e)>0&&!String(e||``).replace(yc,``).trim();function Sc(e,t){return t.role!==`user`||!vc(e)?!1:gc(e).some(e=>t.text.includes(e))||(t.images||0)>0}var Cc=e=>`/uploads/${encodeURIComponent(e)}`,wc=e=>/^\/[^\s/]*(?:\s|$)/.test(String(e||``).trim()),Tc=`/.cache/herdr-web/uploads/`,Ec=e=>String(e||``).replace(/\[Image #\d+\]/g,` `).replace(/\s+/g,` `).trim().toLowerCase(),Dc=e=>Ec(String(e||``).split(`
12
+ `).filter(e=>!e.includes(Tc)).join(`
13
+ `));function Oc(e,t){let n=e.replace(/\s+/g,``).slice(0,80),r=t.replace(/\s+/g,``).slice(0,80);return!n||!r?!1:n===r||Math.min(n.length,r.length)>=24&&(n.startsWith(r)||r.startsWith(n))}var kc=(e,t)=>!!(e&&t)&&hn(e,t,Oc),Ac=(e,t)=>xc(t)&&bc(t)===gc(e).length,jc=e=>/^\s*!/.test(e),Mc=e=>Ec(String(e||``).replace(/^\s*!!?\s*/,``));function Nc(e,t){if(!t)return`queued`;if(vc(e))return t.queued.some(t=>Ac(e,t))||!t.sent||!Ac(e,t.sent)?`queued`:`sent`;let n=Dc(e);if(!n||t.queued.some(e=>kc(n,Ec(e))))return`queued`;let r=t.shell?t.shell.python?/^\s*\$/.test(e)?Ec(e.replace(/^\s*\$\$?\s*/,``)):``:jc(e)?Mc(e):``:``;return t.shell&&kc(r,Ec(t.shell.command))?`running`:jc(e)?t.sent&&jc(t.sent)&&kc(Mc(e),Mc(t.sent))?`sent`:`queued`:t.sent&&!jc(t.sent)&&kc(n,Ec(t.sent))?`sent`:`queued`}function Pc(e,t){let n=e.map(e=>Nc(e,t)),r=e.map(e=>!!(t&&t.queued.some(t=>vc(e)?Ac(e,t):kc(Dc(e),Ec(t))))),i=n.reduce((e,t,n)=>t===`queued`?e:n,-1);return n.map((e,t)=>t>i?e:r.slice(0,t+1).some(Boolean)?`queued`:e===`queued`?`sent`:e)}var Fc=e=>String(e||``).replace(/\s+/g,` `).trim().toLowerCase(),Ic=(e,t)=>hn(Fc(e),Fc(t),(e,t)=>e.includes(t.slice(0,60))),Lc=new Map;function Rc(e,t){let n=(Lc.get(e)||[]).filter(e=>!t.some(t=>t.id===e.id));return n.push(...t.filter(e=>gc(e.text).length)),Lc.set(e,n.slice(-30)),Lc.get(e)}function zc(e){let t=t=>{let n=e=>!t.at||!e.ts||Date.parse(e.ts)>=t.at-1e4;if(vc(t.text))return e.items.some(e=>n(e)&&Sc(t.text,e));let r=_c(t.text),i=Fc(t.text.replace(/^\s*(?:!!?|\$\$?)\s*/,``)).slice(0,60);return!!Fc(r)&&e.items.some(e=>n(e)&&(e.role===`user`?Ic(e.text,r):e.role===`bash`&&!!i&&Fc(e.text).includes(i)))},n=[...e.mine].sort((e,t)=>e.at&&t.at?e.at-t.at:0),r=n.filter(e=>!t(e)),i=Pc(r.map(e=>e.text),e.screen),a=r.filter((e,t)=>vc(e.text)&&!e.state&&i[t]===`queued`).length,o=(e.memory||[]).filter(e=>vc(e.text)&&!n.some(t=>t.id===e.id));for(let t of e.claude){let i=t.images||0;if(!t.text){if(!i)continue;if(a>0){a--;continue}let e=o.shift(),n=t.sent||e?.text;r.push({id:`cc-${t.ts}`,text:n||``,missing:n?0:i});continue}if(!Fc(t.text)||n.some(e=>Ic(e.text,t.text)))continue;let s=i?t.sent||[...e.memory||[]].reverse().find(e=>Ic(_c(e.text),t.text))?.text:null;r.push({id:`cc-${t.ts}`,text:s||t.text,missing:s?0:i})}let s=Pc(r.map(e=>e.text),e.screen);return r.map((e,t)=>({id:e.id,raw:e.text,mine:!e.id.startsWith(`cc-`),phase:e.state?`queued`:s[t],state:e.state||null,...e.local?{local:!0}:{},...e.reason?{reason:e.reason}:{},photos:gc(e.text),missing:e.missing||0,...e.pasted?{pasted:e.pasted}:{}}))}function Bc(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.right-n.left>.5&&n.bottom-n.top>.5)return n}return null}function Vc(e,t,n,r){if(e.bottom<n.top||e.top>n.bottom)return null;let i=n.width-t.width-8,a=Math.min(Math.max(8,e.right-t.width),i),o=r?22:6,s=e.bottom+o;if(!r&&e.right+6<=i){let r=Math.round(e.top+(e.bottom-e.top-t.height)/2);return{top:Math.min(Math.max(r,n.top),n.bottom-t.height),left:e.right+6}}if(s+t.height<=n.bottom)return{top:s,left:a};let c=e.top-6-t.height;return!r&&c>=n.top?{top:c,left:a}:{top:Math.max(n.top,n.bottom-t.height-8),left:a}}function Hc(e){let t=!1,n=null,r=()=>{n&&clearTimeout(n),n=null},i=i=>{r(),n=setTimeout(()=>{n=null,t||e.show()},i)};return{down(){t=!0,r(),e.hide()},up(){t&&(t=!1,i(e.touch()?380:180))},change(n=!1){if(!n){if(e.hide(),t){r();return}i(e.touch()?380:350)}},scroll(){e.hide(),t||i(160)},dispose(){r()}}}function Uc(e){for(let t=e.length-1;t>=0;t--){let n=e[t].replace(/\s+$/u,``).length;if(n>0)return{index:t,offset:n}}return null}function Wc(e,t){let n=e.cloneRange();if(!t.contains(n.startContainer)){if(n.comparePoint(t,0)<0)return null;n.setStart(t,0)}t.contains(n.endContainer)||n.setEnd(t,t.childNodes.length);let r=[],i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let e=a.nextNode();e;e=a.nextNode()){if(!n.intersectsNode(e))continue;let t=e===n.startContainer?n.startOffset:0,a=e===n.endContainer?n.endOffset:e.data.length;r.push(e),i.push(e.data.slice(t,a))}let o=Uc(i);if(!o)return null;let s=r[o.index];return n.setEnd(s,(s===n.startContainer?n.startOffset:0)+o.offset),n}function Gc(e,t,n){let r=null;for(let i of t)!e.has(i)&&n&&(r=i),e.add(i);return r}var Kc=120,qc=50,Jc=new Map;function Yc(e,t,n){Jc.delete(e),!(!t||n.scrollHeight-n.scrollTop-n.clientHeight<Kc)&&(Jc.set(e,{file:t,fromBottom:n.scrollHeight-n.scrollTop}),Jc.size>qc&&Jc.delete(Jc.keys().next().value))}function Xc(e,t,n){let r=Jc.get(e);return!r||r.file!==t?null:Math.max(0,n-r.fromBottom)}var Zc=()=>({misses:0,errors:0});function Qc(e,t){if(!t)return{next:Zc(),clear:!0};let n=e.misses+1;return n>=3?{next:Zc(),clear:!0}:{next:{...e,misses:n},clear:!1}}var $c=e=>({...e,errors:e.errors+1}),el=e=>e.misses+e.errors>=2;function tl(e){let t=new Set,n=new Set;for(let r of e)r.hashes&&r.hashes.forEach((e,i)=>{r.role!==`user`&&r.ref&&t.has(e)&&n.add(`${r.ref}:${(r.imageAt||0)+i}`),t.add(e)});return n}var nl={key:0,class:`search-bar`},rl={class:`search-count`},il={class:`chat-wrap`},al={key:0,class:`chat-empty waiting`},ol={key:0,class:`choices-screen-text`},sl={key:1,class:`chat-empty no-integration`},cl={class:`no-integration-title`},ll={class:`no-integration-text`},ul={class:`no-integration-cmd`},dl={class:`no-integration-actions`},fl={key:2,class:`chat-empty`},pl={key:0,class:`chat-more`},ml={key:1,class:`chat-note`},hl={key:0,class:`day-sep`},gl=[`data-hit-key`],_l=[`aria-label`,`onClick`],vl={class:`msg-quote-time`},yl={class:`msg-quote-text`},bl={key:0,class:`msg-file-chips`},xl=[`title`],Sl={key:0,class:`q-bar`},Cl={class:`q-bar-h`},wl=[`aria-label`,`onClick`,`onMouseenter`,`onMouseleave`,`onFocus`,`onBlur`],Tl=[`aria-pressed`,`aria-label`,`onClick`],El=[`aria-pressed`,`onClick`],Dl={key:1,class:`msg-actions`},Ol=[`onClick`],kl=[`disabled`,`aria-expanded`,`onClick`],Al={class:`omp-job-glyph`},jl={class:`omp-job-label`},Ml={key:0,class:`omp-job-wall`},Nl={key:0,class:`omp-tool-out`},Pl={class:`omp-tool-out-head`},Fl={class:`omp-tool-out-label`},Il={key:0,class:`omp-tool-out-right`},Ll={class:`msg-shell-cmd`},Rl={class:`msg-shell-sign`,"aria-hidden":`true`},zl={key:0,class:`msg-shell-body`},Bl={key:0,class:`msg-shell-out`},Vl={key:1,class:`msg-shell-out err`},Hl={key:1,class:`msg-shell-empty`},Ul=[`aria-expanded`,`onClick`],Wl={key:7,class:`tools omp-console omp-run`},Gl={class:`omp-console-head`},Kl={class:`omp-console-title`},ql={key:8,class:`msg-system`},Jl={class:`msg-notice-head`},Yl=[`aria-expanded`,`onClick`],Xl={key:10,class:`turn-end`},Zl=[`onClick`],Ql={class:`omp-console-head`},$l={key:0,class:`omp-console-total`},eu=[`aria-expanded`,`onClick`],tu={key:2,class:`chat-empty`},nu={key:3,class:`chat-empty`},ru=[`aria-label`],iu={key:0,class:`queued-list`},au=[`aria-label`,`onClick`],ou={class:`msg-quote-time`},su={class:`msg-quote-text`},cu=[`title`],lu={key:0,class:`msg-file-chips`},uu={class:`queued-tag sent`},du={key:0,class:`msg-user-wrap`},fu={class:`msg-shell bash running`},pu={class:`msg-shell-cmd`},mu={class:`msg-shell-sign`,"aria-hidden":`true`},hu={key:0,class:`msg-shell-body`},gu={key:0,class:`msg-shell-hidden`},_u={class:`msg-shell-out`},vu={key:1,class:`msg-shell-empty`},yu={class:`queued-tag running`},bu=[`aria-label`,`onClick`],xu={class:`msg-quote-time`},Su={class:`msg-quote-text`},Cu=[`title`],wu={key:0,class:`msg-file-chips`},Tu={key:1,class:`queued-tag failed`,role:`alert`},Eu=[`disabled`,`onClick`],Du=[`disabled`,`onClick`],Ou={key:2,class:`queued-tag`},ku=[`disabled`,`onClick`],Au={key:0,class:`claude-verb-line`},ju={key:1,class:`omp-step-line`},Mu={key:1},Nu=6,Pu=12,Fu=Object.assign(T({__name:`ChatView`,props:V({pane:{},localQueued:{}},{search:{type:Boolean,default:!1},searchModifiers:{}}),emits:V([`gotoTerm`,`restored`,`quote`,`unanswered`,`sent`],[`update:search`]),setup(e,{expose:t,emit:o}){let s=e;Dt(Jr);let c=cn(),d=o,p=D(e,`search`),b=h(null),x=h(null),S=()=>({file:null,token:``,tailStart:null,older:[],olderCursor:0,tail:[],queue:[]}),C=u(S()),T=n(()=>C.value.older.concat(C.value.tail)),O=h(null),A=h(null),F=h(null),L=u(Zc()),R=h(!1),z=h(!1),V=h(null),W=n(()=>jn.value||On(s.pane)),te=n(()=>!W.value&&yn.value&&Bt(s.pane.agent));async function G(){if(!kn(In()))return;let e=(await dr()).chats.find(e=>e.id===s.pane.id);e&&!T.value.length&&(await re(()=>{C.value={...S(),tail:e.items},V.value=e.at}),Jn(s.pane.id))}let K=e=>{let t=b.value;return!t||t.scrollHeight-t.scrollTop-t.clientHeight<e};function ne(e){let t=b.value;t&&(e||!se&&(oe||K(160)))&&(oe=!0,se=!1,requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight}))}async function re(e,t=!1){let n=!se&&(oe||K(120)),r=!R.value;e(),await P(),R.value=!0;let i=null;ae&&C.value.file&&b.value&&(ae=!1,i=Xc(s.pane.id,C.value.file,b.value.scrollHeight)),!bn&&p.value&&J.q.length>=2?Nn(!1):i!==null&&!bn&&b.value?(oe=!1,b.value.scrollTop=i):!t&&(n||r)&&ne(!0)}let ae=typeof c.query.hit!=`string`,oe=!0,se=!1;function ce(){se=!1,de()}let le=null;w(()=>{le=new ResizeObserver(()=>{let e=b.value;e&&oe&&(e.scrollTop=e.scrollHeight)}),b.value&&le.observe(b.value),x.value&&le.observe(x.value)}),U(()=>{b.value&&R.value&&Yc(s.pane.id,C.value.file,b.value)}),l(()=>le?.disconnect());function ue(){let e=b.value;e&&(zt.open=!1,se||(oe=e.scrollHeight-e.scrollTop-e.clientHeight<120),e.scrollTop<400&&R.value&&De())}function de(){me.value=null}let fe=new Set,pe=new Set,me=h(null),he=h(null),ge=!1,_e=!1;B(cr,e=>{e||(_e=!0,de())}),B(jn,e=>{e&&(_e=!0,de())});function ve(e){let t=ge&&!_e&&Cr.value&&!p.value&&!W.value,n=ge&&!_e&&!p.value&&!W.value,r=Gc(pe,e.filter(e=>e.role===`thinking`).map(br),n);r&&(me.value={id:r,at:Date.now()}),_e=!1,ge=!0;let i=Or(fe,e.filter(e=>e.role===`assistant`).map(br),t&&!r);i&&(he.value={id:i,at:Date.now()})}let ye=e=>he.value&&he.value.id===e?he.value.at:null;function be(e){he.value?.id===e&&(he.value=null)}B([Cr,p],([e,t])=>{(!e||t)&&(he.value=null),t&&de()});function xe(e){return me.value?.id===e?me.value.at:null}function Se(e){me.value?.id===e&&de()}async function Ce(){if(A.value){Q();try{await navigator.clipboard.writeText(A.value.command),$(X(`Command copied.`,`Commande copiée.`))}catch{$(Y(`Copy failed`),!0)}}}let we=!1;async function Te(){if(we)return;we=!0;let e=s.pane.id;try{let t=new URLSearchParams({pane:e,since:C.value.token});C.value.tailStart!==null&&t.set(`from`,String(C.value.tailStart));let n=await kr(`/api/chat?${t}`);if(e!==s.pane.id)return;if(!n.available){let e=Qc(L.value,!!C.value.file&&T.value.length>0);if(L.value=e.next,!e.clear)return;C.value=S(),O.value=n.reason||`unsupported`,A.value=n.reason===`no_integration`&&n.integration||null,ge=!0;return}if(O.value=null,A.value=null,F.value=null,(L.value.misses||L.value.errors)&&(L.value=Zc()),n.unchanged)return;if(V.value=null,C.value.file&&n.file!==C.value.file)return C.value=S(),ge=!1,we=!1,Te();await re(()=>{let e={...C.value};e.tailStart===null&&(e.tailStart=n.start??0,e.olderCursor=n.start??0),e.file=n.file||null,e.token=n.token||``,e.tail=n.items||[],e.queue=n.queue||[],C.value=e,ve(e.tail)}),lr(e,T.value)}catch(t){if(e!==s.pane.id)return;T.value.length?L.value=$c(L.value):F.value=t.message}finally{we=!1}}async function De(){if(z.value||!(C.value.olderCursor>0))return;z.value=!0;let e=s.pane.id,t=C.value.file,n=C.value.olderCursor;try{let r=await kr(`/api/chat?pane=${encodeURIComponent(e)}&before=${n}`);if(e!==s.pane.id||r.file!==t||C.value.olderCursor!==n)return;let i=b.value,a=i?i.scrollHeight-i.scrollTop:0;await re(()=>{C.value={...C.value,older:(r.items||[]).concat(C.value.older),olderCursor:(r.start??0)<n?r.start??0:0}},!0),lr(e,T.value),i&&(i.scrollTop=i.scrollHeight-a)}catch(e){$(e.message,!0)}finally{z.value=!1}}let Oe;w(()=>{G().then(Te).then(Xn),Oe=yr(()=>{!document.hidden&&!jn.value&&Te()},1500)}),l(()=>clearInterval(Oe)),B(cr,e=>{e&&Te()});let ke=X(`Command`,`Commande`),Ae=X(`Edit`,`Modif`),je=X(`Subagent`,`Sous-agent`),Me={Bash:ke,Read:X(`Read`,`Lecture`),Write:X(`Write`,`Écriture`),Edit:Ae,MultiEdit:Ae,Grep:X(`Search`,`Recherche`),Glob:X(`Files`,`Fichiers`),WebFetch:`Web`,WebSearch:X(`Web search`,`Recherche web`),Task:je,Agent:je,TodoWrite:X(`Tasks`,`Tâches`),exec:ke,shell:ke,apply_patch:Ae},Ne={Bash:`i-lucide-terminal`,exec:`i-lucide-terminal`,shell:`i-lucide-terminal`,Read:`i-lucide-file-text`,Write:`i-lucide-file-plus`,Edit:`i-lucide-file-pen`,MultiEdit:`i-lucide-file-pen`,apply_patch:`i-lucide-file-pen`,NotebookEdit:`i-lucide-file-pen`,Grep:`i-lucide-text-search`,Glob:`i-lucide-folder-search`,WebFetch:`i-lucide-globe`,WebSearch:`i-lucide-search`,Task:`i-lucide-bot`,Agent:`i-lucide-bot`,TodoWrite:`i-lucide-list-todo`,AskUserQuestion:`i-lucide-message-circle-question`},Ie=e=>e.name===`TodoWrite`?Y(e.text||``):e.text,Le=e=>e.name===`exec`&&/^\w+$/.test(e.text||``),Re=e=>Le(e)?Y(`Tool`):Me[e.name||``]||e.name||``,ze=e=>e.error?`i-lucide-circle-x`:Le(e)?`i-lucide-wrench`:Ne[e.name||``]||`i-lucide-wrench`,Be=e=>`${Re(e)} · ${e.text}`,Ve=e=>Zo(e.list,Ze(e.key)),He={advisor:[`Advisor`,`i-lucide-lightbulb`],"async-result":[`Background job done`,`i-lucide-circle-check`],"irc:incoming":[`Agent message`,`i-lucide-message-square`],"launch-completion":[`Process`,`i-lucide-cpu`],"lsp-late-diagnostic":[`Diagnostics`,`i-lucide-triangle-alert`],"background-tan-dispatch":[`Background task`,`i-lucide-bot`]},Ue=/\/\.cache\/herdr-web\/uploads\/\S+/g;function We(e){let t=C.value.file,n=[];if(!e.ref||!e.images||!t)return n;for(let r=0;r<e.images;r++)n.push(`/api/chat/image?pane=${encodeURIComponent(s.pane.id)}&file=${encodeURIComponent(t)}&ref=${e.ref}&i=${(e.imageAt||0)+r}`);return n}let Ge=n(()=>{let e=tl(T.value),t=new Set;if(!e.size)return t;for(let n of T.value)n.hashes&&n.role!==`user`&&We(n).forEach((r,i)=>{e.has(`${n.ref}:${(n.imageAt||0)+i}`)&&t.add(r)});return t});function Ke(e){let t=Xo(e.list)?Ve(e).rows:e.list.length<=3||Ze(e.key)?e.list:[];return e.list.filter(e=>e.images&&!t.includes(e)).map(We).filter(e=>e.length)}let qe=r(new Set),Ye=n(()=>!W.value&&s.pane.status===`working`),Xe=n(()=>{let e=[],t=T.value,n=[],r=new Map,i=()=>{if(!n.length)return;let t=n[0],i=`t:${t.ts}:${t.text}`,a=r.get(i)||0;r.set(i,a+1),e.push({k:`tools`,key:`${i}#${a}`,list:n,live:!1}),n=[]},a=null,o=``,c=!0,l=null,u=null,d=[],f=()=>{if(a&&a.end&&a.start&&(a.tools||a.replies)){let t=Math.max(0,Math.round((Date.parse(a.end)-Date.parse(a.start))/1e3)),n=a.tools?` · ${a.tools} ${Y(a.tools>1?`actions`:`action`)}`:``;u&&(u.endsTurn=!0),e.push({k:`turn`,key:`e:${e.length}`,text:`✓ ${wn(t)}${n}`,copy:l,reply:u?.key||null})}a=null,l=null,u=null};t.forEach((t,r)=>{if(t.ts){let n=new Date(t.ts).toDateString();n!==o&&(t.role!==`tool`&&(i(),t.role===`user`&&f()),o&&e.push({k:`day`,key:`d:${n}`,label:Kr(t.ts)}),o=n)}if(t.role===`user`||t.role===`cmd`||t.role===`bash`?(i(),f(),c=!0,t.role!==`cmd`&&(a={start:t.ts,end:null,tools:0,replies:0})):a&&t.ts&&t.role!==`notice`&&t.role!==`job`&&(a.end=t.ts,t.role===`tool`?a.tools++:t.role===`assistant`&&a.replies++),(t.role===`tool`||t.role===`assistant`||t.role===`thinking`)&&c&&(c=!1,e.push({k:`who`,key:`w:${t.ts}:${r}`})),t.role===`tool`){n.push(t);return}i();let s=`${t.role}:${t.ts}:${r}`;if(t.role===`user`){let n=t.text.match(Ue)||[],r=t.text.split(`
14
+ `).map(ca).filter(e=>!!e),i=t.text.replace(/^.*\/\.cache\/herdr-web\/uploads\/\S+\s*$/gm,``).split(`
15
+ `).filter(e=>!Wi(e)).join(`
16
+ `).trim(),a=We(t);for(let e of n)a.push(`/uploads/${encodeURIComponent(e.split(`/`).pop())}`);let o=Lr(i),c=o&&Ar(d,o.reply)?.key||null;e.push({k:`user`,key:s,text:o?o.body:i,pasted:t.pasted,srcs:a,files:r,time:t.ts?Sn(t.ts):null,at:t.ts?tr(t.ts):null,reply:o?.reply||null,origin:c})}else if(t.role===`assistant`){l=t.text;let n=t.ts?Sn(t.ts):null;u={k:`assistant`,key:s,id:br(t),rid:Ln(t),text:t.text,html:qn(Kt(t.text),{reply:Y(`Reply`),quoted:Y(`Quoted`),discuss:Y(`Discuss`),yes:Y(`Yes`),no:Y(`No`),okAll:Y(`OK to all`),decisions:Y(`Decisions`)}),time:n,endsTurn:!1},e.push(u),d.push({key:s,time:n,text:t.text,rid:u.rid})}else if(t.role===`thinking`)e.push({k:`thinking`,key:s,id:br(t),text:t.text,html:Kt(t.text),ms:t.ms});else if(t.role===`job`&&t.job)e.push({k:`job`,key:s,id:t.job.id,tool:t.job.tool,out:t.job.out,ms:t.ms,error:!!t.error});else if(t.role===`bash`&&t.omp)e.push({k:`ompRun`,key:`s:${t.ts}:${t.text.slice(0,40)}`,tool:{...t,omp:t.omp}});else if(t.role===`bash`){let n=t.out||``,r=t.err||``,i=(n?n.split(`
17
17
  `).length:0)+(r?r.split(`
18
- `).length:0);e.push({k:`shell`,key:`s:${t.ts}:${t.text.slice(0,40)}`,bash:t.role===`bash`,text:t.text,out:n,err:r,lines:i,long:i>mu||n.length+r.length>1500})}else if(t.role===`notice`){let[n,r]=Le[t.name||``]||[t.name||`Note`,`i-lucide-info`];e.push({k:`notice`,key:s,label:Y(n),icon:r,html:Yt(t.text),long:t.text.split(`
19
- `).length>mu||t.text.length>1200})}else{let n=t.role===`system`?t.text.match(/^Effort : (low|medium|high|xhigh|max|ultracode) \(cette session\)$/):null;e.push({k:`system`,key:s,text:n?Z(`Effort: ${n[1]} (this session)`,`Effort : ${n[1]} (cette session)`):t.role===`system`?Y(t.text):t.text})}}),i();let p=!V.value&&s.pane.status===`blocked`;if(!Ue.value&&!p&&!s.pane.pendingPrompt)f();else{let t=e[e.length-1];t&&t.k===`tools`&&(Ue.value||p)&&(t.live=!0)}return e}),Ge=e=>He.has(e);function Ke(e,t){t?He.add(e):He.delete(e)}let qe=e=>[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(t=>t.dataset.hitKey===e)||null,Je=e=>{let t=e?.closest(`[data-hit-key]`)?.dataset.hitKey,n=t?We.value.find(e=>e.key===t):null;return n&&n.k===`assistant`?{time:n.time,id:n.rid}:{time:null,id:null}};function Ye(e){let{time:t,id:n}=Je(e);if(e.classList.contains(`q-all`))return Er({n:e.dataset.n||``,text:e.dataset.q||``},t,n,Hn(e));let r=e.closest(`.q-trow`);return r?Sn(Qn(r),t,n):e.dataset.q?En(e.dataset.q,t,n):null}function Xe(e){let t=We.value.find(t=>t.key===e);t&&t.k===`assistant`&&Ze(ar(t.text,t.time,t.rid))}function Ze(e){let t=Bi(s.pane.id),n=e?Kr(t.text,e):null;pt.value=null,window.getSelection()?.removeAllRanges(),n!==null&&(t.text=n),X(),d(`quote`)}let Qe=e=>Y(e===`yes`?`Yes`:`No`),$e=()=>{q=!1};function et(e,t){if(!e)return;$e();let n=Bi(s.pane.id),r=zr(n.text,e,Qe(t));r!==null&&(n.text=r),X()}function tt(e){if(!e)return;$e();let t=Bi(s.pane.id);t.text=wr(t.text,e,Z(`OK to all`,`OK tout`)),X()}let nt=(e,t)=>mn(mr(lt.value,e)||``)===t;function rt(){let e=Bi(s.pane.id).text;for(let t of x.value?.querySelectorAll(`.q-ans, .q-tans`)||[]){let n=Ye(t);t.setAttribute(`aria-pressed`,String(!!n&&mn(mr(e,n)||``)===t.dataset.a))}for(let t of x.value?.querySelectorAll(`.q-all`)||[])t.setAttribute(`aria-pressed`,String(Wr(e,Ye(t))));for(let t of x.value?.querySelectorAll(`.q-reply, .q-point, .q-tquote`)||[]){let n=Ye(t),r=!!n&&Wr(e,n);if(t.classList.toggle(`quoted`,r),t.dataset.n&&!t.classList.contains(`q-tquote`))for(let e of it(t))e.classList.toggle(`quoted`,r)}}let it=e=>e.closest(`.md-body`)?.querySelectorAll(`.q-text[data-n="${e.dataset.n}"]`)||[],at=e=>e.closest(`.md-body`)?.querySelector(`.q-reply[data-n="${e.dataset.n}"]`)||null,ot=null;function st(e){ot?.classList.remove(`q-armed`),ot=e,e?.classList.add(`q-armed`)}let ct=h(null),lt=n(()=>Bi(s.pane.id).text);function ut(e,t,n){for(let r of qe(e)?.querySelectorAll(`.q-text[data-n="${t}"]`)||[])r.classList.toggle(`q-hot`,n)}let dt;function ft(e,t){let n=t.closest(`.msg-ai .md-body .q-pt`),r=n?.querySelector(`:scope > .q-point`),i=r?.dataset.q;if(clearTimeout(dt),!n||!i||t.closest(`a, button, summary, input`))return st(null);if(fn.value===`list`){ct.value&&n.closest(`[data-hit-key]`)?.dataset.hitKey===ct.value&&(ct.value=null,Ze(Ye(r)));return}if(fn.value!==`text`||window.getSelection()?.isCollapsed===!1)return st(null);if(ht())return st(n===ot?null:n);e.detail>1||(dt=setTimeout(()=>{window.getSelection()?.isCollapsed!==!1&&Ze(Ye(r))},220))}l(()=>clearTimeout(dt)),z([()=>Bi(s.pane.id).text,We],()=>N(rt),{flush:`post`});let pt=h(null),mt=h(null),ht=()=>window.matchMedia(`(pointer: coarse)`).matches;function gt(){let e=window.getSelection(),t=e&&!e.isCollapsed&&e.rangeCount?e.getRangeAt(0):null,n=(t?t.startContainer.nodeType===1?t.startContainer:t.startContainer.parentElement:null)?.closest(`.msg-ai[data-hit-key]`);if(!t||!n||V.value||!x.value?.contains(n))return null;let r=kc(t,n.querySelector(`.md`)||n),i=r?.toString().trim()||``;if(!r||!i)return null;let a=Tc(r.getClientRects())||r.getBoundingClientRect();return{host:n,text:i,end:a,sig:`${i}|${Math.round(a.right)}|${Math.round(a.top)}`}}function vt(){let e=gt();if(!e||!x.value){pt.value=null;return}let t=x.value.getBoundingClientRect(),n=Ec(e.end,{width:mt.value?.offsetWidth||104,height:mt.value?.offsetHeight||32},{width:window.innerWidth,top:Math.max(0,t.top),bottom:Math.min(window.innerHeight,t.bottom)},ht());pt.value=n?{text:e.text,...Je(e.host),sig:e.sig,...n}:null}let bt=Dc({show:vt,hide:()=>{pt.value=null},touch:ht}),xt=e=>{e.button===0&&!e.target?.closest?.(`.sel-reply`)&&bt.down()},St=()=>bt.up(),Ct=()=>bt.change(!!pt.value&&gt()?.sig===pt.value.sig),Tt=()=>{(pt.value||window.getSelection()?.isCollapsed===!1)&&bt.scroll()};w(()=>{document.addEventListener(`pointerdown`,xt,!0),document.addEventListener(`pointerup`,St,!0),document.addEventListener(`pointercancel`,St,!0),document.addEventListener(`selectionchange`,Ct),window.addEventListener(`scroll`,Tt,!0),window.addEventListener(`resize`,Tt)}),l(()=>{bt.dispose(),document.removeEventListener(`pointerdown`,xt,!0),document.removeEventListener(`pointerup`,St,!0),document.removeEventListener(`pointercancel`,St,!0),document.removeEventListener(`selectionchange`,Ct),window.removeEventListener(`scroll`,Tt,!0),window.removeEventListener(`resize`,Tt)}),i(`gotoRef`,(e,t)=>{let n=t.closest(`[data-hit-key]`)?.dataset.hitKey,r=n?We.value.findIndex(e=>e.key===n):-1,i=(r<0?We.value:We.value.slice(0,r)).flatMap(e=>e.k===`assistant`?[{key:e.key,time:e.time,text:e.text,rid:e.rid}]:[]);Et(Gn(i,{time:e.time||``,excerpt:e.excerpt,id:e.id&&tr(e.id)})?.key||null)});function Et(e){let t=e?qe(e):null;if(!t)return $(Y(`Original message not found (further up the conversation?)`),!0);t.scrollIntoView({block:`center`,behavior:`smooth`}),t.classList.remove(`msg-flash`),t.offsetWidth,t.classList.add(`msg-flash`),setTimeout(()=>t.classList.remove(`msg-flash`),1700)}async function Dt(e){try{await navigator.clipboard.writeText(e),$(Y(`Copied`))}catch{$(Y(`Copy failed`),!0)}}function Ot(e){let t=e.target,n=t.closest?.(`.q-ans`);if(n?.dataset.q){e.preventDefault(),st(null),ct.value=null,et(Ye(n),n.dataset.a===`no`?`no`:`yes`);return}let r=t.closest?.(`.q-tans`);if(r?.dataset.n){e.preventDefault(),st(null),ct.value=null,et(Ye(r),r.dataset.a===`no`?`no`:`yes`);return}let i=t.closest?.(`.q-all`);if(i){e.preventDefault(),st(null),ct.value=null,tt(Ye(i));return}let a=t.closest?.(`.q-reply, .q-point, .q-tquote`);if(a){e.preventDefault(),st(null),ct.value=null,Ze(Ye(a));return}let o=fn.value===`text`&&!V.value?t.closest?.(`.q-text`):null,s=o&&window.getSelection()?.isCollapsed!==!1?at(o):null;if(s){e.preventDefault(),st(null),Ze(Ye(s));return}let c=t.closest?.(`.md-body .md-path`);if(c){e.preventDefault(),zt(c);return}let l=t.closest?.(`.md-body .md-cmd`);if(l){e.preventDefault(),jt(l);return}let u=t.closest?.(`.md-body img`);if(u&&u.src){e.preventDefault(),Wn(u.src);return}!V.value&&!t.closest?.(`.code-block`)&&ft(e,t);let d=(t.closest?.(`.can-run .code-run`))?.closest(`.code-block`)?.dataset.cmd;if(d){kt(d);return}let f=t.closest?.(`.code-copy`);if(!f)return;let p=f.closest(`.code-block`),m=p?.dataset.cmd??p?.querySelector(`pre`)?.textContent;m!=null&&navigator.clipboard.writeText(m).then(()=>{f.textContent=Y(`Copied`),f.classList.add(`done`),setTimeout(()=>{f.textContent=Y(`Copy`),f.classList.remove(`done`)},1400)}).catch(()=>$(Y(`Copy failed`),!0))}async function kt(e){let t=Ht(s.pane.agent,e);if(!t||!te.value)return;if(s.pane.status===`blocked`&&s.pane.prompt)return $(Z(`The agent is waiting for your answer: answer it first.`,`L’agent attend ta réponse : réponds-lui d’abord.`),!0);X();let n=Tr(s.pane.agent);if(await _t(Z(`Run this command? ${n} runs it in its shell mode (!), in its own folder, and shows the output in the conversation.`,`Lancer cette commande ? ${n} l’exécute dans son mode shell (!), dans son propre dossier, et affiche la sortie dans la conversation.`),Z(`Run`,`Lancer`),`primary`,e))try{d(`sent`,await Pt(s.pane,s.pane.id,t)),X()}catch(e){$(e.message,!0)}}function At(e,t){let n=[];return t&&n.push({label:Z(`Run…`,`Lancer…`),icon:`i-lucide-play`,run:()=>kt(e)}),n.push({label:Y(`Copy command`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>Dt(e)}),n}function jt(e){let t=e.dataset.cmd;t&&It(e,At(t,te.value&&!!e.closest(`.can-run`)),Z(`Command`,`Commande`))}let Nt=r({open:!1,x:0,y:0,w:0,h:0}),Ft=h([]);function It(e,t,n){if(Ar.value){X(),nn(t,n);return}let r=e.getBoundingClientRect();Object.assign(Nt,{x:r.left,y:r.top,w:r.width,h:r.height}),Ft.value=wt(t),Nt.open=!0}let Lt=e=>e.replace(/\/+$/,``).split(`/`).pop()||e;function Rt(e){let t=[];return!Dn.value&&!e.endsWith(`/`)&&t.push({label:Y(`Preview`),icon:`i-lucide-eye`,run:()=>Vt(e)},{label:Y(`Download`),icon:`i-lucide-download`,run:()=>Ut(e)}),Ir(s.pane)&&!Dn.value&&t.push({label:Y(`Reveal in Finder`),icon:`i-lucide-folder-search`,run:()=>Gt(e,`reveal`)},{label:Y(`Open`),icon:`i-lucide-external-link`,run:()=>Gt(e,`open`)}),t.push({label:Y(`Copy path`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>Dt(e)}),t}function zt(e,t){let n=t||(e.textContent||``).trim();n&&It(e,Rt(n),Lt(n))}let Bt=r({open:!1,path:``});function Vt(e){Object.assign(Bt,{open:!0,path:e})}async function Ut(e){try{await Or(`/api/files/download?pane=${encodeURIComponent(s.pane.id)}&path=${encodeURIComponent(e)}&from=chat`,Lt(yt(e)))}catch(e){$(e.message,!0)}}function Wt(e){if(e.key===`Escape`&&(ct.value||ot)){ct.value=null,st(null);return}if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`.md-body .md-path, .md-body .md-cmd`);t&&(e.preventDefault(),t.classList.contains(`md-cmd`)?jt(t):zt(t))}async function Gt(e,t){try{let n=await Dr(`/api/reveal`,{pane_id:s.pane.id,path:e,mode:t});$(t===`reveal`?Z(`Shown in Finder on ${n.machine}`,`Affiché dans le Finder sur ${n.machine}`):Z(`Opened in the editor on ${n.machine}`,`Ouvert dans l’éditeur sur ${n.machine}`))}catch(e){$(e.message,!0)}}let Kt=n(()=>{if(V.value)return null;let e=s.pane;return e.agent===`omp`?e.ompShell?{shell:e.ompShell,sent:null,queued:[]}:null:e.agent===`claude`&&e.status===`working`&&e.claudeScreen||null}),qt=n(()=>Kt.value&&Kt.value.shell||null),Jt=h(Date.now()),Xt;z(qt,e=>{e&&!Xt&&(Xt=Lr(()=>{Jt.value=Date.now()},1e3)),!e&&Xt&&(clearInterval(Xt),Xt=void 0)},{immediate:!0}),l(()=>clearInterval(Xt));let Zt=n(()=>{let e=qt.value&&qt.value.since;if(!e)return null;let t=Math.max(0,Math.round((Jt.value-e)/1e3));return t<60?`${t} s`:`${Math.floor(t/60)} min ${String(t%60).padStart(2,`0`)} s`}),Qt=n(()=>{let e=s.pane,t=zi(V.value?[]:(e.queued||[]).filter(e=>!e.back),s.localQueued),n=Cc(e.id,t),r=We.value.filter(e=>e.k===`assistant`);return wc({mine:t,claude:C.value.queue||[],items:T.value,screen:Kt.value,memory:n}).map(e=>{let t=e.raw.split(`
20
- `),n=t.filter(e=>!ec(e)&&!Vi(e)).join(`
21
- `).trim(),i=pn(n);return{...e,srcs:e.photos.map(cc),files:t.map(ia).filter(e=>!!e),text:n,body:i?i.body:n,reply:i?.reply||null,origin:i&&Gn(r,i.reply)?.key||null}})}),$t=e=>[...e.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...Array.from({length:e.missing},()=>({type:`file`,mediaType:`image/jpeg`,url:``})),...e.body||e.files.length?[{type:`text`,text:e.body||` `}]:[]],en=n(()=>!V.value&&Si(s.pane)),rn=h(null);async function an(e){if(!rn.value){if(e.local){ji(Bi(s.pane.id),ea(s.pane.id,e.id)||e.raw),d(`restored`);return}rn.value=e.id,X();try{let t=await Dr(`/api/unqueue`,{pane_id:s.pane.id,text:e.raw,id:e.mine?e.id:void 0});ji(Bi(s.pane.id),t.text||e.raw,e.pasted),d(`restored`),t.lost?$(Y(`Removed from the queue`),!0,Mi(t.lost)):$(Y(`Removed from the queue`)),setTimeout(xe,400)}catch(e){$(e.message,!0)}finally{rn.value=null}}}let on=h(null);async function cn(e){if(!on.value){on.value=e.id,X();try{e.local?await Qi(s.pane,s.pane.id,e.id):await Dr(`/api/requeue`,{pane_id:s.pane.id,id:e.id})}catch(e){$(e.message,!0)}finally{on.value=null}}}let ln=n(()=>{let e=s.pane;return e.pendingPrompt?Z(`will be sent when ${Tr(e.agent)} is ready`,`partira dès que ${Tr(e.agent)} sera prêt`):e.status===`working`?Y(`will be read at the agent’s next step`):e.status===`blocked`?Y(`after you answer the question`):Y(`sending…`)});z(()=>Qt.value.map(e=>`${e.id}:${e.phase}`).join(`,`),()=>N(()=>ne(!1))),z(()=>qt.value&&qt.value.lines.join(`
22
- `),()=>N(()=>ne(!1)));let un=n(()=>{let e=s.pane;if(e.interaction===`terminal`||O.value!==`not_found`||!e.screen||e.status===`working`||V.value)return null;let t=Tr(e.agent);return gr(e)?{text:Z(`${t} is waiting for your answer, below or in the terminal.`,`${t} attend ta réponse, ci-dessous ou dans le terminal.`),lines:[]}:{text:Z(`${t} is waiting for an action in the terminal.`,`${t} attend une action dans le terminal.`),lines:e.screen.lines}}),dn=n(()=>{if(V.value)return null;let e=s.pane;if(e.pendingPrompt&&e.status!==`working`)return{typing:!0,text:Z(`Your first message will be sent when ${Tr(e.agent)} is ready`,`Ton premier message partira dès que ${Tr(e.agent)} sera prêt`)};if(qt.value)return{typing:!0,text:Z(`Command running…`,`Commande en cours…`)};if(e.status===`working`&&e.agent===`claude`&&e.activity)return{typing:!0,verb:!0,text:`${e.activity}…`};if(e.status===`working`&&e.agent===`omp`&&e.ompActivity){let t=e.ompActivity;return{typing:!0,omp:!0,since:t.since,text:t.step||`${Tr(e.agent)} ${Z(`is working…`,`travaille…`)}`}}return e.status===`working`?{typing:!0,text:`${Tr(e.agent)} ${Z(`is working…`,`travaille…`)}`}:e.status===`blocked`&&!(e.prompt&&e.prompt.options)&&!gr(e)?{typing:!1,text:Y(`Waiting for your reply — details in the Terminal tab`)}:null});z(()=>s.pane.status,()=>N(()=>ne(!1)));let J=r({q:``,hits:[],cur:-1,loading:!1}),hn=!1,gn=h(null),yn=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase(),bn=typeof CSS<`u`&&`highlights`in CSS?CSS.highlights:null,Cn=globalThis.Highlight;function wn(){bn?.delete(`hw-hit`),bn?.delete(`hw-cur`)}function kn(e,t){if(wn(),J.hits=[],!p.value||J.q.length<2||!x.value)return;let n=yn(J.q),r=document.createTreeWalker(x.value,NodeFilter.SHOW_TEXT);for(let e=r.nextNode();e;e=r.nextNode()){let t=yn(e.nodeValue||``),r=0,i;for(;(i=t.indexOf(n,r))>=0;){let t=document.createRange();t.setStart(e,i),t.setEnd(e,Math.min(i+n.length,(e.nodeValue||``).length)),J.hits.push(t),r=i+n.length}}if(t){let e=J.hits.findIndex(e=>t.contains(e.startContainer));J.cur=e>=0?e:0}else(e||J.cur>=J.hits.length)&&(J.cur=J.hits.length-1);An()}function An(){if(bn&&Cn){bn.set(`hw-hit`,new Cn(...J.hits.filter((e,t)=>t!==J.cur)));let e=J.hits[J.cur];e?bn.set(`hw-cur`,new Cn(e)):bn.delete(`hw-cur`)}let e=J.hits[J.cur],t=b.value;if(e&&t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.scrollTo({top:t.scrollTop+n.top-r.top-t.clientHeight/2,behavior:`smooth`})}}let jn=n(()=>J.loading?Y(`loading…`):J.q.length<2?``:J.hits.length?`${J.cur+1}/${J.hits.length}`:Y(`no results`));function Mn(e){J.hits.length&&(J.cur=(J.cur+e+J.hits.length)%J.hits.length,An())}async function Nn(){for(;C.value.olderCursor>0;){let e=C.value.olderCursor;if(await Se(),C.value.olderCursor===e)break}}let Fn;function In(){clearTimeout(Fn),Fn=setTimeout(Rn,250)}async function Rn(){if(J.q.trim().length<2){wn(),J.hits=[],J.cur=-1;return}C.value.olderCursor>0&&!V.value&&(J.loading=!0,await Nn(),J.loading=!1),kn(!0)}async function Bn(){let e=c.query.hit,t=c.query.q;if(typeof e!=`string`||typeof t!=`string`||!/^\d+$/.test(e))return;let n=Number(e);p.value=!0,J.q=t,J.loading=!0,hn=!0;try{for(;C.value.olderCursor>n&&!V.value;){let e=C.value.olderCursor;if(await Se(),C.value.olderCursor>=e)break}await N();let e=String(c.query.role||``),t=String(c.query.ts||``),r=String(c.query.prefix||``),i=T.value.findIndex(n=>n.role===e&&n.ts===t&&n.text.startsWith(r)),a=i<0?``:`${e}:${t}:${i}`,o=[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(e=>e.dataset.hitKey===a);kn(!1,o),o&&!J.hits.length&&o.scrollIntoView({block:`center`})}finally{hn=!1,J.loading=!1}}z(()=>c.query.hit,()=>{c.params.pane===s.pane.id&&Bn()});function Vn(){p.value=!1}z(p,e=>{e?N(()=>gn.value?.inputRef?.focus()):(J.q=``,J.hits=[],J.cur=-1,wn())}),l(wn);function Un(e){e.key===`Enter`&&(e.preventDefault(),Mn(e.shiftKey?1:-1)),e.key===`Escape`&&(e.preventDefault(),Vn())}function Wn(e){ue([e])}function Kn(){let e=gn.value?.inputRef;e?.focus(),e?.select()}let qn=n(()=>{if(V.value||Ue.value||s.pane.status===`blocked`||Qt.value.length||qt.value)return null;let e=We.value.findLast(e=>e.k===`assistant`||e.k===`user`||e.k===`shell`||e.k===`ompRun`);if(!e||e.k!==`assistant`||ge(e.id)!==null)return null;let t=Hr(e.html);return t.questions.length+t.rows.length?{key:e.key,time:e.time,rid:e.rid,targets:t}:null}),Yn=n(()=>{let e=qn.value?Ln(qn.value.targets,lt.value,qn.value.time,qn.value.rid):0;return qn.value&&e?{key:qn.value.key,count:e}:null});z(()=>Yn.value?.count||0,e=>d(`unanswered`,e),{immediate:!0}),l(()=>d(`unanswered`,0));function Xn(){let e=Yn.value?qe(Yn.value.key):null,t=lt.value,n=Je(e),r=[...e?.querySelectorAll(`.q-reply, .q-trow`)||[]].find(e=>e.classList.contains(`q-trow`)?!xn(t,Qn(e),n.time,n.id):!Wr(t,Ye(e)));if(!r)return;let i=r.classList.contains(`q-trow`)?[r]:[...it(r)];(i[0]||r).scrollIntoView({block:`center`,behavior:lr.value?`auto`:`smooth`});for(let e of i)e.classList.remove(`q-flash`),e.offsetWidth,e.classList.add(`q-flash`),setTimeout(()=>e.classList.remove(`q-flash`),1700);X()}return t({scrollToEnd:ne,reload:()=>setTimeout(xe,400),focusSearch:Kn,gotoUnanswered:Xn}),(t,n)=>{let r=tn,i=Oe,o=si,s=De,c=to,l=co,u=So,h=wo,S=ei,w=ko,D=Qr,N=ls,z=fs,U=_s,W=Do,G=Fo,ne=xs,re=oi,ie=Qs,q=yi;return _(),v(k,null,[p.value?(_(),v(`div`,Vc,[E(r,{ref_key:`searchInput`,ref:gn,modelValue:f(J).q,"onUpdate:modelValue":[n[0]||=e=>f(J).q=e,In],type:`search`,enterkeyhint:`search`,autocomplete:`off`,icon:`i-lucide-search`,variant:`none`,placeholder:(`t`in t?t.t:f(Y))(`Search the conversation`),class:`flex-1 min-w-0`,onKeydown:Un},null,8,[`modelValue`,`placeholder`]),F(`span`,Hc,M(f(jn)),1),E(i,{icon:`i-lucide-chevron-up`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Y))(`Previous`),onClick:n[1]||=e=>Mn(-1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-chevron-down`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Y))(`Next`),onClick:n[2]||=e=>Mn(1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Y))(`Close`),onClick:Vn},null,8,[`aria-label`])])):g(``,!0),F(`div`,Uc,[f(V)||(`netDown`in t?t.netDown:f(nr))?(_(),m(o,{key:0,label:f(V)?(`t`in t?t.t:f(Y))(`Offline reading`):void 0,at:f(B)},null,8,[`label`,`at`])):f(zc)(f(P))?(_(),m(o,{key:1,label:(`t`in t?t.t:f(Y))(`Conversation not up to date — reconnecting…`)},null,8,[`label`])):g(``,!0),F(`div`,{ref_key:`box`,ref:b,class:`chat`,onScrollPassive:oe,onWheelPassive:se,onTouchmovePassive:se},[E(ne,{status:f(Ue)?`streaming`:`ready`,"should-auto-scroll":!1,"auto-scroll":{color:`neutral`,variant:`outline`},"auto-scroll-icon":`i-lucide-arrow-down`,ui:{root:`chat-msgs`,viewport:`hw-jump-vp`,autoScroll:`hw-jump`}},{default:H(()=>[F(`div`,{ref_key:`listEl`,ref:x,class:j([`chat-list`,[f(V)?`no-reply`:`rs-${`replyStyle`in t?t.replyStyle:f(fn)}`,{asking:f(qn)}]]),onClick:Ot,onKeydown:Wt},[f(O)&&f(un)?(_(),v(`div`,Wc,[E(s,{name:`i-lucide-square-terminal`,class:`chat-empty-icon`}),F(`p`,null,M(f(un).text),1),f(un).lines.length?(_(),v(`pre`,Gc,M(f(un).lines.join(`
23
- `)),1)):g(``,!0),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[3]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`View terminal`)),1)]),_:1})])):f(O)?(_(),v(`div`,Kc,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),F(`p`,null,M(f(O)===`not_found`?(`t`in t?t.t:f(Y))(`No conversation for this agent yet.`):(`t`in t?t.t:f(Y))(`Conversation unavailable for this agent.`)),1),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[4]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`View terminal`)),1)]),_:1})])):(_(),v(k,{key:2},[f(C).olderCursor>0?(_(),v(`div`,qc,[E(i,{size:`xs`,color:`neutral`,variant:`outline`,class:`mono-btn`,loading:f(R),icon:`i-lucide-arrow-up`,onClick:Se},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Load earlier messages`)),1)]),_:1},8,[`loading`])])):f(C).older.length?(_(),v(`div`,Jc,M((`t`in t?t.t:f(Y))(`Start of conversation`)),1)):g(``,!0),(_(!0),v(k,null,y(f(We),r=>(_(),v(k,{key:r.key},[r.k===`day`?(_(),v(`div`,Yc,[F(`span`,null,M(r.label),1)])):r.k===`who`?(_(),v(`div`,{key:1,class:j([`msg-who`,e.pane.agent||``])},[E(s,{name:(`agentIcon`in t?t.agentIcon:f(li))(e.pane.agent)||`i-lucide-bot`},null,8,[`name`]),F(`span`,null,M((`kindLabel`in t?t.kindLabel:f(Tr))(e.pane.agent)),1)],2)):r.k===`user`?(_(),v(`div`,{key:2,class:`msg-user-wrap`,"data-hit-key":r.key},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Y))(`Show original message`),onClick:e=>Et(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),F(`span`,Qc,M(r.reply.time),1),F(`span`,$c,M(r.reply.excerpt),1)],8,Zc)):g(``,!0),E(h,{id:r.key,role:`user`,side:`right`,variant:`soft`,parts:[...r.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...r.text||r.files.length?[{type:`text`,text:r.text||` `}]:[]],ui:{root:r.text.trim()||r.files.length?`msg msg-user`:`msg msg-user msg-no-text`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[E(c,{srcs:r.srcs,offline:f(V)},null,8,[`srcs`,`offline`])]),content:H(()=>[r.files.length?(_(),v(`span`,el,[(_(!0),v(k,null,y(r.files,e=>(_(),m(l,{key:e.path,name:e.name,clickable:``,onOpen:t=>zt(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(u,{text:r.text,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.time?(_(),v(`div`,{key:1,class:`msg-time`,title:r.at||void 0},M(r.time),9,tl)):g(``,!0)],8,Xc)):r.k===`assistant`?(_(),v(k,{key:3},[E(h,{id:r.key,role:`assistant`,side:`left`,variant:`naked`,"data-hit-key":r.key,parts:[{type:`text`,text:r.text}],ui:{root:`msg msg-ai tw-${e.pane.agent||`agent`}${f(te)?` can-run`:``}${f(ct)===r.key?` q-picking`:``}`,container:`msg-c`,content:`md`}},{content:H(()=>[E(S,{html:r.html,typing:ge(r.id),onDone:e=>_e(r.id)},null,8,[`html`,`typing`,`onDone`])]),_:2},1032,[`id`,`data-hit-key`,`parts`,`ui`]),(`replyStyle`in t?t.replyStyle:f(fn))===`list`&&!f(V)&&ge(r.id)===null&&(f(Hr)(r.html).questions.length||f(Hr)(r.html).pick)?(_(),v(`div`,nl,[f(Hr)(r.html).questions.length?(_(),v(k,{key:0},[F(`p`,rl,M((`tl`in t?t.tl:f(Z))(`Questions · reply to`,`Questions · répondre à`)),1),(_(!0),v(k,null,y(f(Hr)(r.html).questions,e=>(_(),v(`div`,{key:e.n,class:`q-line`},[F(`button`,{type:`button`,class:j([`q-row`,{quoted:f(Wr)(f(lt),f(En)(e.text,r.time,r.rid))}]),"aria-label":`${(`t`in t?t.t:f(Y))(`Reply`)}: ${e.text}`,onClick:t=>Ze(f(En)(e.text,r.time,r.rid)),onMouseenter:t=>ut(r.key,e.n,!0),onMouseleave:t=>ut(r.key,e.n,!1),onFocus:t=>ut(r.key,e.n,!0),onBlur:t=>ut(r.key,e.n,!1)},[F(`b`,null,M(f(Wr)(f(lt),f(En)(e.text,r.time,r.rid))?`✓`:e.n),1),F(`span`,null,M(e.text),1),F(`i`,null,[n[10]||=a(`↳`,-1),F(`em`,null,M(f(Wr)(f(lt),f(En)(e.text,r.time,r.rid))?(`t`in t?t.t:f(Y))(`Quoted`):(`t`in t?t.t:f(Y))(`Reply`)),1)])],42,il),e.closed?(_(),v(k,{key:0},y([`yes`,`no`],t=>F(`button`,{key:t,type:`button`,class:`q-row-ans`,"aria-pressed":nt(f(En)(e.text,r.time,r.rid),t),"aria-label":`${Qe(t)}: ${e.text}`,onClick:n=>et(f(En)(e.text,r.time,r.rid),t)},M(Qe(t)),9,al)),64)):g(``,!0)]))),128))],64)):g(``,!0),f(Hr)(r.html).pick?(_(),v(`button`,{key:1,type:`button`,class:`q-pick`,"aria-pressed":f(ct)===r.key,onClick:e=>ct.value=f(ct)===r.key?null:r.key},M(f(ct)===r.key?(`tl`in t?t.tl:f(Z))(`Pick the point to quote · Cancel`,`Choisis le point à citer · Annuler`):(`tl`in t?t.tl:f(Z))(`+ Quote a point`,`+ Citer un point`)),9,ol)):g(``,!0)])):g(``,!0),!r.endsTurn&&!f(V)?(_(),v(`div`,sl,[F(`button`,{type:`button`,class:`msg-reply`,onClick:e=>Xe(r.key)},[E(s,{name:`i-lucide-reply`}),F(`span`,null,M((`t`in t?t.t:f(Y))(`Reply`)),1)],8,cl)])):g(``,!0)],64)):r.k===`thinking`?(_(),m(w,{key:4,class:`omp-thinking`,text:r.text,streaming:ve(r.id)!==null,duration:r.ms===void 0?void 0:Math.max(1,Math.round(r.ms/1e3)),"auto-close-delay":450,ui:{root:`omp-thinking`,trigger:`omp-thinking-head`,label:`omp-thinking-label`,content:`omp-thinking-content`,body:`omp-thinking-body`}},{default:H(()=>[E(S,{class:`md`,html:r.html,typing:ve(r.id),speed:(`reducedMotion`in t?t.reducedMotion:f(lr))?`off`:`fast`,cipher:!1,onDone:e=>ye(r.id)},null,8,[`html`,`typing`,`speed`,`onDone`])]),_:2},1032,[`text`,`streaming`,`duration`])):r.k===`job`?(_(),v(`div`,{key:5,class:j([`omp-job`,{err:r.error,open:Ge(r.key)}])},[F(`button`,{type:`button`,class:`omp-job-head`,disabled:!r.out,"aria-expanded":r.out?Ge(r.key):void 0,onClick:e=>Ke(r.key,!Ge(r.key))},[F(`span`,ul,M(r.error?`✗`:`✓`),1),F(`span`,dl,M((`tl`in t?t.tl:f(Z))(`Background job completed`,`Tâche de fond terminée`)),1),F(`code`,null,`[`+M(r.tool)+`] `+M(r.id),1),r.ms===void 0?g(``,!0):(_(),v(`span`,fl,M(f(Lo)(r.ms)),1)),r.out?(_(),m(s,{key:1,name:Ge(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`])):g(``,!0)],8,ll),r.out&&Ge(r.key)?(_(),v(`div`,pl,[F(`div`,ml,[F(`span`,hl,M(r.error?(`tl`in t?t.tl:f(Z))(`Error`,`Erreur`):(`tl`in t?t.tl:f(Z))(`Output`,`Sortie`)),1),r.ms===void 0?g(``,!0):(_(),v(`span`,gl,`wall `+M(f(Lo)(r.ms)),1))]),F(`pre`,null,M(r.out),1)])):g(``,!0)],2)):r.k===`shell`?(_(),v(`div`,{key:6,class:j([`msg-shell`,{bash:r.bash,long:r.long,open:Ge(r.key)}])},[F(`div`,_l,[F(`span`,vl,M(r.bash?`!`:`❯`),1),F(`code`,null,M(r.text),1),E(D,{text:(`t`in t?t.t:f(Y))(`Copy command`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`msg-shell-copy`,"aria-label":(`t`in t?t.t:f(Y))(`Copy command`),onClick:e=>Dt(r.bash?`!${r.text}`:r.text)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])]),r.out||r.err?(_(),v(`div`,yl,[r.out?(_(),v(`pre`,bl,M(r.out),1)):g(``,!0),r.err?(_(),v(`pre`,xl,M(r.err),1)):g(``,!0)])):r.bash?(_(),v(`div`,Sl,M((`t`in t?t.t:f(Y))(`No output`)),1)):g(``,!0),r.long?(_(),v(`button`,{key:2,type:`button`,class:`msg-shell-more`,"aria-expanded":Ge(r.key),onClick:e=>Ke(r.key,!Ge(r.key))},[E(s,{name:Ge(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),F(`span`,null,M(Ge(r.key)?(`t`in t?t.t:f(Y))(`Collapse`):(`tl`in t?t.tl:f(Z))(`Show all · ${r.lines} lines`,`Tout afficher · ${r.lines} lignes`)),1)],8,Cl)):g(``,!0)],2)):r.k===`ompRun`?(_(),v(`div`,wl,[F(`div`,Tl,[F(`span`,El,M(r.tool.omp.title===`Python`?`$`:`!`),1),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`You ran`,`Lancé par toi`)),1)]),E(N,{tool:r.tool,run:``},null,8,[`tool`])])):r.k===`system`?(_(),v(`div`,Dl,[F(`span`,null,M(r.text),1)])):r.k===`notice`?(_(),v(`div`,{key:9,class:j([`msg-notice`,{long:r.long,open:Ge(r.key)}])},[F(`div`,Ol,[E(s,{name:r.icon},null,8,[`name`]),F(`span`,null,M(r.label),1)]),E(S,{class:`msg-notice-body md`,html:r.html,typing:null},null,8,[`html`]),r.long?(_(),v(`button`,{key:0,type:`button`,class:`msg-shell-more`,"aria-expanded":Ge(r.key),onClick:e=>Ke(r.key,!Ge(r.key))},[E(s,{name:Ge(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),F(`span`,null,M(Ge(r.key)?(`t`in t?t.t:f(Y))(`Collapse`):(`t`in t?t.t:f(Y))(`Show all`)),1)],8,kl)):g(``,!0)],2)):r.k===`turn`?(_(),v(`div`,Al,[r.copy?(_(),m(D,{key:0,text:(`t`in t?t.t:f(Y))(`Copy reply`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`turn-copy`,"aria-label":(`t`in t?t.t:f(Y))(`Copy reply`),onClick:e=>Dt(r.copy)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])):g(``,!0),r.reply&&!f(V)?(_(),v(`button`,{key:1,type:`button`,class:`msg-reply`,onClick:e=>Xe(r.reply)},[E(s,{name:`i-lucide-reply`}),F(`span`,null,M((`t`in t?t.t:f(Y))(`Reply`)),1)],8,jl)):g(``,!0),F(`span`,null,M(r.text),1)])):r.k===`tools`&&f(Go)(r.list)?(_(),v(`div`,{key:11,class:j([`tools omp-console`,{live:r.live}])},[F(`div`,Ml,[n[11]||=F(`span`,{class:`omp-console-title`},`omp`,-1),F(`span`,null,M(r.list.length)+` `+M((`t`in t?t.t:f(Y))(`actions`)),1),f(Wo)(r.list)?(_(),v(`span`,Nl,`Σ `+M(f(Lo)(f(Wo)(r.list))),1)):g(``,!0)]),Ie(r).hidden||r.list.length>f(3)&&Ge(r.key)?(_(),v(`button`,{key:0,type:`button`,class:`omp-console-more`,"aria-expanded":Ge(r.key),onClick:e=>Ke(r.key,!Ge(r.key))},[Ie(r).hidden?(_(),v(k,{key:0},[a(`⋯ `+M((`tl`in t?t.tl:f(Z))(`${Ie(r).hidden} earlier actions`,`${Ie(r).hidden} actions avant`)),1)],64)):(_(),v(k,{key:1},[a(`⋯ `+M((`t`in t?t.t:f(Y))(`Collapse`)),1)],64))],8,Pl)):g(``,!0),(_(!0),v(k,null,y(Ve(r),(e,t)=>(_(),m(c,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:pu,offline:f(V),dupes:f(Be)},null,8,[`srcs`,`offline`,`dupes`]))),128)),(_(!0),v(k,null,y(Ie(r).rows,(e,t)=>(_(),v(k,{key:`${r.key}:${r.list.length-Ie(r).rows.length+t}`},[E(N,{tool:{...e,omp:e.omp},live:r.live&&e===r.list[r.list.length-1]},null,8,[`tool`,`live`]),e.images?(_(),m(c,{key:0,class:`tool-thumbs`,srcs:ze(e),max:pu,offline:f(V),dupes:f(Be)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))],2)):r.k===`tools`?(_(),v(`div`,{key:12,class:j([`tools`,{live:r.live}])},[r.list.length<=3?(_(!0),v(k,{key:0},y(r.list,(e,t)=>(_(),v(k,{key:t},[E(z,{text:Ne(e),suffix:je(e),icon:Pe(e),loading:r.live&&t===r.list.length-1,streaming:r.live&&t===r.list.length-1,ui:{root:`tool`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`},class:j({err:e.error})},null,8,[`text`,`suffix`,`icon`,`loading`,`streaming`,`class`]),e.images?(_(),m(c,{key:0,class:`tool-thumbs`,srcs:ze(e),max:pu,offline:f(V),dupes:f(Be)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128)):(_(),m(z,{key:1,open:Ge(r.key),text:`${r.list.length} ${(`t`in t?t.t:f(Y))(`actions`)}`,suffix:Fe(r.list[r.list.length-1]),icon:r.live?void 0:`i-lucide-layers`,loading:r.live,streaming:r.live,chevron:`trailing`,ui:{root:`tool group`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`,body:`tool-body`,trailingIcon:`tool-chev`},"onUpdate:open":e=>Ke(r.key,e)},{default:H(()=>[(_(!0),v(k,null,y(r.list,(e,t)=>(_(),v(k,{key:t},[F(`div`,{class:j([`tool-row`,{err:e.error}])},[E(s,{name:Pe(e)},null,8,[`name`]),F(`b`,null,M(Ne(e)),1),F(`span`,null,M(je(e)),1)],2),e.images?(_(),m(c,{key:0,class:`tool-thumbs`,srcs:ze(e),max:pu,offline:f(V),dupes:f(Be)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))]),_:2},1032,[`open`,`text`,`suffix`,`icon`,`loading`,`streaming`,`onUpdate:open`])),(_(!0),v(k,null,y(Ve(r),(e,t)=>(_(),m(c,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:pu,offline:f(V),dupes:f(Be)},null,8,[`srcs`,`offline`,`dupes`]))),128))],2)):g(``,!0)],64))),128)),f(I)&&!f(T).length&&!f(A)?(_(),v(`div`,Fl,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),F(`p`,null,M((`t`in t?t.t:f(Y))(`No messages yet.`)),1)])):g(``,!0),f(A)?(_(),v(`div`,Il,[F(`p`,null,M(f(A)),1)])):g(``,!0)],64))],34),(_(),m(ee,{to:`body`},[f(pt)?(_(),v(`button`,{key:0,ref_key:`selBtn`,ref:mt,type:`button`,class:`sel-reply`,style:L({top:`${f(pt).top}px`,left:`${f(pt).left}px`}),"aria-label":(`t`in t?t.t:f(Y))(`Reply to this passage`),onPointerdown:n[5]||=K(()=>{},[`prevent`]),onMousedown:n[6]||=K(()=>{},[`prevent`]),onClick:n[7]||=e=>Ze(f(En)(f(pt).text,f(pt).time,f(pt).id))},[E(s,{name:`i-lucide-reply`}),F(`span`,null,M((`t`in t?t.t:f(Y))(`Reply`)),1)],44,Ll)):g(``,!0)])),f(Qt).length||f(qt)?(_(),v(`div`,Rl,[(_(!0),v(k,null,y(f(Qt).filter(e=>e.phase===`sent`),e=>(_(),v(`div`,{key:e.id,class:`msg-user-wrap`},[e.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Y))(`Show original message`),onClick:t=>Et(e.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),F(`span`,Bl,M(e.reply.time),1),F(`span`,Vl,M(e.reply.excerpt),1)],8,zl)):g(``,!0),E(h,{id:`q:${e.id}`,role:`user`,side:`right`,variant:`soft`,parts:$t(e),ui:{root:`msg msg-user msg-pending sent${e.body||e.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[e.srcs.length?(_(),m(c,{key:0,srcs:e.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(e.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Y))(`Image`)},[E(s,{name:`i-lucide-image`})],8,Hl))),128))]),content:H(()=>[e.files.length?(_(),v(`span`,Ul,[(_(!0),v(k,null,y(e.files,e=>(_(),m(l,{key:e.path,name:e.name,clickable:``,onOpen:t=>zt(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(u,{text:e.body,pasted:e.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),F(`div`,Wl,[E(s,{name:`i-lucide-check`}),F(`span`,null,M((`t`in t?t.t:f(Y))(`Sent · read by the agent`)),1)])]))),128)),f(qt)?(_(),v(`div`,Gl,[F(`div`,Kl,[F(`div`,ql,[F(`span`,Jl,M(e.pane.agent===`omp`?f(qt).python?`>>>`:`$`:`!`),1),F(`code`,null,M(f(qt).command),1)]),f(qt).lines.length?(_(),v(`div`,Yl,[f(qt).hidden?(_(),v(`div`,Xl,M((`tl`in t?t.tl:f(Z))(`+ ${f(qt).hidden} lines above`,`+ ${f(qt).hidden} lignes au-dessus`)),1)):g(``,!0),F(`pre`,Zl,M(f(qt).lines.join(`
24
- `)),1)])):(_(),v(`div`,Ql,M((`t`in t?t.t:f(Y))(`No output yet`)),1))]),F(`div`,$l,[E(s,{name:`i-lucide-loader-circle`,class:`spin`}),F(`span`,null,[a(M((`t`in t?t.t:f(Y))(`Running`)),1),f(Zt)?(_(),v(k,{key:0},[a(` · `+M(f(Zt)),1)],64)):g(``,!0)])])])):g(``,!0),(_(!0),v(k,null,y(f(Qt).filter(e=>e.phase===`queued`),e=>(_(),v(`div`,{key:e.id,class:`msg-user-wrap`},[e.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Y))(`Show original message`),onClick:t=>Et(e.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),F(`span`,tu,M(e.reply.time),1),F(`span`,nu,M(e.reply.excerpt),1)],8,eu)):g(``,!0),E(h,{id:`q:${e.id}`,role:`user`,side:`right`,variant:`soft`,parts:$t(e),ui:{root:`msg msg-user msg-pending queued${e.body||e.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble queued`,header:`msg-files`}},{files:H(()=>[e.srcs.length?(_(),m(c,{key:0,srcs:e.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(e.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Y))(`Image`)},[E(s,{name:`i-lucide-image`})],8,ru))),128))]),content:H(()=>[e.files.length?(_(),v(`span`,iu,[(_(!0),v(k,null,y(e.files,e=>(_(),m(l,{key:e.path,name:e.name,clickable:``,onOpen:t=>zt(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(u,{text:e.body,pasted:e.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),e.state===`failed`?(_(),v(`div`,au,[E(s,{name:`i-lucide-circle-alert`}),F(`span`,null,M(e.reason===`busy`?(`t`in t?t.t:f(Y))(`Not sent — the agent’s input contains text`):e.reason===`no_input`?(`t`in t?t.t:f(Y))(`Not sent — the agent’s input field was not found on its screen`):(`t`in t?t.t:f(Y))(`Not sent`)),1),F(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(on),onClick:t=>cn(e)},[E(s,{name:f(on)===e.id?`i-lucide-loader-circle`:`i-lucide-rotate-cw`,class:j({spin:f(on)===e.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Y))(`Retry`)),1)],8,ou),F(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(rn),onClick:t=>an(e)},[E(s,{name:f(rn)===e.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(rn)===e.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Y))(`Cancel`)),1)],8,su)])):(_(),v(`div`,cu,[E(s,{name:`i-lucide-clock`}),F(`span`,null,M((`t`in t?t.t:f(Y))(`Queued · `))+M(e.state===`sending`?(`t`in t?t.t:f(Y))(`sending…`):e.state===`held`?e.reason===`busy`?(`t`in t?t.t:f(Y))(`will be sent when the agent’s input is free`):(`t`in t?t.t:f(Y))(`will be sent when the menu closes`):f(ln)),1),e.state!==`sending`&&(f(en)||e.state===`held`)&&e.raw?(_(),v(`button`,{key:0,type:`button`,class:`queued-cancel`,disabled:!!f(rn),onClick:t=>an(e)},[E(s,{name:f(rn)===e.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(rn)===e.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Y))(`Cancel`)),1)],8,lu)):g(``,!0)]))]))),128))])):g(``,!0),f(dn)?(_(),v(`div`,{key:1,class:j([`chat-status`,{typing:f(dn).typing,waiting:!f(dn).typing}])},[`verb`in f(dn)?(_(),v(`span`,uu,[E(U),E(W,{text:f(dn).text,duration:2.4,class:`claude-verb`},null,8,[`text`])])):`omp`in f(dn)?(_(),v(`span`,du,[E(G,{since:f(dn).since},{default:H(()=>[E(W,{text:f(dn).text,duration:2.4,class:`omp-step`},null,8,[`text`])]),_:1},8,[`since`])])):(_(),v(k,{key:2},[n[12]||=F(`i`,{class:`status-dot`},null,-1),f(dn).typing?(_(),m(W,{key:0,text:f(dn).text,duration:2.4},null,8,[`text`])):(_(),v(`span`,fu,M(f(dn).text),1))],64))],2)):g(``,!0)]),_:1},8,[`status`])],544),(`sheetMenus`in t?t.sheetMenus:f(Ar))?g(``,!0):(_(),m(re,{key:2,open:f(Nt).open,"onUpdate:open":n[8]||=e=>f(Nt).open=e,items:f(Ft),content:{align:`start`,side:`bottom`,sideOffset:4},ui:{content:`hw-dropdown`}},{default:H(()=>[F(`span`,{class:`path-anchor`,style:L({left:`${f(Nt).x}px`,top:`${f(Nt).y}px`,width:`${f(Nt).w}px`,height:`${f(Nt).h}px`}),"aria-hidden":`true`},null,4)]),_:1},8,[`open`,`items`])),E(q,{open:f(Bt).open,"onUpdate:open":n[9]||=e=>f(Bt).open=e,title:Lt(f(yt)(f(Bt).path)),wide:``,full:``,screen:``},{default:H(()=>[f(Bt).open?(_(),m(ie,{key:f(Bt).path,"pane-id":e.pane.id,file:f(Bt).path},null,8,[`pane-id`,`file`])):g(``,!0)]),_:1},8,[`open`,`title`])])],64)}}}),{__name:`ChatView`});function gu(e,t,n,r){return t===1?e*n:t===2?e*n*Math.max(1,r):e}function _u(e,t){let n=t>0?t:16,r=Math.trunc(e/n);return{lines:r,rest:e-r*n}}var vu={key:0,class:`term-loading`},yu={key:1,class:`terminal-selection-hint`},bu=[`aria-label`],xu=Object.assign(T({__name:`TerminalView`,props:{ctl:{}},setup(e){let t=e,n=h(null),r=null,i=null,o=0,s=0,c=0,u=!1,d=()=>{c=0,s&&=(t.ctl.scroll(s),0)},p=e=>{s+=e,c||=requestAnimationFrame(d)};function m(e){r=e.touches[0].clientY,i=e.touches[0].clientX,o=0,u=!1}function y(e){if(e.preventDefault(),r===null)return;let a=e.touches[0].clientY,s=e.touches[0].clientX,c=i===null?0:s-i,l=a-r;i=s;let d=n.value?.querySelector(`.xterm`);if(d&&d.scrollWidth>d.clientWidth&&Math.abs(c)>Math.abs(l)){d.scrollLeft-=c,r=a,u=!0;return}o+=l,r=a;let{lines:f,rest:m}=_u(o,t.ctl.rowHeight());o=m,f&&(u=!0,p(f))}function b(e){let n=e.changedTouches[0];r=null,i=null,u||(n&&t.ctl.tapLink(n.clientX,n.clientY)&&e.preventDefault(),t.ctl.blur(),document.activeElement?.blur?.())}function x(){t.ctl.focus()}function S(e){e.preventDefault(),e.stopPropagation();let r=n.value?.querySelector(`.xterm`);if(r&&r.scrollWidth>r.clientWidth&&(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))){r.scrollLeft+=e.shiftKey?e.deltaY:e.deltaX;return}let i=t.ctl.rowHeight();o-=gu(e.deltaY,e.deltaMode,i,t.ctl.pageRows());let{lines:a,rest:s}=_u(o,i);o=s,a&&p(a)}let C;function T(){C||=setTimeout(()=>{C=void 0,t.ctl.fitNow(!0)},50)}z($i,T);let E=null;return w(()=>{t.ctl.mount(n.value),N(()=>{t.ctl.fitNow(!1),t.ctl.hasBanner()||t.ctl.connect(!1)}),E=new ResizeObserver(T),E.observe(n.value)}),l(()=>{E?.disconnect(),clearTimeout(C),cancelAnimationFrame(c),t.ctl.dispose()}),(t,r)=>(_(),v(`div`,{id:`termWrap`,onWheelCapture:S},[F(`div`,{id:`term`,ref_key:`host`,ref:n},null,512),F(`div`,{id:`touch`,"aria-hidden":`true`,onTouchstartPassive:m,onTouchmove:y,onTouchend:b,onMousedown:K(x,[`prevent`])},null,32),e.ctl.loading.value?(_(),v(`div`,vu,[...r[1]||=[F(`span`,{class:`spinner`},null,-1)]])):g(``,!0),e.ctl.selectionHint.visible.value?(_(),v(`div`,yu,[a(M((`tl`in t?t.tl:f(Z))(`Shift + drag to select`,`Shift + glisser pour sélectionner`))+` `,1),F(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Y))(`Hide`),onClick:r[0]||=t=>e.ctl.selectionHint.dismiss()},`×`,8,bu)])):g(``,!0)],32))}}),{__name:`TerminalView`}),Su=[`stop`,`resolve`];function Cu(e){if(e.resolved)return[];let t=[];return e.report&&!e.acked&&t.push(`ack`),e.token===`working`&&e.hasPane&&t.push(`stop`),e.token!==`working`&&t.push(`restart`),t.push(`resolve`),t}var wu=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function Tu(e,t){let n=wu(t).split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=wu(`${e.id} ${e.title} ${e.machine} ${e.profile}`);return n.every(e=>t.includes(e))}):e}function Eu(e){let t=[];for(let n of e){let e=t.find(e=>e.token===n.token);e?e.threads.push(n):t.push({token:n.token,group:n.group,threads:[n]})}return t}function Du(e){let t=e.split(`
25
- `).map(e=>e.trim()).filter(Boolean);return(t[t.length-1]||``).replace(/^error:\s*/i,``).slice(0,400)}var Ou={class:`pt`},ku={key:0,class:`pt-filter`},Au={class:`pt-group-head`},ju={class:`pp-count`},Mu={class:`pp-list`},Nu={class:`pp-card`},Pu=[`aria-label`,`onClick`],Fu={class:`pp-thread-title`},Iu={class:`pp-meta`},Lu={key:1,class:`pp-empty pt-none`},Ru=[`aria-expanded`],zu={class:`pp-sec-title`},Bu={class:`pp-count`},Vu={key:0,class:`pp-list`},Hu={class:`pp-card resolved`},Uu=[`aria-label`,`onClick`],Wu={class:`pp-thread-title`},Gu={class:`pp-meta`},Ku={key:0,class:`pp-empty`},qu={key:0,class:`pt-detail`},Ju={class:`pt-state`},Yu={key:0,class:`pt-state-line`},Xu={key:1,class:`spinner pt-spin`},Zu={key:0,class:`pp-notice error`,role:`alert`},Qu={key:1,class:`pp-notice error`},$u={key:2,class:`pt-block`},ed={class:`pt-label`},td={class:`pt-next`},nd={class:`pt-next-n`},rd={class:`pt-links`},id={key:3,class:`pt-block`},ad={class:`pt-label`},od={class:`pt-actions`},sd={key:4,class:`pt-output`},cd={class:`pt-facts`},ld=new Map,ud=r(new Map),dd=Object.assign(T({__name:`ProjectThreads`,props:{paneId:{},board:{}},emits:[`reload`,`report`,`agent`],setup(e,{emit:t}){let r=e,i=t,o=h(ld.get(r.paneId)||``);z(o,e=>ld.set(r.paneId,e));let s=n(()=>Tu(r.board.open,o.value)),c=n(()=>Tu(r.board.resolved,o.value)),d=n(()=>Eu(s.value)),p=h(!1),b=h(30),x=n(()=>p.value||!!o.value.trim()&&c.value.length>0);z(o,()=>{b.value=30});function S(){p.value=!x.value,X()}let C={"waiting-on-you":[`blocked`,Y(`Your turn`)],"ready-for-review":[`done`,Y(`Ready for review`)],landing:[`working`,Y(`Landing`)],working:[`working`,Y(`Working`)],idle:[`idle`,Y(`Idle`)],resolved:[`inactive`,Z(`Resolved`,`Clôturé`)]},w=e=>C[e]?.[0]||`unknown`,T=(e,t)=>C[e]?.[1]||t||Y(`Unknown`);function D(e){let t=Xn.value.panes.find(e=>e.id===r.paneId);return t?ui(t,r.board.slug,e):void 0}function O(e){let t=[e.id.toUpperCase()];e.machine&&t.push(e.machine),e.profile&&t.push(e.profile),!e.resolved&&e.percent!==null&&t.push(`${e.percent} %`),!e.resolved&&e.activity&&t.push(e.activity);let n=e.updated&&Zn(e.updated);return n&&t.push(n),t.join(` · `)}let A=h(null),N=u(null),P=h(!1),I=h(!1),L=h(``),R=h(``),B=0,V=!0;l(()=>{V=!1});async function U(){let e=A.value;if(!e)return;let t=++B;I.value=!0,L.value=``;try{let n=await Dt(r.paneId,e.id);t===B&&(N.value=n.thread)}catch(e){t===B&&(L.value=e.message)}finally{t===B&&(I.value=!1)}}function ee(e){X(),A.value=e,N.value=null,R.value=``,P.value=!0,U()}let W=n(()=>{let e=P.value?A.value?.id:void 0,t=e?r.board.open.find(t=>t.id===e)||r.board.resolved.find(t=>t.id===e):void 0;return t?`${t.token}|${t.updated}|${t.stateLine}|${t.report}|${t.pr}`:``});z(W,(e,t)=>{e&&t&&U()});let G=n(()=>N.value||A.value),ne=n(()=>G.value?D(G.value):void 0),re=n(()=>N.value?Cu(N.value):[]),K=n(()=>{let e=N.value,t=G.value;if(!t)return[];let n=[[Z(`Machine`,`Machine`),t.machine||Z(`The project’s machine`,`Celle du projet`)],[Z(`Profile`,`Profil`),e&&e.agent&&e.agent!==t.profile?`${t.profile} (${e.agent})`:t.profile]];return e?.branch&&n.push([Z(`Branch`,`Branche`),e.base?`${e.branch} ← ${e.base}`:e.branch]),e?.kind&&n.push([Z(`Kind`,`Type`),e.kind===`worktree`?Z(`Worktree`,`Worktree`):e.kind===`tab`?Z(`Tab`,`Onglet`):e.kind]),(e?.prState||e?.prReview)&&n.push([Y(`Pull request`),[e.prState,e.prReview].filter(Boolean).join(` · `)]),t.created&&Zn(t.created)&&n.push([Z(`Created`,`Créé`),Zn(t.created)]),t.updated&&Zn(t.updated)&&n.push([Z(`Updated`,`Mis à jour`),Zn(t.updated)]),e?.resolved&&e.keptWorktree&&n.push([Z(`Worktree`,`Worktree`),Z(`Kept`,`Conservé`)]),n.filter(e=>e[1])}),ie={ack:{label:Z(`Acknowledge`,`Marquer vu`),icon:`i-lucide-eye`,hint:Z(`Record that you have seen its report`,`Noter que tu as vu son rapport`)},restart:{label:Y(`Restart`),icon:`i-lucide-rotate-cw`,hint:Z(`Bring back a thread whose pane is gone or whose start failed`,`Relancer un thread dont le pane a disparu ou dont le démarrage a échoué`)},stop:{label:Z(`Stop`,`Arrêter`),icon:`i-lucide-square`,hint:Z(`Send Escape to its agent`,`Envoyer Échap à son agent`)},resolve:{label:Z(`Resolve`,`Clôturer`),icon:`i-lucide-circle-check`,hint:Z(`Close the thread and clean up its worktree, merged branch and tab`,`Clôturer le thread et nettoyer son worktree, sa branche fusionnée et son onglet`)}},q=e=>`${r.paneId}|${e}`,ae=n(()=>(G.value?ud.get(q(G.value.id)):void 0)??null);function oe(e,t){let n=t.id.toUpperCase();return e===`stop`?Z(`Stop ${n}?\n${t.title}\n\nEscape is sent to its agent: the turn in progress is interrupted.`,`Arrêter ${n} ?\n${t.title}\n\nÉchap est envoyé à son agent : le tour en cours est interrompu.`):Z(`Resolve ${n}?\n${t.title}\n\nIts worktree, its branch once merged and its tab are removed. Its report and library are kept.`,`Clôturer ${n} ?\n${t.title}\n\nSon worktree, sa branche une fois fusionnée et son onglet sont supprimés. Son rapport et sa bibliothèque sont conservés.`)}async function se(e){let t=G.value;if(!t||ae.value)return;if(!_n.value||Dn.value)return $(Z(`Thread actions are unavailable offline`,`Actions des threads indisponibles hors ligne`),!0);if(X(),Su.includes(e)&&!await _t(oe(e,t),ie[e].label,`error`))return;let n=q(t.id);if(ud.has(n))return;ud.set(n,e);let a=()=>V&&A.value?.id===t.id;try{let n=await At(r.paneId,t.id,e);a()&&(R.value=n.output),$(Du(n.output)||Z(`${ie[e].label}: done`,`${ie[e].label} : fait`))}catch(e){$(e.message,!0)}finally{ud.delete(n),i(`reload`),a()&&U()}}function ce(){G.value&&(P.value=!1,i(`agent`,G.value))}function le(){G.value&&(P.value=!1,i(`report`,G.value))}return(t,n)=>{let r=ki,i=De,l=Oe,u=Qr,p=yi;return _(),v(`div`,Ou,[e.board.open.length+e.board.resolved.length>0?(_(),v(`div`,ku,[E(r,{modelValue:f(o),"onUpdate:modelValue":n[0]||=e=>te(o)?o.value=e:null,label:(`tl`in t?t.tl:f(Z))(`Filter threads`,`Filtrer les threads`)},null,8,[`modelValue`,`label`])])):g(``,!0),(_(!0),v(k,null,y(f(d),e=>(_(),v(`section`,{key:e.token,class:`pt-group`},[F(`h3`,Au,[F(`span`,{class:j([`pill`,w(e.token)])},[n[3]||=F(`i`,null,null,-1),a(M(T(e.token,e.group)),1)],2),F(`span`,ju,M(e.threads.length),1)]),F(`ul`,Mu,[(_(!0),v(k,null,y(e.threads,e=>(_(),v(`li`,{key:e.id,class:`pp-row`},[F(`div`,Nu,[F(`button`,{type:`button`,class:`pp-thread pt-thread`,"aria-label":(`tl`in t?t.tl:f(Z))(`Thread ${e.id}: ${e.title}`,`Thread ${e.id} : ${e.title}`),onClick:t=>ee(e)},[F(`span`,Fu,M(e.title),1),F(`span`,Iu,M(O(e)),1)],8,Pu),E(i,{name:`i-lucide-chevron-right`,class:`pt-go`})])]))),128))])]))),128)),f(s).length?g(``,!0):(_(),v(`p`,Lu,M(f(o).trim()?(`tl`in t?t.tl:f(Z))(`No open thread matches`,`Aucun thread ouvert ne correspond`):(`tl`in t?t.tl:f(Z))(`No open thread`,`Aucun thread ouvert`)),1)),F(`section`,{class:j([`pp-sec done pt-resolved`,{folded:!f(x)}])},[F(`button`,{type:`button`,class:`pp-sec-head`,"aria-expanded":f(x),onClick:S},[E(i,{name:`i-lucide-circle-check`,class:`pp-sec-icon`}),F(`span`,zu,M((`tl`in t?t.tl:f(Z))(`Resolved`,`Clôturés`)),1),F(`span`,Bu,M(f(c).length),1),E(i,{name:`i-lucide-chevron-down`,class:`pp-chev`})],8,Ru),f(x)?(_(),v(`ul`,Vu,[(_(!0),v(k,null,y(f(c).slice(0,f(b)),e=>(_(),v(`li`,{key:e.id,class:`pp-row`},[F(`div`,Hu,[F(`button`,{type:`button`,class:`pp-thread pt-thread`,"aria-label":(`tl`in t?t.tl:f(Z))(`Thread ${e.id}: ${e.title}`,`Thread ${e.id} : ${e.title}`),onClick:t=>ee(e)},[F(`span`,Wu,M(e.title),1),F(`span`,Gu,M(O(e)),1)],8,Uu),E(i,{name:`i-lucide-chevron-right`,class:`pt-go`})])]))),128)),f(c).length?g(``,!0):(_(),v(`li`,Ku,M((`t`in t?t.t:f(Y))(`Nothing yet`)),1))])):g(``,!0),f(x)&&f(c).length>f(b)?(_(),v(`button`,{key:1,type:`button`,class:`pp-more`,onClick:n[1]||=e=>b.value+=30},M((`tl`in t?t.tl:f(Z))(`Show more (${f(c).length-f(b)} left)`,`Voir plus (${f(c).length-f(b)} restants)`)),1)):g(``,!0)],2),E(p,{open:f(P),"onUpdate:open":n[2]||=e=>te(P)?P.value=e:null,title:f(G)?`${f(G).id.toUpperCase()} · ${f(G).title}`:``,wide:``,tall:``,screen:``},{default:H(()=>[f(G)?(_(),v(`div`,qu,[F(`p`,Ju,[F(`span`,{class:j([`pill`,w(f(G).token)])},[n[4]||=F(`i`,null,null,-1),a(M(T(f(G).token,f(G).group)),1)],2),f(G).stateLine?(_(),v(`span`,Yu,M(f(G).stateLine),1)):g(``,!0),f(I)?(_(),v(`span`,Xu)):g(``,!0)]),f(L)?(_(),v(`p`,Zu,[F(`span`,null,[a(M((`tl`in t?t.tl:f(Z))(`Thread record unavailable`,`Fiche du thread indisponible`))+` · `,1),F(`code`,null,M(f(L)),1)]),E(l,{size:`xs`,color:`neutral`,variant:`outline`,onClick:U},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(N)?.error?(_(),v(`p`,Qu,[F(`code`,null,M(f(N).error),1)])):g(``,!0),f(N)?.next.length?(_(),v(`section`,$u,[F(`h4`,ed,M((`tl`in t?t.tl:f(Z))(`Next`,`Ensuite`)),1),F(`ol`,td,[(_(!0),v(k,null,y(f(N).next,(e,t)=>(_(),v(`li`,{key:t},[F(`span`,nd,M(t+1),1),F(`span`,null,M(e),1)]))),128))])])):g(``,!0),F(`div`,rd,[f(ne)?(_(),m(l,{key:0,icon:`i-lucide-message-square`,color:`neutral`,variant:`outline`,class:`pt-btn`,onClick:ce},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Open agent`)),1)]),_:1})):g(``,!0),f(G).report?(_(),m(l,{key:1,icon:`i-lucide-file-text`,color:`neutral`,variant:`outline`,class:`pt-btn`,onClick:le},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`View report`)),1)]),_:1})):g(``,!0),f(G).pr?(_(),m(l,{key:2,icon:`i-lucide-git-pull-request`,color:`neutral`,variant:`outline`,class:`pt-btn`,to:f(G).pr,target:`_blank`,rel:`noopener noreferrer`},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Pull request`)),1)]),_:1},8,[`to`])):g(``,!0)]),f(re).length?(_(),v(`section`,id,[F(`h4`,ad,M((`tl`in t?t.tl:f(Z))(`Actions`,`Actions`)),1),F(`div`,od,[(_(!0),v(k,null,y(f(re),e=>(_(),m(u,{key:e,text:ie[e].hint,disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[E(l,{icon:ie[e].icon,color:e===`resolve`||e===`stop`?`error`:`neutral`,variant:`outline`,class:j([`pt-btn`,`pt-act-${e}`]),loading:f(ae)===e,disabled:f(ae)!==null,onClick:t=>se(e)},{default:H(()=>[a(M(ie[e].label),1)]),_:2},1032,[`icon`,`color`,`class`,`loading`,`disabled`,`onClick`])]),_:2},1032,[`text`,`disabled`]))),128))])])):g(``,!0),f(R)?(_(),v(`pre`,sd,M(f(R)),1)):g(``,!0),F(`dl`,cd,[(_(!0),v(k,null,y(f(K),([e,t])=>(_(),v(`div`,{key:e},[F(`dt`,null,M(e),1),F(`dd`,null,M(t),1)]))),128))])])):g(``,!0)]),_:1},8,[`open`,`title`])])}}}),{__name:`ProjectThreads`}),fd=e=>/^t-\d{4,}$/.test(e.subject)?e.subject:null,pd={class:`pi`},md={key:0,class:`pp-notice error`,role:`alert`},hd={key:1,class:`pp-notice`},gd={key:0,class:`pp-empty pi-none`},_d={key:1,class:`pp-list pi-list`},vd={class:`pp-card pi-card`},yd={class:`pi-body`},bd={class:`pi-kind`},xd={class:`pi-title`},Sd={class:`pp-meta pi-meta`},Cd=[`aria-expanded`,`aria-label`,`onClick`],wd={key:0},Td={key:1,class:`pi-prompt`},Ed={key:2,class:`pp-empty pi-more`},Dd=Object.assign(T({__name:`ProjectInbox`,props:{paneId:{},board:{},tick:{}},emits:[`count`,`thread`],setup(e,{emit:t}){let n=e,r=t,i=u(null),o=h(0),s=h(!1),c=h(``),d=0;async function p(){if(Dn.value)return;let e=++d;s.value=!0;try{let t=await $e(n.paneId);if(e!==d)return;i.value=t.items,o.value=t.total,c.value=``,r(`count`,t.total)}catch(t){e===d&&(c.value=t.message)}finally{e===d&&(s.value=!1)}}w(p),z(()=>[n.tick,n.board.version],p),l(()=>{d++});let b={"thread-state":[`Thread`,`i-lucide-git-branch`],routine:[Z(`Routine`,`Routine`),`i-lucide-alarm-clock`],pr:[`PR`,`i-lucide-git-pull-request`],outage:[Z(`Machine`,`Machine`),`i-lucide-unplug`],space:[`Space`,`i-lucide-layout-panel-left`]},x=e=>b[e.kind]?.[0]||e.kind||Z(`Notice`,`Avis`),S=e=>b[e.kind]?.[1]||`i-lucide-bell`;function T(e){let t=fd(e);return t?n.board.open.find(e=>e.id===t)||n.board.resolved.find(e=>e.id===t):void 0}let D=e=>T(e)?.title||e.subject||x(e);function O(e){let t=[];fd(e)&&t.push(e.subject.toUpperCase()),e.event&&t.push(e.event);let n=e.created&&Zn(e.created);return n&&t.push(n),t.join(` · `)}let A=h(new Set);function N(e){let t=new Set(A.value);t.delete(e)||t.add(e),A.value=t}let P=h(null);async function I(e){if(!P.value){if(!_n.value||Dn.value)return $(Z(`Inbox actions are unavailable offline`,`Actions de l’inbox indisponibles hors ligne`),!0);P.value=e.id,X();try{await ct(n.paneId,e.id),i.value=(i.value||[]).filter(t=>t.id!==e.id),o.value=Math.max(0,o.value-1),r(`count`,o.value),$(Z(`Marked as handled`,`Marqué comme traité`))}catch(e){$(e.message,!0)}finally{P.value=null}}}return(e,t)=>{let n=Oe,l=De,u=Qr;return _(),v(`div`,pd,[f(c)?(_(),v(`p`,md,[F(`span`,null,[a(M((`tl`in e?e.tl:f(Z))(`Inbox unavailable`,`Inbox indisponible`))+` · `,1),F(`code`,null,M(f(c)),1)]),E(n,{size:`xs`,color:`neutral`,variant:`outline`,onClick:p},{default:H(()=>[a(M((`tl`in e?e.tl:f(Z))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(i)===null&&f(s)?(_(),v(`p`,hd,[t[0]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`tl`in e?e.tl:f(Z))(`Reading the inbox…`,`Lecture de l’inbox…`)),1)])):g(``,!0),f(i)?(_(),v(k,{key:2},[f(i).length?(_(),v(`ul`,_d,[(_(!0),v(k,null,y(f(i),t=>(_(),v(`li`,{key:t.id,class:`pp-row`},[F(`div`,vd,[F(`div`,yd,[(_(),m(C(T(t)?`button`:`div`),{class:j([`pi-head`,{link:T(t)}]),type:T(t)?`button`:void 0,"aria-label":T(t)?(`tl`in e?e.tl:f(Z))(`Open the thread: ${D(t)}`,`Ouvrir le thread : ${D(t)}`):void 0,onClick:e=>T(t)&&r(`thread`,T(t))},{default:H(()=>[F(`span`,bd,[E(l,{name:S(t)},null,8,[`name`]),a(M(x(t)),1)]),F(`span`,xd,M(D(t)),1),F(`span`,Sd,M(O(t)),1)]),_:2},1032,[`class`,`type`,`aria-label`,`onClick`])),t.summary||t.body?(_(),v(`button`,{key:0,type:`button`,class:`pi-fold`,"aria-expanded":f(A).has(t.id),"aria-label":(`tl`in e?e.tl:f(Z))(`Show or fold the text`,`Afficher ou replier le texte`),onClick:e=>N(t.id)},[F(`span`,{class:j([`pi-text`,{open:f(A).has(t.id)}])},[t.summary?(_(),v(`span`,wd,M(t.summary),1)):g(``,!0),t.body?(_(),v(`span`,Td,M(t.body),1)):g(``,!0)],2)],8,Cd)):g(``,!0)]),E(u,{text:(`tl`in e?e.tl:f(Z))(`Mark as handled`,`Marquer comme traité`),disabled:!(`desk`in e?e.desk:f(Q))},{default:H(()=>[E(n,{icon:`i-lucide-check`,color:`neutral`,variant:`outline`,class:`pi-done`,loading:f(P)===t.id,disabled:f(P)!==null,"aria-label":(`tl`in e?e.tl:f(Z))(`Mark as handled: ${D(t)}`,`Marquer comme traité : ${D(t)}`),onClick:e=>I(t)},null,8,[`loading`,`disabled`,`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])])]))),128))])):(_(),v(`p`,gd,M((`tl`in e?e.tl:f(Z))(`Nothing waiting in the inbox`,`Rien en attente dans l’inbox`)),1)),f(o)>f(i).length?(_(),v(`p`,Ed,M((`tl`in e?e.tl:f(Z))(`${f(i).length} oldest of ${f(o)} shown`,`${f(i).length} plus anciens affichés sur ${f(o)}`)),1)):g(``,!0)],64)):g(``,!0)])}}}),{__name:`ProjectInbox`}),Od={class:`pr`},kd={key:0,class:`pp-notice error`,role:`alert`},Ad={key:1,class:`pp-notice`},jd={key:0,class:`pp-empty pi-none`},Md={key:1,class:`pp-list pi-list`},Nd={class:`pr-head`},Pd={class:`pr-name`},Fd={class:`pr-schedule`},Id={class:`pr-facts`},Ld={key:0},Rd={class:`wide`},zd={class:`pp-card pr-card broken`},Bd={class:`pr-head`},Vd={class:`pr-name`},Hd={class:`pr-error`},Ud={key:2,class:`pp-empty pi-more`},Wd=Object.assign(T({__name:`ProjectRoutines`,props:{paneId:{},board:{},tick:{}},setup(e){let t=e,n=u(null),r=h(!1),i=h(``),o=0;async function s(){if(Dn.value)return;let e=++o;r.value=!0;try{let r=await qt(t.paneId);if(e!==o)return;n.value=r,i.value=``}catch(t){e===o&&(i.value=t.message)}finally{e===o&&(r.value=!1)}}return w(s),z(()=>[t.tick,t.board.version],s),l(()=>{o++}),(e,t)=>{let o=Oe,c=De;return _(),v(`div`,Od,[f(i)?(_(),v(`p`,kd,[F(`span`,null,[a(M((`tl`in e?e.tl:f(Z))(`Routines unavailable`,`Routines indisponibles`))+` · `,1),F(`code`,null,M(f(i)),1)]),E(o,{size:`xs`,color:`neutral`,variant:`outline`,onClick:s},{default:H(()=>[a(M((`tl`in e?e.tl:f(Z))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(n)===null&&f(r)?(_(),v(`p`,Ad,[t[0]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`tl`in e?e.tl:f(Z))(`Reading the routines…`,`Lecture des routines…`)),1)])):g(``,!0),f(n)?(_(),v(k,{key:2},[!f(n).routines.length&&!f(n).broken.length?(_(),v(`p`,jd,M((`tl`in e?e.tl:f(Z))(`No routine in this project`,`Aucune routine dans ce projet`)),1)):(_(),v(`ul`,Md,[(_(!0),v(k,null,y(f(n).routines,n=>(_(),v(`li`,{key:n.name,class:`pp-row`},[F(`div`,{class:j([`pp-card pr-card`,{off:!n.enabled}])},[F(`div`,Nd,[F(`span`,Pd,M(n.name),1),F(`span`,{class:j([`pill`,n.enabled?`done`:`inactive`])},[t[1]||=F(`i`,null,null,-1),a(M(n.enabled?(`tl`in e?e.tl:f(Z))(`Enabled`,`Activée`):(`tl`in e?e.tl:f(Z))(`Disabled`,`Désactivée`)),1)],2)]),F(`span`,Fd,[E(c,{name:`i-lucide-alarm-clock`}),a(M(n.schedule),1)]),F(`dl`,Id,[n.kind?(_(),v(`div`,Ld,[F(`dt`,null,M((`tl`in e?e.tl:f(Z))(`Kind`,`Type`)),1),F(`dd`,null,M(n.kind),1)])):g(``,!0),(_(!0),v(k,null,y(n.when,(e,t)=>(_(),v(`div`,{key:t},[F(`dd`,Rd,M(e),1)]))),128))])],2)]))),128)),(_(!0),v(k,null,y(f(n).broken,e=>(_(),v(`li`,{key:e.file,class:`pp-row`},[F(`div`,zd,[F(`div`,Bd,[F(`span`,Vd,M(e.file),1)]),F(`p`,Hd,M(e.error),1)])]))),128))])),f(n).routines.length||f(n).broken.length?(_(),v(`p`,Ud,M((`tl`in e?e.tl:f(Z))(`Read-only. Routines are approved and switched from the terminal.`,`Lecture seule. Les routines s’approuvent et s’activent depuis le terminal.`)),1)):g(``,!0)],64)):g(``,!0)])}}}),{__name:`ProjectRoutines`}),Gd={class:`ps`},Kd={key:0,class:`pp-notice error`,role:`alert`},qd={key:1,class:`pp-notice`},Jd={class:`ps-list`},Yd={class:`ps-label`},Xd={class:`ps-key`},Zd={key:0,class:`ps-default`},Qd={class:`pt-label ps-head`},$d={class:`pp-count`},ef={key:0,class:`pp-empty ps-none`},tf={key:1,class:`ps-repos`},nf={key:0,class:`ps-default`},rf={class:`pp-empty ps-note`},af=Object.assign(T({__name:`ProjectSettings`,props:{paneId:{},board:{},tick:{}},setup(e){let t=e,r=u(null),i=h(!1),o=h(``),s=0;async function c(){if(Dn.value)return;let e=++s;i.value=!0;try{let n=await it(t.paneId);if(e!==s)return;r.value=n.settings,o.value=``}catch(t){e===s&&(o.value=t.message)}finally{e===s&&(i.value=!1)}}w(c),z(()=>[t.tick,t.board.version],c),l(()=>{s++});let d=e=>e?Z(`On`,`Oui`):Z(`Off`,`Non`),p=e=>e===0?Z(`Never`,`Jamais`):Z(`${e} day${e===1?``:`s`}`,`${e} jour${e>1?`s`:``}`),m=n(()=>{let e=r.value;return e?[{key:`name`,label:Z(`Name`,`Nom`),toml:`name`,value:e.name||`—`},{key:`goal`,label:Z(`Goal`,`Objectif`),toml:`goal`,value:e.goal||`—`},{key:`coordinatorProfile`,label:Z(`Coordinator profile`,`Profil du coordinateur`),toml:`coordinator_profile`,value:e.coordinatorProfile},{key:`threadProfile`,label:Z(`Thread profile`,`Profil des threads`),toml:`thread_profile`,value:e.threadProfile},{key:`maxParallelThreads`,label:Z(`Parallel threads`,`Threads en parallèle`),toml:`max_parallel_threads`,value:String(e.maxParallelThreads)},{key:`autoResolveDays`,label:Z(`Auto-resolve after`,`Clôture automatique après`),toml:`auto_resolve_days`,value:p(e.autoResolveDays)},{key:`nudge`,label:Z(`Nudge the coordinator`,`Relancer le coordinateur`),toml:`nudge`,value:d(e.nudge)},{key:`mute`,label:Z(`Mute notifications`,`Notifications en sourdine`),toml:`mute`,value:d(e.mute)}]:[]});return(e,t)=>{let n=Oe;return _(),v(`div`,Gd,[f(o)?(_(),v(`p`,Kd,[F(`span`,null,[a(M((`tl`in e?e.tl:f(Z))(`Settings unavailable`,`Réglages indisponibles`))+` · `,1),F(`code`,null,M(f(o)),1)]),E(n,{size:`xs`,color:`neutral`,variant:`outline`,onClick:c},{default:H(()=>[a(M((`tl`in e?e.tl:f(Z))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(r)===null&&f(i)?(_(),v(`p`,qd,[t[0]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`tl`in e?e.tl:f(Z))(`Reading the settings…`,`Lecture des réglages…`)),1)])):g(``,!0),f(r)?(_(),v(k,{key:2},[F(`dl`,Jd,[(_(!0),v(k,null,y(f(m),t=>(_(),v(`div`,{key:t.key,class:`ps-row`},[F(`dt`,null,[F(`span`,Yd,M(t.label),1),F(`code`,Xd,M(t.toml),1)]),F(`dd`,null,[a(M(t.value),1),f(r).defaults.includes(t.key)?(_(),v(`span`,Zd,M((`tl`in e?e.tl:f(Z))(`default`,`par défaut`)),1)):g(``,!0)])]))),128))]),F(`h3`,Qd,[a(M((`tl`in e?e.tl:f(Z))(`Repositories`,`Dépôts`))+` `,1),F(`span`,$d,M(f(r).repos.length),1)]),f(r).repos.length?(_(),v(`ul`,tf,[(_(!0),v(k,null,y(f(r).repos,(e,t)=>(_(),v(`li`,{key:t},[F(`code`,null,M(e.path),1),e.machine?(_(),v(`span`,nf,M(e.machine),1)):g(``,!0)]))),128))])):(_(),v(`p`,ef,M((`tl`in e?e.tl:f(Z))(`No repository: threads start as tabs in the project`,`Aucun dépôt : les threads démarrent en onglets du projet`)),1)),F(`p`,rf,M((`tl`in e?e.tl:f(Z))(`Read-only. Change a setting with “herdr-projects set”, or ask the coordinator.`,`Lecture seule. Un réglage se change avec « herdr-projects set », ou en le demandant au coordinateur.`)),1)],64)):g(``,!0)])}}}),{__name:`ProjectSettings`}),of={class:`pm`},sf={key:0,class:`pp-notice error`,role:`alert`},cf={key:1,class:`pp-notice`},lf={key:0,class:`pp-empty pi-none`},uf={key:1,class:`pp-list pm-list`},df=[`aria-label`,`onClick`],ff={class:`pp-thread-title`},pf={key:0,class:`pm-hook`},mf={class:`pp-meta`},hf={key:0,class:`spinner pp-spin`},gf={key:2,class:`pp-empty ps-note`},_f={key:0,class:`pp-report pm-doc`},vf={class:`pp-meta pm-path`},yf={class:`md`},bf={key:0,class:`pp-notice`},xf=Object.assign(T({__name:`ProjectMemory`,props:{paneId:{},board:{},tick:{}},setup(e){let t=e,n=u(null),r=h(!1),i=h(``),o=0;async function s(){if(Dn.value)return;let e=++o;r.value=!0;try{let r=await Lt(t.paneId);if(e!==o)return;n.value=r.files,i.value=``}catch(t){e===o&&(i.value=t.message)}finally{e===o&&(r.value=!1)}}w(s),z(()=>[t.tick,t.board.version],s),l(()=>{o++});let c=h(null),d=h(!1),p=h(null);async function b(e){if(!p.value){if(e.missing)return $(Z(`This file is listed in MEMORY.md but does not exist`,`Ce fichier est cité dans MEMORY.md mais n’existe pas`),!0);p.value=e.name,X();try{let n=await xt(t.paneId,e.name);c.value={file:e,html:Yt(n.text,{plain:!0}),truncated:n.truncated},d.value=!0}catch(e){$(e.message,!0)}finally{p.value=null}}}return(e,t)=>{let o=Oe,l=De,u=ei,h=yi;return _(),v(`div`,of,[f(i)?(_(),v(`p`,sf,[F(`span`,null,[a(M((`tl`in e?e.tl:f(Z))(`Memory unavailable`,`Mémoire indisponible`))+` · `,1),F(`code`,null,M(f(i)),1)]),E(o,{size:`xs`,color:`neutral`,variant:`outline`,onClick:s},{default:H(()=>[a(M((`tl`in e?e.tl:f(Z))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(n)===null&&f(r)?(_(),v(`p`,cf,[t[1]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`tl`in e?e.tl:f(Z))(`Reading the memory…`,`Lecture de la mémoire…`)),1)])):g(``,!0),f(n)?(_(),v(k,{key:2},[f(n).length?(_(),v(`ul`,uf,[(_(!0),v(k,null,y(f(n),t=>(_(),v(`li`,{key:t.name,class:`pp-row`},[F(`div`,{class:j([`pp-card pm-card`,{missing:t.missing,index:t.index}])},[F(`button`,{type:`button`,class:`pp-thread pm-file`,"aria-label":(`tl`in e?e.tl:f(Z))(`Memory: ${t.title}`,`Mémoire : ${t.title}`),onClick:e=>b(t)},[F(`span`,ff,M(t.index?(`tl`in e?e.tl:f(Z))(`Index`,`Index`):t.title),1),t.hook?(_(),v(`span`,pf,M(t.hook),1)):g(``,!0),F(`span`,mf,M(t.index?t.name:`memory/${t.name}`)+M(t.missing?(`tl`in e?e.tl:f(Z))(` · missing`,` · absent`):``),1)],8,df),f(p)===t.name?(_(),v(`span`,hf)):(_(),m(l,{key:1,name:`i-lucide-chevron-right`,class:`pt-go`}))],2)]))),128))])):(_(),v(`p`,lf,M((`tl`in e?e.tl:f(Z))(`No memory in this project yet`,`Pas encore de mémoire dans ce projet`)),1)),f(n).length?(_(),v(`p`,gf,M((`tl`in e?e.tl:f(Z))(`Read-only. The coordinator writes the project’s memory.`,`Lecture seule. La mémoire du projet est écrite par le coordinateur.`)),1)):g(``,!0)],64)):g(``,!0),E(h,{open:f(d),"onUpdate:open":t[0]||=e=>te(d)?d.value=e:null,title:f(c)?f(c).file.index?f(c).file.name:f(c).file.title:``,wide:``,tall:``,screen:``},{default:H(()=>[f(c)?(_(),v(`div`,_f,[F(`p`,vf,M(f(c).file.index?f(c).file.name:`memory/${f(c).file.name}`),1),F(`div`,yf,[E(u,{html:f(c).html,typing:null},null,8,[`html`])]),f(c).truncated?(_(),v(`p`,bf,M((`tl`in e?e.tl:f(Z))(`File truncated (too long).`,`Fichier tronqué (trop long).`)),1)):g(``,!0)])):g(``,!0)]),_:1},8,[`open`,`title`])])}}}),{__name:`ProjectMemory`}),Sf=[`aria-label`],Cf={class:`pp-head`},wf={class:`pp-kicker`},Tf={key:0,class:`pp-slug`},Ef=[`aria-label`],Df=[`id`,`aria-selected`,`tabindex`,`onClick`],Of={key:0,class:`pp-tab-n`},kf=[`aria-labelledby`],Af={key:0,class:`pp-notice error`,role:`alert`},jf={key:1,class:`pp-notice`},Mf={key:2,class:`pp-notice error`},Nf={key:0,class:`pp-notice`},Pf={key:1,class:`pp-hint`},Ff=[`aria-label`],If=[`aria-expanded`,`onClick`],Lf={class:`pp-sec-title`},Rf={class:`pp-count`},zf={key:0,class:`pp-slots`},Bf={key:2,class:`pp-list`},Vf=[`onClick`],Hf={class:`pp-thread-title`},Uf={class:`pp-meta`},Wf={key:2,class:`spinner pp-spin`},Gf={key:0,class:`pp-task-body`},Kf={class:`pp-task-text`},qf={class:`pp-reason`},Jf={key:1,class:`pp-task-text`},Yf={key:2,class:`pp-tags`},Xf={key:1,class:`pp-task-body`},Zf={class:`pp-task-text`},Qf={key:0,class:`pp-reason`},$f={class:`pp-task-foot`},ep={key:0,class:`pp-sent`},tp=[`disabled`,`aria-label`,`onClick`],np={key:0,class:`spinner`},rp=[`disabled`,`aria-label`,`onClick`],ip={key:0,class:`spinner`},ap=[`disabled`,`aria-label`,`onClick`],op={key:0,class:`spinner`},sp=[`disabled`,`aria-label`,`onClick`],cp={key:0,class:`spinner`},lp=[`aria-label`,`onClick`],up=[`disabled`,`aria-label`,`onClick`],dp={key:0,class:`spinner`},fp=[`disabled`,`aria-label`,`onClick`],pp={key:0,class:`spinner`},mp=[`aria-label`,`onClick`],hp=[`disabled`,`aria-label`,`onClick`],gp={key:0,class:`spinner`},_p=[`aria-label`,`onClick`],vp=[`disabled`,`aria-label`,`onClick`],yp={key:0,class:`spinner`},bp=[`aria-label`,`onClick`],xp=[`aria-label`,`onClick`],Sp=[`aria-label`,`onClick`],Cp=[`disabled`,`aria-label`,`onClick`],wp={key:0,class:`spinner`},Tp=[`disabled`,`aria-label`,`onClick`],Ep={key:0,class:`spinner`},Dp=[`aria-label`,`onClick`],Op={key:0,class:`pp-empty`},kp={class:`pp-list pp-all`},Ap={class:`pp-card resolved`},jp=[`onClick`],Mp={class:`pp-thread-title`},Np={class:`pp-meta`},Pp={key:0,class:`spinner pp-spin`},Fp={class:`pp-info-for`},Ip={class:`pp-info-id`},Lp={class:`pp-info-title`},Rp={class:`plugin-input-hint`},zp={class:`rename-actions`},Bp=new Map,Vp=Object.assign(T({__name:`ProjectPanel`,props:{paneId:{},board:{},loading:{type:Boolean},error:{},side:{type:Boolean}},emits:[`reload`,`collapse`,`sent`,`prefill`],setup(e,{emit:t}){let r=e,i=t,o=[{key:`tasks`,label:Z(`Tasks`,`Tâches`)},{key:`threads`,label:`Threads`},{key:`inbox`,label:`Inbox`},{key:`routines`,label:`Routines`},{key:`settings`,label:Y(`Settings`)},{key:`memory`,label:Z(`Memory`,`Mémoire`)}],s=Bp.get(r.paneId),c=h(o.some(e=>e.key===s)?s:`tasks`);function u(e){c.value!==e&&(c.value=e,Bp.set(r.paneId,e),X())}function d(e,t){u(e),t.currentTarget.scrollIntoView?.({block:`nearest`,inline:`nearest`})}let p=b(`tabBar`),x=h({left:!1,right:!1});function S(){let e=p.value;e&&(x.value={left:e.scrollLeft>2,right:e.scrollLeft+e.clientWidth<e.scrollWidth-2})}let C=null;z(p,e=>{C?.disconnect(),C=null,e&&(S(),typeof ResizeObserver<`u`&&(C=new ResizeObserver(S),C.observe(e)),e.querySelector(`.pp-tab.on`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}))},{flush:`post`}),l(()=>C?.disconnect());function T(e){let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0;if(!t)return;e.preventDefault();let n=o[(o.findIndex(e=>e.key===c.value)+t+o.length)%o.length],r=e.currentTarget;u(n.key),N(()=>{let e=r.querySelector(`.pp-tab.on`);e?.focus(),e?.scrollIntoView?.({block:`nearest`,inline:`nearest`})})}let D=h(null),O=e=>e===`threads`&&r.board?r.board.open.length:e===`inbox`?D.value:null,A=h(0);function P(){A.value++,i(`reload`)}function I(e){ne.value&&r.board&&ui(ne.value,r.board.slug,e)||e.report?re(e):u(`threads`)}let L=n(()=>r.board?le(Xe(r.board,{doing:Y(`In progress`),done:Z(`Done`,`Fait`)}),Mr.value):[]),R={test:`i-lucide-flask-conical`,decide:`i-lucide-signpost`,review:`i-lucide-git-pull-request`,blocked:`i-lucide-octagon-alert`,doing:`i-lucide-activity`,queue:`i-lucide-list-ordered`,todo:`i-lucide-list-todo`,backlog:`i-lucide-archive`,done:`i-lucide-circle-check`},B=e=>e?R[e]:`i-lucide-list`,V=h({}),U=e=>!(V.value[e.key]??e.kind===`done`);function ee(e){V.value={...V.value,[e.key]:U(e)},X()}let W=e=>e.tasks.filter(e=>!e.done).length+e.threads.length,ne=n(()=>Xn.value.panes.find(e=>e.id===r.paneId));function re(e){ne.value&&r.board&&di(ne.value,r.board.slug,e)}let ie=h(!1),q=()=>Kn===`en`?`en`:`fr`,ae=ha;z(()=>r.board,e=>{e&&ma(r.paneId,e)},{immediate:!0});async function oe(e,t,n,a){let o=await ga(r.paneId,e,t,n,a);o!==!1&&((t===`up`||t===`down`)&&$(Y(`Sent to the coordinator`)),i(`sent`,o))}let se=(e,t)=>e.kind===`test`&&!t.done,ce=(e,t)=>e.kind===`decide`&&!t.done,ue=(e,t)=>e.kind===`backlog`&&!t.done,de=(e,t)=>e.kind===`blocked`&&!t.done,fe=(e,t)=>e.kind===`review`&&!t.done,pe=(e,t)=>(e.kind===`todo`||e.kind===`queue`)&&!t.done,me=(e,t)=>e.kind===`doing`&&!t.done&&!!t.thread&&!r.board?.resolved.some(e=>e.id===t.thread),he=(e,t)=>se(e,t)||ce(e,t)||ue(e,t)||de(e,t)||fe(e,t)||pe(e,t)||me(e,t),ge=(e,t)=>(se(e,t)||ue(e,t)||de(e,t)||fe(e,t)||pe(e,t))&&va(r.paneId,e.kind,t.text),_e=(e,t,n)=>la(e.kind,t,n.text),ve=e=>e.tasks.filter(e=>!e.done),ye=(e,t)=>ve(e)[0]===t,be=(e,t)=>ve(e).at(-1)===t,xe=(e,t,n)=>oe(e.kind,n,t.text,ut(n,t.text,q())),Se=e=>e.kind===`queue`?pt(r.board?.slots,ve(e)[0]?.text,q()):null,Ce=e=>e.kind===`queue`?mi(r.board?.machineSlots,q()):null,we=n(()=>!!(r.board?.machineSlots&&r.board.machineSlots.open>=r.board.machineSlots.max)),Te=e=>oe(`review`,`reviewed`,e.text,en(e.text,q())),Ee=e=>oe(`test`,`tested`,e.text,et(e.text,q())),ke=e=>oe(`backlog`,`launch`,e.text,Qt(e.text,q())),Ae=e=>oe(`blocked`,`unblock`,e.text,Ie(e.text,q()));function je(e,t){X();let n={problem:kt,question:gt,decision:Gt,detail:nt,comment:Je}[t];i(`prefill`,n(e.text,q()))}let Me=h(null),Ne=h(!1),Pe=h(``),Fe=h(!1),Le=h(null),Re=new Map;function ze(e,t){X(),Me.value={id:e,title:t},Pe.value=Re.get(e)||``,Ne.value=!0,setTimeout(()=>Le.value?.textareaRef?.focus(),80)}z(Pe,e=>{Me.value&&Re.set(Me.value.id,e)});async function Be(){let e=Me.value;if(e&&!Fe.value&&Pe.value.trim()){Fe.value=!0,X();try{let t=await fa(r.paneId,Tt(e.id,Pe.value,q()));if(t===!1)return;Ne.value=!1,Pe.value=``,Re.delete(e.id),$(Y(`Sent to the coordinator`)),i(`sent`,t)}catch(e){$(e.message,!0)}finally{Fe.value=!1}}}let Ve=`hw-project-hint-off`,He=h(!1);w(()=>{try{He.value=localStorage.getItem(Ve)===`1`}catch{}});let Ue=n(()=>r.board&&!r.board.tasksMissing?ot(r.board.lists):[]),We=n(()=>{let e=Ue.value.map(e=>e===`test`?Z(`“To test”`,`« À tester »`):Z(`“To decide”`,`« À décider »`));return Z(`No ${e.join(` or `)} list in TASKS.md.`,`Pas de liste ${e.join(` ni `)} dans TASKS.md.`)});function Ge(){He.value=!0;try{localStorage.setItem(Ve,`1`)}catch{}}return(t,n)=>{let r=Oe,s=Qr,l=dd,u=Dd,h=Wd,b=af,C=xf,w=dn,N=De,R=da,z=_a,V=yi,q=Li;return _(),v(`aside`,{class:j([`project-panel`,{side:e.side}]),"aria-label":(`t`in t?t.t:f(Y))(`Project`)},[F(`header`,Cf,[F(`span`,wf,M((`t`in t?t.t:f(Y))(`Project`)),1),e.board?(_(),v(`span`,Tf,M(e.board.slug),1)):g(``,!0),n[9]||=F(`span`,{class:`pp-grow`},null,-1),E(s,{text:(`t`in t?t.t:f(Y))(`Refresh`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[E(r,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`ghost`,size:`sm`,class:j([`icon-btn pp-btn`,{spinning:e.loading}]),"aria-label":(`t`in t?t.t:f(Y))(`Refresh`),onClick:P},null,8,[`class`,`aria-label`])]),_:1},8,[`text`,`disabled`]),e.side?(_(),m(s,{key:1,text:(`t`in t?t.t:f(Y))(`Collapse the panel`)},{default:H(()=>[E(r,{icon:`i-lucide-panel-right-close`,color:`neutral`,variant:`ghost`,size:`sm`,class:`icon-btn pp-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Collapse the panel`),onClick:n[0]||=e=>i(`collapse`)},null,8,[`aria-label`])]),_:1},8,[`text`])):g(``,!0)]),e.board?(_(),v(`div`,{key:0,class:j([`pp-tabs-wrap`,{"more-left":f(x).left,"more-right":f(x).right}])},[F(`div`,{ref_key:`tabBar`,ref:p,class:`pp-tabs`,role:`tablist`,"aria-label":(`tl`in t?t.tl:f(Z))(`Project sections`,`Sections du projet`),onKeydown:T,onScrollPassive:S},[(_(),v(k,null,y(o,e=>F(`button`,{id:`pp-tab-${e.key}`,key:e.key,type:`button`,role:`tab`,class:j([`pp-tab`,{on:f(c)===e.key}]),"aria-selected":f(c)===e.key,tabindex:f(c)===e.key?0:-1,onClick:t=>d(e.key,t)},[F(`span`,null,M(e.label),1),O(e.key)===null?g(``,!0):(_(),v(`span`,Of,M(O(e.key)),1))],10,Df)),64))],40,Ef)],2)):g(``,!0),F(`div`,{class:`pp-scroll`,role:`tabpanel`,"aria-labelledby":e.board?`pp-tab-${f(c)}`:void 0},[e.error&&!e.board?(_(),v(`p`,Af,M(e.error),1)):g(``,!0),!e.board&&e.loading?(_(),v(`p`,jf,[n[10]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in t?t.t:f(Y))(`Reading the project…`)),1)])):g(``,!0),e.board?.threadsError?(_(),v(`p`,Mf,[a(M((`t`in t?t.t:f(Y))(`Threads unavailable`))+` · `,1),F(`code`,null,M(e.board.threadsError),1)])):g(``,!0),e.board&&f(c)===`threads`?(_(),m(l,{key:3,"pane-id":e.paneId,board:e.board,onReload:n[1]||=e=>i(`reload`),onReport:n[2]||=n=>(`openThreadReport`in t?t.openThreadReport:f(ci))(e.paneId,n),onAgent:re},null,8,[`pane-id`,`board`])):e.board&&f(c)===`inbox`?(_(),m(u,{key:4,"pane-id":e.paneId,board:e.board,tick:f(A),onCount:n[3]||=e=>D.value=e,onThread:I},null,8,[`pane-id`,`board`,`tick`])):e.board&&f(c)===`routines`?(_(),m(h,{key:5,"pane-id":e.paneId,board:e.board,tick:f(A)},null,8,[`pane-id`,`board`,`tick`])):e.board&&f(c)===`settings`?(_(),m(b,{key:6,"pane-id":e.paneId,board:e.board,tick:f(A)},null,8,[`pane-id`,`board`,`tick`])):e.board&&f(c)===`memory`?(_(),m(C,{key:7,"pane-id":e.paneId,board:e.board,tick:f(A)},null,8,[`pane-id`,`board`,`tick`])):e.board?(_(),v(k,{key:8},[e.board.tasksMissing?(_(),v(`p`,Nf,M((`t`in t?t.t:f(Y))(`No TASKS.md in this project yet.`)),1)):g(``,!0),f(Ue).length&&!f(He)?(_(),v(`p`,Pf,[F(`span`,null,[a(M(f(We))+` `,1),E(w,{to:`/settings?section=plugins`},{default:H(()=>[a(M((`tl`in t?t.tl:f(Z))(`See the convention`,`Voir la convention`)),1)]),_:1})]),F(`button`,{type:`button`,class:`pp-hint-x`,"aria-label":(`tl`in t?t.tl:f(Z))(`Hide the suggestion`,`Masquer la suggestion`),onClick:Ge},[E(N,{name:`i-lucide-x`})],8,Ff)])):g(``,!0),(_(!0),v(k,null,y(f(L),i=>(_(),v(`section`,{key:i.key,class:j([`pp-sec`,[i.kind,{folded:!U(i)}]])},[F(`button`,{type:`button`,class:`pp-sec-head`,"aria-expanded":U(i),onClick:e=>ee(i)},[E(N,{name:B(i.kind),class:`pp-sec-icon`},null,8,[`name`]),F(`span`,Lf,M(i.title),1),F(`span`,Rf,M(W(i)),1),E(N,{name:`i-lucide-chevron-down`,class:`pp-chev`})],8,If),U(i)&&Se(i)?(_(),v(`p`,zf,M(Se(i)),1)):g(``,!0),U(i)&&Ce(i)?(_(),v(`p`,{key:1,class:j([`pp-slots machine`,{full:f(we)}])},M(Ce(i)),3)):g(``,!0),U(i)?(_(),v(`ul`,Bf,[(_(!0),v(k,null,y(i.kind===`done`?i.threads.slice(0,20):i.threads,i=>(_(),v(`li`,{key:i.id,class:`pp-row`},[F(`div`,{class:j([`pp-card`,{resolved:i.resolved}])},[F(`button`,{type:`button`,class:`pp-thread`,onClick:n=>i.resolved?(`openThreadReport`in t?t.openThreadReport:f(ci))(e.paneId,i):re(i)},[i.resolved?g(``,!0):(_(),v(`span`,{key:0,class:j([`pill`,(`threadClass`in t?t.threadClass:f(ua))(i)])},[n[11]||=F(`i`,null,null,-1),a(M((`threadLabel`in t?t.threadLabel:f(pa))(i)),1)],2)),F(`span`,Hf,M(i.title),1),F(`span`,Uf,M((`threadMeta`in t?t.threadMeta:f(ya))(i)),1)],8,Vf),i.resolved?g(``,!0):(_(),m(s,{key:0,text:(`tl`in t?t.tl:f(Z))(`Add info for this thread`,`Ajouter une info pour ce thread`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[E(r,{icon:`i-lucide-message-square-plus`,color:`neutral`,variant:`ghost`,size:`sm`,class:`icon-btn pp-btn pp-info-btn`,"aria-label":(`tl`in t?t.tl:f(Z))(`Add info: ${i.title}`,`Ajouter une info : ${i.title}`),onClick:e=>ze(i.id,i.title)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])),i.report&&!i.resolved?(_(),m(r,{key:1,icon:`i-lucide-file-text`,color:`neutral`,variant:`ghost`,size:`sm`,class:`icon-btn pp-btn`,loading:(`threadReportLoading`in t?t.threadReportLoading:f(ii))===i.id,"aria-label":(`t`in t?t.t:f(Y))(`View report`),onClick:n=>(`openThreadReport`in t?t.openThreadReport:f(ci))(e.paneId,i)},null,8,[`loading`,`aria-label`,`onClick`])):(`threadReportLoading`in t?t.threadReportLoading:f(ii))===i.id?(_(),v(`span`,Wf)):g(``,!0)],2)]))),128)),(_(!0),v(k,null,y(i.tasks,(r,o)=>(_(),v(`li`,{key:`t${o}`,class:j([`pp-row pp-task`,{done:r.done,testable:se(i,r),decidable:ce(i,r),launchable:ue(i,r),unblockable:de(i,r),reviewable:fe(i,r),sent:ge(i,r),orderable:pe(i,r)}])},[n[12]||=F(`span`,{class:`pp-box`,"aria-hidden":`true`},null,-1),he(i,r)?(_(),v(`span`,Xf,[F(`span`,Zf,[E(R,{text:r.text},null,8,[`text`])]),r.reason?(_(),v(`span`,Qf,M(r.reason),1)):g(``,!0),F(`span`,$f,[ge(i,r)?(_(),v(`span`,ep,[E(N,{name:`i-lucide-send`}),a(M((`t`in t?t.t:f(Y))(`Sent to the coordinator`)),1)])):g(``,!0),r.badges&&f(ne)?(_(),m(z,{key:1,badges:r.badges,coordinator:f(ne),board:e.board},null,8,[`badges`,`coordinator`,`board`])):g(``,!0),me(i,r)||ce(i,r)||ue(i,r)||de(i,r)||(fe(i,r)||se(i,r)||pe(i,r))&&!ge(i,r)?(_(),v(`span`,{key:2,class:j([`pp-verdict`,{wrap:pe(i,r)}])},[pe(i,r)?(_(),v(k,{key:0},[E(s,{text:(`tl`in t?t.tl:f(Z))(`Move up`,`Monter`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn move`,disabled:f(ae)!==null||ye(i,r),"aria-label":(`tl`in t?t.tl:f(Z))(`Move up: ${r.text}`,`Monter : ${r.text}`),onClick:e=>xe(i,r,`up`)},[f(ae)===_e(i,`up`,r)?(_(),v(`span`,np)):(_(),m(N,{key:1,name:`i-lucide-arrow-up`}))],8,tp)]),_:2},1032,[`text`,`disabled`]),E(s,{text:(`tl`in t?t.tl:f(Z))(`Move down`,`Descendre`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn move`,disabled:f(ae)!==null||be(i,r),"aria-label":(`tl`in t?t.tl:f(Z))(`Move down: ${r.text}`,`Descendre : ${r.text}`),onClick:e=>xe(i,r,`down`)},[f(ae)===_e(i,`down`,r)?(_(),v(`span`,ip)):(_(),m(N,{key:1,name:`i-lucide-arrow-down`}))],8,rp)]),_:2},1032,[`text`,`disabled`]),i.kind===`todo`?(_(),m(s,{key:0,text:(`tl`in t?t.tl:f(Z))(`Queue it: launched automatically when a thread slot frees`,`Mettre en file : lancé automatiquement dès qu’une place de thread se libère`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn backlog-action queue`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(Z))(`Queue it: ${r.text}`,`Mettre en file : ${r.text}`),onClick:e=>xe(i,r,`queue`)},[f(ae)===_e(i,`queue`,r)?(_(),v(`span`,op)):(_(),m(N,{key:1,name:`i-lucide-list-plus`})),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`Queue`,`En file`)),1)],8,ap)]),_:2},1032,[`text`,`disabled`])):g(``,!0),E(s,{text:i.kind===`queue`?(`tl`in t?t.tl:f(Z))(`Launch now, ahead of the queue`,`Lancer maintenant, avant la file`):(`tl`in t?t.tl:f(Z))(`Launch now if a thread slot is free, otherwise first in the queue`,`Lancer maintenant si une place de thread est libre, sinon en tête de file`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn backlog-action launch`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(Z))(`Launch now: ${r.text}`,`Lancer maintenant : ${r.text}`),onClick:e=>xe(i,r,`now`)},[f(ae)===_e(i,`now`,r)?(_(),v(`span`,cp)):(_(),m(N,{key:1,name:`i-lucide-play`})),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`Launch`,`Lancer`)),1)],8,sp)]),_:2},1032,[`text`,`disabled`]),E(s,{text:(`tl`in t?t.tl:f(Z))(`Clarify this task`,`Préciser cette tâche`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn clarify`,"aria-label":(`tl`in t?t.tl:f(Z))(`Clarify: ${r.text}`,`Préciser : ${r.text}`),onClick:e=>je(r,`detail`)},[E(N,{name:`i-lucide-pencil`})],8,lp)]),_:2},1032,[`text`,`disabled`]),i.kind===`todo`?(_(),m(s,{key:1,text:(`tl`in t?t.tl:f(Z))(`Back to backlog`,`Remettre au backlog`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn park`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(Z))(`Back to backlog: ${r.text}`,`Remettre au backlog : ${r.text}`),onClick:e=>xe(i,r,`backlog`)},[f(ae)===_e(i,`backlog`,r)?(_(),v(`span`,dp)):(_(),m(N,{key:1,name:`i-lucide-archive`}))],8,up)]),_:2},1032,[`text`,`disabled`])):(_(),m(s,{key:2,text:(`tl`in t?t.tl:f(Z))(`Remove from queue (back to To do)`,`Retirer de la file (retour en À faire)`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn park`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(Z))(`Remove from queue: ${r.text}`,`Retirer de la file : ${r.text}`),onClick:e=>xe(i,r,`unqueue`)},[f(ae)===_e(i,`unqueue`,r)?(_(),v(`span`,pp)):(_(),m(N,{key:1,name:`i-lucide-list-x`}))],8,fp)]),_:2},1032,[`text`,`disabled`]))],64)):g(``,!0),me(i,r)?(_(),m(s,{key:1,text:(`tl`in t?t.tl:f(Z))(`Add info for this thread`,`Ajouter une info pour ce thread`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn backlog-action info`,"aria-label":(`tl`in t?t.tl:f(Z))(`Add info: ${r.text}`,`Ajouter une info : ${r.text}`),onClick:e=>ze(r.thread,r.text)},[E(N,{name:`i-lucide-message-square-plus`}),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`Add info`,`Ajouter info`)),1)],8,mp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),fe(i,r)?(_(),m(s,{key:2,text:(`tl`in t?t.tl:f(Z))(`Reviewed: tell the coordinator`,`Relu : prévenir le coordinateur`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn backlog-action reviewed`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(Z))(`Reviewed: ${r.text}`,`Relu : ${r.text}`),onClick:e=>Te(r)},[f(ae)===(`sentKey`in t?t.sentKey:f(la))(`review`,`reviewed`,r.text)?(_(),v(`span`,gp)):(_(),m(N,{key:1,name:`i-lucide-check`})),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`Reviewed`,`Relu`)),1)],8,hp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),fe(i,r)?(_(),m(s,{key:3,text:(`tl`in t?t.tl:f(Z))(`Draft review feedback`,`Préparer un retour de relecture`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn backlog-action clarify`,"aria-label":(`tl`in t?t.tl:f(Z))(`Comment: ${r.text}`,`Commenter : ${r.text}`),onClick:e=>je(r,`comment`)},[E(N,{name:`i-lucide-message-square`}),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`Comment`,`Commenter`)),1)],8,_p)]),_:2},1032,[`text`,`disabled`])):g(``,!0),se(i,r)?(_(),m(s,{key:4,text:(`t`in t?t.t:f(Y))(`Confirm: tested, it works`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn ok`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(Z))(`Confirm: ${r.text}`,`Confirmer : ${r.text}`),onClick:e=>Ee(r)},[f(ae)===(`sentKey`in t?t.sentKey:f(la))(`test`,`tested`,r.text)?(_(),v(`span`,yp)):(_(),m(N,{key:1,name:`i-lucide-check`}))],8,vp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),se(i,r)?(_(),m(s,{key:5,text:(`t`in t?t.t:f(Y))(`Report a problem`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn ko`,"aria-label":(`tl`in t?t.tl:f(Z))(`Problem: ${r.text}`,`Problème : ${r.text}`),onClick:e=>je(r,`problem`)},[E(N,{name:`i-lucide-x`})],8,bp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),se(i,r)||ce(i,r)?(_(),m(s,{key:6,text:(`t`in t?t.t:f(Y))(`Ask a question`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn ask`,"aria-label":(`tl`in t?t.tl:f(Z))(`Question: ${r.text}`,`Question : ${r.text}`),onClick:e=>je(r,`question`)},[E(N,{name:`i-lucide-circle-help`})],8,xp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),ce(i,r)?(_(),m(s,{key:7,text:(`tl`in t?t.tl:f(Z))(`Answer this decision`,`Répondre à cette décision`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn decide`,"aria-label":(`tl`in t?t.tl:f(Z))(`Answer: ${r.text}`,`Répondre : ${r.text}`),onClick:e=>je(r,`decision`)},[E(N,{name:`i-lucide-reply`})],8,Sp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),ue(i,r)&&!ge(i,r)?(_(),m(s,{key:8,text:(`tl`in t?t.tl:f(Z))(`Send to coordinator`,`Envoyer au coordinateur`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn backlog-action launch`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(Z))(`Launch: ${r.text}`,`Lancer : ${r.text}`),onClick:e=>ke(r)},[f(ae)===(`sentKey`in t?t.sentKey:f(la))(`backlog`,`launch`,r.text)?(_(),v(`span`,wp)):(_(),m(N,{key:1,name:`i-lucide-play`})),F(`span`,null,M((`t`in t?t.t:f(Y))(`Launch`)),1)],8,Cp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),de(i,r)&&!ge(i,r)?(_(),m(s,{key:9,text:(`tl`in t?t.tl:f(Z))(`Ask to unblock this task`,`Demander de débloquer cette tâche`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn backlog-action unblock`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(Z))(`Unblock: ${r.text}`,`Débloquer : ${r.text}`),onClick:e=>Ae(r)},[f(ae)===(`sentKey`in t?t.sentKey:f(la))(`blocked`,`unblock`,r.text)?(_(),v(`span`,Ep)):(_(),m(N,{key:1,name:`i-lucide-lock-keyhole-open`})),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`Unblock`,`Débloquer`)),1)],8,Tp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),ue(i,r)||de(i,r)?(_(),m(s,{key:10,text:(`tl`in t?t.tl:f(Z))(`Clarify this task`,`Préciser cette tâche`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`pp-vbtn backlog-action clarify`,"aria-label":(`tl`in t?t.tl:f(Z))(`Clarify: ${r.text}`,`Préciser : ${r.text}`),onClick:e=>je(r,`detail`)},[E(N,{name:`i-lucide-pencil`}),F(`span`,null,M((`t`in t?t.t:f(Y))(`Clarify`)),1)],8,Dp)]),_:2},1032,[`text`,`disabled`])):g(``,!0)],2)):g(``,!0)])])):(_(),v(k,{key:0},[r.reason?(_(),v(`span`,Gf,[F(`span`,Kf,[E(R,{text:r.text},null,8,[`text`])]),F(`span`,qf,M(r.reason),1)])):(_(),v(`span`,Jf,[E(R,{text:r.text},null,8,[`text`])])),r.badges&&f(ne)?(_(),v(`span`,Yf,[E(z,{badges:r.badges,coordinator:f(ne),board:e.board},null,8,[`badges`,`coordinator`,`board`])])):g(``,!0)],64))],2))),128)),!i.tasks.length&&!i.threads.length?(_(),v(`li`,Op,M((`t`in t?t.t:f(Y))(`Nothing yet`)),1)):g(``,!0)])):g(``,!0),U(i)&&i.kind===`done`&&i.threads.length>20?(_(),v(`button`,{key:3,type:`button`,class:`pp-more`,onClick:n[4]||=e=>ie.value=!0},M((`tl`in t?t.tl:f(Z))(`See all (${i.threads.length})`,`Tout voir (${i.threads.length})`)),1)):g(``,!0)],2))),128))],64)):g(``,!0)],8,kf),E(V,{open:f(ie),"onUpdate:open":n[5]||=e=>te(ie)?ie.value=e:null,title:(`tl`in t?t.tl:f(Z))(`Done · ${e.board?.resolved.length||0} threads`,`Fait · ${e.board?.resolved.length||0} threads`),wide:``,screen:``},{default:H(()=>[F(`ul`,kp,[(_(!0),v(k,null,y(e.board?.resolved||[],n=>(_(),v(`li`,{key:n.id,class:`pp-row`},[F(`div`,Ap,[F(`button`,{type:`button`,class:`pp-thread`,onClick:r=>(`openThreadReport`in t?t.openThreadReport:f(ci))(e.paneId,n)},[F(`span`,Mp,M(n.title),1),F(`span`,Np,M((`threadMeta`in t?t.threadMeta:f(ya))(n)),1)],8,jp),(`threadReportLoading`in t?t.threadReportLoading:f(ii))===n.id?(_(),v(`span`,Pp)):g(``,!0)])]))),128))])]),_:1},8,[`open`,`title`]),E(V,{open:f(Ne),"onUpdate:open":n[8]||=e=>te(Ne)?Ne.value=e:null,title:(`tl`in t?t.tl:f(Z))(`Add info`,`Ajouter une info`),screen:``},{footer:H(()=>[F(`div`,zp,[E(r,{color:`neutral`,variant:`ghost`,class:`sheet-btn`,disabled:f(Fe),onClick:n[7]||=e=>Ne.value=!1},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Cancel`)),1)]),_:1},8,[`disabled`]),E(r,{type:`submit`,form:`pp-info-form`,color:`primary`,variant:`solid`,class:`sheet-btn hw-cta`,loading:f(Fe),disabled:!f(Pe).trim()},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Send`)),1)]),_:1},8,[`loading`,`disabled`])])]),default:H(()=>[f(Me)?(_(),v(`form`,{key:0,id:`pp-info-form`,class:`rename sheet-form pp-info`,onSubmit:K(Be,[`prevent`])},[F(`p`,Fp,[F(`span`,Ip,M(f(Me).id.toUpperCase()),1),F(`span`,Lp,M(f(Me).title),1)]),E(q,{ref_key:`infoField`,ref:Le,modelValue:f(Pe),"onUpdate:modelValue":n[6]||=e=>te(Pe)?Pe.value=e:null,rows:5,autoresize:``,maxrows:12,size:`xl`,class:`w-full`,"aria-label":(`tl`in t?t.tl:f(Z))(`Info for the thread`,`Info pour le thread`),placeholder:(`tl`in t?t.tl:f(Z))(`What the thread should know…`,`Ce que le thread doit savoir…`),onKeydown:[G(K(Be,[`meta`,`prevent`]),[`enter`]),G(K(Be,[`ctrl`,`prevent`]),[`enter`])]},null,8,[`modelValue`,`aria-label`,`placeholder`,`onKeydown`]),F(`p`,Rp,M((`tl`in t?t.tl:f(Z))(`Sent to the coordinator, which passes it on to the thread as is.`,`Envoyé au coordinateur, qui le transmet tel quel au thread.`)),1)],32)):g(``,!0)]),_:1},8,[`open`,`title`])],10,Sf)}}}),{__name:`ProjectPanel`}),Hp=[`aria-label`],Up=[`onClick`],Wp=[`aria-label`],Gp=Object.assign(T({__name:`Keybar`,props:{ctl:{},allDigits:{type:Boolean}},setup(e){let t=e,r=[{key:`esc`,label:`esc`},{key:`enter`,label:`⏎`,cls:`wide`},{key:`up`,label:`↑`},{key:`down`,label:`↓`},{key:`1`,label:`1`},{key:`2`,label:`2`},{key:`3`,label:`3`},{key:`tab`,label:`tab`},{key:`shift+tab`,label:`⇧tab`},{key:`left`,label:`←`},{key:`right`,label:`→`},{key:`ctrl+c`,label:`^C`,cls:`danger`},{key:`backspace`,label:`⌫`},{key:`y`,label:`y`},{key:`n`,label:`n`}],i=n(()=>t.allDigits?[...r.slice(0,7),...[`4`,`5`,`6`,`7`,`8`,`9`,`0`].map(e=>({key:e,label:e})),...r.slice(7)]:r);function a(e){X(),t.ctl.sendKeys([e])}function o(){t.ctl.hasFocus()?t.ctl.blur():t.ctl.focus()}return(t,n)=>{let r=De;return _(),v(`div`,{class:`keybar`,role:`toolbar`,"aria-label":(`t`in t?t.t:f(Y))(`Keys`)},[(_(!0),v(k,null,y(f(i),e=>(_(),v(`button`,{key:e.key,type:`button`,class:j(e.cls),onPointerdown:n[0]||=K(()=>{},[`prevent`]),onClick:t=>a(e.key)},M(e.label),43,Up))),128)),F(`button`,{type:`button`,class:j([`kbd`,{on:e.ctl.kbdOn.value}]),"aria-label":(`t`in t?t.t:f(Y))(`Type in terminal`),onPointerdown:n[1]||=K(()=>{},[`prevent`]),onClick:o},[E(r,{name:`i-lucide-keyboard`})],42,Wp)],8,Hp)}}}),{__name:`Keybar`}),Kp=`wherdr.mouse-selection-hint.dismissed`,qp=h(!1),Jp=!1;function Yp(){if(!Jp&&typeof localStorage<`u`){Jp=!0;try{qp.value=localStorage.getItem(Kp)===`1`}catch{}}let e=h(!1),t=typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches,r=n(()=>t&&e.value&&!qp.value);function i(t){e.value=t.modes.mouseTrackingMode!==`none`}function a(){qp.value=!0;try{localStorage.setItem(Kp,`1`)}catch{}}return{visible:r,refresh:i,dismiss:a}}var Xp=e(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
18
+ `).length:0);e.push({k:`shell`,key:`s:${t.ts}:${t.text.slice(0,40)}`,bash:t.role===`bash`,text:t.text,out:n,err:r,lines:i,long:i>Pu||n.length+r.length>1500})}else if(t.role===`notice`){let[n,r]=He[t.name||``]||[t.name||`Note`,`i-lucide-info`];e.push({k:`notice`,key:s,label:Y(n),icon:r,html:Kt(t.text),long:t.text.split(`
19
+ `).length>Pu||t.text.length>1200})}else{let n=t.role===`system`?t.text.match(/^Effort : (low|medium|high|xhigh|max|ultracode) \(cette session\)$/):null;e.push({k:`system`,key:s,text:n?X(`Effort: ${n[1]} (this session)`,`Effort : ${n[1]} (cette session)`):t.role===`system`?Y(t.text):t.text})}}),i();let p=!W.value&&s.pane.status===`blocked`;if(!Ye.value&&!p&&!s.pane.pendingPrompt)f();else{let t=e[e.length-1];t&&t.k===`tools`&&(Ye.value||p)&&(t.live=!0)}return e}),Ze=e=>qe.has(e);function Qe(e,t){t?qe.add(e):qe.delete(e)}let $e=e=>[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(t=>t.dataset.hitKey===e)||null,et=e=>{let t=e?.closest(`[data-hit-key]`)?.dataset.hitKey,n=t?Xe.value.find(e=>e.key===t):null;return n&&n.k===`assistant`?{time:n.time,id:n.rid}:{time:null,id:null}};function tt(e){let{time:t,id:n}=et(e);if(e.classList.contains(`q-all`))return _n({n:e.dataset.n||``,text:e.dataset.q||``},t,n,Dr(e));let r=e.closest(`.q-trow`);return r?Cn(Tn(r),t,n):e.dataset.q?fr(e.dataset.q,t,n):null}function nt(e){let t=Xe.value.find(t=>t.key===e);t&&t.k===`assistant`&&rt(Pn(t.text,t.time,t.rid))}function rt(e){let t=Ui(s.pane.id),n=e?Yr(t.text,e):null;St.value=null,window.getSelection()?.removeAllRanges(),n!==null&&(t.text=n),Q(),d(`quote`)}let it=e=>Y(e===`yes`?`Yes`:`No`),at=()=>{oe=!1,se=!0};function ot(e,t){if(!e)return;at();let n=Ui(s.pane.id),r=Wr(n.text,e,it(t));r!==null&&(n.text=r),Q()}function st(e){if(!e)return;at();let t=Ui(s.pane.id);t.text=Bn(t.text,e,X(`OK to all`,`OK tout`)),Q()}let ct=(e,t)=>Er(_r(_t.value,e)||``)===t;function ut(){let e=Ui(s.pane.id).text;for(let t of x.value?.querySelectorAll(`.q-ans, .q-tans`)||[]){let n=tt(t);t.setAttribute(`aria-pressed`,String(!!n&&Er(_r(e,n)||``)===t.dataset.a))}for(let t of x.value?.querySelectorAll(`.q-all`)||[])t.setAttribute(`aria-pressed`,String($n(e,tt(t))));for(let t of x.value?.querySelectorAll(`.q-reply, .q-point, .q-tquote`)||[]){let n=tt(t),r=!!n&&$n(e,n);if(t.classList.toggle(`quoted`,r),t.dataset.n&&!t.classList.contains(`q-tquote`))for(let e of dt(t))e.classList.toggle(`quoted`,r)}}let dt=e=>e.closest(`.md-body`)?.querySelectorAll(`.q-text[data-n="${e.dataset.n}"]`)||[],ft=e=>e.closest(`.md-body`)?.querySelector(`.q-reply[data-n="${e.dataset.n}"]`)||null,pt=null;function ht(e){pt?.classList.remove(`q-armed`),pt=e,e?.classList.add(`q-armed`)}let gt=h(null),_t=n(()=>Ui(s.pane.id).text);B(_t,e=>{e||(se=!1)});function vt(e,t,n){for(let r of $e(e)?.querySelectorAll(`.q-text[data-n="${t}"]`)||[])r.classList.toggle(`q-hot`,n)}let bt;function xt(e,t){let n=t.closest(`.msg-ai .md-body .q-pt`),r=n?.querySelector(`:scope > .q-point`),i=r?.dataset.q;if(clearTimeout(bt),!n||!i||t.closest(`a, button, summary, input`))return ht(null);if(mn.value===`list`){gt.value&&n.closest(`[data-hit-key]`)?.dataset.hitKey===gt.value&&(gt.value=null,rt(tt(r)));return}if(mn.value!==`text`||window.getSelection()?.isCollapsed===!1)return ht(null);if(wt())return ht(n===pt?null:n);e.detail>1||(bt=setTimeout(()=>{window.getSelection()?.isCollapsed!==!1&&rt(tt(r))},220))}l(()=>clearTimeout(bt)),B([()=>Ui(s.pane.id).text,Xe],()=>P(ut),{flush:`post`});let St=h(null),Ct=h(null),wt=()=>window.matchMedia(`(pointer: coarse)`).matches;function Tt(){let e=window.getSelection(),t=e&&!e.isCollapsed&&e.rangeCount?e.getRangeAt(0):null,n=(t?t.startContainer.nodeType===1?t.startContainer:t.startContainer.parentElement:null)?.closest(`.msg-ai[data-hit-key]`);if(!t||!n||W.value||!x.value?.contains(n))return null;let r=Wc(t,n.querySelector(`.md`)||n),i=r?.toString().trim()||``;if(!r||!i)return null;let a=Bc(r.getClientRects())||r.getBoundingClientRect();return{host:n,text:i,end:a,sig:`${i}|${Math.round(a.right)}|${Math.round(a.top)}`}}function Et(){let e=Tt();if(!e||!x.value){St.value=null;return}let t=x.value.getBoundingClientRect(),n=Vc(e.end,{width:Ct.value?.offsetWidth||104,height:Ct.value?.offsetHeight||32},{width:window.innerWidth,top:Math.max(0,t.top),bottom:Math.min(window.innerHeight,t.bottom)},wt());St.value=n?{text:e.text,...et(e.host),sig:e.sig,...n}:null}let Ot=Hc({show:Et,hide:()=>{St.value=null},touch:wt}),kt=e=>{e.button===0&&!e.target?.closest?.(`.sel-reply`)&&Ot.down()},At=()=>Ot.up(),jt=()=>Ot.change(!!St.value&&Tt()?.sig===St.value.sig),Mt=()=>{(St.value||window.getSelection()?.isCollapsed===!1)&&Ot.scroll()};w(()=>{document.addEventListener(`pointerdown`,kt,!0),document.addEventListener(`pointerup`,At,!0),document.addEventListener(`pointercancel`,At,!0),document.addEventListener(`selectionchange`,jt),window.addEventListener(`scroll`,Mt,!0),window.addEventListener(`resize`,Mt)}),l(()=>{Ot.dispose(),document.removeEventListener(`pointerdown`,kt,!0),document.removeEventListener(`pointerup`,At,!0),document.removeEventListener(`pointercancel`,At,!0),document.removeEventListener(`selectionchange`,jt),window.removeEventListener(`scroll`,Mt,!0),window.removeEventListener(`resize`,Mt)}),i(`gotoRef`,(e,t)=>{let n=t.closest(`[data-hit-key]`)?.dataset.hitKey,r=n?Xe.value.findIndex(e=>e.key===n):-1,i=(r<0?Xe.value:Xe.value.slice(0,r)).flatMap(e=>e.k===`assistant`?[{key:e.key,time:e.time,text:e.text,rid:e.rid}]:[]);Nt(Ar(i,{time:e.time||``,excerpt:e.excerpt,id:e.id&&Ir(e.id)})?.key||null)});function Nt(e){let t=e?$e(e):null;if(!t)return $(Y(`Original message not found (further up the conversation?)`),!0);t.scrollIntoView({block:`center`,behavior:`smooth`}),t.classList.remove(`msg-flash`),t.offsetWidth,t.classList.add(`msg-flash`),setTimeout(()=>t.classList.remove(`msg-flash`),1700)}async function Pt(e){try{await navigator.clipboard.writeText(e),$(Y(`Copied`))}catch{$(Y(`Copy failed`),!0)}}function Ft(e){let t=e.target,n=t.closest?.(`.q-ans`);if(n?.dataset.q){e.preventDefault(),ht(null),gt.value=null,ot(tt(n),n.dataset.a===`no`?`no`:`yes`);return}let r=t.closest?.(`.q-tans`);if(r?.dataset.n){e.preventDefault(),ht(null),gt.value=null,ot(tt(r),r.dataset.a===`no`?`no`:`yes`);return}let i=t.closest?.(`.q-all`);if(i){e.preventDefault(),ht(null),gt.value=null,st(tt(i));return}let a=t.closest?.(`.q-reply, .q-point, .q-tquote`);if(a){e.preventDefault(),ht(null),gt.value=null,rt(tt(a));return}let o=mn.value===`text`&&!W.value?t.closest?.(`.q-text`):null,s=o&&window.getSelection()?.isCollapsed!==!1?ft(o):null;if(s){e.preventDefault(),ht(null),rt(tt(s));return}let c=t.closest?.(`.md-body .md-path`);if(c){e.preventDefault(),qt(c);return}let l=t.closest?.(`.md-body .md-cmd`);if(l){e.preventDefault(),Rt(l);return}let u=t.closest?.(`.md-body img`);if(u&&u.src){e.preventDefault(),er(u.src);return}!W.value&&!t.closest?.(`.code-block`)&&xt(e,t);let d=(t.closest?.(`.can-run .code-run`))?.closest(`.code-block`)?.dataset.cmd;if(d){It(d);return}let f=t.closest?.(`.code-copy`);if(!f)return;let p=f.closest(`.code-block`),m=p?.dataset.cmd??p?.querySelector(`pre`)?.textContent;m!=null&&navigator.clipboard.writeText(m).then(()=>{f.textContent=Y(`Copied`),f.classList.add(`done`),setTimeout(()=>{f.textContent=Y(`Copy`),f.classList.remove(`done`)},1400)}).catch(()=>$(Y(`Copy failed`),!0))}async function It(e){let t=mt(s.pane.agent,e);if(!t||!te.value)return;if(s.pane.status===`blocked`&&s.pane.prompt)return $(X(`The agent is waiting for your answer: answer it first.`,`L’agent attend ta réponse : réponds-lui d’abord.`),!0);Q();let n=zn(s.pane.agent);if(await lt(X(`Run this command? ${n} runs it in its shell mode (!), in its own folder, and shows the output in the conversation.`,`Lancer cette commande ? ${n} l’exécute dans son mode shell (!), dans son propre dossier, et affiche la sortie dans la conversation.`),X(`Run`,`Lancer`),`primary`,e))try{d(`sent`,await Ht(s.pane,s.pane.id,t)),Q()}catch(e){$(e.message,!0)}}function Lt(e,t){let n=[];return t&&n.push({label:X(`Run…`,`Lancer…`),icon:`i-lucide-play`,run:()=>It(e)}),n.push({label:Y(`Copy command`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>Pt(e)}),n}function Rt(e){let t=e.dataset.cmd;t&&Ut(e,Lt(t,te.value&&!!e.closest(`.can-run`)),X(`Command`,`Commande`))}let zt=r({open:!1,x:0,y:0,w:0,h:0}),Vt=h([]);function Ut(e,t,n){if(Nr.value){Q(),Fe(t,n);return}let r=e.getBoundingClientRect();Object.assign(zt,{x:r.left,y:r.top,w:r.width,h:r.height}),Vt.value=ie(t),zt.open=!0}let Wt=e=>e.replace(/\/+$/,``).split(`/`).pop()||e;function Gt(e){let t=[];return!jn.value&&!e.endsWith(`/`)&&t.push({label:Y(`Preview`),icon:`i-lucide-eye`,run:()=>Yt(e)},{label:Y(`Download`),icon:`i-lucide-download`,run:()=>Xt(e)}),zr(s.pane)&&!jn.value&&t.push({label:Y(`Reveal in Finder`),icon:`i-lucide-folder-search`,run:()=>Qt(e,`reveal`)},{label:Y(`Open`),icon:`i-lucide-external-link`,run:()=>Qt(e,`open`)}),t.push({label:Y(`Copy path`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>Pt(e)}),t}function qt(e,t){let n=t||(e.textContent||``).trim();n&&Ut(e,Gt(n),Wt(n))}let Jt=r({open:!1,path:``});function Yt(e){Object.assign(Jt,{open:!0,path:e})}async function Xt(e){try{await jr(`/api/files/download?pane=${encodeURIComponent(s.pane.id)}&path=${encodeURIComponent(e)}&from=chat`,Wt(Je(e)))}catch(e){$(e.message,!0)}}function Zt(e){if(e.key===`Escape`&&(gt.value||pt)){gt.value=null,ht(null);return}if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`.md-body .md-path, .md-body .md-cmd`);t&&(e.preventDefault(),t.classList.contains(`md-cmd`)?Rt(t):qt(t))}async function Qt(e,t){try{let n=await kr(`/api/reveal`,{pane_id:s.pane.id,path:e,mode:t});$(t===`reveal`?X(`Shown in Finder on ${n.machine}`,`Affiché dans le Finder sur ${n.machine}`):X(`Opened in the editor on ${n.machine}`,`Ouvert dans l’éditeur sur ${n.machine}`))}catch(e){$(e.message,!0)}}let $t=n(()=>{if(W.value)return null;let e=s.pane;return e.agent===`omp`?e.ompShell?{shell:e.ompShell,sent:null,queued:[]}:null:e.agent===`claude`&&e.status===`working`&&e.claudeScreen||null}),en=n(()=>$t.value&&$t.value.shell||null),nn=h(Date.now()),rn;B(en,e=>{e&&!rn&&(rn=yr(()=>{nn.value=Date.now()},1e3)),!e&&rn&&(clearInterval(rn),rn=void 0)},{immediate:!0}),l(()=>clearInterval(rn));let an=n(()=>{let e=en.value&&en.value.since;if(!e)return null;let t=Math.max(0,Math.round((nn.value-e)/1e3));return t<60?`${t} s`:`${Math.floor(t/60)} min ${String(t%60).padStart(2,`0`)} s`}),on=n(()=>{let e=s.pane,t=Hi(W.value?[]:(e.queued||[]).filter(e=>!e.back),s.localQueued),n=Rc(e.id,t),r=Xe.value.filter(e=>e.k===`assistant`);return zc({mine:t,claude:C.value.queue||[],items:T.value,screen:$t.value,memory:n}).map(e=>{let t=e.raw.split(`
20
+ `),n=t.filter(e=>!hc(e)&&!Wi(e)).join(`
21
+ `).trim(),i=Lr(n);return{...e,srcs:e.photos.map(Cc),files:t.map(ca).filter(e=>!!e),text:n,body:i?i.body:n,reply:i?.reply||null,origin:i&&Ar(r,i.reply)?.key||null}})}),sn=e=>[...e.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...Array.from({length:e.missing},()=>({type:`file`,mediaType:`image/jpeg`,url:``})),...e.body||e.files.length?[{type:`text`,text:e.body||` `}]:[]],ln=n(()=>!W.value&&Ti(s.pane)),un=h(null);async function dn(e){if(!un.value){if(e.local){Pi(Ui(s.pane.id),ia(s.pane.id,e.id)||e.raw),d(`restored`);return}un.value=e.id,Q();try{let t=await kr(`/api/unqueue`,{pane_id:s.pane.id,text:e.raw,id:e.mine?e.id:void 0});Pi(Ui(s.pane.id),t.text||e.raw,e.pasted),d(`restored`),t.lost?$(Y(`Removed from the queue`),!0,Fi(t.lost)):$(Y(`Removed from the queue`)),setTimeout(Te,400)}catch(e){$(e.message,!0)}finally{un.value=null}}}let fn=h(null);async function pn(e){if(!fn.value){fn.value=e.id,Q();try{e.local?await ta(s.pane,s.pane.id,e.id):await kr(`/api/requeue`,{pane_id:s.pane.id,id:e.id})}catch(e){$(e.message,!0)}finally{fn.value=null}}}let hn=n(()=>{let e=s.pane;return e.pendingPrompt?X(`will be sent when ${zn(e.agent)} is ready`,`partira dès que ${zn(e.agent)} sera prêt`):e.status===`working`?Y(`will be read at the agent’s next step`):e.status===`blocked`?Y(`after you answer the question`):Y(`sending…`)});B(()=>on.value.map(e=>`${e.id}:${e.phase}`).join(`,`),()=>P(()=>ne(!1))),B(()=>en.value&&en.value.lines.join(`
22
+ `),()=>P(()=>ne(!1)));let gn=n(()=>{let e=s.pane;if(e.interaction===`terminal`||!O.value||O.value===`unsupported`||!e.screen||e.status===`working`||W.value)return null;let t=zn(e.agent);return Rr(e)?{text:X(`${t} is waiting for your answer, below or in the terminal.`,`${t} attend ta réponse, ci-dessous ou dans le terminal.`),lines:[]}:{text:X(`${t} is waiting for an action in the terminal.`,`${t} attend une action dans le terminal.`),lines:e.screen.lines}}),vn=n(()=>{if(W.value)return null;let e=s.pane;if(e.pendingPrompt&&e.status!==`working`)return{typing:!0,text:X(`Your first message will be sent when ${zn(e.agent)} is ready`,`Ton premier message partira dès que ${zn(e.agent)} sera prêt`)};if(en.value)return{typing:!0,text:X(`Command running…`,`Commande en cours…`)};if(e.status===`working`&&e.agent===`claude`&&e.activity)return{typing:!0,verb:!0,text:`${e.activity}…`};if(e.status===`working`&&e.agent===`omp`&&e.ompActivity){let t=e.ompActivity;return{typing:!0,omp:!0,since:t.since,text:t.step||`${zn(e.agent)} ${X(`is working…`,`travaille…`)}`}}return e.status===`working`?{typing:!0,text:`${zn(e.agent)} ${X(`is working…`,`travaille…`)}`}:e.status===`blocked`&&!(e.prompt&&e.prompt.options)&&!Rr(e)?{typing:!1,text:Y(`Waiting for your reply — details in the Terminal tab`)}:null});B(()=>s.pane.status,()=>P(()=>ne(!1)));let J=r({q:``,hits:[],cur:-1,loading:!1}),bn=!1,xn=h(null),En=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase(),Dn=typeof CSS<`u`&&`highlights`in CSS?CSS.highlights:null,An=globalThis.Highlight;function Mn(){Dn?.delete(`hw-hit`),Dn?.delete(`hw-cur`)}function Nn(e,t){if(Mn(),J.hits=[],!p.value||J.q.length<2||!x.value)return;let n=En(J.q),r=document.createTreeWalker(x.value,NodeFilter.SHOW_TEXT);for(let e=r.nextNode();e;e=r.nextNode()){let t=En(e.nodeValue||``),r=0,i;for(;(i=t.indexOf(n,r))>=0;){let t=document.createRange();t.setStart(e,i),t.setEnd(e,Math.min(i+n.length,(e.nodeValue||``).length)),J.hits.push(t),r=i+n.length}}if(t){let e=J.hits.findIndex(e=>t.contains(e.startContainer));J.cur=e>=0?e:0}else(e||J.cur>=J.hits.length)&&(J.cur=J.hits.length-1);Fn()}function Fn(){if(Dn&&An){Dn.set(`hw-hit`,new An(...J.hits.filter((e,t)=>t!==J.cur)));let e=J.hits[J.cur];e?Dn.set(`hw-cur`,new An(e)):Dn.delete(`hw-cur`)}let e=J.hits[J.cur],t=b.value;if(e&&t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.scrollTo({top:t.scrollTop+n.top-r.top-t.clientHeight/2,behavior:`smooth`})}}let Rn=n(()=>J.loading?Y(`loading…`):J.q.length<2?``:J.hits.length?`${J.cur+1}/${J.hits.length}`:Y(`no results`));function Vn(e){J.hits.length&&(J.cur=(J.cur+e+J.hits.length)%J.hits.length,Fn())}async function Un(){for(;C.value.olderCursor>0;){let e=C.value.olderCursor;if(await De(),C.value.olderCursor===e)break}}let Wn;function Kn(){clearTimeout(Wn),Wn=setTimeout(Yn,250)}async function Yn(){if(J.q.trim().length<2){Mn(),J.hits=[],J.cur=-1;return}C.value.olderCursor>0&&!W.value&&(J.loading=!0,await Un(),J.loading=!1),Nn(!0)}async function Xn(){let e=c.query.hit,t=c.query.q;if(typeof e!=`string`||typeof t!=`string`||!/^\d+$/.test(e))return;let n=Number(e);p.value=!0,J.q=t,J.loading=!0,bn=!0;try{for(;C.value.olderCursor>n&&!W.value;){let e=C.value.olderCursor;if(await De(),C.value.olderCursor>=e)break}await P();let e=String(c.query.role||``),t=String(c.query.ts||``),r=String(c.query.prefix||``),i=T.value.findIndex(n=>n.role===e&&n.ts===t&&n.text.startsWith(r)),a=i<0?``:`${e}:${t}:${i}`,o=[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(e=>e.dataset.hitKey===a);Nn(!1,o),o&&!J.hits.length&&o.scrollIntoView({block:`center`})}finally{bn=!1,J.loading=!1}}B(()=>c.query.hit,()=>{c.params.pane===s.pane.id&&Xn()});function Zn(){p.value=!1}B(p,e=>{e?P(()=>xn.value?.inputRef?.focus()):(J.q=``,J.hits=[],J.cur=-1,Mn())}),l(Mn);function Qn(e){e.key===`Enter`&&(e.preventDefault(),Vn(e.shiftKey?1:-1)),e.key===`Escape`&&(e.preventDefault(),Zn())}function er(e){tn([e])}function rr(){let e=xn.value?.inputRef;e?.focus(),e?.select()}let ir=n(()=>{if(W.value||Ye.value||s.pane.status===`blocked`||on.value.length||en.value)return null;let e=Xe.value.findLast(e=>e.k===`assistant`||e.k===`user`||e.k===`shell`||e.k===`ompRun`);if(!e||e.k!==`assistant`||ye(e.id)!==null)return null;let t=nr(e.html);return t.questions.length+t.rows.length?{key:e.key,time:e.time,rid:e.rid,targets:t}:null}),or=n(()=>{let e=ir.value?Hn(ir.value.targets,_t.value,ir.value.time,ir.value.rid):0;return ir.value&&e?{key:ir.value.key,count:e}:null});B(()=>or.value?.count||0,e=>d(`unanswered`,e),{immediate:!0}),l(()=>d(`unanswered`,0));function sr(){let e=or.value?$e(or.value.key):null,t=_t.value,n=et(e),r=[...e?.querySelectorAll(`.q-reply, .q-trow`)||[]].find(e=>e.classList.contains(`q-trow`)?!Gn(t,Tn(e),n.time,n.id):!$n(t,tt(e)));if(!r)return;let i=r.classList.contains(`q-trow`)?[r]:[...dt(r)];(i[0]||r).scrollIntoView({block:`center`,behavior:pr.value?`auto`:`smooth`});for(let e of i)e.classList.remove(`q-flash`),e.offsetWidth,e.classList.add(`q-flash`),setTimeout(()=>e.classList.remove(`q-flash`),1700);Q()}return t({scrollToEnd:ne,reload:()=>setTimeout(Te,400),focusSearch:rr,gotoUnanswered:sr}),(t,n)=>{let r=Pe,i=yt,o=ci,s=Ee,c=ao,l=po,u=Eo,h=Oo,S=ri,w=No,D=ti,P=ms,B=_s,U=Cs,G=jo,K=Bo,ne=Ds,re=oi,ie=pc,ae=Si;return _(),v(k,null,[p.value?(_(),v(`div`,nl,[E(r,{ref_key:`searchInput`,ref:xn,modelValue:f(J).q,"onUpdate:modelValue":[n[0]||=e=>f(J).q=e,Kn],type:`search`,enterkeyhint:`search`,autocomplete:`off`,icon:`i-lucide-search`,variant:`none`,placeholder:(`t`in t?t.t:f(Y))(`Search the conversation`),class:`flex-1 min-w-0`,onKeydown:Qn},null,8,[`modelValue`,`placeholder`]),I(`span`,rl,M(f(Rn)),1),E(i,{icon:`i-lucide-chevron-up`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Y))(`Previous`),onClick:n[1]||=e=>Vn(-1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-chevron-down`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Y))(`Next`),onClick:n[2]||=e=>Vn(1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Y))(`Close`),onClick:Zn},null,8,[`aria-label`])])):g(``,!0),I(`div`,il,[f(W)||(`netDown`in t?t.netDown:f(ar))?(_(),m(o,{key:0,label:f(W)?(`t`in t?t.t:f(Y))(`Offline reading`):void 0,at:f(V)},null,8,[`label`,`at`])):f(el)(f(L))?(_(),m(o,{key:1,label:(`t`in t?t.t:f(Y))(`Conversation not up to date — reconnecting…`)},null,8,[`label`])):g(``,!0),I(`div`,{ref_key:`box`,ref:b,class:`chat`,onScrollPassive:ue,onWheelPassive:ce,onTouchmovePassive:ce},[E(ne,{status:f(Ye)?`streaming`:`ready`,"should-auto-scroll":!1,"auto-scroll":{color:`neutral`,variant:`outline`},"auto-scroll-icon":`i-lucide-arrow-down`,ui:{root:`chat-msgs`,viewport:`hw-jump-vp`,autoScroll:`hw-jump`}},{default:H(()=>[I(`div`,{ref_key:`listEl`,ref:x,class:j([`chat-list`,[f(W)?`no-reply`:`rs-${`replyStyle`in t?t.replyStyle:f(mn)}`,{asking:f(ir)}]]),onClick:Ft,onKeydown:Zt},[f(O)&&f(gn)?(_(),v(`div`,al,[E(s,{name:`i-lucide-square-terminal`,class:`chat-empty-icon`}),I(`p`,null,M(f(gn).text),1),f(gn).lines.length?(_(),v(`pre`,ol,M(f(gn).lines.join(`
23
+ `)),1)):g(``,!0),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[3]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`View terminal`)),1)]),_:1})])):f(O)===`no_integration`&&f(A)?(_(),v(`div`,sl,[E(s,{name:`i-lucide-plug-zap`,class:`chat-empty-icon`}),I(`p`,cl,M((`tl`in t?t.tl:f(X))(`Herdr's ${(`kindLabel`in t?t.kindLabel:f(zn))(f(A).agent)} integration is missing`,`L’intégration ${(`kindLabel`in t?t.kindLabel:f(zn))(f(A).agent)} de Herdr manque`)),1),I(`p`,ll,M(f(A).machine?(`tl`in t?t.tl:f(X))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on ${f(A).machine}, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de ${f(A).machine}, puis relance l’agent :`):(`tl`in t?t.tl:f(X))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on the agent's machine, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de la machine de l’agent, puis relance l’agent :`)),1),I(`code`,ul,M(f(A).command),1),I(`div`,dl,[E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-copy`,onClick:Ce},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Copy command`)),1)]),_:1}),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[4]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`View terminal`)),1)]),_:1})])])):f(O)?(_(),v(`div`,fl,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),I(`p`,null,M(f(O)===`not_found`?(`t`in t?t.t:f(Y))(`No conversation for this agent yet.`):(`t`in t?t.t:f(Y))(`Conversation unavailable for this agent.`)),1),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[5]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`View terminal`)),1)]),_:1})])):(_(),v(k,{key:3},[f(C).olderCursor>0?(_(),v(`div`,pl,[E(i,{size:`xs`,color:`neutral`,variant:`outline`,class:`mono-btn`,loading:f(z),icon:`i-lucide-arrow-up`,onClick:De},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Load earlier messages`)),1)]),_:1},8,[`loading`])])):f(C).older.length?(_(),v(`div`,ml,M((`t`in t?t.t:f(Y))(`Start of conversation`)),1)):g(``,!0),(_(!0),v(k,null,y(f(Xe),r=>(_(),v(k,{key:r.key},[r.k===`day`?(_(),v(`div`,hl,[I(`span`,null,M(r.label),1)])):r.k===`who`?(_(),v(`div`,{key:1,class:j([`msg-who`,e.pane.agent||``])},[E(s,{name:(`agentIcon`in t?t.agentIcon:f(li))(e.pane.agent)||`i-lucide-bot`},null,8,[`name`]),I(`span`,null,M((`kindLabel`in t?t.kindLabel:f(zn))(e.pane.agent)),1)],2)):r.k===`user`?(_(),v(`div`,{key:2,class:`msg-user-wrap`,"data-hit-key":r.key},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Y))(`Show original message`),onClick:e=>Nt(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,vl,M(r.reply.time),1),I(`span`,yl,M(r.reply.excerpt),1)],8,_l)):g(``,!0),E(h,{id:r.key,role:`user`,side:`right`,variant:`soft`,parts:[...r.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...r.text||r.files.length?[{type:`text`,text:r.text||` `}]:[]],ui:{root:r.text.trim()||r.files.length?`msg msg-user`:`msg msg-user msg-no-text`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[E(c,{srcs:r.srcs,offline:f(W)},null,8,[`srcs`,`offline`])]),content:H(()=>[r.files.length?(_(),v(`span`,bl,[(_(!0),v(k,null,y(r.files,e=>(_(),m(l,{key:e.path,name:e.name,clickable:``,onOpen:t=>qt(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(u,{text:r.text,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.time?(_(),v(`div`,{key:1,class:`msg-time`,title:r.at||void 0},M(r.time),9,xl)):g(``,!0)],8,gl)):r.k===`assistant`?(_(),v(k,{key:3},[E(h,{id:r.key,role:`assistant`,side:`left`,variant:`naked`,"data-hit-key":r.key,parts:[{type:`text`,text:r.text}],ui:{root:`msg msg-ai tw-${e.pane.agent||`agent`}${f(te)?` can-run`:``}${f(gt)===r.key?` q-picking`:``}`,container:`msg-c`,content:`md`}},{content:H(()=>[E(S,{html:r.html,typing:ye(r.id),onDone:e=>be(r.id)},null,8,[`html`,`typing`,`onDone`])]),_:2},1032,[`id`,`data-hit-key`,`parts`,`ui`]),(`replyStyle`in t?t.replyStyle:f(mn))===`list`&&!f(W)&&ye(r.id)===null&&(f(nr)(r.html).questions.length||f(nr)(r.html).pick)?(_(),v(`div`,Sl,[f(nr)(r.html).questions.length?(_(),v(k,{key:0},[I(`p`,Cl,M((`tl`in t?t.tl:f(X))(`Questions · reply to`,`Questions · répondre à`)),1),(_(!0),v(k,null,y(f(nr)(r.html).questions,e=>(_(),v(`div`,{key:e.n,class:`q-line`},[I(`button`,{type:`button`,class:j([`q-row`,{quoted:f($n)(f(_t),f(fr)(e.text,r.time,r.rid))}]),"aria-label":`${(`t`in t?t.t:f(Y))(`Reply`)}: ${e.text}`,onClick:t=>rt(f(fr)(e.text,r.time,r.rid)),onMouseenter:t=>vt(r.key,e.n,!0),onMouseleave:t=>vt(r.key,e.n,!1),onFocus:t=>vt(r.key,e.n,!0),onBlur:t=>vt(r.key,e.n,!1)},[I(`b`,null,M(f($n)(f(_t),f(fr)(e.text,r.time,r.rid))?`✓`:e.n),1),I(`span`,null,M(e.text),1),I(`i`,null,[n[11]||=a(`↳`,-1),I(`em`,null,M(f($n)(f(_t),f(fr)(e.text,r.time,r.rid))?(`t`in t?t.t:f(Y))(`Quoted`):(`t`in t?t.t:f(Y))(`Reply`)),1)])],42,wl),e.closed?(_(),v(k,{key:0},y([`yes`,`no`],t=>I(`button`,{key:t,type:`button`,class:`q-row-ans`,"aria-pressed":ct(f(fr)(e.text,r.time,r.rid),t),"aria-label":`${it(t)}: ${e.text}`,onClick:n=>ot(f(fr)(e.text,r.time,r.rid),t)},M(it(t)),9,Tl)),64)):g(``,!0)]))),128))],64)):g(``,!0),f(nr)(r.html).pick?(_(),v(`button`,{key:1,type:`button`,class:`q-pick`,"aria-pressed":f(gt)===r.key,onClick:e=>gt.value=f(gt)===r.key?null:r.key},M(f(gt)===r.key?(`tl`in t?t.tl:f(X))(`Pick the point to quote · Cancel`,`Choisis le point à citer · Annuler`):(`tl`in t?t.tl:f(X))(`+ Quote a point`,`+ Citer un point`)),9,El)):g(``,!0)])):g(``,!0),!r.endsTurn&&!f(W)?(_(),v(`div`,Dl,[I(`button`,{type:`button`,class:`msg-reply`,onClick:e=>nt(r.key)},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Y))(`Reply`)),1)],8,Ol)])):g(``,!0)],64)):r.k===`thinking`?(_(),m(w,{key:4,class:`omp-thinking`,text:r.text,streaming:xe(r.id)!==null,duration:r.ms===void 0?void 0:Math.max(1,Math.round(r.ms/1e3)),"auto-close-delay":450,ui:{root:`omp-thinking`,trigger:`omp-thinking-head`,label:`omp-thinking-label`,content:`omp-thinking-content`,body:`omp-thinking-body`}},{default:H(()=>[E(S,{class:`md`,html:r.html,typing:xe(r.id),speed:(`reducedMotion`in t?t.reducedMotion:f(pr))?`off`:`fast`,cipher:!1,onDone:e=>Se(r.id)},null,8,[`html`,`typing`,`speed`,`onDone`])]),_:2},1032,[`text`,`streaming`,`duration`])):r.k===`job`?(_(),v(`div`,{key:5,class:j([`omp-job`,{err:r.error,open:Ze(r.key)}])},[I(`button`,{type:`button`,class:`omp-job-head`,disabled:!r.out,"aria-expanded":r.out?Ze(r.key):void 0,onClick:e=>Qe(r.key,!Ze(r.key))},[I(`span`,Al,M(r.error?`✗`:`✓`),1),I(`span`,jl,M((`tl`in t?t.tl:f(X))(`Background job completed`,`Tâche de fond terminée`)),1),I(`code`,null,`[`+M(r.tool)+`] `+M(r.id),1),r.ms===void 0?g(``,!0):(_(),v(`span`,Ml,M(f(Ho)(r.ms)),1)),r.out?(_(),m(s,{key:1,name:Ze(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`])):g(``,!0)],8,kl),r.out&&Ze(r.key)?(_(),v(`div`,Nl,[I(`div`,Pl,[I(`span`,Fl,M(r.error?(`tl`in t?t.tl:f(X))(`Error`,`Erreur`):(`tl`in t?t.tl:f(X))(`Output`,`Sortie`)),1),r.ms===void 0?g(``,!0):(_(),v(`span`,Il,`wall `+M(f(Ho)(r.ms)),1))]),I(`pre`,null,M(r.out),1)])):g(``,!0)],2)):r.k===`shell`?(_(),v(`div`,{key:6,class:j([`msg-shell`,{bash:r.bash,long:r.long,open:Ze(r.key)}])},[I(`div`,Ll,[I(`span`,Rl,M(r.bash?`!`:`❯`),1),I(`code`,null,M(r.text),1),E(D,{text:(`t`in t?t.t:f(Y))(`Copy command`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`msg-shell-copy`,"aria-label":(`t`in t?t.t:f(Y))(`Copy command`),onClick:e=>Pt(r.bash?`!${r.text}`:r.text)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])]),r.out||r.err?(_(),v(`div`,zl,[r.out?(_(),v(`pre`,Bl,M(r.out),1)):g(``,!0),r.err?(_(),v(`pre`,Vl,M(r.err),1)):g(``,!0)])):r.bash?(_(),v(`div`,Hl,M((`t`in t?t.t:f(Y))(`No output`)),1)):g(``,!0),r.long?(_(),v(`button`,{key:2,type:`button`,class:`msg-shell-more`,"aria-expanded":Ze(r.key),onClick:e=>Qe(r.key,!Ze(r.key))},[E(s,{name:Ze(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),I(`span`,null,M(Ze(r.key)?(`t`in t?t.t:f(Y))(`Collapse`):(`tl`in t?t.tl:f(X))(`Show all · ${r.lines} lines`,`Tout afficher · ${r.lines} lignes`)),1)],8,Ul)):g(``,!0)],2)):r.k===`ompRun`?(_(),v(`div`,Wl,[I(`div`,Gl,[I(`span`,Kl,M(r.tool.omp.title===`Python`?`$`:`!`),1),I(`span`,null,M((`tl`in t?t.tl:f(X))(`You ran`,`Lancé par toi`)),1)]),E(P,{tool:r.tool,run:``},null,8,[`tool`])])):r.k===`system`?(_(),v(`div`,ql,[I(`span`,null,M(r.text),1)])):r.k===`notice`?(_(),v(`div`,{key:9,class:j([`msg-notice`,{long:r.long,open:Ze(r.key)}])},[I(`div`,Jl,[E(s,{name:r.icon},null,8,[`name`]),I(`span`,null,M(r.label),1)]),E(S,{class:`msg-notice-body md`,html:r.html,typing:null},null,8,[`html`]),r.long?(_(),v(`button`,{key:0,type:`button`,class:`msg-shell-more`,"aria-expanded":Ze(r.key),onClick:e=>Qe(r.key,!Ze(r.key))},[E(s,{name:Ze(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),I(`span`,null,M(Ze(r.key)?(`t`in t?t.t:f(Y))(`Collapse`):(`t`in t?t.t:f(Y))(`Show all`)),1)],8,Yl)):g(``,!0)],2)):r.k===`turn`?(_(),v(`div`,Xl,[r.copy?(_(),m(D,{key:0,text:(`t`in t?t.t:f(Y))(`Copy reply`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`turn-copy`,"aria-label":(`t`in t?t.t:f(Y))(`Copy reply`),onClick:e=>Pt(r.copy)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])):g(``,!0),r.reply&&!f(W)?(_(),v(`button`,{key:1,type:`button`,class:`msg-reply`,onClick:e=>nt(r.reply)},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Y))(`Reply`)),1)],8,Zl)):g(``,!0),I(`span`,null,M(r.text),1)])):r.k===`tools`&&f(Xo)(r.list)?(_(),v(`div`,{key:11,class:j([`tools omp-console`,{live:r.live}])},[I(`div`,Ql,[n[12]||=I(`span`,{class:`omp-console-title`},`omp`,-1),I(`span`,null,M(r.list.length)+` `+M((`t`in t?t.t:f(Y))(`actions`)),1),f(Yo)(r.list)?(_(),v(`span`,$l,`Σ `+M(f(Ho)(f(Yo)(r.list))),1)):g(``,!0)]),Ve(r).hidden||r.list.length>f(3)&&Ze(r.key)?(_(),v(`button`,{key:0,type:`button`,class:`omp-console-more`,"aria-expanded":Ze(r.key),onClick:e=>Qe(r.key,!Ze(r.key))},[Ve(r).hidden?(_(),v(k,{key:0},[a(`⋯ `+M((`tl`in t?t.tl:f(X))(`${Ve(r).hidden} earlier actions`,`${Ve(r).hidden} actions avant`)),1)],64)):(_(),v(k,{key:1},[a(`⋯ `+M((`t`in t?t.t:f(Y))(`Collapse`)),1)],64))],8,eu)):g(``,!0),(_(!0),v(k,null,y(Ke(r),(e,t)=>(_(),m(c,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:Nu,offline:f(W),dupes:f(Ge)},null,8,[`srcs`,`offline`,`dupes`]))),128)),(_(!0),v(k,null,y(Ve(r).rows,(e,t)=>(_(),v(k,{key:`${r.key}:${r.list.length-Ve(r).rows.length+t}`},[E(P,{tool:{...e,omp:e.omp},live:r.live&&e===r.list[r.list.length-1]},null,8,[`tool`,`live`]),e.images?(_(),m(c,{key:0,class:`tool-thumbs`,srcs:We(e),max:Nu,offline:f(W),dupes:f(Ge)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))],2)):r.k===`tools`?(_(),v(`div`,{key:12,class:j([`tools`,{live:r.live}])},[r.list.length<=3?(_(!0),v(k,{key:0},y(r.list,(e,t)=>(_(),v(k,{key:t},[E(B,{text:Re(e),suffix:Ie(e),icon:ze(e),loading:r.live&&t===r.list.length-1,streaming:r.live&&t===r.list.length-1,ui:{root:`tool`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`},class:j({err:e.error})},null,8,[`text`,`suffix`,`icon`,`loading`,`streaming`,`class`]),e.images?(_(),m(c,{key:0,class:`tool-thumbs`,srcs:We(e),max:Nu,offline:f(W),dupes:f(Ge)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128)):(_(),m(B,{key:1,open:Ze(r.key),text:`${r.list.length} ${(`t`in t?t.t:f(Y))(`actions`)}`,suffix:Be(r.list[r.list.length-1]),icon:r.live?void 0:`i-lucide-layers`,loading:r.live,streaming:r.live,chevron:`trailing`,ui:{root:`tool group`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`,body:`tool-body`,trailingIcon:`tool-chev`},"onUpdate:open":e=>Qe(r.key,e)},{default:H(()=>[(_(!0),v(k,null,y(r.list,(e,t)=>(_(),v(k,{key:t},[I(`div`,{class:j([`tool-row`,{err:e.error}])},[E(s,{name:ze(e)},null,8,[`name`]),I(`b`,null,M(Re(e)),1),I(`span`,null,M(Ie(e)),1)],2),e.images?(_(),m(c,{key:0,class:`tool-thumbs`,srcs:We(e),max:Nu,offline:f(W),dupes:f(Ge)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))]),_:2},1032,[`open`,`text`,`suffix`,`icon`,`loading`,`streaming`,`onUpdate:open`])),(_(!0),v(k,null,y(Ke(r),(e,t)=>(_(),m(c,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:Nu,offline:f(W),dupes:f(Ge)},null,8,[`srcs`,`offline`,`dupes`]))),128))],2)):g(``,!0)],64))),128)),f(R)&&!f(T).length&&!f(F)?(_(),v(`div`,tu,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),I(`p`,null,M((`t`in t?t.t:f(Y))(`No messages yet.`)),1)])):g(``,!0),f(F)?(_(),v(`div`,nu,[I(`p`,null,M(f(F)),1)])):g(``,!0)],64))],34),(_(),m(ee,{to:`body`},[f(St)?(_(),v(`button`,{key:0,ref_key:`selBtn`,ref:Ct,type:`button`,class:`sel-reply`,style:N({top:`${f(St).top}px`,left:`${f(St).left}px`}),"aria-label":(`t`in t?t.t:f(Y))(`Reply to this passage`),onPointerdown:n[6]||=q(()=>{},[`prevent`]),onMousedown:n[7]||=q(()=>{},[`prevent`]),onClick:n[8]||=e=>rt(f(fr)(f(St).text,f(St).time,f(St).id))},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Y))(`Reply`)),1)],44,ru)):g(``,!0)])),f(on).length||f(en)?(_(),v(`div`,iu,[(_(!0),v(k,null,y(f(on).filter(e=>e.phase===`sent`),e=>(_(),v(`div`,{key:e.id,class:`msg-user-wrap`},[e.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Y))(`Show original message`),onClick:t=>Nt(e.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,ou,M(e.reply.time),1),I(`span`,su,M(e.reply.excerpt),1)],8,au)):g(``,!0),E(h,{id:`q:${e.id}`,role:`user`,side:`right`,variant:`soft`,parts:sn(e),ui:{root:`msg msg-user msg-pending sent${e.body||e.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[e.srcs.length?(_(),m(c,{key:0,srcs:e.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(e.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Y))(`Image`)},[E(s,{name:`i-lucide-image`})],8,cu))),128))]),content:H(()=>[e.files.length?(_(),v(`span`,lu,[(_(!0),v(k,null,y(e.files,e=>(_(),m(l,{key:e.path,name:e.name,clickable:``,onOpen:t=>qt(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(u,{text:e.body,pasted:e.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),I(`div`,uu,[E(s,{name:`i-lucide-check`}),I(`span`,null,M((`t`in t?t.t:f(Y))(`Sent · read by the agent`)),1)])]))),128)),f(en)?(_(),v(`div`,du,[I(`div`,fu,[I(`div`,pu,[I(`span`,mu,M(e.pane.agent===`omp`?f(en).python?`>>>`:`$`:`!`),1),I(`code`,null,M(f(en).command),1)]),f(en).lines.length?(_(),v(`div`,hu,[f(en).hidden?(_(),v(`div`,gu,M((`tl`in t?t.tl:f(X))(`+ ${f(en).hidden} lines above`,`+ ${f(en).hidden} lignes au-dessus`)),1)):g(``,!0),I(`pre`,_u,M(f(en).lines.join(`
24
+ `)),1)])):(_(),v(`div`,vu,M((`t`in t?t.t:f(Y))(`No output yet`)),1))]),I(`div`,yu,[E(s,{name:`i-lucide-loader-circle`,class:`spin`}),I(`span`,null,[a(M((`t`in t?t.t:f(Y))(`Running`)),1),f(an)?(_(),v(k,{key:0},[a(` · `+M(f(an)),1)],64)):g(``,!0)])])])):g(``,!0),(_(!0),v(k,null,y(f(on).filter(e=>e.phase===`queued`),e=>(_(),v(`div`,{key:e.id,class:`msg-user-wrap`},[e.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Y))(`Show original message`),onClick:t=>Nt(e.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,xu,M(e.reply.time),1),I(`span`,Su,M(e.reply.excerpt),1)],8,bu)):g(``,!0),E(h,{id:`q:${e.id}`,role:`user`,side:`right`,variant:`soft`,parts:sn(e),ui:{root:`msg msg-user msg-pending queued${e.body||e.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble queued`,header:`msg-files`}},{files:H(()=>[e.srcs.length?(_(),m(c,{key:0,srcs:e.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(e.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Y))(`Image`)},[E(s,{name:`i-lucide-image`})],8,Cu))),128))]),content:H(()=>[e.files.length?(_(),v(`span`,wu,[(_(!0),v(k,null,y(e.files,e=>(_(),m(l,{key:e.path,name:e.name,clickable:``,onOpen:t=>qt(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(u,{text:e.body,pasted:e.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),e.state===`failed`?(_(),v(`div`,Tu,[E(s,{name:`i-lucide-circle-alert`}),I(`span`,null,M(e.reason===`busy`?(`t`in t?t.t:f(Y))(`Not sent — the agent’s input contains text`):e.reason===`no_input`?(`t`in t?t.t:f(Y))(`Not sent — the agent’s input field was not found on its screen`):(`t`in t?t.t:f(Y))(`Not sent`)),1),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(fn),onClick:t=>pn(e)},[E(s,{name:f(fn)===e.id?`i-lucide-loader-circle`:`i-lucide-rotate-cw`,class:j({spin:f(fn)===e.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Y))(`Retry`)),1)],8,Eu),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(un),onClick:t=>dn(e)},[E(s,{name:f(un)===e.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(un)===e.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Y))(`Cancel`)),1)],8,Du)])):(_(),v(`div`,Ou,[E(s,{name:`i-lucide-clock`}),I(`span`,null,M((`t`in t?t.t:f(Y))(`Queued · `))+M(e.state===`sending`?(`t`in t?t.t:f(Y))(`sending…`):e.state===`held`?e.reason===`busy`?(`t`in t?t.t:f(Y))(`will be sent when the agent’s input is free`):(`t`in t?t.t:f(Y))(`will be sent when the menu closes`):f(hn)),1),e.state!==`sending`&&(f(ln)||e.state===`held`)&&e.raw?(_(),v(`button`,{key:0,type:`button`,class:`queued-cancel`,disabled:!!f(un),onClick:t=>dn(e)},[E(s,{name:f(un)===e.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(un)===e.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Y))(`Cancel`)),1)],8,ku)):g(``,!0)]))]))),128))])):g(``,!0),f(vn)?(_(),v(`div`,{key:1,class:j([`chat-status`,{typing:f(vn).typing,waiting:!f(vn).typing}])},[`verb`in f(vn)?(_(),v(`span`,Au,[E(U),E(G,{text:f(vn).text,duration:2.4,class:`claude-verb`},null,8,[`text`])])):`omp`in f(vn)?(_(),v(`span`,ju,[E(K,{since:f(vn).since},{default:H(()=>[E(G,{text:f(vn).text,duration:2.4,class:`omp-step`},null,8,[`text`])]),_:1},8,[`since`])])):(_(),v(k,{key:2},[n[13]||=I(`i`,{class:`status-dot`},null,-1),f(vn).typing?(_(),m(G,{key:0,text:f(vn).text,duration:2.4},null,8,[`text`])):(_(),v(`span`,Mu,M(f(vn).text),1))],64))],2)):g(``,!0)]),_:1},8,[`status`])],544),(`sheetMenus`in t?t.sheetMenus:f(Nr))?g(``,!0):(_(),m(re,{key:2,open:f(zt).open,"onUpdate:open":n[9]||=e=>f(zt).open=e,items:f(Vt),content:{align:`start`,side:`bottom`,sideOffset:4},ui:{content:`hw-dropdown`}},{default:H(()=>[I(`span`,{class:`path-anchor`,style:N({left:`${f(zt).x}px`,top:`${f(zt).y}px`,width:`${f(zt).w}px`,height:`${f(zt).h}px`}),"aria-hidden":`true`},null,4)]),_:1},8,[`open`,`items`])),E(ae,{open:f(Jt).open,"onUpdate:open":n[10]||=e=>f(Jt).open=e,title:Wt(f(Je)(f(Jt).path)),wide:``,full:``,screen:``},{default:H(()=>[f(Jt).open?(_(),m(ie,{key:f(Jt).path,"pane-id":e.pane.id,file:f(Jt).path},null,8,[`pane-id`,`file`])):g(``,!0)]),_:1},8,[`open`,`title`])])],64)}}}),{__name:`ChatView`});function Iu(e,t,n,r){return t===1?e*n:t===2?e*n*Math.max(1,r):e}function Lu(e,t){let n=t>0?t:16,r=Math.trunc(e/n);return{lines:r,rest:e-r*n}}var Ru={key:0,class:`term-loading`},zu={key:1,class:`terminal-selection-hint`},Bu=[`aria-label`],Vu=Object.assign(T({__name:`TerminalView`,props:{ctl:{}},setup(e){let t=e,n=h(null),r=null,i=null,o=0,s=0,c=0,u=!1,d=()=>{c=0,s&&=(t.ctl.scroll(s),0)},p=e=>{s+=e,c||=requestAnimationFrame(d)};function m(e){r=e.touches[0].clientY,i=e.touches[0].clientX,o=0,u=!1}function y(e){if(e.preventDefault(),r===null)return;let a=e.touches[0].clientY,s=e.touches[0].clientX,c=i===null?0:s-i,l=a-r;i=s;let d=n.value?.querySelector(`.xterm`);if(d&&d.scrollWidth>d.clientWidth&&Math.abs(c)>Math.abs(l)){d.scrollLeft-=c,r=a,u=!0;return}o+=l,r=a;let{lines:f,rest:m}=Lu(o,t.ctl.rowHeight());o=m,f&&(u=!0,p(f))}function b(e){let n=e.changedTouches[0];r=null,i=null,u||(n&&t.ctl.tapLink(n.clientX,n.clientY)&&e.preventDefault(),t.ctl.blur(),document.activeElement?.blur?.())}function x(){t.ctl.focus()}function S(e){e.preventDefault(),e.stopPropagation();let r=n.value?.querySelector(`.xterm`);if(r&&r.scrollWidth>r.clientWidth&&(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))){r.scrollLeft+=e.shiftKey?e.deltaY:e.deltaX;return}let i=t.ctl.rowHeight();o-=Iu(e.deltaY,e.deltaMode,i,t.ctl.pageRows());let{lines:a,rest:s}=Lu(o,i);o=s,a&&p(a)}let C;function T(){C||=setTimeout(()=>{C=void 0,t.ctl.fitNow(!0)},50)}B(ra,T);let E=null;return w(()=>{t.ctl.mount(n.value),P(()=>{t.ctl.fitNow(!1),t.ctl.hasBanner()||t.ctl.connect(!1)}),E=new ResizeObserver(T),E.observe(n.value)}),l(()=>{E?.disconnect(),clearTimeout(C),cancelAnimationFrame(c),t.ctl.dispose()}),(t,r)=>(_(),v(`div`,{id:`termWrap`,onWheelCapture:S},[I(`div`,{id:`term`,ref_key:`host`,ref:n},null,512),I(`div`,{id:`touch`,"aria-hidden":`true`,onTouchstartPassive:m,onTouchmove:y,onTouchend:b,onMousedown:q(x,[`prevent`])},null,32),e.ctl.loading.value?(_(),v(`div`,Ru,[...r[1]||=[I(`span`,{class:`spinner`},null,-1)]])):g(``,!0),e.ctl.selectionHint.visible.value?(_(),v(`div`,zu,[a(M((`tl`in t?t.tl:f(X))(`Shift + drag to select`,`Shift + glisser pour sélectionner`))+` `,1),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Y))(`Hide`),onClick:r[0]||=t=>e.ctl.selectionHint.dismiss()},`×`,8,Bu)])):g(``,!0)],32))}}),{__name:`TerminalView`}),Hu=[`stop`,`resolve`];function Uu(e){if(e.resolved)return[];let t=[];return e.report&&!e.acked&&t.push(`ack`),e.token===`working`&&e.hasPane&&t.push(`stop`),e.token!==`working`&&t.push(`restart`),t.push(`resolve`),t}var Wu=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function Gu(e,t){let n=Wu(t).split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=Wu(`${e.id} ${e.title} ${e.machine} ${e.profile}`);return n.every(e=>t.includes(e))}):e}function Ku(e){let t=[];for(let n of e){let e=t.find(e=>e.token===n.token);e?e.threads.push(n):t.push({token:n.token,group:n.group,threads:[n]})}return t}function qu(e){let t=e.split(`
25
+ `).map(e=>e.trim()).filter(Boolean);return(t[t.length-1]||``).replace(/^error:\s*/i,``).slice(0,400)}var Ju={class:`pt`},Yu={key:0,class:`pt-filter`},Xu={class:`pt-group-head`},Zu={class:`pp-count`},Qu={class:`pp-list`},$u={class:`pp-card`},ed=[`aria-label`,`onClick`],td={class:`pp-thread-title`},nd={class:`pp-meta`},rd={key:1,class:`pp-empty pt-none`},id=[`aria-expanded`],ad={class:`pp-sec-title`},od={class:`pp-count`},sd={key:0,class:`pp-list`},cd={class:`pp-card resolved`},ld=[`aria-label`,`onClick`],ud={class:`pp-thread-title`},dd={class:`pp-meta`},fd={key:0,class:`pp-empty`},pd={key:0,class:`pt-detail`},md={class:`pt-state`},hd={key:0,class:`pt-state-line`},gd={key:1,class:`spinner pt-spin`},_d={key:0,class:`pp-notice error`,role:`alert`},vd={key:1,class:`pp-notice error`},yd={key:2,class:`pt-block`},bd={class:`pt-label`},xd={class:`pt-next`},Sd={class:`pt-next-n`},Cd={class:`pt-links`},wd={key:3,class:`pt-block`},Td={class:`pt-label`},Ed={class:`pt-actions`},Dd={key:4,class:`pt-output`},Od={class:`pt-facts`},kd=new Map,Ad=r(new Map),jd=Object.assign(T({__name:`ProjectThreads`,props:{paneId:{},board:{}},emits:[`reload`,`report`,`agent`],setup(e,{emit:t}){let r=e,i=t,o=h(kd.get(r.paneId)||``);B(o,e=>kd.set(r.paneId,e));let s=n(()=>Gu(r.board.open,o.value)),c=n(()=>Gu(r.board.resolved,o.value)),d=n(()=>Ku(s.value)),p=h(!1),b=h(30),x=n(()=>p.value||!!o.value.trim()&&c.value.length>0);B(o,()=>{b.value=30});function S(){p.value=!x.value,Q()}function C(e){let t=er.value.panes.find(e=>e.id===r.paneId);return t?fi(t,r.board.slug,e):void 0}function w(e){let t=[e.id.toUpperCase()];e.machine&&t.push(e.machine),e.profile&&t.push(e.profile),!e.resolved&&e.percent!==null&&t.push(`${e.percent} %`),!e.resolved&&e.activity&&t.push(e.activity);let n=e.updated&&Wn(e.updated);return n&&t.push(n),t.join(` · `)}let T=h(null),D=u(null),O=h(!1),A=h(!1),N=h(``),P=h(``),F=0,L=!0;l(()=>{L=!1});async function R(){let e=T.value;if(!e)return;let t=++F;A.value=!0,N.value=``;try{let n=await Xt(r.paneId,e.id);t===F&&(D.value=n.thread)}catch(e){t===F&&(N.value=e.message)}finally{t===F&&(A.value=!1)}}function z(e){Q(),T.value=e,D.value=null,P.value=``,O.value=!0,R()}let V=n(()=>{let e=O.value?T.value?.id:void 0,t=e?r.board.open.find(t=>t.id===e)||r.board.resolved.find(t=>t.id===e):void 0;return t?`${t.token}|${t.updated}|${t.stateLine}|${t.report}|${t.pr}`:``});B(V,(e,t)=>{e&&t&&R()});let U=n(()=>D.value||T.value),ee=n(()=>U.value?C(U.value):void 0),te=n(()=>D.value?Uu(D.value):[]),G=n(()=>{let e=D.value,t=U.value;if(!t)return[];let n=[[X(`Machine`,`Machine`),t.machine||X(`The project’s machine`,`Celle du projet`)],[X(`Profile`,`Profil`),e&&e.agent&&e.agent!==t.profile?`${t.profile} (${e.agent})`:t.profile]];return e?.branch&&n.push([X(`Branch`,`Branche`),e.base?`${e.branch} ← ${e.base}`:e.branch]),e?.kind&&n.push([X(`Kind`,`Type`),e.kind===`worktree`?X(`Worktree`,`Worktree`):e.kind===`tab`?X(`Tab`,`Onglet`):e.kind]),(e?.prState||e?.prReview)&&n.push([Y(`Pull request`),[e.prState,e.prReview].filter(Boolean).join(` · `)]),t.created&&Wn(t.created)&&n.push([X(`Created`,`Créé`),Wn(t.created)]),t.updated&&Wn(t.updated)&&n.push([X(`Updated`,`Mis à jour`),Wn(t.updated)]),e?.resolved&&e.keptWorktree&&n.push([X(`Worktree`,`Worktree`),X(`Kept`,`Conservé`)]),n.filter(e=>e[1])}),K={ack:{label:X(`Acknowledge`,`Marquer vu`),icon:`i-lucide-eye`,hint:X(`Record that you have seen its report`,`Noter que tu as vu son rapport`)},restart:{label:Y(`Restart`),icon:`i-lucide-rotate-cw`,hint:X(`Bring back a thread whose pane is gone or whose start failed`,`Relancer un thread dont le pane a disparu ou dont le démarrage a échoué`)},stop:{label:X(`Stop`,`Arrêter`),icon:`i-lucide-square`,hint:X(`Send Escape to its agent`,`Envoyer Échap à son agent`)},resolve:{label:X(`Mark done`,`Marquer comme fait`),icon:`i-lucide-circle-check`,hint:X(`Mark the thread done and clean up its worktree, merged branch and tab`,`Marquer le thread comme fait et nettoyer son worktree, sa branche fusionnée et son onglet`)}},ne=e=>`${r.paneId}|${e}`,q=n(()=>(U.value?Ad.get(ne(U.value.id)):void 0)??null);function re(e,t){let n=t.id.toUpperCase();return e===`stop`?X(`Stop ${n}?\n${t.title}\n\nEscape is sent to its agent: the turn in progress is interrupted.`,`Arrêter ${n} ?\n${t.title}\n\nÉchap est envoyé à son agent : le tour en cours est interrompu.`):X(`Mark ${n} done?\n${t.title}\n\nIts worktree, its branch once merged and its tab are removed. Its report and library are kept.`,`Marquer ${n} comme fait ?\n${t.title}\n\nSon worktree, sa branche une fois fusionnée et son onglet sont supprimés. Son rapport et sa bibliothèque sont conservés.`)}async function ie(e){let t=U.value;if(!t||q.value)return;if(!yn.value||jn.value)return $(X(`Thread actions are unavailable offline`,`Actions des threads indisponibles hors ligne`),!0);if(Q(),Hu.includes(e)&&!await lt(re(e,t),K[e].label,`error`))return;let n=ne(t.id);if(Ad.has(n))return;Ad.set(n,e);let a=()=>L&&T.value?.id===t.id;try{let n=await ft(r.paneId,t.id,e);a()&&(P.value=n.output),$(e===`resolve`?X(`Thread marked done`,`Thread marqué comme fait`):qu(n.output)||X(`${K[e].label}: done`,`${K[e].label} : fait`))}catch(e){$(e.message,!0)}finally{Ad.delete(n),i(`reload`),a()&&R()}}function ae(){U.value&&(O.value=!1,i(`agent`,U.value))}function oe(){U.value&&(O.value=!1,i(`report`,U.value))}return(t,n)=>{let r=Mi,i=Ee,l=yt,u=ti,p=Si;return _(),v(`div`,Ju,[e.board.open.length+e.board.resolved.length>0?(_(),v(`div`,Yu,[E(r,{modelValue:f(o),"onUpdate:modelValue":n[0]||=e=>W(o)?o.value=e:null,label:(`tl`in t?t.tl:f(X))(`Filter threads`,`Filtrer les threads`)},null,8,[`modelValue`,`label`])])):g(``,!0),(_(!0),v(k,null,y(f(d),e=>(_(),v(`section`,{key:e.token,class:`pt-group`},[I(`h3`,Xu,[I(`span`,{class:j([`pill`,(`threadClass`in t?t.threadClass:f(_a))(e)])},[n[3]||=I(`i`,null,null,-1),a(M((`threadLabel`in t?t.threadLabel:f(Ca))(e)),1)],2),I(`span`,Zu,M(e.threads.length),1)]),I(`ul`,Qu,[(_(!0),v(k,null,y(e.threads,e=>(_(),v(`li`,{key:e.id,class:`pp-row`},[I(`div`,$u,[I(`button`,{type:`button`,class:`pp-thread pt-thread`,"aria-label":(`tl`in t?t.tl:f(X))(`Thread ${e.id}: ${e.title}`,`Thread ${e.id} : ${e.title}`),onClick:t=>z(e)},[I(`span`,td,M(e.title),1),I(`span`,nd,M(w(e)),1)],8,ed),E(i,{name:`i-lucide-chevron-right`,class:`pt-go`})])]))),128))])]))),128)),f(s).length?g(``,!0):(_(),v(`p`,rd,M(f(o).trim()?(`tl`in t?t.tl:f(X))(`No open thread matches`,`Aucun thread ouvert ne correspond`):(`tl`in t?t.tl:f(X))(`No open thread`,`Aucun thread ouvert`)),1)),I(`section`,{class:j([`pp-sec done pt-resolved`,{folded:!f(x)}])},[I(`button`,{type:`button`,class:`pp-sec-head`,"aria-expanded":f(x),onClick:S},[E(i,{name:`i-lucide-circle-check`,class:`pp-sec-icon`}),I(`span`,ad,M((`threadLabel`in t?t.threadLabel:f(Ca))({token:`resolved`,group:``})),1),I(`span`,od,M(f(c).length),1),E(i,{name:`i-lucide-chevron-down`,class:`pp-chev`})],8,id),f(x)?(_(),v(`ul`,sd,[(_(!0),v(k,null,y(f(c).slice(0,f(b)),e=>(_(),v(`li`,{key:e.id,class:`pp-row`},[I(`div`,cd,[I(`button`,{type:`button`,class:`pp-thread pt-thread`,"aria-label":(`tl`in t?t.tl:f(X))(`Thread ${e.id}: ${e.title}`,`Thread ${e.id} : ${e.title}`),onClick:t=>z(e)},[I(`span`,ud,M(e.title),1),I(`span`,dd,M(w(e)),1)],8,ld),E(i,{name:`i-lucide-chevron-right`,class:`pt-go`})])]))),128)),f(c).length?g(``,!0):(_(),v(`li`,fd,M((`t`in t?t.t:f(Y))(`Nothing yet`)),1))])):g(``,!0),f(x)&&f(c).length>f(b)?(_(),v(`button`,{key:1,type:`button`,class:`pp-more`,onClick:n[1]||=e=>b.value+=30},M((`tl`in t?t.tl:f(X))(`Show more (${f(c).length-f(b)} left)`,`Voir plus (${f(c).length-f(b)} restants)`)),1)):g(``,!0)],2),E(p,{open:f(O),"onUpdate:open":n[2]||=e=>W(O)?O.value=e:null,title:f(U)?`${f(U).id.toUpperCase()} · ${f(U).title}`:``,wide:``,tall:``,screen:``},{default:H(()=>[f(U)?(_(),v(`div`,pd,[I(`p`,md,[I(`span`,{class:j([`pill`,(`threadClass`in t?t.threadClass:f(_a))(f(U))])},[n[4]||=I(`i`,null,null,-1),a(M((`threadLabel`in t?t.threadLabel:f(Ca))(f(U))),1)],2),f(U).stateLine?(_(),v(`span`,hd,M(f(U).stateLine),1)):g(``,!0),f(A)?(_(),v(`span`,gd)):g(``,!0)]),f(N)?(_(),v(`p`,_d,[I(`span`,null,[a(M((`tl`in t?t.tl:f(X))(`Thread record unavailable`,`Fiche du thread indisponible`))+` · `,1),I(`code`,null,M(f(N)),1)]),E(l,{size:`xs`,color:`neutral`,variant:`outline`,onClick:R},{default:H(()=>[a(M((`tl`in t?t.tl:f(X))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(D)?.error?(_(),v(`p`,vd,[I(`code`,null,M(f(D).error),1)])):g(``,!0),f(D)?.next.length?(_(),v(`section`,yd,[I(`h4`,bd,M((`tl`in t?t.tl:f(X))(`Next`,`Ensuite`)),1),I(`ol`,xd,[(_(!0),v(k,null,y(f(D).next,(e,t)=>(_(),v(`li`,{key:t},[I(`span`,Sd,M(t+1),1),I(`span`,null,M(e),1)]))),128))])])):g(``,!0),I(`div`,Cd,[f(ee)?(_(),m(l,{key:0,icon:`i-lucide-message-square`,color:`neutral`,variant:`outline`,class:`pt-btn`,onClick:ae},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Open agent`)),1)]),_:1})):g(``,!0),f(U).report?(_(),m(l,{key:1,icon:`i-lucide-file-text`,color:`neutral`,variant:`outline`,class:`pt-btn`,onClick:oe},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`View report`)),1)]),_:1})):g(``,!0),f(U).pr?(_(),m(l,{key:2,icon:`i-lucide-git-pull-request`,color:`neutral`,variant:`outline`,class:`pt-btn`,to:f(U).pr,target:`_blank`,rel:`noopener noreferrer`},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Pull request`)),1)]),_:1},8,[`to`])):g(``,!0)]),f(te).length?(_(),v(`section`,wd,[I(`h4`,Td,M((`tl`in t?t.tl:f(X))(`Actions`,`Actions`)),1),I(`div`,Ed,[(_(!0),v(k,null,y(f(te),e=>(_(),m(u,{key:e,text:K[e].hint,disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[E(l,{icon:K[e].icon,color:e===`resolve`||e===`stop`?`error`:`neutral`,variant:`outline`,class:j([`pt-btn`,`pt-act-${e}`]),loading:f(q)===e,disabled:f(q)!==null,onClick:t=>ie(e)},{default:H(()=>[a(M(K[e].label),1)]),_:2},1032,[`icon`,`color`,`class`,`loading`,`disabled`,`onClick`])]),_:2},1032,[`text`,`disabled`]))),128))])])):g(``,!0),f(P)?(_(),v(`pre`,Dd,M(f(P)),1)):g(``,!0),I(`dl`,Od,[(_(!0),v(k,null,y(f(G),([e,t])=>(_(),v(`div`,{key:e},[I(`dt`,null,M(e),1),I(`dd`,null,M(t),1)]))),128))])])):g(``,!0)]),_:1},8,[`open`,`title`])])}}}),{__name:`ProjectThreads`}),Md=e=>/^t-\d{4,}$/.test(e.subject)?e.subject:null,Nd={class:`pi`},Pd={key:0,class:`pp-notice error`,role:`alert`},Fd={key:1,class:`pp-notice`},Id={key:0,class:`pp-empty pi-none`},Ld={key:1,class:`pp-list pi-list`},Rd={class:`pp-card pi-card`},zd={class:`pi-body`},Bd={class:`pi-kind`},Vd={class:`pi-title`},Hd={class:`pp-meta pi-meta`},Ud=[`aria-expanded`,`aria-label`,`onClick`],Wd={key:0},Gd={key:1,class:`pi-prompt`},Kd={key:2,class:`pp-empty pi-more`},qd=Object.assign(T({__name:`ProjectInbox`,props:{paneId:{},board:{},tick:{}},emits:[`count`,`thread`],setup(e,{emit:t}){let n=e,r=t,i=u(null),o=h(0),s=h(!1),c=h(``),d=0;async function p(){if(jn.value)return;let e=++d;s.value=!0;try{let t=await Nt(n.paneId);if(e!==d)return;i.value=t.items,o.value=t.total,c.value=``,r(`count`,t.total)}catch(t){e===d&&(c.value=t.message)}finally{e===d&&(s.value=!1)}}w(p),B(()=>[n.tick,n.board.version],p),l(()=>{d++});let b={"thread-state":[`Thread`,`i-lucide-git-branch`],routine:[X(`Routine`,`Routine`),`i-lucide-alarm-clock`],pr:[`PR`,`i-lucide-git-pull-request`],outage:[X(`Machine`,`Machine`),`i-lucide-unplug`],space:[`Space`,`i-lucide-layout-panel-left`]},x=e=>b[e.kind]?.[0]||e.kind||X(`Notice`,`Avis`),S=e=>b[e.kind]?.[1]||`i-lucide-bell`;function T(e){let t=Md(e);return t?n.board.open.find(e=>e.id===t)||n.board.resolved.find(e=>e.id===t):void 0}let D=e=>T(e)?.title||e.subject||x(e);function O(e){let t=[];Md(e)&&t.push(e.subject.toUpperCase()),e.event&&t.push(e.kind===`thread-state`&&e.event===`resolved`?Ca({token:e.event,group:``}):e.event);let n=e.created&&Wn(e.created);return n&&t.push(n),t.join(` · `)}let A=h(new Set);function N(e){let t=new Set(A.value);t.delete(e)||t.add(e),A.value=t}let P=h(null);async function F(e){if(!P.value){if(!yn.value||jn.value)return $(X(`Inbox actions are unavailable offline`,`Actions de l’inbox indisponibles hors ligne`),!0);P.value=e.id,Q();try{await st(n.paneId,e.id),i.value=(i.value||[]).filter(t=>t.id!==e.id),o.value=Math.max(0,o.value-1),r(`count`,o.value),$(X(`Marked as handled`,`Marqué comme traité`))}catch(e){$(e.message,!0)}finally{P.value=null}}}return(e,t)=>{let n=yt,l=Ee,u=ti;return _(),v(`div`,Nd,[f(c)?(_(),v(`p`,Pd,[I(`span`,null,[a(M((`tl`in e?e.tl:f(X))(`Inbox unavailable`,`Inbox indisponible`))+` · `,1),I(`code`,null,M(f(c)),1)]),E(n,{size:`xs`,color:`neutral`,variant:`outline`,onClick:p},{default:H(()=>[a(M((`tl`in e?e.tl:f(X))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(i)===null&&f(s)?(_(),v(`p`,Fd,[t[0]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`tl`in e?e.tl:f(X))(`Reading the inbox…`,`Lecture de l’inbox…`)),1)])):g(``,!0),f(i)?(_(),v(k,{key:2},[f(i).length?(_(),v(`ul`,Ld,[(_(!0),v(k,null,y(f(i),t=>(_(),v(`li`,{key:t.id,class:`pp-row`},[I(`div`,Rd,[I(`div`,zd,[(_(),m(C(T(t)?`button`:`div`),{class:j([`pi-head`,{link:T(t)}]),type:T(t)?`button`:void 0,"aria-label":T(t)?(`tl`in e?e.tl:f(X))(`Open the thread: ${D(t)}`,`Ouvrir le thread : ${D(t)}`):void 0,onClick:e=>T(t)&&r(`thread`,T(t))},{default:H(()=>[I(`span`,Bd,[E(l,{name:S(t)},null,8,[`name`]),a(M(x(t)),1)]),I(`span`,Vd,M(D(t)),1),I(`span`,Hd,M(O(t)),1)]),_:2},1032,[`class`,`type`,`aria-label`,`onClick`])),t.summary||t.body?(_(),v(`button`,{key:0,type:`button`,class:`pi-fold`,"aria-expanded":f(A).has(t.id),"aria-label":(`tl`in e?e.tl:f(X))(`Show or fold the text`,`Afficher ou replier le texte`),onClick:e=>N(t.id)},[I(`span`,{class:j([`pi-text`,{open:f(A).has(t.id)}])},[t.summary?(_(),v(`span`,Wd,M(t.summary),1)):g(``,!0),t.body?(_(),v(`span`,Gd,M(t.body),1)):g(``,!0)],2)],8,Ud)):g(``,!0)]),E(u,{text:(`tl`in e?e.tl:f(X))(`Mark as handled`,`Marquer comme traité`),disabled:!(`desk`in e?e.desk:f(Z))},{default:H(()=>[E(n,{icon:`i-lucide-check`,color:`neutral`,variant:`outline`,class:`pi-done`,loading:f(P)===t.id,disabled:f(P)!==null,"aria-label":(`tl`in e?e.tl:f(X))(`Mark as handled: ${D(t)}`,`Marquer comme traité : ${D(t)}`),onClick:e=>F(t)},null,8,[`loading`,`disabled`,`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])])]))),128))])):(_(),v(`p`,Id,M((`tl`in e?e.tl:f(X))(`Nothing waiting in the inbox`,`Rien en attente dans l’inbox`)),1)),f(o)>f(i).length?(_(),v(`p`,Kd,M((`tl`in e?e.tl:f(X))(`${f(i).length} oldest of ${f(o)} shown`,`${f(i).length} plus anciens affichés sur ${f(o)}`)),1)):g(``,!0)],64)):g(``,!0)])}}}),{__name:`ProjectInbox`}),Jd={class:`pr`},Yd={key:0,class:`pp-notice error`,role:`alert`},Xd={key:1,class:`pp-notice`},Zd={key:0,class:`pp-empty pi-none`},Qd={key:1,class:`pp-list pi-list`},$d={class:`pr-head`},ef={class:`pr-name`},tf={class:`pr-schedule`},nf={class:`pr-facts`},rf={key:0},af={class:`wide`},of={class:`pp-card pr-card broken`},sf={class:`pr-head`},cf={class:`pr-name`},lf={class:`pr-error`},uf={key:2,class:`pp-empty pi-more`},df=Object.assign(T({__name:`ProjectRoutines`,props:{paneId:{},board:{},tick:{}},setup(e){let t=e,n=u(null),r=h(!1),i=h(``),o=0;async function s(){if(jn.value)return;let e=++o;r.value=!0;try{let r=await $e(t.paneId);if(e!==o)return;n.value=r,i.value=``}catch(t){e===o&&(i.value=t.message)}finally{e===o&&(r.value=!1)}}return w(s),B(()=>[t.tick,t.board.version],s),l(()=>{o++}),(e,t)=>{let o=yt,c=Ee;return _(),v(`div`,Jd,[f(i)?(_(),v(`p`,Yd,[I(`span`,null,[a(M((`tl`in e?e.tl:f(X))(`Routines unavailable`,`Routines indisponibles`))+` · `,1),I(`code`,null,M(f(i)),1)]),E(o,{size:`xs`,color:`neutral`,variant:`outline`,onClick:s},{default:H(()=>[a(M((`tl`in e?e.tl:f(X))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(n)===null&&f(r)?(_(),v(`p`,Xd,[t[0]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`tl`in e?e.tl:f(X))(`Reading the routines…`,`Lecture des routines…`)),1)])):g(``,!0),f(n)?(_(),v(k,{key:2},[!f(n).routines.length&&!f(n).broken.length?(_(),v(`p`,Zd,M((`tl`in e?e.tl:f(X))(`No routine in this project`,`Aucune routine dans ce projet`)),1)):(_(),v(`ul`,Qd,[(_(!0),v(k,null,y(f(n).routines,n=>(_(),v(`li`,{key:n.name,class:`pp-row`},[I(`div`,{class:j([`pp-card pr-card`,{off:!n.enabled}])},[I(`div`,$d,[I(`span`,ef,M(n.name),1),I(`span`,{class:j([`pill`,n.enabled?`done`:`inactive`])},[t[1]||=I(`i`,null,null,-1),a(M(n.enabled?(`tl`in e?e.tl:f(X))(`Enabled`,`Activée`):(`tl`in e?e.tl:f(X))(`Disabled`,`Désactivée`)),1)],2)]),I(`span`,tf,[E(c,{name:`i-lucide-alarm-clock`}),a(M(n.schedule),1)]),I(`dl`,nf,[n.kind?(_(),v(`div`,rf,[I(`dt`,null,M((`tl`in e?e.tl:f(X))(`Kind`,`Type`)),1),I(`dd`,null,M(n.kind),1)])):g(``,!0),(_(!0),v(k,null,y(n.when,(e,t)=>(_(),v(`div`,{key:t},[I(`dd`,af,M(e),1)]))),128))])],2)]))),128)),(_(!0),v(k,null,y(f(n).broken,e=>(_(),v(`li`,{key:e.file,class:`pp-row`},[I(`div`,of,[I(`div`,sf,[I(`span`,cf,M(e.file),1)]),I(`p`,lf,M(e.error),1)])]))),128))])),f(n).routines.length||f(n).broken.length?(_(),v(`p`,uf,M((`tl`in e?e.tl:f(X))(`Read-only. Routines are approved and switched from the terminal.`,`Lecture seule. Les routines s’approuvent et s’activent depuis le terminal.`)),1)):g(``,!0)],64)):g(``,!0)])}}}),{__name:`ProjectRoutines`}),ff={class:`ps`},pf={key:0,class:`pp-notice error`,role:`alert`},mf={key:1,class:`pp-notice`},hf={class:`ps-list`},gf={class:`ps-label`},_f={class:`ps-key`},vf={key:0,class:`ps-default`},yf={class:`pt-label ps-head`},bf={class:`pp-count`},xf={key:0,class:`pp-empty ps-none`},Sf={key:1,class:`ps-repos`},Cf={key:0,class:`ps-default`},wf={class:`pp-empty ps-note`},Tf=Object.assign(T({__name:`ProjectSettings`,props:{paneId:{},board:{},tick:{}},setup(e){let t=e,r=u(null),i=h(!1),o=h(``),s=0;async function c(){if(jn.value)return;let e=++s;i.value=!0;try{let n=await Ct(t.paneId);if(e!==s)return;r.value=n.settings,o.value=``}catch(t){e===s&&(o.value=t.message)}finally{e===s&&(i.value=!1)}}w(c),B(()=>[t.tick,t.board.version],c),l(()=>{s++});let d=e=>e?X(`On`,`Oui`):X(`Off`,`Non`),p=e=>e===0?X(`Never`,`Jamais`):X(`${e} day${e===1?``:`s`}`,`${e} jour${e>1?`s`:``}`),m=n(()=>{let e=r.value;return e?[{key:`name`,label:X(`Name`,`Nom`),toml:`name`,value:e.name||`—`},{key:`goal`,label:X(`Goal`,`Objectif`),toml:`goal`,value:e.goal||`—`},{key:`coordinatorProfile`,label:X(`Coordinator profile`,`Profil du coordinateur`),toml:`coordinator_profile`,value:e.coordinatorProfile},{key:`threadProfile`,label:X(`Thread profile`,`Profil des threads`),toml:`thread_profile`,value:e.threadProfile},{key:`maxParallelThreads`,label:X(`Parallel threads`,`Threads en parallèle`),toml:`max_parallel_threads`,value:String(e.maxParallelThreads)},{key:`autoResolveDays`,label:X(`Automatically mark done after`,`Marquer automatiquement comme fait après`),toml:`auto_resolve_days`,value:p(e.autoResolveDays)},{key:`nudge`,label:X(`Nudge the coordinator`,`Relancer le coordinateur`),toml:`nudge`,value:d(e.nudge)},{key:`mute`,label:X(`Mute notifications`,`Notifications en sourdine`),toml:`mute`,value:d(e.mute)}]:[]});return(e,t)=>{let n=yt;return _(),v(`div`,ff,[f(o)?(_(),v(`p`,pf,[I(`span`,null,[a(M((`tl`in e?e.tl:f(X))(`Settings unavailable`,`Réglages indisponibles`))+` · `,1),I(`code`,null,M(f(o)),1)]),E(n,{size:`xs`,color:`neutral`,variant:`outline`,onClick:c},{default:H(()=>[a(M((`tl`in e?e.tl:f(X))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(r)===null&&f(i)?(_(),v(`p`,mf,[t[0]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`tl`in e?e.tl:f(X))(`Reading the settings…`,`Lecture des réglages…`)),1)])):g(``,!0),f(r)?(_(),v(k,{key:2},[I(`dl`,hf,[(_(!0),v(k,null,y(f(m),t=>(_(),v(`div`,{key:t.key,class:`ps-row`},[I(`dt`,null,[I(`span`,gf,M(t.label),1),I(`code`,_f,M(t.toml),1)]),I(`dd`,null,[a(M(t.value),1),f(r).defaults.includes(t.key)?(_(),v(`span`,vf,M((`tl`in e?e.tl:f(X))(`default`,`par défaut`)),1)):g(``,!0)])]))),128))]),I(`h3`,yf,[a(M((`tl`in e?e.tl:f(X))(`Repositories`,`Dépôts`))+` `,1),I(`span`,bf,M(f(r).repos.length),1)]),f(r).repos.length?(_(),v(`ul`,Sf,[(_(!0),v(k,null,y(f(r).repos,(e,t)=>(_(),v(`li`,{key:t},[I(`code`,null,M(e.path),1),e.machine?(_(),v(`span`,Cf,M(e.machine),1)):g(``,!0)]))),128))])):(_(),v(`p`,xf,M((`tl`in e?e.tl:f(X))(`No repository: threads start as tabs in the project`,`Aucun dépôt : les threads démarrent en onglets du projet`)),1)),I(`p`,wf,M((`tl`in e?e.tl:f(X))(`Read-only. Change a setting with “herdr-projects set”, or ask the coordinator.`,`Lecture seule. Un réglage se change avec « herdr-projects set », ou en le demandant au coordinateur.`)),1)],64)):g(``,!0)])}}}),{__name:`ProjectSettings`}),Ef={class:`pm`},Df={key:0,class:`pp-notice error`,role:`alert`},Of={key:1,class:`pp-notice`},kf={key:0,class:`pp-empty pi-none`},Af={key:1,class:`pp-list pm-list`},jf=[`aria-label`,`onClick`],Mf={class:`pp-thread-title`},Nf={key:0,class:`pm-hook`},Pf={class:`pp-meta`},Ff={key:0,class:`spinner pp-spin`},If={key:2,class:`pp-empty ps-note`},Lf={key:0,class:`pp-report pm-doc`},Rf={class:`pp-meta pm-path`},zf={class:`md`},Bf={key:0,class:`pp-notice`},Vf=Object.assign(T({__name:`ProjectMemory`,props:{paneId:{},board:{},tick:{}},setup(e){let t=e,n=u(null),r=h(!1),i=h(``),o=0;async function s(){if(jn.value)return;let e=++o;r.value=!0;try{let r=await Gt(t.paneId);if(e!==o)return;n.value=r.files,i.value=``}catch(t){e===o&&(i.value=t.message)}finally{e===o&&(r.value=!1)}}w(s),B(()=>[t.tick,t.board.version],s),l(()=>{o++});let c=h(null),d=h(!1),p=h(null);async function b(e){if(!p.value){if(e.missing)return $(X(`This file is listed in MEMORY.md but does not exist`,`Ce fichier est cité dans MEMORY.md mais n’existe pas`),!0);p.value=e.name,Q();try{let n=await Xe(t.paneId,e.name);c.value={file:e,html:Kt(n.text,{plain:!0}),truncated:n.truncated},d.value=!0}catch(e){$(e.message,!0)}finally{p.value=null}}}return(e,t)=>{let o=yt,l=Ee,u=ri,h=Si;return _(),v(`div`,Ef,[f(i)?(_(),v(`p`,Df,[I(`span`,null,[a(M((`tl`in e?e.tl:f(X))(`Memory unavailable`,`Mémoire indisponible`))+` · `,1),I(`code`,null,M(f(i)),1)]),E(o,{size:`xs`,color:`neutral`,variant:`outline`,onClick:s},{default:H(()=>[a(M((`tl`in e?e.tl:f(X))(`Retry`,`Réessayer`)),1)]),_:1})])):g(``,!0),f(n)===null&&f(r)?(_(),v(`p`,Of,[t[1]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`tl`in e?e.tl:f(X))(`Reading the memory…`,`Lecture de la mémoire…`)),1)])):g(``,!0),f(n)?(_(),v(k,{key:2},[f(n).length?(_(),v(`ul`,Af,[(_(!0),v(k,null,y(f(n),t=>(_(),v(`li`,{key:t.name,class:`pp-row`},[I(`div`,{class:j([`pp-card pm-card`,{missing:t.missing,index:t.index}])},[I(`button`,{type:`button`,class:`pp-thread pm-file`,"aria-label":(`tl`in e?e.tl:f(X))(`Memory: ${t.title}`,`Mémoire : ${t.title}`),onClick:e=>b(t)},[I(`span`,Mf,M(t.index?(`tl`in e?e.tl:f(X))(`Index`,`Index`):t.title),1),t.hook?(_(),v(`span`,Nf,M(t.hook),1)):g(``,!0),I(`span`,Pf,M(t.index?t.name:`memory/${t.name}`)+M(t.missing?(`tl`in e?e.tl:f(X))(` · missing`,` · absent`):``),1)],8,jf),f(p)===t.name?(_(),v(`span`,Ff)):(_(),m(l,{key:1,name:`i-lucide-chevron-right`,class:`pt-go`}))],2)]))),128))])):(_(),v(`p`,kf,M((`tl`in e?e.tl:f(X))(`No memory in this project yet`,`Pas encore de mémoire dans ce projet`)),1)),f(n).length?(_(),v(`p`,If,M((`tl`in e?e.tl:f(X))(`Read-only. The coordinator writes the project’s memory.`,`Lecture seule. La mémoire du projet est écrite par le coordinateur.`)),1)):g(``,!0)],64)):g(``,!0),E(h,{open:f(d),"onUpdate:open":t[0]||=e=>W(d)?d.value=e:null,title:f(c)?f(c).file.index?f(c).file.name:f(c).file.title:``,wide:``,tall:``,screen:``},{default:H(()=>[f(c)?(_(),v(`div`,Lf,[I(`p`,Rf,M(f(c).file.index?f(c).file.name:`memory/${f(c).file.name}`),1),I(`div`,zf,[E(u,{html:f(c).html,typing:null},null,8,[`html`])]),f(c).truncated?(_(),v(`p`,Bf,M((`tl`in e?e.tl:f(X))(`File truncated (too long).`,`Fichier tronqué (trop long).`)),1)):g(``,!0)])):g(``,!0)]),_:1},8,[`open`,`title`])])}}}),{__name:`ProjectMemory`}),Hf=[`aria-label`],Uf={class:`pp-head`},Wf={class:`pp-kicker`},Gf={key:0,class:`pp-slug`},Kf=[`aria-label`],qf=[`id`,`aria-selected`,`tabindex`,`onClick`],Jf={key:0,class:`pp-tab-n`},Yf=[`aria-labelledby`],Xf={key:0,class:`pp-notice error`,role:`alert`},Zf={key:1,class:`pp-notice`},Qf={key:2,class:`pp-notice error`},$f={key:0,class:`pp-notice`},ep={key:1,class:`pp-hint`},tp=[`aria-label`],np=[`aria-expanded`,`onClick`],rp={class:`pp-sec-title`},ip={class:`pp-count`},ap={key:0,class:`pp-slots`},op={key:2,class:`pp-list`},sp=[`onClick`],cp={class:`pp-thread-title`},lp={class:`pp-meta`},up={key:2,class:`spinner pp-spin`},dp={class:`pp-task-body`},fp={class:`pp-task-text`},pp={key:0,class:`pp-reason`},mp={key:1,class:`pp-task-foot`},hp={key:0,class:`pp-sent`},gp=[`disabled`,`aria-label`,`onClick`],_p={key:0,class:`spinner`},vp=[`disabled`,`aria-label`,`onClick`],yp={key:0,class:`spinner`},bp=[`disabled`,`aria-label`,`onClick`],xp={key:0,class:`spinner`},Sp=[`disabled`,`aria-label`,`onClick`],Cp={key:0,class:`spinner`},wp=[`aria-label`,`onClick`],Tp=[`disabled`,`aria-label`,`onClick`],Ep={key:0,class:`spinner`},Dp=[`disabled`,`aria-label`,`onClick`],Op={key:0,class:`spinner`},kp=[`aria-label`,`onClick`],Ap=[`disabled`,`aria-label`,`onClick`],jp={key:0,class:`spinner`},Mp=[`aria-label`,`onClick`],Np=[`disabled`,`aria-label`,`onClick`],Pp={key:0,class:`spinner`},Fp=[`aria-label`,`onClick`],Ip=[`aria-label`,`onClick`],Lp=[`aria-label`,`onClick`],Rp=[`disabled`,`aria-label`,`onClick`],zp={key:0,class:`spinner`},Bp=[`disabled`,`aria-label`,`onClick`],Vp={key:0,class:`spinner`},Hp=[`aria-label`,`onClick`],Up={key:0,class:`pp-empty`},Wp={class:`pp-list pp-all`},Gp={class:`pp-card resolved`},Kp=[`onClick`],qp={class:`pp-thread-title`},Jp={class:`pp-meta`},Yp={key:0,class:`spinner pp-spin`},Xp={class:`pp-info-for`},Zp={class:`pp-info-id`},Qp={class:`pp-info-title`},$p={class:`plugin-input-hint`},em={class:`rename-actions`},tm=new Map,nm=Object.assign(T({__name:`ProjectPanel`,props:{paneId:{},board:{},loading:{type:Boolean},error:{},side:{type:Boolean}},emits:[`reload`,`collapse`,`sent`,`prefill`],setup(e,{emit:t}){let r=e,i=t,o=[{key:`tasks`,label:X(`Tasks`,`Tâches`)},{key:`threads`,label:`Threads`},{key:`inbox`,label:`Inbox`},{key:`routines`,label:`Routines`},{key:`settings`,label:Y(`Settings`)},{key:`memory`,label:X(`Memory`,`Mémoire`)}],s=tm.get(r.paneId),c=h(o.some(e=>e.key===s)?s:`tasks`);function u(e){c.value!==e&&(c.value=e,tm.set(r.paneId,e),Q())}function d(e,t){u(e),t.currentTarget.scrollIntoView?.({block:`nearest`,inline:`nearest`})}let p=b(`tabBar`),x=h({left:!1,right:!1});function S(){let e=p.value;e&&(x.value={left:e.scrollLeft>2,right:e.scrollLeft+e.clientWidth<e.scrollWidth-2})}let C=null;B(p,e=>{C?.disconnect(),C=null,e&&(S(),typeof ResizeObserver<`u`&&(C=new ResizeObserver(S),C.observe(e)),e.querySelector(`.pp-tab.on`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}))},{flush:`post`}),l(()=>C?.disconnect());function T(e){let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0;if(!t)return;e.preventDefault();let n=o[(o.findIndex(e=>e.key===c.value)+t+o.length)%o.length],r=e.currentTarget;u(n.key),P(()=>{let e=r.querySelector(`.pp-tab.on`);e?.focus(),e?.scrollIntoView?.({block:`nearest`,inline:`nearest`})})}let D=h(null),O=e=>e===`threads`&&r.board?r.board.open.length:e===`inbox`?D.value:null,A=h(0);function N(){A.value++,i(`reload`)}function F(e){K.value&&r.board&&fi(K.value,r.board.slug,e)||e.report?ne(e):u(`threads`)}let L=n(()=>r.board?en(At(r.board,{doing:Y(`In progress`),done:X(`Done`,`Fait`)}),Fr.value):[]),R={test:`i-lucide-flask-conical`,decide:`i-lucide-signpost`,review:`i-lucide-git-pull-request`,blocked:`i-lucide-octagon-alert`,doing:`i-lucide-activity`,queue:`i-lucide-list-ordered`,todo:`i-lucide-list-todo`,backlog:`i-lucide-archive`,done:`i-lucide-circle-check`},z=e=>e?R[e]:`i-lucide-list`,V=h({}),U=e=>!(V.value[e.key]??e.kind===`done`);function ee(e){V.value={...V.value,[e.key]:U(e)},Q()}let te=e=>e.tasks.filter(e=>!e.done).length+e.threads.length,K=n(()=>er.value.panes.find(e=>e.id===r.paneId));function ne(e){K.value&&r.board&&pi(K.value,r.board.slug,e)}let re=h(!1),ie=()=>or===`en`?`en`:`fr`,ae=ya;B(()=>r.board,e=>{e&&va(r.paneId,e)},{immediate:!0});async function se(e,t,n,a){let o=await ba(r.paneId,e,t,n,a);o!==!1&&((t===`up`||t===`down`)&&$(Y(`Sent to the coordinator`)),i(`sent`,o))}let ce=(e,t)=>e.kind===`test`&&!t.done,le=(e,t)=>e.kind===`decide`&&!t.done,ue=(e,t)=>e.kind===`backlog`&&!t.done,de=(e,t)=>e.kind===`blocked`&&!t.done,fe=(e,t)=>e.kind===`review`&&!t.done,pe=(e,t)=>(e.kind===`todo`||e.kind===`queue`)&&!t.done,me=(e,t)=>e.kind===`doing`&&!t.done&&!!t.thread&&!r.board?.resolved.some(e=>e.id===t.thread),he=(e,t)=>!t.done&&e.kind!==`done`,ge=(e,t)=>(ce(e,t)||ue(e,t)||de(e,t)||fe(e,t)||pe(e,t))&&Sa(r.paneId,e.kind,t.text),_e=(e,t,n)=>pa(e.kind,t,n.text),ve=e=>e.tasks.filter(e=>!e.done),ye=(e,t)=>ve(e)[0]===t,be=(e,t)=>ve(e).at(-1)===t,xe=(e,t,n)=>se(e.kind,n,t.text,Pt(n,t.text,ie())),Se=e=>e.kind===`queue`?Ge(r.board?.slots,ve(e)[0]?.text,ie()):null,Ce=e=>e.kind===`queue`?_i(r.board?.machineSlots,ie()):null,we=n(()=>!!(r.board?.machineSlots&&r.board.machineSlots.open>=r.board.machineSlots.max)),Te=e=>se(`review`,`reviewed`,e.text,on(e.text,ie())),De=e=>se(`test`,`tested`,e.text,rn(e.text,ie())),Oe=e=>se(`backlog`,`launch`,e.text,tt(e.text,ie())),ke=e=>se(`blocked`,`unblock`,e.text,oe(e.text,ie()));function Ae(e,t){Q();let n={problem:dt,question:ct,decision:Ze,detail:xt,comment:Qt}[t];i(`prefill`,n(e.text,ie()))}let je=h(null),Me=h(!1),Ne=h(``),Pe=h(!1),Fe=h(null),Ie=new Map;function Le(e,t){Q(),je.value={id:e,title:t},Ne.value=Ie.get(e)||``,Me.value=!0,setTimeout(()=>Fe.value?.textareaRef?.focus(),80)}B(Ne,e=>{je.value&&Ie.set(je.value.id,e)});async function Re(){let e=je.value;if(e&&!Pe.value&&Ne.value.trim()){Pe.value=!0,Q();try{let t=await ga(r.paneId,Jt(e.id,Ne.value,ie()));if(t===!1)return;Me.value=!1,Ne.value=``,Ie.delete(e.id),$(Y(`Sent to the coordinator`)),i(`sent`,t)}catch(e){$(e.message,!0)}finally{Pe.value=!1}}}let ze=`hw-project-hint-off`,Be=h(!1);w(()=>{try{Be.value=localStorage.getItem(ze)===`1`}catch{}});let Ve=n(()=>r.board&&!r.board.tasksMissing?at(r.board.lists):[]),He=n(()=>{let e=Ve.value.map(e=>e===`test`?X(`“To test”`,`« À tester »`):X(`“To decide”`,`« À décider »`));return X(`No ${e.join(` or `)} list in TASKS.md.`,`Pas de liste ${e.join(` ni `)} dans TASKS.md.`)});function Ue(){Be.value=!0;try{localStorage.setItem(ze,`1`)}catch{}}return(t,n)=>{let r=yt,s=ti,l=jd,u=qd,h=df,b=Tf,C=Vf,w=fn,P=Ee,R=ma,B=xa,V=Si,ie=Bi;return _(),v(`aside`,{class:j([`project-panel`,{side:e.side}]),"aria-label":(`t`in t?t.t:f(Y))(`Project`)},[I(`header`,Uf,[I(`span`,Wf,M((`t`in t?t.t:f(Y))(`Project`)),1),e.board?(_(),v(`span`,Gf,M(e.board.slug),1)):g(``,!0),n[9]||=I(`span`,{class:`pp-grow`},null,-1),E(s,{text:(`t`in t?t.t:f(Y))(`Refresh`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[E(r,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`ghost`,size:`sm`,class:j([`icon-btn pp-btn`,{spinning:e.loading}]),"aria-label":(`t`in t?t.t:f(Y))(`Refresh`),onClick:N},null,8,[`class`,`aria-label`])]),_:1},8,[`text`,`disabled`]),e.side?(_(),m(s,{key:1,text:(`t`in t?t.t:f(Y))(`Collapse the panel`)},{default:H(()=>[E(r,{icon:`i-lucide-panel-right-close`,color:`neutral`,variant:`ghost`,size:`sm`,class:`icon-btn pp-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Collapse the panel`),onClick:n[0]||=e=>i(`collapse`)},null,8,[`aria-label`])]),_:1},8,[`text`])):g(``,!0)]),e.board?(_(),v(`div`,{key:0,class:j([`pp-tabs-wrap`,{"more-left":f(x).left,"more-right":f(x).right}])},[I(`div`,{ref_key:`tabBar`,ref:p,class:`pp-tabs`,role:`tablist`,"aria-label":(`tl`in t?t.tl:f(X))(`Project sections`,`Sections du projet`),onKeydown:T,onScrollPassive:S},[(_(),v(k,null,y(o,e=>I(`button`,{id:`pp-tab-${e.key}`,key:e.key,type:`button`,role:`tab`,class:j([`pp-tab`,{on:f(c)===e.key}]),"aria-selected":f(c)===e.key,tabindex:f(c)===e.key?0:-1,onClick:t=>d(e.key,t)},[I(`span`,null,M(e.label),1),O(e.key)===null?g(``,!0):(_(),v(`span`,Jf,M(O(e.key)),1))],10,qf)),64))],40,Kf)],2)):g(``,!0),I(`div`,{class:`pp-scroll`,role:`tabpanel`,"aria-labelledby":e.board?`pp-tab-${f(c)}`:void 0},[e.error&&!e.board?(_(),v(`p`,Xf,M(e.error),1)):g(``,!0),!e.board&&e.loading?(_(),v(`p`,Zf,[n[10]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in t?t.t:f(Y))(`Reading the project…`)),1)])):g(``,!0),e.board?.threadsError?(_(),v(`p`,Qf,[a(M((`t`in t?t.t:f(Y))(`Threads unavailable`))+` · `,1),I(`code`,null,M(e.board.threadsError),1)])):g(``,!0),e.board&&f(c)===`threads`?(_(),m(l,{key:3,"pane-id":e.paneId,board:e.board,onReload:n[1]||=e=>i(`reload`),onReport:n[2]||=n=>(`openThreadReport`in t?t.openThreadReport:f(di))(e.paneId,n),onAgent:ne},null,8,[`pane-id`,`board`])):e.board&&f(c)===`inbox`?(_(),m(u,{key:4,"pane-id":e.paneId,board:e.board,tick:f(A),onCount:n[3]||=e=>D.value=e,onThread:F},null,8,[`pane-id`,`board`,`tick`])):e.board&&f(c)===`routines`?(_(),m(h,{key:5,"pane-id":e.paneId,board:e.board,tick:f(A)},null,8,[`pane-id`,`board`,`tick`])):e.board&&f(c)===`settings`?(_(),m(b,{key:6,"pane-id":e.paneId,board:e.board,tick:f(A)},null,8,[`pane-id`,`board`,`tick`])):e.board&&f(c)===`memory`?(_(),m(C,{key:7,"pane-id":e.paneId,board:e.board,tick:f(A)},null,8,[`pane-id`,`board`,`tick`])):e.board?(_(),v(k,{key:8},[e.board.tasksMissing?(_(),v(`p`,$f,M((`t`in t?t.t:f(Y))(`No TASKS.md in this project yet.`)),1)):g(``,!0),f(Ve).length&&!f(Be)?(_(),v(`p`,ep,[I(`span`,null,[a(M(f(He))+` `,1),E(w,{to:`/settings?section=plugins`},{default:H(()=>[a(M((`tl`in t?t.tl:f(X))(`See the convention`,`Voir la convention`)),1)]),_:1})]),I(`button`,{type:`button`,class:`pp-hint-x`,"aria-label":(`tl`in t?t.tl:f(X))(`Hide the suggestion`,`Masquer la suggestion`),onClick:Ue},[E(P,{name:`i-lucide-x`})],8,tp)])):g(``,!0),(_(!0),v(k,null,y(f(L),i=>(_(),v(`section`,{key:i.key,class:j([`pp-sec`,[i.kind,{folded:!U(i)}]])},[I(`button`,{type:`button`,class:`pp-sec-head`,"aria-expanded":U(i),onClick:e=>ee(i)},[E(P,{name:z(i.kind),class:`pp-sec-icon`},null,8,[`name`]),I(`span`,rp,M(i.title),1),I(`span`,ip,M(te(i)),1),E(P,{name:`i-lucide-chevron-down`,class:`pp-chev`})],8,np),U(i)&&Se(i)?(_(),v(`p`,ap,M(Se(i)),1)):g(``,!0),U(i)&&Ce(i)?(_(),v(`p`,{key:1,class:j([`pp-slots machine`,{full:f(we)}])},M(Ce(i)),3)):g(``,!0),U(i)?(_(),v(`ul`,op,[(_(!0),v(k,null,y(i.kind===`done`?i.threads.slice(0,20):i.threads,i=>(_(),v(`li`,{key:i.id,class:`pp-row`},[I(`div`,{class:j([`pp-card`,{resolved:i.resolved}])},[I(`button`,{type:`button`,class:`pp-thread`,onClick:n=>i.resolved?(`openThreadReport`in t?t.openThreadReport:f(di))(e.paneId,i):ne(i)},[i.resolved?g(``,!0):(_(),v(`span`,{key:0,class:j([`pill`,(`threadClass`in t?t.threadClass:f(_a))(i)])},[n[11]||=I(`i`,null,null,-1),a(M((`threadLabel`in t?t.threadLabel:f(Ca))(i)),1)],2)),I(`span`,cp,M(i.title),1),I(`span`,lp,M((`threadMeta`in t?t.threadMeta:f(ha))(i)),1)],8,sp),i.resolved?g(``,!0):(_(),m(s,{key:0,text:(`tl`in t?t.tl:f(X))(`Add info for this thread`,`Ajouter une info pour ce thread`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[E(r,{icon:`i-lucide-message-square-plus`,color:`neutral`,variant:`ghost`,size:`sm`,class:`icon-btn pp-btn pp-info-btn`,"aria-label":(`tl`in t?t.tl:f(X))(`Add info: ${i.title}`,`Ajouter une info : ${i.title}`),onClick:e=>Le(i.id,i.title)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])),i.report&&!i.resolved?(_(),m(r,{key:1,icon:`i-lucide-file-text`,color:`neutral`,variant:`ghost`,size:`sm`,class:`icon-btn pp-btn`,loading:(`threadReportLoading`in t?t.threadReportLoading:f(si))===i.id,"aria-label":(`t`in t?t.t:f(Y))(`View report`),onClick:n=>(`openThreadReport`in t?t.openThreadReport:f(di))(e.paneId,i)},null,8,[`loading`,`aria-label`,`onClick`])):(`threadReportLoading`in t?t.threadReportLoading:f(si))===i.id?(_(),v(`span`,up)):g(``,!0)],2)]))),128)),(_(!0),v(k,null,y(i.tasks,(r,o)=>(_(),v(`li`,{key:`t${o}`,class:j([`pp-row pp-task`,{done:r.done,testable:ce(i,r),decidable:le(i,r),launchable:ue(i,r),unblockable:de(i,r),reviewable:fe(i,r),sent:ge(i,r),orderable:pe(i,r)}])},[n[12]||=I(`span`,{class:`pp-box`,"aria-hidden":`true`},null,-1),I(`span`,dp,[I(`span`,fp,[E(R,{text:r.text},null,8,[`text`])]),r.reason?(_(),v(`span`,pp,M(r.reason),1)):g(``,!0),r.badges?.length||he(i,r)?(_(),v(`span`,mp,[ge(i,r)?(_(),v(`span`,hp,[E(P,{name:`i-lucide-send`}),a(M((`t`in t?t.t:f(Y))(`Sent to the coordinator`)),1)])):g(``,!0),r.badges&&f(K)?(_(),m(B,{key:1,badges:r.badges,coordinator:f(K),board:e.board},null,8,[`badges`,`coordinator`,`board`])):g(``,!0),he(i,r)?(_(),v(`span`,{key:2,class:j([`pp-verdict`,{wrap:pe(i,r)}])},[pe(i,r)&&!ge(i,r)?(_(),v(k,{key:0},[E(s,{text:(`tl`in t?t.tl:f(X))(`Move up`,`Monter`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn move`,disabled:f(ae)!==null||ye(i,r),"aria-label":(`tl`in t?t.tl:f(X))(`Move up: ${r.text}`,`Monter : ${r.text}`),onClick:e=>xe(i,r,`up`)},[f(ae)===_e(i,`up`,r)?(_(),v(`span`,_p)):(_(),m(P,{key:1,name:`i-lucide-arrow-up`}))],8,gp)]),_:2},1032,[`text`,`disabled`]),E(s,{text:(`tl`in t?t.tl:f(X))(`Move down`,`Descendre`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn move`,disabled:f(ae)!==null||be(i,r),"aria-label":(`tl`in t?t.tl:f(X))(`Move down: ${r.text}`,`Descendre : ${r.text}`),onClick:e=>xe(i,r,`down`)},[f(ae)===_e(i,`down`,r)?(_(),v(`span`,yp)):(_(),m(P,{key:1,name:`i-lucide-arrow-down`}))],8,vp)]),_:2},1032,[`text`,`disabled`]),i.kind===`todo`?(_(),m(s,{key:0,text:(`tl`in t?t.tl:f(X))(`Queue it: launched automatically when a thread slot frees`,`Mettre en file : lancé automatiquement dès qu’une place de thread se libère`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn backlog-action queue`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(X))(`Queue it: ${r.text}`,`Mettre en file : ${r.text}`),onClick:e=>xe(i,r,`queue`)},[f(ae)===_e(i,`queue`,r)?(_(),v(`span`,xp)):(_(),m(P,{key:1,name:`i-lucide-list-plus`})),I(`span`,null,M((`tl`in t?t.tl:f(X))(`Queue`,`En file`)),1)],8,bp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),E(s,{text:i.kind===`queue`?(`tl`in t?t.tl:f(X))(`Launch now, ahead of the queue`,`Lancer maintenant, avant la file`):(`tl`in t?t.tl:f(X))(`Launch now if a thread slot is free, otherwise first in the queue`,`Lancer maintenant si une place de thread est libre, sinon en tête de file`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn backlog-action launch`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(X))(`Launch now: ${r.text}`,`Lancer maintenant : ${r.text}`),onClick:e=>xe(i,r,`now`)},[f(ae)===_e(i,`now`,r)?(_(),v(`span`,Cp)):(_(),m(P,{key:1,name:`i-lucide-play`})),I(`span`,null,M((`tl`in t?t.tl:f(X))(`Launch`,`Lancer`)),1)],8,Sp)]),_:2},1032,[`text`,`disabled`]),E(s,{text:(`tl`in t?t.tl:f(X))(`Clarify this task`,`Préciser cette tâche`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn clarify`,"aria-label":(`tl`in t?t.tl:f(X))(`Clarify: ${r.text}`,`Préciser : ${r.text}`),onClick:e=>Ae(r,`detail`)},[E(P,{name:`i-lucide-pencil`})],8,wp)]),_:2},1032,[`text`,`disabled`]),i.kind===`todo`?(_(),m(s,{key:1,text:(`tl`in t?t.tl:f(X))(`Back to backlog`,`Remettre au backlog`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn park`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(X))(`Back to backlog: ${r.text}`,`Remettre au backlog : ${r.text}`),onClick:e=>xe(i,r,`backlog`)},[f(ae)===_e(i,`backlog`,r)?(_(),v(`span`,Ep)):(_(),m(P,{key:1,name:`i-lucide-archive`}))],8,Tp)]),_:2},1032,[`text`,`disabled`])):(_(),m(s,{key:2,text:(`tl`in t?t.tl:f(X))(`Remove from queue (back to To do)`,`Retirer de la file (retour en À faire)`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn park`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(X))(`Remove from queue: ${r.text}`,`Retirer de la file : ${r.text}`),onClick:e=>xe(i,r,`unqueue`)},[f(ae)===_e(i,`unqueue`,r)?(_(),v(`span`,Op)):(_(),m(P,{key:1,name:`i-lucide-list-x`}))],8,Dp)]),_:2},1032,[`text`,`disabled`]))],64)):g(``,!0),me(i,r)?(_(),m(s,{key:1,text:(`tl`in t?t.tl:f(X))(`Add info for this thread`,`Ajouter une info pour ce thread`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn backlog-action info`,"aria-label":(`tl`in t?t.tl:f(X))(`Add info: ${r.text}`,`Ajouter une info : ${r.text}`),onClick:e=>Le(r.thread,r.text)},[E(P,{name:`i-lucide-message-square-plus`}),I(`span`,null,M((`tl`in t?t.tl:f(X))(`Add info`,`Ajouter info`)),1)],8,kp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),fe(i,r)&&!ge(i,r)?(_(),m(s,{key:2,text:(`tl`in t?t.tl:f(X))(`Reviewed: tell the coordinator`,`Relu : prévenir le coordinateur`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn backlog-action reviewed`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(X))(`Reviewed: ${r.text}`,`Relu : ${r.text}`),onClick:e=>Te(r)},[f(ae)===(`sentKey`in t?t.sentKey:f(pa))(`review`,`reviewed`,r.text)?(_(),v(`span`,jp)):(_(),m(P,{key:1,name:`i-lucide-check`})),I(`span`,null,M((`tl`in t?t.tl:f(X))(`Reviewed`,`Relu`)),1)],8,Ap)]),_:2},1032,[`text`,`disabled`])):g(``,!0),fe(i,r)&&!ge(i,r)?(_(),m(s,{key:3,text:(`tl`in t?t.tl:f(X))(`Draft review feedback`,`Préparer un retour de relecture`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn backlog-action clarify`,"aria-label":(`tl`in t?t.tl:f(X))(`Comment: ${r.text}`,`Commenter : ${r.text}`),onClick:e=>Ae(r,`comment`)},[E(P,{name:`i-lucide-message-square`}),I(`span`,null,M((`tl`in t?t.tl:f(X))(`Comment`,`Commenter`)),1)],8,Mp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),ce(i,r)&&!ge(i,r)?(_(),m(s,{key:4,text:(`t`in t?t.t:f(Y))(`Confirm: tested, it works`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn ok`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(X))(`Confirm: ${r.text}`,`Confirmer : ${r.text}`),onClick:e=>De(r)},[f(ae)===(`sentKey`in t?t.sentKey:f(pa))(`test`,`tested`,r.text)?(_(),v(`span`,Pp)):(_(),m(P,{key:1,name:`i-lucide-check`}))],8,Np)]),_:2},1032,[`text`,`disabled`])):g(``,!0),ce(i,r)&&!ge(i,r)?(_(),m(s,{key:5,text:(`t`in t?t.t:f(Y))(`Report a problem`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn ko`,"aria-label":(`tl`in t?t.tl:f(X))(`Problem: ${r.text}`,`Problème : ${r.text}`),onClick:e=>Ae(r,`problem`)},[E(P,{name:`i-lucide-x`})],8,Fp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),he(i,r)?(_(),m(s,{key:6,text:(`t`in t?t.t:f(Y))(`Ask a question`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn ask`,"aria-label":(`tl`in t?t.tl:f(X))(`Question: ${r.text}`,`Question : ${r.text}`),onClick:e=>Ae(r,`question`)},[E(P,{name:`i-lucide-circle-help`})],8,Ip)]),_:2},1032,[`text`,`disabled`])):g(``,!0),le(i,r)?(_(),m(s,{key:7,text:(`tl`in t?t.tl:f(X))(`Answer this decision`,`Répondre à cette décision`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn decide`,"aria-label":(`tl`in t?t.tl:f(X))(`Answer: ${r.text}`,`Répondre : ${r.text}`),onClick:e=>Ae(r,`decision`)},[E(P,{name:`i-lucide-reply`})],8,Lp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),ue(i,r)&&!ge(i,r)?(_(),m(s,{key:8,text:(`tl`in t?t.tl:f(X))(`Send to coordinator`,`Envoyer au coordinateur`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn backlog-action launch`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(X))(`Launch: ${r.text}`,`Lancer : ${r.text}`),onClick:e=>Oe(r)},[f(ae)===(`sentKey`in t?t.sentKey:f(pa))(`backlog`,`launch`,r.text)?(_(),v(`span`,zp)):(_(),m(P,{key:1,name:`i-lucide-play`})),I(`span`,null,M((`t`in t?t.t:f(Y))(`Launch`)),1)],8,Rp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),de(i,r)&&!ge(i,r)?(_(),m(s,{key:9,text:(`tl`in t?t.tl:f(X))(`Ask to unblock this task`,`Demander de débloquer cette tâche`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn backlog-action unblock`,disabled:f(ae)!==null,"aria-label":(`tl`in t?t.tl:f(X))(`Unblock: ${r.text}`,`Débloquer : ${r.text}`),onClick:e=>ke(r)},[f(ae)===(`sentKey`in t?t.sentKey:f(pa))(`blocked`,`unblock`,r.text)?(_(),v(`span`,Vp)):(_(),m(P,{key:1,name:`i-lucide-lock-keyhole-open`})),I(`span`,null,M((`tl`in t?t.tl:f(X))(`Unblock`,`Débloquer`)),1)],8,Bp)]),_:2},1032,[`text`,`disabled`])):g(``,!0),ue(i,r)||de(i,r)?(_(),m(s,{key:10,text:(`tl`in t?t.tl:f(X))(`Clarify this task`,`Préciser cette tâche`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`pp-vbtn backlog-action clarify`,"aria-label":(`tl`in t?t.tl:f(X))(`Clarify: ${r.text}`,`Préciser : ${r.text}`),onClick:e=>Ae(r,`detail`)},[E(P,{name:`i-lucide-pencil`}),I(`span`,null,M((`t`in t?t.t:f(Y))(`Clarify`)),1)],8,Hp)]),_:2},1032,[`text`,`disabled`])):g(``,!0)],2)):g(``,!0)])):g(``,!0)])],2))),128)),!i.tasks.length&&!i.threads.length?(_(),v(`li`,Up,M((`t`in t?t.t:f(Y))(`Nothing yet`)),1)):g(``,!0)])):g(``,!0),U(i)&&i.kind===`done`&&i.threads.length>20?(_(),v(`button`,{key:3,type:`button`,class:`pp-more`,onClick:n[4]||=e=>re.value=!0},M((`tl`in t?t.tl:f(X))(`See all (${i.threads.length})`,`Tout voir (${i.threads.length})`)),1)):g(``,!0)],2))),128))],64)):g(``,!0)],8,Yf),E(V,{open:f(re),"onUpdate:open":n[5]||=e=>W(re)?re.value=e:null,title:(`tl`in t?t.tl:f(X))(`Done · ${e.board?.resolved.length||0} threads`,`Fait · ${e.board?.resolved.length||0} threads`),wide:``,screen:``},{default:H(()=>[I(`ul`,Wp,[(_(!0),v(k,null,y(e.board?.resolved||[],n=>(_(),v(`li`,{key:n.id,class:`pp-row`},[I(`div`,Gp,[I(`button`,{type:`button`,class:`pp-thread`,onClick:r=>(`openThreadReport`in t?t.openThreadReport:f(di))(e.paneId,n)},[I(`span`,qp,M(n.title),1),I(`span`,Jp,M((`threadMeta`in t?t.threadMeta:f(ha))(n)),1)],8,Kp),(`threadReportLoading`in t?t.threadReportLoading:f(si))===n.id?(_(),v(`span`,Yp)):g(``,!0)])]))),128))])]),_:1},8,[`open`,`title`]),E(V,{open:f(Me),"onUpdate:open":n[8]||=e=>W(Me)?Me.value=e:null,title:(`tl`in t?t.tl:f(X))(`Add info`,`Ajouter une info`),screen:``},{footer:H(()=>[I(`div`,em,[E(r,{color:`neutral`,variant:`ghost`,class:`sheet-btn`,disabled:f(Pe),onClick:n[7]||=e=>Me.value=!1},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Cancel`)),1)]),_:1},8,[`disabled`]),E(r,{type:`submit`,form:`pp-info-form`,color:`primary`,variant:`solid`,class:`sheet-btn hw-cta`,loading:f(Pe),disabled:!f(Ne).trim()},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Send`)),1)]),_:1},8,[`loading`,`disabled`])])]),default:H(()=>[f(je)?(_(),v(`form`,{key:0,id:`pp-info-form`,class:`rename sheet-form pp-info`,onSubmit:q(Re,[`prevent`])},[I(`p`,Xp,[I(`span`,Zp,M(f(je).id.toUpperCase()),1),I(`span`,Qp,M(f(je).title),1)]),E(ie,{ref_key:`infoField`,ref:Fe,modelValue:f(Ne),"onUpdate:modelValue":n[6]||=e=>W(Ne)?Ne.value=e:null,rows:5,autoresize:``,maxrows:12,size:`xl`,class:`w-full`,"aria-label":(`tl`in t?t.tl:f(X))(`Info for the thread`,`Info pour le thread`),placeholder:(`tl`in t?t.tl:f(X))(`What the thread should know…`,`Ce que le thread doit savoir…`),onKeydown:[G(q(Re,[`meta`,`prevent`]),[`enter`]),G(q(Re,[`ctrl`,`prevent`]),[`enter`])]},null,8,[`modelValue`,`aria-label`,`placeholder`,`onKeydown`]),I(`p`,$p,M((`tl`in t?t.tl:f(X))(`Sent to the coordinator, which passes it on to the thread as is.`,`Envoyé au coordinateur, qui le transmet tel quel au thread.`)),1)],32)):g(``,!0)]),_:1},8,[`open`,`title`])],10,Hf)}}}),{__name:`ProjectPanel`}),rm=[`aria-label`],im=[`onClick`],am=[`aria-label`],om=Object.assign(T({__name:`Keybar`,props:{ctl:{},allDigits:{type:Boolean}},setup(e){let t=e,r=[{key:`esc`,label:`esc`},{key:`enter`,label:`⏎`,cls:`wide`},{key:`up`,label:`↑`},{key:`down`,label:`↓`},{key:`1`,label:`1`},{key:`2`,label:`2`},{key:`3`,label:`3`},{key:`tab`,label:`tab`},{key:`shift+tab`,label:`⇧tab`},{key:`left`,label:`←`},{key:`right`,label:`→`},{key:`ctrl+c`,label:`^C`,cls:`danger`},{key:`backspace`,label:`⌫`},{key:`y`,label:`y`},{key:`n`,label:`n`}],i=n(()=>t.allDigits?[...r.slice(0,7),...[`4`,`5`,`6`,`7`,`8`,`9`,`0`].map(e=>({key:e,label:e})),...r.slice(7)]:r);function a(e){Q(),t.ctl.sendKeys([e])}function o(){t.ctl.hasFocus()?t.ctl.blur():t.ctl.focus()}return(t,n)=>{let r=Ee;return _(),v(`div`,{class:`keybar`,role:`toolbar`,"aria-label":(`t`in t?t.t:f(Y))(`Keys`)},[(_(!0),v(k,null,y(f(i),e=>(_(),v(`button`,{key:e.key,type:`button`,class:j(e.cls),onPointerdown:n[0]||=q(()=>{},[`prevent`]),onClick:t=>a(e.key)},M(e.label),43,im))),128)),I(`button`,{type:`button`,class:j([`kbd`,{on:e.ctl.kbdOn.value}]),"aria-label":(`t`in t?t.t:f(Y))(`Type in terminal`),onPointerdown:n[1]||=q(()=>{},[`prevent`]),onClick:o},[E(r,{name:`i-lucide-keyboard`})],42,am)],8,rm)}}}),{__name:`Keybar`}),sm=`wherdr.mouse-selection-hint.dismissed`,cm=h(!1),lm=!1;function um(){if(!lm&&typeof localStorage<`u`){lm=!0;try{cm.value=localStorage.getItem(sm)===`1`}catch{}}let e=h(!1),t=typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches,r=n(()=>t&&e.value&&!cm.value);function i(t){e.value=t.modes.mouseTrackingMode!==`none`}function a(){cm.value=!0;try{localStorage.setItem(sm,`1`)}catch{}}return{visible:r,refresh:i,dismiss:a}}var dm=e(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
26
26
  `)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
27
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),M=n(5435),N=n(4567),P=n(779);class F extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=F},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0){if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,A=0,j=[],M=m!==-1&&g!==-1;for(let N=0;N<x;N++){e.loadCell(N,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let P=!1,F=N,I=this._workCell;if(v.length>0&&N===v[0][0]){P=!0;let t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),F=t[1]-1,x=I.getWidth()}let L=this._isCellInSelection(N,t),R=n&&N===s,z=M&&N>=m&&N<=g,B=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{B=!0}));let V=I.getChars()||o.WHITESPACE_CELL_CHAR;if(V===` `&&(I.isUnderline()||I.isOverline())&&(V=`\xA0`),A=x*u-f.get(V,I.isBold(),I.isItalic()),b){if(S&&(L&&k||!L&&!k&&I.bg===w)&&(L&&k&&y.selectionForeground||I.fg===T)&&I.extended.ext===E&&z===D&&A===O&&!R&&!P&&!B){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=V,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=I.bg,T=I.fg,E=I.extended.ext,D=z,O=A,k=L,P&&s>=N&&s<=F&&(s=N),!this._coreService.isCursorHidden&&R&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(I.isBold()&&j.push(`xterm-bold`),I.isItalic()&&j.push(`xterm-italic`),I.isDim()&&j.push(`xterm-dim`),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(j.push(`xterm-underline-${I.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!I.isUnderlineColorDefault())){if(I.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(I.getUnderlineColor()).join(`,`)})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}}I.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),I.isStrikethrough()&&j.push(`xterm-strikethrough`),z&&(b.style.textDecoration=`underline`);let H=I.getFgColor(),U=I.getFgColorMode(),ee=I.getBgColor(),te=I.getBgColorMode(),W=!!I.isInverse();if(W){let e=H;H=ee,ee=e;let t=U;U=te,te=t}let G,ne,re,K=!1;switch(this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{e.options.layer!==`top`&&K||(e.backgroundColorRGB&&(te=50331648,ee=e.backgroundColorRGB.rgba>>8&16777215,G=e.backgroundColorRGB),e.foregroundColorRGB&&(U=50331648,H=e.foregroundColorRGB.rgba>>8&16777215,ne=e.foregroundColorRGB),K=e.options.layer===`top`)})),!K&&L&&(G=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ee=G.rgba>>8&16777215,te=50331648,K=!0,y.selectionForeground&&(U=50331648,H=y.selectionForeground.rgba>>8&16777215,ne=y.selectionForeground)),K&&j.push(`xterm-decoration-top`),te){case 16777216:case 33554432:re=y.ansi[ee],j.push(`xterm-bg-${ee}`);break;case 50331648:re=l.channels.toColor(ee>>16,ee>>8&255,255&ee),this._addStyle(b,`background-color:#${h((ee>>>0).toString(16),`0`,6)}`);break;default:W?(re=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):re=y.background}switch(G||I.isDim()&&(G=l.color.multiplyOpacity(re,.5)),U){case 16777216:case 33554432:I.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(b,re,y.ansi[H],I,G,void 0)||j.push(`xterm-fg-${H}`);break;case 50331648:let e=l.channels.toColor(H>>16&255,H>>8&255,255&H);this._applyMinimumContrast(b,re,e,I,G,ne)||this._addStyle(b,`color:#${h(H.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,re,y.foreground,I,G,ne)||W&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),R||P||B?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),N=F}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
27
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),M=n(5435),N=n(4567),P=n(779);class F extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=F},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0){if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,A=0,j=[],M=m!==-1&&g!==-1;for(let N=0;N<x;N++){e.loadCell(N,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let P=!1,F=N,I=this._workCell;if(v.length>0&&N===v[0][0]){P=!0;let t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),F=t[1]-1,x=I.getWidth()}let L=this._isCellInSelection(N,t),R=n&&N===s,z=M&&N>=m&&N<=g,B=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{B=!0}));let V=I.getChars()||o.WHITESPACE_CELL_CHAR;if(V===` `&&(I.isUnderline()||I.isOverline())&&(V=`\xA0`),A=x*u-f.get(V,I.isBold(),I.isItalic()),b){if(S&&(L&&k||!L&&!k&&I.bg===w)&&(L&&k&&y.selectionForeground||I.fg===T)&&I.extended.ext===E&&z===D&&A===O&&!R&&!P&&!B){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=V,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=I.bg,T=I.fg,E=I.extended.ext,D=z,O=A,k=L,P&&s>=N&&s<=F&&(s=N),!this._coreService.isCursorHidden&&R&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(I.isBold()&&j.push(`xterm-bold`),I.isItalic()&&j.push(`xterm-italic`),I.isDim()&&j.push(`xterm-dim`),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(j.push(`xterm-underline-${I.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!I.isUnderlineColorDefault())){if(I.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(I.getUnderlineColor()).join(`,`)})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}}I.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),I.isStrikethrough()&&j.push(`xterm-strikethrough`),z&&(b.style.textDecoration=`underline`);let H=I.getFgColor(),U=I.getFgColorMode(),ee=I.getBgColor(),W=I.getBgColorMode(),te=!!I.isInverse();if(te){let e=H;H=ee,ee=e;let t=U;U=W,W=t}let G,K,ne,q=!1;switch(this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{e.options.layer!==`top`&&q||(e.backgroundColorRGB&&(W=50331648,ee=e.backgroundColorRGB.rgba>>8&16777215,G=e.backgroundColorRGB),e.foregroundColorRGB&&(U=50331648,H=e.foregroundColorRGB.rgba>>8&16777215,K=e.foregroundColorRGB),q=e.options.layer===`top`)})),!q&&L&&(G=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ee=G.rgba>>8&16777215,W=50331648,q=!0,y.selectionForeground&&(U=50331648,H=y.selectionForeground.rgba>>8&16777215,K=y.selectionForeground)),q&&j.push(`xterm-decoration-top`),W){case 16777216:case 33554432:ne=y.ansi[ee],j.push(`xterm-bg-${ee}`);break;case 50331648:ne=l.channels.toColor(ee>>16,ee>>8&255,255&ee),this._addStyle(b,`background-color:#${h((ee>>>0).toString(16),`0`,6)}`);break;default:te?(ne=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):ne=y.background}switch(G||I.isDim()&&(G=l.color.multiplyOpacity(ne,.5)),U){case 16777216:case 33554432:I.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(b,ne,y.ansi[H],I,G,void 0)||j.push(`xterm-fg-${H}`);break;case 50331648:let e=l.channels.toColor(H>>16&255,H>>8&255,255&H);this._applyMinimumContrast(b,ne,e,I,G,K)||this._addStyle(b,`color:#${h(H.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,ne,y.foreground,I,G,K)||te&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),R||P||B?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),N=F}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
28
28
  `:`
29
29
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(n&&r&&t)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(e.button!==2||!this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=g=r([i(3,m.IBufferService),i(4,m.ICoreService),i(5,c.IMouseService),i(6,m.IOptionsService),i(7,c.IRenderService),i(8,c.ICoreBrowserService)],g)},4725:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;let r=n(8343);t.ICharSizeService=(0,r.createDecorator)(`CharSizeService`),t.ICoreBrowserService=(0,r.createDecorator)(`CoreBrowserService`),t.IMouseService=(0,r.createDecorator)(`MouseService`),t.IRenderService=(0,r.createDecorator)(`RenderService`),t.ISelectionService=(0,r.createDecorator)(`SelectionService`),t.ICharacterJoinerService=(0,r.createDecorator)(`CharacterJoinerService`),t.IThemeService=(0,r.createDecorator)(`ThemeService`),t.ILinkProviderService=(0,r.createDecorator)(`LinkProviderService`)},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;let a=n(7239),o=n(8055),s=n(8460),c=n(844),l=n(2585),u=o.css.toColor(`#ffffff`),d=o.css.toColor(`#000000`),f=o.css.toColor(`#ffffff`),p=o.css.toColor(`#000000`),m={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let e=[o.css.toColor(`#2e3436`),o.css.toColor(`#cc0000`),o.css.toColor(`#4e9a06`),o.css.toColor(`#c4a000`),o.css.toColor(`#3465a4`),o.css.toColor(`#75507b`),o.css.toColor(`#06989a`),o.css.toColor(`#d3d7cf`),o.css.toColor(`#555753`),o.css.toColor(`#ef2929`),o.css.toColor(`#8ae234`),o.css.toColor(`#fce94f`),o.css.toColor(`#729fcf`),o.css.toColor(`#ad7fa8`),o.css.toColor(`#34e2e2`),o.css.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:o.channels.toCss(r,i,a),rgba:o.channels.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+10*t;e.push({css:o.channels.toCss(n,n,n),rgba:o.channels.toRgba(n,n,n)})}return e})());let h=t.ThemeService=class extends c.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:f,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:o.color.blend(d,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:o.color.blend(d,m),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange(`theme`,(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(e={}){let n=this._colors;if(n.foreground=g(e.foreground,u),n.background=g(e.background,d),n.cursor=g(e.cursor,f),n.cursorAccent=g(e.cursorAccent,p),n.selectionBackgroundTransparent=g(e.selectionBackground,m),n.selectionBackgroundOpaque=o.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=o.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,n.selectionForeground===o.NULL_COLOR&&(n.selectionForeground=void 0),o.color.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=o.color.opacity(n.selectionBackgroundTransparent,.3)),o.color.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=o.color.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=g(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e!==void 0)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function g(e,t){if(e!==void 0)try{return o.css.toColor(e)}catch{}return t}t.ThemeService=h=r([i(0,l.IOptionsService)],h)},6349:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=a},1439:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,n=5){if(typeof t!=`object`)return t;let r=Array.isArray(t)?[]:{};for(let i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},8969:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;let r=n(844),i=n(2585),a=n(4348),o=n(7866),s=n(744),c=n(7302),l=n(6975),u=n(8460),d=n(1753),f=n(1480),p=n(7994),m=n(9282),h=n(5435),g=n(5981),_=n(2660),v=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event((e=>{this._onScrollApi?.fire(e.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new c.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new h.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!v&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)((()=>{for(let t of e)t.dispose()}))}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;let a=n(2584),o=n(7116),s=n(2015),c=n(844),l=n(482),u=n(8437),d=n(8460),f=n(643),p=n(511),m=n(3734),h=n(2585),g=n(1480),_=n(6242),v=n(6351),y=n(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var C;(function(e){e[e.GET_WIN_SIZE_PIXELS=0]=`GET_WIN_SIZE_PIXELS`,e[e.GET_CELL_SIZE_PIXELS=1]=`GET_CELL_SIZE_PIXELS`})(C||(t.WindowsOptionsReportType=C={}));let w=0;class T extends c.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,c,f,m,h=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=c,this._coreMouseService=f,this._unicodeService=m,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new E(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._parser.setCsiHandlerFallback(((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})})),this._parser.setEscHandlerFallback((e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})})),this._parser.setExecuteHandlerFallback((e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})})),this._parser.setOscHandlerFallback(((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})})),this._parser.setDcsHandlerFallback(((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})})),this._parser.setPrintHandler(((e,t,n)=>this.print(e,t,n))),this._parser.registerCsiHandler({final:`@`},(e=>this.insertChars(e))),this._parser.registerCsiHandler({intermediates:` `,final:`@`},(e=>this.scrollLeft(e))),this._parser.registerCsiHandler({final:`A`},(e=>this.cursorUp(e))),this._parser.registerCsiHandler({intermediates:` `,final:`A`},(e=>this.scrollRight(e))),this._parser.registerCsiHandler({final:`B`},(e=>this.cursorDown(e))),this._parser.registerCsiHandler({final:`C`},(e=>this.cursorForward(e))),this._parser.registerCsiHandler({final:`D`},(e=>this.cursorBackward(e))),this._parser.registerCsiHandler({final:`E`},(e=>this.cursorNextLine(e))),this._parser.registerCsiHandler({final:`F`},(e=>this.cursorPrecedingLine(e))),this._parser.registerCsiHandler({final:`G`},(e=>this.cursorCharAbsolute(e))),this._parser.registerCsiHandler({final:`H`},(e=>this.cursorPosition(e))),this._parser.registerCsiHandler({final:`I`},(e=>this.cursorForwardTab(e))),this._parser.registerCsiHandler({final:`J`},(e=>this.eraseInDisplay(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`J`},(e=>this.eraseInDisplay(e,!0))),this._parser.registerCsiHandler({final:`K`},(e=>this.eraseInLine(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`K`},(e=>this.eraseInLine(e,!0))),this._parser.registerCsiHandler({final:`L`},(e=>this.insertLines(e))),this._parser.registerCsiHandler({final:`M`},(e=>this.deleteLines(e))),this._parser.registerCsiHandler({final:`P`},(e=>this.deleteChars(e))),this._parser.registerCsiHandler({final:`S`},(e=>this.scrollUp(e))),this._parser.registerCsiHandler({final:`T`},(e=>this.scrollDown(e))),this._parser.registerCsiHandler({final:`X`},(e=>this.eraseChars(e))),this._parser.registerCsiHandler({final:`Z`},(e=>this.cursorBackwardTab(e))),this._parser.registerCsiHandler({final:"`"},(e=>this.charPosAbsolute(e))),this._parser.registerCsiHandler({final:`a`},(e=>this.hPositionRelative(e))),this._parser.registerCsiHandler({final:`b`},(e=>this.repeatPrecedingCharacter(e))),this._parser.registerCsiHandler({final:`c`},(e=>this.sendDeviceAttributesPrimary(e))),this._parser.registerCsiHandler({prefix:`>`,final:`c`},(e=>this.sendDeviceAttributesSecondary(e))),this._parser.registerCsiHandler({final:`d`},(e=>this.linePosAbsolute(e))),this._parser.registerCsiHandler({final:`e`},(e=>this.vPositionRelative(e))),this._parser.registerCsiHandler({final:`f`},(e=>this.hVPosition(e))),this._parser.registerCsiHandler({final:`g`},(e=>this.tabClear(e))),this._parser.registerCsiHandler({final:`h`},(e=>this.setMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`h`},(e=>this.setModePrivate(e))),this._parser.registerCsiHandler({final:`l`},(e=>this.resetMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`l`},(e=>this.resetModePrivate(e))),this._parser.registerCsiHandler({final:`m`},(e=>this.charAttributes(e))),this._parser.registerCsiHandler({final:`n`},(e=>this.deviceStatus(e))),this._parser.registerCsiHandler({prefix:`?`,final:`n`},(e=>this.deviceStatusPrivate(e))),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},(e=>this.softReset(e))),this._parser.registerCsiHandler({intermediates:` `,final:`q`},(e=>this.setCursorStyle(e))),this._parser.registerCsiHandler({final:`r`},(e=>this.setScrollRegion(e))),this._parser.registerCsiHandler({final:`s`},(e=>this.saveCursor(e))),this._parser.registerCsiHandler({final:`t`},(e=>this.windowOptions(e))),this._parser.registerCsiHandler({final:`u`},(e=>this.restoreCursor(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},(e=>this.insertColumns(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},(e=>this.deleteColumns(e))),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},(e=>this.selectProtected(e))),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},(e=>this.requestMode(e,!0))),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},(e=>this.requestMode(e,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new _.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new _.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new _.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new _.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new _.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new _.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new _.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new _.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new _.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new _.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new _.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new _.OscHandler((e=>this.restoreCursorColor(e)))),this._parser.registerEscHandler({final:`7`},(()=>this.saveCursor())),this._parser.registerEscHandler({final:`8`},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:`D`},(()=>this.index())),this._parser.registerEscHandler({final:`E`},(()=>this.nextLine())),this._parser.registerEscHandler({final:`H`},(()=>this.tabSet())),this._parser.registerEscHandler({final:`M`},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:`=`},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:`>`},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:`c`},(()=>this.fullReset())),this._parser.registerEscHandler({final:`n`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`o`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`|`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`}`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`~`},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:`%`,final:`@`},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:`%`,final:`G`},(()=>this.selectDefaultCharset()));for(let e in o.CHARSETS)this._parser.registerEscHandler({intermediates:`(`,final:e},(()=>this.selectCharset(`(`+e))),this._parser.registerEscHandler({intermediates:`)`,final:e},(()=>this.selectCharset(`)`+e))),this._parser.registerEscHandler({intermediates:`*`,final:e},(()=>this.selectCharset(`*`+e))),this._parser.registerEscHandler({intermediates:`+`,final:e},(()=>this.selectCharset(`+`+e))),this._parser.registerEscHandler({intermediates:`-`,final:e},(()=>this.selectCharset(`-`+e))),this._parser.registerEscHandler({intermediates:`.`,final:e},(()=>this.selectCharset(`.`+e))),this._parser.registerEscHandler({intermediates:`/`,final:e},(()=>this.selectCharset(`/`+e)));this._parser.registerEscHandler({intermediates:`#`,final:`8`},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((e=>(this._logService.error(`Parsing error: `,e),e))),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new v.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=h.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(`#SLOW_TIMEOUT`)),5e3)))]).catch((e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 ms`)}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>x&&(a=this._parseStack.position+x)}if(this._logService.logLevel<=h.LogLevelEnum.DEBUG&&this._logService.debug(`parsing data`+(typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(``)}"`),typeof e==`string`?e.split(``).map((e=>e.charCodeAt(0))):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(e.length,x))),o||this._dirtyRowTracker.clearRange(),e.length>x)for(let t=a;t<e.length;t+=x){let a=t+x<e.length?t+x:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}this._activeBuffer.x===r&&this._activeBuffer.y===i||this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(c,this._bufferService.rows-1),Math.min(s,this._bufferService.rows-1))}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let h=this._parser.precedingJoinState;for(let _=t;_<n;++_){if(r=e[_],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,h);i=g.UnicodeService.extractWidth(t);let n=g.UnicodeService.extractShouldJoin(t),v=n?g.UnicodeService.extractWidth(h):0;if(h=t,o&&this._onA11yChar.fire((0,l.stringFromCodePoint)(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-v>s){if(c){let e=m,t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&m instanceof u.BufferLine&&m.copyCellsFrom(e,t,0,v,!1);t<s;)e.setCellFromCodepoint(t++,0,1,p)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-v;--e>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}else if(d&&(m.insertCells(this._activeBuffer.x,i-v,this._activeBuffer.getNullCell(p)),m.getWidth(s-1)===2&&m.setCellFromCodepoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,i,p),i>0)for(;--i;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=h,this._activeBuffer.x<s&&n-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final!==`t`||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!S(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new _.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),t!==2&&t!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){let n;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=g.UnicodeService.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(a.C0.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=e=>e?1:2,p=e.params[0];return m=p,h=t?p===2?4:p===4?f(o.modes.insertMode):p===12?3:p===20?f(d.convertEol):0:p===1?f(n.applicationCursorKeys):p===3?d.windowOptions.setWinLines?c===80?2:+(c===132):0:p===6?f(n.origin):p===7?f(n.wraparound):p===8?3:p===9?f(r===`X10`):p===12?f(d.cursorBlink):p===25?f(!o.isCursorHidden):p===45?f(n.reverseWraparound):p===66?f(n.applicationKeypad):p===67?4:p===1e3?f(r===`VT200`):p===1002?f(r===`DRAG`):p===1003?f(r===`ANY`):p===1004?f(n.sendFocus):p===1005?4:p===1006?f(i===`SGR`):p===1015?4:p===1016?f(i===`SGR_PIXELS`):p===1048?1:p===47||p===1047||p===1049?f(l===u):p===2004?f(n.bracketedPasteMode):0,o.triggerDataEvent(`${a.C0.ESC}[${t?``:`?`}${m};${h}$y`),!0;var m,h}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=m.AttributeData.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|255&n),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):n===49?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=`block`;break;case 3:case 4:this._optionsService.options.cursorStyle=`underline`;break;case 5:case 6:this._optionsService.options.cursorStyle=`bar`}let n=t%2==1;return this._optionsService.options.cursorBlink=n,!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!S(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:t!==0&&t!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),t!==0&&t!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:t!==0&&t!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),t!==0&&t!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(D(n)){if(r===`?`)t.push({type:0,index:n});else{let e=(0,y.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.split(`;`);return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex((e=>e.startsWith(`id=`)));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=(0,y.parseColor)(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);D(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(b[e[0]],o.CHARSETS[e[1]]||o.DEFAULT_CHARSET),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new p.CellData;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${e}${a.C0.ESC}\\`),!0))(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-+!!r.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=T;let E=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(w=e,e=t,t=w),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function D(e){return 0<=e&&e<256}E=r([i(0,h.IBufferService)],E)},844:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){this._array.length===0?this._array.push(e):(n=this._search(this._getKey(e)),this._array.splice(n,0,e))}delete(e){if(this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n=this._search(t),n===-1)||this._getKey(this._array[n])!==t)return!1;do if(this._array[n]===e)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===t);return!1}*getKeyIterator(e){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===e)}forEachByKey(e,t){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do t(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===e)}values(){return[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else{if(!(i<e)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;let r=n(643);t.updateWindowsModeWrappedState=function(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&t[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let r=n(6349),i=n(7226),a=n(3734),o=n(8437),s=n(4634),c=n(511),l=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let n=e+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new o.BufferLine(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(n.length>0){let r=(0,s.reflowLargerCreateNewLayout)(this.lines,n);(0,s.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(o.DEFAULT_ATTR_DATA),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=[],i=0;for(let a=this.lines.length-1;a>=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let l=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);let u=this.ybase+this.y;if(u>=a&&u<a+l.length)continue;let d=l[l.length-1].getTrimmedLength(),f=(0,s.reflowSmallerGetNewLineLengths)(l,this._cols,e),p=f.length-l.length,m;m=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+p):Math.max(0,this.lines.length-this.lines.maxLength+p);let h=[];for(let e=0;e<p;e++){let e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);h.push(e)}h.length>0&&(r.push({start:a+l.length+i,newLines:h}),i+=h.length),l.push(...h);let g=f.length-1,_=f[g];_===0&&(g--,_=f[g]);let v=l.length-p-1,y=d;for(;v>=0;){let e=Math.min(y,_);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[v],y-e,_-e,e,!0),_-=e,_===0&&(g--,_=f[g]),y-=e,y===0){v--;let e=Math.max(v,0);y=(0,s.getWrappedLineTrimmedLength)(l,e,this._cols)}}for(let t=0;t<l.length;t++)f[t]<e&&l[t].setCell(f[t],n);let b=p-m;for(;b-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(r.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,a=n-1,o=0,s=r[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+i-1);l>=0;l--)if(s&&s.start>a+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:a+1,amount:s.newLines.length}),c+=s.newLines.length,s=r[++o]}else this.lines.set(l,t[a--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new u.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim((e=>{t.line-=e,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((e=>{t.line>=e.index&&(t.line+=e.amount)}))),t.register(this.lines.onDelete((e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let r=n(3734),i=n(511),a=n(643),o=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let s=0;class c{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||i.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[3*e+0],n=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:n?(0,o.stringFromCodePoint)(n):``,t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):``}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,n,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&r?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&r)+(0,o.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[3*e+0]=r}insertCells(e,t,n){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new i.CellData;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new i.CellData;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new c(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[3*t+0],n=2097151&e,s=2097152&e?this._combined[t]:n?(0,o.stringFromCodePoint)(n):a.WHITESPACE_CELL_CHAR;if(i+=s,r)for(let e=0;e<s.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}}t.BufferLine=c},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function n(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(i>=s&&i<c){s+=u.length-1;continue}let d=0,f=n(u,d,t),p=1,m=0;for(;p<u.length;){let e=n(u,p,t),i=e-m,o=r-f,s=Math.min(i,o);u[d].copyCellsFrom(u[p],m,f,s,!1),f+=s,f===r&&(d++,f=0),m+=s,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(r-1)===2&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,a))}u[d].replaceCells(f,r,a);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}},t.reflowLargerApplyNewLayout=function(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,r){let i=[],a=e.map(((r,i)=>n(e,i,t))).reduce(((e,t)=>e+t)),o=0,s=0,c=0;for(;c<a;){if(a-c<r){i.push(a-c);break}o+=r;let l=n(e,s,t);o>l&&(o-=l,s++);let u=e[s].getWidth(o-1)===2;u&&o--;let d=u?r-1:r;i.push(d),c+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;let r=n(8460),i=n(844),a=n(9092);class o extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,(()=>this.setupTabStops())))}reset(){this._normal=new a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(482),i=n(643),a=n(3734);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;let r=n(8460),i=n(844);class a{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=a,a._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},t.CHARSETS.A={"#":`£`},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},t.CHARSETS.C=t.CHARSETS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},t.CHARSETS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},t.CHARSETS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},t.CHARSETS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},t.CHARSETS.E=t.CHARSETS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},t.CHARSETS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},t.CHARSETS.H=t.CHARSETS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
30
30
  `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:o.key=e.ctrlKey?`\b`:r.C0.DEL,e.altKey&&(o.key=r.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:o.key=e.ctrlKey?r.C0.ESC+`[5;`+(s+1)+`~`:r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:o.key=e.ctrlKey?r.C0.ESC+`[6;`+(s+1)+`~`:r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey){if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let r=n(1480),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},5981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(4095),t=Array.apply(null,Array(256)).map(((e,t)=>t)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e)}this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,n)=>t(e,n.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,(t=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?r.css.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?r.css.toColor(this.options.foregroundColor):void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options={...n},this._setupOptions(),this.register((0,i.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(r,n))),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(o,a))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every((e=>e.line!==t))){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(n,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);class a{static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this.register(new s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
31
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),Zp=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),Qp=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebglAddon=r():n.WebglAddon=r()})(self,(()=>(()=>{var e={965:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;let r=n(374),i=n(509),a=n(855),o=n(859),s=n(381),c=11*Float32Array.BYTES_PER_ELEMENT,l,u=0,d=0,f=0;class p extends o.Disposable{constructor(e,t,n,a){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=a,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let l=this._gl;i.TextureAtlas.maxAtlasPages===void 0&&(i.TextureAtlas.maxAtlasPages=Math.min(32,(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),i.TextureAtlas.maxTextureSize=(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=(0,r.throwIfFalsy)((0,s.createProgram)(l,`#version 300 es
31
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),fm=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),pm=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebglAddon=r():n.WebglAddon=r()})(self,(()=>(()=>{var e={965:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;let r=n(374),i=n(509),a=n(855),o=n(859),s=n(381),c=11*Float32Array.BYTES_PER_ELEMENT,l,u=0,d=0,f=0;class p extends o.Disposable{constructor(e,t,n,a){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=a,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let l=this._gl;i.TextureAtlas.maxAtlasPages===void 0&&(i.TextureAtlas.maxAtlasPages=Math.min(32,(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),i.TextureAtlas.maxTextureSize=(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=(0,r.throwIfFalsy)((0,s.createProgram)(l,`#version 300 es
32
32
  layout (location = 0) in vec2 a_unitquad;
33
33
  layout (location = 1) in vec2 a_cellpos;
34
34
  layout (location = 2) in vec2 a_offset;
@@ -71,22 +71,26 @@ out vec4 outColor;
71
71
 
72
72
  void main() {
73
73
  outColor = v_color;
74
- }`)),this.register((0,i.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0,r.throwIfFalsy)(l.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(p)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p),l.bufferData(l.ELEMENT_ARRAY_BUFFER,f,l.STATIC_DRAW),this._attributesBuffer=(0,r.throwIfFalsy)(l.createBuffer()),this.register((0,i.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,s,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,s,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,s,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r,i,o,s,c,l,u,d,f,p,m,h=1;for(r=0;r<t.rows;r++){for(o=-1,s=0,c=0,l=!1,i=0;i<t.cols;i++)u=(r*t.cols+i)*a.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[u+a.RENDER_MODEL_BG_OFFSET],f=e.cells[u+a.RENDER_MODEL_FG_OFFSET],p=!!(67108864&f),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,i,r)),o=i,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,t.cols,r))}n.count=h}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`)return void(t.count=0);let r,i=0;n.style!==`bar`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.style!==`underline`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=8*i++,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,s){if(67108864&n)switch(50331648&n){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&n].rgba;break;case 50331648:l=(16777215&n)<<8;break;default:l=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:l=(16777215&r)<<8;break;default:l=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=(0,o.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),u=i*this._dimensions.device.cell.width,d=s*this._dimensions.device.cell.height,f=(l>>24&255)/255,p=(l>>16&255)/255,m=(l>>8&255)/255,h=1,this._addRectangle(e.attributes,t,u,d,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,f,p,m,h)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}}t.RectangleRenderer=g},310:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;let r=n(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=(0,r.createSelectionRenderModel)()}resize(e,n){let r=e*n*t.RENDER_MODEL_INDICIES_PER_CELL;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;let r=n(820),i=n(274),a=n(627),o=n(457),s=n(56),c=n(374),l=n(345),u=n(859),d=n(147),f=n(782),p=n(855),m=n(965),h=n(742),g=n(310),_=n(733);class v extends u.Disposable{constructor(e,t,n,o,d,p,m,h,v){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=o,this._coreService=d,this._decorationService=p,this._optionsService=m,this._themeService=h,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new g.RenderModel,this._workCell=new f.CellData,this._workCell2=new f.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new l.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new l.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new l.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new i.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,m,this._themeService)],this.dimensions=(0,c.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(m.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let y={antialias:!1,depth:!1,preserveDrawingBuffer:v};if(this._gl=this._canvas.getContext(`webgl2`,y),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextlost`,(e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)}),3e3)}))),this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextrestored`,(e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,a.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,a.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new h.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new m.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let e=(0,a.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,l.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,l.forwardEvent)(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(e){return-1}deregisterCharacterJoiner(e){return!1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new o.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r,i,a,o,s,c,l,u,d,f,m,h,_,v,x=this._workCell;e=b(e,n.rows-1,0),t=b(t,n.rows-1,0);let S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let D=!1;for(i=e;i<=t;i++)for(a=i+n.buffer.ydisp,o=n.buffer.lines.get(a),this._model.lineLengths[i]=0,s=this._characterJoinerService.getJoinedCharacters(a),_=0;_<n.cols;_++)if(r=this._cellColorResolver.result.bg,o.loadCell(_,x),_===0&&(r=this._cellColorResolver.result.bg),c=!1,l=_,s.length>0&&_===s[0][0]&&(c=!0,u=s.shift(),x=new y(x,o.translateToString(!0,u[0],u[1]),u[1]-u[0]),l=u[1]-1),d=x.getChars(),f=x.getCode(),h=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(x,_,a,this.dimensions.device.cell.width),E&&a===S&&(_===w&&(this._model.cursor={x:w,y:C,width:x.getWidth(),style:this._coreBrowserService.isFocused?n.options.cursorStyle||`block`:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+x.getWidth()-1),_>=w&&_<=T&&(this._coreBrowserService.isFocused&&(n.options.cursorStyle||`block`)===`block`||!1===this._coreBrowserService.isFocused&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),f!==p.NULL_CELL_CODE&&(this._model.lineLengths[i]=_+1),(this._model.cells[h]!==f||this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(D=!0,d.length>1&&(f|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[h]=f,this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,m=x.getWidth(),this._glyphRenderer.value.updateCell(_,i,f,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,m,r),c))for(x=this._workCell,_++;_<l;_++)v=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(_,i,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[v]=p.NULL_CELL_CODE,this._model.cells[v+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[v+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[v+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;D&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}}t.WebglRenderer=v;class y extends d.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function b(e,t,n=0){return Math.max(Math.min(e,t),n)}t.JoinedCellData=y},381:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;let r=n(374);function i(e,t,n){let i=(0,r.throwIfFalsy)(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,n){let a=(0,r.throwIfFalsy)(e.createProgram());if(e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.VERTEX_SHADER,t))),e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.FRAGMENT_SHADER,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)},t.createShader=i,t.expandFloat32Array=function(e,t){let n=Math.min(2*e.length,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1}}},592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(627),i=n(237),a=n(374),o=n(859);class s extends o.Disposable{constructor(e,t,n,r,i,a,s,c){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=s,this._themeService=c,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e)}))),this.register((0,o.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,a.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,r.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=i.TEXT_BASELINE,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){return`${n?`italic`:``} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=s},733:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(592);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===i.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&(0,r.is256Color)(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}}t.LinkRenderLayer=o},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let r=n(855),i=n(160),a=n(374),o,s=0,c=0,l=!1,u=!1,d=!1,f=0;t.CellColorResolver=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,p){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,c=0,s=0,u=!1,l=!1,d=!1,o=this._themeService.colors,f=0,e.getCode()!==r.NULL_CELL_CODE&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));f=t*p%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),d){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:c=(16777215&this.result.fg)<<8|255;break;default:c=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:c=(16777215&this.result.bg)<<8|255}c=i.rgba.blend(c,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else c=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,o.selectionForeground&&(s=o.selectionForeground.rgba>>8&16777215,l=!0),(0,a.treatGlyphAsBackgroundColor)(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))s=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:s=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:s=(16777215&this.result.fg)<<8|255;break;default:s=this._themeService.colors.foreground.rgba}s=i.rgba.blend(s,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}l=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),u&&(c=d?e.bg&-150994944|c|50331648:-16777216&e.bg|c|50331648),l&&(s=e.fg&-83886080|s|50331648),67108864&this.result.fg&&(u&&!l&&(s=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&o.background.rgba>>8|50331648,l=!0),!u&&l&&(c=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&o.foreground.rgba>>8|50331648,u=!0)),o=void 0,this.result.bg=u?c:this.result.bg,this.result.fg=l?s:this.result.fg,this.result.ext&=536870911,this.result.ext|=f<<29&3758096384}}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;let r=n(509),i=n(197),a=[];t.acquireTextureAtlas=function(e,t,n,o,s,c,l,u){let d=(0,i.generateConfig)(o,s,c,l,t,n,u);for(let t=0;t<a.length;t++){let n=a[t],r=n.ownedBy.indexOf(e);if(r>=0){if((0,i.configEquals)(n.config,d))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),a.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<a.length;t++){let n=a[t];if((0,i.configEquals)(n.config,d))return n.ownedBy.push(e),n.atlas}let f=e._core,p={atlas:new r.TextureAtlas(document,d,f.unicodeService),config:d,ownedBy:[e]};return a.push(p),p.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<a.length;t++){let n=a[t].ownedBy.indexOf(e);if(n!==-1){a[t].ownedBy.length===1?(a[t].atlas.dispose(),a.splice(t,1)):a[t].ownedBy.splice(n,1);break}}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;let r=n(160);t.generateConfig=function(e,t,n,i,a,o,s){let c={foreground:o.foreground,background:o.background,cursor:r.NULL_COLOR,cursorAccent:r.NULL_COLOR,selectionForeground:r.NULL_COLOR,selectionBackgroundTransparent:r.NULL_COLOR,selectionBackgroundOpaque:r.NULL_COLOR,selectionInactiveBackgroundTransparent:r.NULL_COLOR,selectionInactiveBackgroundOpaque:r.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:s,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:c}},t.configEquals=function(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba},t.is256Color=function(e){return(50331648&e)==16777216||(50331648&e)==33554432}},237:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;let r=n(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};let i={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}},t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.tryDrawCustomChar=function(e,n,o,l,u,d,f,p){let m=t.blockElementDefinitions[n];if(m)return function(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}(e,m,o,l,u,d),!0;let h=i[n];if(h)return function(e,t,n,i,o,s){let c=a.get(t);c||(c=new Map,a.set(t,c));let l=e.fillStyle;if(typeof l!=`string`)throw Error(`Unexpected fillStyle type "${l}"`);let u=c.get(l);if(!u){let n=t[0].length,i=t.length,a=e.canvas.ownerDocument.createElement(`canvas`);a.width=n,a.height=i;let o=(0,r.throwIfFalsy)(a.getContext(`2d`)),s=new ImageData(n,i),d,f,p,m;if(l.startsWith(`#`))d=parseInt(l.slice(1,3),16),f=parseInt(l.slice(3,5),16),p=parseInt(l.slice(5,7),16),m=l.length>7&&parseInt(l.slice(7,9),16)||1;else{if(!l.startsWith(`rgba`))throw Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,f,p,m]=l.substring(5,l.length-1).split(`,`).map((e=>parseFloat(e)))}for(let e=0;e<i;e++)for(let r=0;r<n;r++)s.data[4*(e*n+r)]=d,s.data[4*(e*n+r)+1]=f,s.data[4*(e*n+r)+2]=p,s.data[4*(e*n+r)+3]=t[e][r]*(255*m);o.putImageData(s,0,0),u=(0,r.throwIfFalsy)(e.createPattern(a,null)),c.set(l,u)}e.fillStyle=u,e.fillRect(n,i,o,s)}(e,h,o,l,u,d),!0;let g=t.boxDrawingDefinitions[n];if(g)return function(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[l,u]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=o*Number.parseInt(l),t=typeof u==`function`?u(.15,.15/a*i):u;for(let l of t.split(` `)){let t=l[0],u=s[t];if(!u){console.error(`Could not find drawing instructions for "${t}"`);continue}let d=l.substring(1).split(`,`);d[0]&&d[1]&&u(e,c(d,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}(e,g,o,l,u,d,p),!0;let _=t.powerlineDefinitions[n];return!!_&&(function(e,t,n,r,i,a,o,l){let u=new Path2D;u.rect(n,r,i,a),e.clip(u),e.beginPath();let d=o/12;e.lineWidth=l*d;for(let o of t.d.split(` `)){let u=o[0],f=s[u];if(!f){console.error(`Could not find drawing instructions for "${u}"`);continue}let p=o.substring(1).split(`,`);p[0]&&p[1]&&f(e,c(p,i,a,n,r,!1,l,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,_,o,l,u,d,f,p),!0)};let a=new Map;function o(e,t,n=0){return Math.max(Math.min(e,t),n)}let s={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function c(e,t,n,r,i,a,s,c=0,l=0){let u=e.map((e=>parseFloat(e)||parseInt(e)));if(u.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<u.length;e+=2)u[e]*=t-c*s-l*s,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,t,0)),u[e]+=r+c*s;for(let e=1;e<u.length;e+=2)u[e]*=n,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,n,0)),u[e]+=i;return u}},56:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;let r=n(859);t.observeDevicePixelDimensions=function(e,t,n){let i=new t.ResizeObserver((t=>{let r=t.find((t=>t.target===e));if(!r)return;if(!(`devicePixelContentBoxSize`in r))return i?.disconnect(),void(i=void 0);let a=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)}));try{i.observe(e,{box:[`device-pixel-content-box`]})}catch{i.disconnect(),i=void 0}return(0,r.toDisposable)((()=>i?.disconnect()))}},374:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},509:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;let r=n(237),i=n(860),a=n(374),o=n(160),s=n(345),c=n(485),l=n(385),u=n(147),d=n(855),f={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},p;class m{get pages(){return this._pages}constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new c.FourKeyMap,this._cacheMapCombined=new c.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new s.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new s.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,a.throwIfFalsy)(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new l.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT)){let e=this._drawToCache(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT);this._cacheMap.set(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT,e)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(m.maxAtlasPages&&this._pages.length>=Math.max(4,m.maxAtlasPages)){let e=this._pages.filter((e=>2*e.canvas.width<=(m.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width)),t=-1,n=0;for(let r=0;r<e.length;r++)if(e[r].canvas.width!==n)t=r,n=e[r].canvas.width;else if(r-t==3)break;let r=e.slice(t,t+4),i=r.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),a=this.pages.length-r.length,o=this._mergePages(r,a);o.version++;for(let e=i.length-1;e>=0;e--)this._deletePage(i[e]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let e=new h(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let n=2*e[0].canvas.width,r=new h(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i)}getRasterizedGlyph(e,t,n,r,i){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i)}_getFromCacheMap(e,t,n,r,i,a=!1){return p=e.get(t,n,r,i),p||(p=this._drawToCache(t,n,r,i,a),e.set(t,n,r,i,p)),p}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return o.NULL_COLOR;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=u.AttributeData.toColorRGB(t);i=o.channels.toColor(e[0],e[1],e[2]);break;default:i=n?o.color.opaque(this._config.colors.foreground):this._config.colors.background}return i}_getForegroundColor(e,t,n,i,a,s,c,l,d,f){let p=this._getMinimumContrastColor(e,t,n,i,a,s,c,d,l,f);if(p)return p;let m;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&s<8&&(s+=8),m=this._getColorFromAnsiIndex(s);break;case 50331648:let e=u.AttributeData.toColorRGB(s);m=o.channels.toColor(e[0],e[1],e[2]);break;default:m=c?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(m=o.color.opaque(m)),l&&(m=o.color.multiplyOpacity(m,r.DIM_OPACITY)),m}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,s,c,l,u){if(this._config.minimumContrastRatio===1||u)return;let d=this._getContrastCache(l),f=d.getColor(e,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(t,n,s),m=this._resolveForegroundRgba(i,a,s,c),h=o.rgba.ensureContrastRatio(p,m,this._config.minimumContrastRatio/(l?2:1));if(!h)return void d.setColor(e,r,null);let g=o.channels.toColor(h>>24&255,h>>16&255,h>>8&255);return d.setColor(e,r,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,n,o,s=!1){let c=typeof e==`number`?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let d=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=o,this._workAttributeData.isInvisible())return f;let p=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(h){let e=S;S=w,w=e;let t=C;C=T,T=t}let E=this._getBackgroundColor(T,w,h,_);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let D=p?this._config.fontWeightBold:this._config.fontWeight,O=v?`italic`:``;this._tmpCtx.font=`${O} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;let k=c.length===1&&(0,a.isPowerlineGlyph)(c.charCodeAt(0)),A=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),j=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=j.css;let M=A?0:4,N=!1;!1!==this._config.customGlyphs&&(N=(0,i.tryDrawCustomChar)(this._tmpCtx,c,M,M,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let P,F=!k;if(P=typeof e==`number`?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())F=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{F=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=M,r=Math.ceil(M+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<P;s++){this._tmpCtx.save();let c=n+s*this._config.deviceCellWidth,u=n+(s+1)*this._config.deviceCellWidth,d=c+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r),this._tmpCtx.moveTo(c,o),this._tmpCtx.lineTo(u,o);break;case 3:let n=e<=1?o:Math.ceil(M+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(M+this._config.deviceCharHeight+e/2)-t,f=new Path2D;f.rect(c,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(f),this._tmpCtx.moveTo(c-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(c-this._config.deviceCellWidth/2,s,c,s,c,i),this._tmpCtx.bezierCurveTo(c,n,d,n,d,i),this._tmpCtx.bezierCurveTo(d,s,u,s,u,i),this._tmpCtx.bezierCurveTo(u,n,u+this._config.deviceCellWidth/2,n,u+this._config.deviceCellWidth/2,i);break;case 4:let p=l===0?0:l>=e?2*e-l:e-l;!(l>=e)==0||p===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c+p,r),this._tmpCtx.lineTo(u,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(c+p,r),this._tmpCtx.moveTo(c+p+e,r),this._tmpCtx.lineTo(u,r)),l=(0,a.computeNextVariantOffset)(u-c,e,l);break;case 5:let m=u-c,h=Math.floor(.6*m),g=Math.floor(.3*m),_=m-h-g;this._tmpCtx.setLineDash([h,g,_]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r);break;default:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!N&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*P,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(c,M,M+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+t),this._tmpCtx.stroke()}if(N||this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F),e);t++);}if(b){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),L;if(L=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(I):g(I,E,j,F),L)return f;let R=this._findGlyphBoundingBox(I,this._workBoundingBox,l,A,N,M),z,B;for(;;){if(this._activePages.length===0){let e=this._createNewPage();z=e,B=e.currentRow,B.height=R.size.y;break}z=this._activePages[this._activePages.length-1],B=z.currentRow;for(let e of this._activePages)R.size.y<=e.currentRow.height&&(z=e,B=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=B.height&&R.size.y<=t.height&&(z=this._activePages[e],B=t);if(B.y+R.size.y>=z.canvas.height||B.height>R.size.y+2){let e=!1;if(z.currentRow.y+z.currentRow.height+R.size.y>=z.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+R.size.y<e.canvas.height){t=e;break}if(t)z=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&B.y+R.size.y<=z.canvas.height&&B.height>=R.size.y&&B.x+R.size.x<=z.canvas.width)e=!0;else{let t=this._createNewPage();z=t,B=t.currentRow,B.height=R.size.y,e=!0}}e||(z.currentRow.height>0&&z.fixedRows.push(z.currentRow),B={x:0,y:z.currentRow.y+z.currentRow.height,height:R.size.y},z.fixedRows.push(B),z.currentRow={x:0,y:B.y+B.height,height:0})}if(B.x+R.size.x<=z.canvas.width)break;B===z.currentRow?(B.x=0,B.y+=B.height,B.height=0):z.fixedRows.splice(z.fixedRows.indexOf(B),1)}return R.texturePage=this._pages.indexOf(z),R.texturePosition.x=B.x,R.texturePosition.y=B.y,R.texturePositionClipSpace.x=B.x/z.canvas.width,R.texturePositionClipSpace.y=B.y/z.canvas.height,R.sizeClipSpace.x/=z.canvas.width,R.sizeClipSpace.y/=z.canvas.height,B.height=Math.max(B.height,R.size.y),B.x+=R.size.x,z.ctx.putImageData(I,R.texturePosition.x-this._workBoundingBox.left,R.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,R.size.x,R.size.y),z.addGlyph(R),z.version++,R}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=m;class h{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=_(e,t,t),this.ctx=(0,a.throwIfFalsy)(this.canvas.getContext(`2d`,{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function _(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(399);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},782:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(133),i=n(855),a=n(147);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},776:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(859),o=n(97),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},97:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(726);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;let t=n(345),i=n(859),a=n(399),o=n(666),s=n(776);class c extends i.Disposable{constructor(e){if(a.isSafari&&(0,a.getSafariVersion)()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(e){let n=e._core;if(!e.element)return void this.register(n.onWillOpen((()=>this.activate(e))));this._terminal=e;let r=n.coreService,a=n.optionsService,c=n,l=c._renderService,u=c._characterJoinerService,d=c._charSizeService,f=c._coreBrowserService,p=c._decorationService,m=c._logService,h=c._themeService;(0,s.setTraceLogger)(m),this._renderer=this.register(new o.WebglRenderer(e,u,d,f,r,p,a,h,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0,i.toDisposable)((()=>{let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.WebglAddon=c})(),r})()))})),$p=Xp(),em=Zp(),tm=Qp();function nm(e,t,n=!0){return n?t===`normal`?Math.min(Math.max(0,e),760):Math.min(t===`wide`?1100:1/0,Math.max(0,e-48)):Math.max(0,e)}var rm=/https?:\/\/[^\s"'<>`─-▟]+/g,im=/[─-▟|]/,am={")":`(`,"]":`[`,"}":`{`};function om(e){let t;try{t=new URL(e.trim())}catch{return null}return t.protocol===`http:`||t.protocol===`https:`?t.href:null}function sm(e,t){let n=e[e.length-1],r=t[0];return!!n&&!!r&&n!==` `&&r!==` `&&!im.test(n)&&!im.test(r)}function cm(e){for(;;){let t=e[e.length-1];if(`.,;:!?'"`.includes(t))e=e.slice(0,-1);else if(am[t]&&e.split(am[t]).length<=e.split(t).length-1)e=e.slice(0,-1);else return e}}function lm(e){let t=[];for(let n of e.matchAll(rm)){let e=cm(n[0]);om(e)&&e.length>8&&t.push({start:n.index,end:n.index+e.length,url:e})}return t}function um(e,t,n=()=>!1){if(!e[t])return[];let r=t=>n(t+1)||sm(e[t],e[t+1]??``),i=t;for(;i>0&&r(i-1);)i--;let a=t;for(;a<e.length-1&&r(a);)a++;let o=[],s=``;for(let t=i;t<=a;t++)o.push(s.length),s+=e[t];let c=e=>{let t=o.length-1;for(;t>0&&o[t]>e;)t--;return{row:i+t,col:e-o[t]}};return lm(s).map(e=>({url:e.url,start:c(e.start),end:c(e.end-1)})).filter(e=>e.start.row<=t&&e.end.row>=t).map(e=>({...e,end:{row:e.end.row,col:e.end.col+1}}))}function dm(e,t){let n=``;for(let r=0;r<t;r++){let t=e?.getCell(r)?.getChars()||` `;n+=t.length===1?t:` `}return n}function fm(e){let t=e.buffer.active,n=[];for(let r=0;r<t.length;r++)n.push(dm(t.getLine(r),e.cols));return n}var pm=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),mm=()=>typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches;function hm(e,t,n){return!t||(n?e.metaKey:e.ctrlKey)}function gm(e){let t=om(e);return t?(window.open(t,`_blank`,`noopener,noreferrer`),!0):!1}function _m(e,t){let n=pm(),r=mm(),i=e=>`${e}\n${t(n?`⌘+click to open`:`Ctrl+click to open`)}`,a=!1,o=(e,t)=>{hm(e,r,n)&&(a=gm(t)||a)},s=()=>e.element?.querySelector(`.xterm-screen`),c=(e,t)=>{let n=s();n&&r&&om(t)&&(n.title=i(t))},l=()=>{let e=s();e&&e.removeAttribute(`title`)},u={activate:o,hover:c,leave:l,allowNonHttpProtocols:!1};e.options.linkHandler=u;let d=e.registerLinkProvider({provideLinks(t,n){let r=fm(e),i=e.buffer.active,a=um(r,t-1,e=>!!i.getLine(e)?.isWrapped);n(a.length?a.map(e=>({text:e.url,range:{start:{x:e.start.col+1,y:e.start.row+1},end:{x:e.end.col,y:e.end.row+1}},activate:t=>o(t,e.url),hover:t=>c(t,e.url),leave:l})):void 0)}});return{tap:(t,n)=>{let r=s();if(!r)return!1;a=!1;let i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:n,button:0};for(let e of[`mousemove`,`mousedown`,`mouseup`])r.dispatchEvent(new MouseEvent(e,{...i,buttons:+(e===`mousedown`)}));return e.element?.dispatchEvent(new MouseEvent(`mouseleave`,i)),e.clearSelection(),a},dispose(){d.dispose(),l()}}}function vm(e){return e.key.toLowerCase()===`c`&&!e.altKey&&(e.metaKey||e.ctrlKey&&e.shiftKey)}function ym(e,t,n){return e.button!==0||!e.shiftKey||e.altKey?null:n?t?{shiftKey:!1,altKey:!0}:null:{shiftKey:!1,altKey:!1}}function bm(e){return e.replace(/[ \t]+$/gm,``)}function xm(e,t,n=()=>!1){let r=e.split(`
75
- `);return r.length===t.length?r.reduce((e,r,i)=>i===0?r:e+(n(i)||sm(t[i-1],t[i])?``:`
76
- `)+r,``):e}function Sm(e){let t=e.getSelection(),n=e.getSelectionPosition();if(!n)return bm(t);let r=Math.min(n.start.y,n.end.y),i=Math.max(n.start.y,n.end.y),a=e.buffer.active;return bm(xm(t,fm(e).slice(r,i+1),e=>!!a.getLine(r+e)?.isWrapped))}function Cm(e,t=globalThis.navigator?.clipboard){if(!e||!t?.writeText)return Promise.resolve(!1);try{return t.writeText(e).then(()=>!0,()=>!1)}catch{return Promise.resolve(!1)}}var wm=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent);function Tm(e,t){let n=e.element;if(!n)return()=>{};let r=wm(),i=()=>{e.hasSelection()&&Cm(Sm(e)).then(e=>e&&t?.())},a=t=>{vm(t)&&e.hasSelection()&&(t.preventDefault(),t.stopPropagation(),i())},o=()=>i(),s=t=>{t.button===0&&window.addEventListener(`mouseup`,o,{capture:!0,once:!0});let n=ym(t,r,e.modes.mouseTrackingMode!==`none`);n&&(t.preventDefault(),t.stopImmediatePropagation(),t.target?.dispatchEvent(new MouseEvent(`mousedown`,{bubbles:!0,cancelable:!0,composed:!0,view:window,detail:t.detail,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:t.button,buttons:t.buttons,ctrlKey:t.ctrlKey,metaKey:t.metaKey,...n})))};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`mousedown`,s,!0),()=>{window.removeEventListener(`mouseup`,o,{capture:!0}),n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`mousedown`,s,!0)}}function Em(e,t){e.attachCustomKeyEventHandler(e=>e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.altKey||e.metaKey||e.isComposing?!0:(e.type===`keydown`&&(e.preventDefault(),t(`shift+enter`)),!1))}function Dm(e){return!e||e.getData(`text/plain`)?[]:[...e.items||[]].filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e)}function Om(e,t){async function n(e){let n=[];for(let r of e)try{n.push(await t.upload(r))}catch(e){t.report(`${Y(`Photo upload failed`)} : ${e.message}`)}n.length&&!t.paste(n.join(` `))&&t.report(Y(`Terminal not connected — image not pasted`))}let r=e=>{let r=Dm(e.clipboardData);!r.length||t.enabled&&!t.enabled()||(e.preventDefault(),e.stopPropagation(),n(r))};return e.addEventListener(`paste`,r,!0),()=>e.removeEventListener(`paste`,r,!0)}async function km(e){let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=Math.min(1,2048/Math.max(e.naturalWidth,e.naturalHeight)),r=document.createElement(`canvas`);r.width=Math.round(e.naturalWidth*n),r.height=Math.round(e.naturalHeight*n);let i=r.getContext(`2d`);i.fillStyle=`#fff`,i.fillRect(0,0,r.width,r.height),i.drawImage(e,0,0,r.width,r.height);let a=await new Promise(e=>r.toBlob(e,`image/jpeg`,.86));if(a)return a}catch{}finally{URL.revokeObjectURL(t)}return e}async function Am(e,t){let n=await km(t),r=await fetch(`/api/upload?pane=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":n.type||`image/jpeg`},body:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(Y(i.error||`HTTP ${r.status}`));return{path:i.path,name:i.name}}function jm(e){return e.code===`unreachable`?Z(`${e.machine||`Machine`} unreachable`,`${e.machine||`Machine`} injoignable`):e.code===`unknown_machine`?Z(`unknown machine`,`machine inconnue`):Y(e.reason||``)}function Mm(e){return e?Z(`Terminal unavailable: ${e}`,`Terminal indisponible : ${e}`):Y(`Terminal unavailable`)}var Nm=`"Wherdr Symbols", "JetBrains Mono Variable", "JetBrains Mono", "Wherdr Nerd Symbols", ui-monospace, "SF Mono", Menlo, monospace`;function Pm(e){let t=typeof document<`u`?document.fonts:void 0;return t?.addEventListener?(t.addEventListener(`loadingdone`,e),()=>t.removeEventListener(`loadingdone`,e)):()=>{}}function Fm(e,t){let n=null,r=null,i=null,a=null,o=null,s=0,c,l=!1,u={cols:0,rows:0},d=!1,f=h(!1),p=h(!1),m=Yp(),g=null,_=null,v=null,y=null,b=()=>`${location.protocol===`https:`?`wss`:`ws`}://${location.host}`;function x(i){a=i,d=!1,s=0,n=new $p.Terminal({fontFamily:Nm,fontSize:Br.value,lineHeight:1,scrollback:0,cursorBlink:!1,allowProposedApi:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:Zr.value}),r=new em.FitAddon,n.loadAddon(r),n.open(i),g=Tm(n,()=>$(Y(`Copied`))),y=_m(n,Y),_=Om(i,{upload:async t=>(await Am(e,t)).path,paste:e=>S({type:`paste`,text:e}),report:e=>$(e,!0)}),T(jr.value);let o=n;Promise.all([document.fonts?.load(`${Br.value}px "JetBrains Mono Variable"`),document.fonts?.load(`${Br.value}px "Wherdr Symbols"`,`─▀█⎿⏵⏺✻✳`)]).then(()=>{d||n!==o||(o.options.fontFamily=Nm,w(!0),o.refresh(0,o.rows-1))}).catch(()=>{}),v=Pm(()=>{d||n!==o||(o.clearTextureAtlas(),o.refresh(0,o.rows-1))});let c=n.textarea;c&&(c.setAttribute(`autocorrect`,`off`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`spellcheck`,`false`),c.addEventListener(`blur`,()=>{p.value=!1}),c.addEventListener(`focus`,()=>{p.value=!0})),n.attachCustomWheelEventHandler(()=>!1),Em(n,e=>C([e])),n.onData(e=>{t.input?.()!==!1&&S({type:`terminal.input`,text:e})}),n.onBinary(e=>{if(t.input?.()===!1)return;let n=Uint8Array.from(e,e=>e.charCodeAt(0)&255);S({type:`terminal.input`,bytes:pr(n)})})}function S(e){return o&&o.readyState===1?(o.send(JSON.stringify(e)),!0):!1}async function C(t){if(!S({type:`keys`,keys:t}))try{await Dr(`/api/input`,{pane_id:e,keys:t}),X()}catch(e){$(e.message,!0)}}function w(e){if(!n||!r||!a||!a.parentElement)return;let i=matchMedia(`(min-width: 900px)`).matches&&!t.fill?.();a.style.width=i?`${nm(a.parentElement.clientWidth,vr.value)}px`:``;let o=r.proposeDimensions();if(!o||!o.cols||!o.rows)return;let s={cols:o.cols,rows:o.rows};(s.cols!==n.cols||s.rows!==n.rows)&&n.resize(s.cols,s.rows),e&&(s.cols!==u.cols||s.rows!==u.rows)&&S({type:`terminal.resize`,cols:s.cols,rows:s.rows})&&(u={cols:s.cols,rows:s.rows})}z(Zr,e=>{n&&(n.options.theme=e)}),z(vr,()=>N(()=>w(!0)));function T(e){if(n){if(i){let e=i;i=null,e.dispose()}if(e===`webgl`){let e=null;try{e=new tm.WebglAddon;let t=e;e.onContextLoss(()=>{i===t&&(i=null,t.dispose(),_r(`html-fallback`),w(!0))}),n.loadAddon(e),i=e,_r(`webgl`)}catch{try{e?.dispose()}catch{}_r(`html-fallback`)}}else _r(`html`);w(!0)}}z(jr,T);function E(e){n&&(n.options.fontSize=e,w(!0))}function D(r){if(d||!n)return;if(clearTimeout(c),o){o.onclose=null;try{o.close(1e3)}catch{}}w(!1);let i=new URLSearchParams({pane:e,cols:String(n.cols),rows:String(n.rows)});r&&i.set(`takeover`,`1`),f.value=!0,l=!0;let a=null,p=!1,h=``,g=new WebSocket(`${b()}/ws/term?${i}`);o=g,g.onopen=()=>{n&&(u={cols:n.cols,rows:n.rows}),g.send(JSON.stringify({type:`visibility`,visible:!document.hidden}))},g.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type===`terminal.frame`){if(p||(p=!0,s=0),f.value=!1,!n)return;t.width&&t.height&&(t.width!==n.cols||t.height!==n.rows)&&n.resize(t.width,t.height);let e=n;e.write(Gr(t.bytes||``),()=>m.refresh(e))}else t.type===`terminal.closed`?a=jm(t):t.type===`herdr.stderr`?/^run 'herdr --help'/.test(t.message)||(h=t.message):t.type===`web.error`&&$(t.message,!0)},g.onclose=()=>{if(o===g&&(o=null,f.value=!1,l&&!d)){if(a&&/already has an attached client/.test(a))return t.setBanner({text:Y(`This terminal is already open elsewhere.`),btn:Y(`Take control`),fn:()=>{t.setBanner(null),D(!0)}});if(a&&/taken over/.test(a))return t.setBanner({text:Y(`Another client took control.`),btn:Y(`Take back control`),fn:()=>{t.setBanner(null),D(!0)}});if((Rr.value||!Xn.value.ok)&&!document.hidden){if(!p&&s>=3){s=0;let e=h||a;return t.setBanner({text:Mm(e),btn:Y(`Retry`),fn:()=>{t.setBanner(null),D(!1)}})}c=setTimeout(()=>D(!1),Math.min(6e3,400*2**s++))}}}}function O(){if(l=!1,clearTimeout(c),o){let e=o;o=null;try{e.close(1e3)}catch{}}}let k=()=>!!(o&&o.readyState<=1);function A(){n?.reset()}function j(){n?.focus(),p.value=!0}function M(){n?.textarea?.blur()}let P=(e,t)=>y?.tap(e,t)??!1,F=()=>!!(n&&document.activeElement===n.textarea),I=()=>n&&n.rows&&a?a.clientHeight/n.rows:16,L=()=>n?.rows||24;function R(e){return S({type:`terminal.scroll`,direction:e>0?`up`:`down`,lines:Math.abs(e)})}function B(e){S({type:`visibility`,visible:e}),e&&N(()=>w(!0))}function V(){d=!0,O(),g?.(),_?.(),v?.(),v=null,g=null,_=null,y?.dispose(),y=null,i=null,n?.dispose(),n=null}return{mount:x,connect:D,disconnect:O,isConnected:k,sendTerm:S,sendKeys:C,fitNow:w,setFontSize:E,reset:A,scroll:R,focus:j,blur:M,tapLink:P,hasFocus:F,rowHeight:I,pageRows:L,setVisible:B,dispose:V,loading:f,kbdOn:p,hasBanner:t.hasBanner,selectionHint:m}}var Im={key:0},Lm={class:`interactive-terminal-note`},Rm={key:0,class:`term-banner`},zm=Object.assign(T({__name:`InteractiveTerminal`,props:{paneId:{},active:{type:Boolean},title:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=u(null),o=Fm(n.paneId,{setBanner:e=>{i.value=e},hasBanner:()=>!!i.value,fill:()=>!0,input:()=>n.active});z(rr,e=>o.setVisible(e));let s=!1;function c(){if(!s||!Q.value||o.hasFocus())return;let e=document.activeElement;e instanceof HTMLElement&&e.closest(`.interactive-terminal`)&&e.matches(`button, input, textarea`)||o.focus()}function l(e){e.preventDefault(),s=!0,e.currentTarget?.focus(),setTimeout(c,50)}z(()=>o.loading.value,e=>{e||N(c)});let d={onOpenAutoFocus:l,onEscapeKeyDown:e=>e.preventDefault()},p={overlay:`hw-scrim interactive-terminal-scrim`,content:`interactive-terminal`};return(t,n)=>{let s=De,c=Oe,l=xu,u=Gp,h=Ti;return _(),m(h,{open:``,title:(`tl`in t?t.tl:f(Z))(`Interactive terminal`,`Terminal interactif`),content:d,ui:p,"onUpdate:open":n[5]||=e=>e||r(`close`)},{content:H(()=>[F(`header`,{class:`interactive-terminal-head`,onKeydown:n[1]||=K(()=>{},[`stop`])},[F(`span`,null,[E(s,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Z))(`Interactive terminal`,`Terminal interactif`)),1),e.title?(_(),v(`small`,Im,M(e.title),1)):g(``,!0)]),E(c,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,"aria-label":(`tl`in t?t.tl:f(Z))(`Close terminal window`,`Fermer la fenêtre terminal`),onClick:n[0]||=e=>r(`close`)},null,8,[`aria-label`])],32),F(`p`,Lm,M((`tl`in t?t.tl:f(Z))(`Live agent screen · closes when the message field returns`,`Écran réel de l’agent · se ferme au retour du champ libre`)),1),f(i)?(_(),v(`div`,Rm,[F(`span`,null,M(f(i).text),1),E(c,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[2]||=e=>f(i).fn()},{default:H(()=>[a(M(f(i).btn),1)]),_:1})])):g(``,!0),E(l,{ctl:f(o),onKeydown:n[3]||=K(()=>{},[`stop`])},null,8,[`ctl`]),E(u,{ctl:f(o),"all-digits":``,onKeydown:n[4]||=K(()=>{},[`stop`])},null,8,[`ctl`])]),_:1},8,[`title`])}}}),{__name:`InteractiveTerminal`}),Bm={class:`prompt-detail-head`},Vm={class:`prompt-detail-tool`},Hm={key:0,class:`prompt-detail-desc`},Um={key:0,class:`prompt-detail-file`},Wm={class:`path`},Gm={key:0,class:`prompt-detail-stats`},Km={key:0,class:`add`},qm={key:1,class:`del`},Jm={key:2,class:`prompt-detail-note`},Ym=Object.assign(T({__name:`PromptDetailBlock`,props:{detail:{}},setup(e){let t=e,r=h(!1);z(()=>t.detail.command,()=>{r.value=!1});let i=n(()=>(t.detail.command||``).split(`
77
- `)),o=n(()=>i.value.length>8||(t.detail.command||``).length>800),s=n(()=>Ei(t.detail));return(t,n)=>{let c=De;return _(),v(`div`,{class:j([`prompt-detail`,{file:e.detail.file}])},[F(`p`,Bm,[F(`span`,Vm,M(e.detail.tool),1),e.detail.description?(_(),v(`span`,Hm,M(e.detail.description),1)):g(``,!0)]),e.detail.file?(_(),v(`p`,Um,[E(c,{name:`i-lucide-file-pen`}),F(`span`,Wm,M(e.detail.file),1),f(s)?(_(),v(`span`,Gm,[e.detail.added?(_(),v(`span`,Km,`+`+M(e.detail.added),1)):g(``,!0),e.detail.removed?(_(),v(`span`,qm,`−`+M(e.detail.removed),1)):g(``,!0)])):g(``,!0)])):g(``,!0),e.detail.command?(_(),v(`pre`,{key:1,class:j([`prompt-detail-code`,{collapsed:f(o)&&!f(r)}])},[F(`code`,null,[(_(!0),v(k,null,y(f(i),(n,r)=>(_(),v(`span`,{key:r,class:j((`diffKind`in t?t.diffKind:f(xi))(n,!!e.detail.file))},M(n),3))),128))])],2)):g(``,!0),e.detail.truncated?(_(),v(`p`,Jm,M((`t`in t?t.t:f(Y))(`Too long: only the beginning is shown. The terminal shows the rest.`)),1)):g(``,!0),f(o)?(_(),v(`button`,{key:3,type:`button`,class:`prompt-detail-more`,onClick:n[0]||=e=>r.value=!f(r)},[E(c,{name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),a(` `+M(f(r)?(`t`in t?t.t:f(Y))(`Collapse`):(`tl`in t?t.tl:f(Z))(`Show all (${f(i).length} lines)`,`Tout afficher (${f(i).length} lignes)`)),1)])):g(``,!0)],2)}}}),{__name:`PromptDetailBlock`}),Xm={class:`eyebrow choices-eyebrow`},Zm=[`aria-label`],Qm=[`aria-current`,`disabled`,`onClick`],$m={key:2,class:`choices-q`},eh={key:3,class:`choices-note`},th=[`aria-pressed`,`aria-expanded`,`disabled`,`onClick`],nh={key:0,class:`n`},rh={key:1,class:`n`},ih={class:`l`},ah={key:0},oh=[`onSubmit`],sh={class:`choices-free-actions`},ch=[`disabled`],lh={key:6,class:`choices-keys`},uh=[`disabled`],dh=[`disabled`,`onClick`],fh={key:1,class:`card-kbd`,"aria-hidden":`true`},ph={key:0},mh=Object.assign(T({__name:`ChoicesPanel`,props:{paneId:{},prompt:{},screen:{},keys:{type:Boolean}},setup(e){let t=e,r=h(!1);z(()=>[t.prompt,t.screen],()=>{r.value=!1});let i=n(()=>t.screen?t.screen.actions.filter(e=>!(t.prompt&&e.key===`enter`)):[]),o=n(()=>t.screen?fr(t.screen.kind):null),s=n(()=>!!(t.screen&&t.screen.lines.some(e=>/\S {3,}\S/.test(e)))),c=n(()=>t.prompt?.kind===`self-update`?Y(t.prompt.question||``):t.screen&&t.screen.title||t.prompt&&t.prompt.question);async function l(e,n){r.value=!0,await be(t.paneId,e,n)||(r.value=!1)}async function u(e){r.value=!0,await lt(t.paneId,e)||(r.value=!1)}let d=n(()=>t.prompt?.kind===`self-update`);async function p(){r.value=!0,await qe(t.paneId)||(r.value=!1)}async function b(){r.value=!0,await q(t.paneId,`enter`)||(r.value=!1)}let x=n(()=>!!(t.prompt&&t.prompt.options.some(e=>e.checked===void 0))),S=n(()=>t.prompt&&t.prompt.tabs&&t.prompt.tab!==void 0&&!t.prompt.typing?t.prompt.tabs:null);async function C(e){let n=t.prompt;n&&n.tabs&&e!==n.tab&&!L.value&&(r.value=!0,await Ce(t.paneId,e,n.tabs[e])?T.value=``:r.value=!1)}let w=h(null),T=h(``),D=h(!1),O=n(()=>t.prompt?.typing?t.prompt.options.findIndex(e=>e.free):w.value);z(()=>t.prompt?.question,()=>{w.value=null});let A=n(()=>Q.value&&!Vn&&!Un);async function N(e,n){let i=T.value.trim();if(!(!i||L.value||D.value)){r.value=!0,D.value=!0;try{await be(t.paneId,e,n,{text:i,question:t.prompt?.question??null})?(T.value=``,w.value=null):r.value=!1}finally{D.value=!1}}}function P(){t.prompt?.typing?q(t.paneId,`esc`):w.value=null}function I(e,t,n){e.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),P()):e.key===`Enter`&&!e.shiftKey&&A.value&&(e.preventDefault(),N(t,n)))}let L=n(()=>r.value||!_n.value||Dn.value),R=n(()=>!!(t.keys&&Q.value&&t.prompt&&!t.prompt.kind&&t.prompt.options.length&&O.value===null&&!L.value));return Jr(()=>R.value,()=>({digits:Math.min(9,t.prompt?.options.length||0),enter:!0,tabs:!!S.value}),e=>{let n=t.prompt;if(n){if(e.kind===`digit`){let t=n.options[e.n-1];t.free?w.value=e.n-1:l(e.n-1,t.label);return}if(e.kind===`tab`)return q(t.paneId,e.dir>0?`right`:`left`);e.kind===`nav`&&q(t.paneId,e.key)}}),(t,n)=>{let r=Ym,h=De,A=Li,z=Oe;return _(),v(`div`,{class:j([`choices`,{"choices-screen":e.screen}])},[F(`p`,Xm,[n[1]||=F(`i`,null,null,-1),a(M((`t`in t?t.t:f(Y))(`Your turn`)),1)]),f(S)?(_(),v(`div`,{key:0,class:`choices-tabs`,role:`group`,"aria-label":(`t`in t?t.t:f(Y))(`Questions`)},[(_(!0),v(k,null,y(f(S),(t,n)=>(_(),v(`button`,{key:n,type:`button`,class:j({on:n===e.prompt.tab}),"aria-current":n===e.prompt.tab?`step`:void 0,disabled:f(L),onClick:e=>C(n)},M(t),11,Qm))),128))],8,Zm)):g(``,!0),e.prompt?.detail?(_(),m(r,{key:1,detail:e.prompt.detail},null,8,[`detail`])):g(``,!0),f(c)?(_(),v(`p`,$m,M(f(c)),1)):g(``,!0),f(o)?(_(),v(`p`,eh,M(f(o)),1)):g(``,!0),e.screen&&e.screen.lines.length&&!e.prompt?.detail?(_(),v(`pre`,{key:4,class:j([`choices-screen-text`,{wrap:!f(s)}])},M(e.screen.lines.join(`
78
- `)),3)):g(``,!0),e.prompt?(_(),v(`div`,{key:5,class:j([`choices-list`,{multi:e.prompt.multi}])},[(_(!0),v(k,null,y(e.prompt.options,(r,i)=>(_(),v(k,{key:i},[F(`button`,{type:`button`,class:j({cur:i===e.prompt.cursor,on:r.checked}),"aria-pressed":e.prompt.multi&&!r.free?!!r.checked:void 0,"aria-expanded":r.free?f(O)===i:void 0,disabled:f(L),onClick:t=>r.free?w.value=e.prompt.typing||f(w)===i?null:i:l(i,r.label)},[e.prompt.multi&&r.checked!==void 0?(_(),v(`span`,nh,[E(h,{name:r.checked?`i-lucide-square-check`:`i-lucide-square`},null,8,[`name`])])):(_(),v(`span`,rh,M(i+1),1)),F(`span`,ih,[a(M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Y))(r.label):r.label),1),r.hint?(_(),v(`small`,ah,M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Y))(r.hint):r.hint),1)):g(``,!0)]),r.free?(_(),m(h,{key:2,name:`i-lucide-pencil-line`,class:`choices-free-icon`})):g(``,!0)],10,th),r.free&&f(O)===i?(_(),v(`form`,{key:0,class:`choices-free`,onSubmit:K(e=>N(i,r.label),[`prevent`])},[E(A,{modelValue:f(T),"onUpdate:modelValue":n[0]||=e=>te(T)?T.value=e:null,rows:1,maxrows:6,autoresize:``,autofocus:!e.prompt.typing,size:`lg`,class:`w-full`,placeholder:(`t`in t?t.t:f(Y))(`Your answer…`),disabled:f(L)||f(D),onKeydown:e=>I(e,i,r.label)},null,8,[`modelValue`,`autofocus`,`placeholder`,`disabled`,`onKeydown`]),F(`div`,sh,[E(z,{type:`button`,color:`neutral`,variant:`ghost`,size:`sm`,disabled:f(L)||f(D),onClick:P},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Cancel`)),1)]),_:1},8,[`disabled`]),E(z,{type:`submit`,color:`primary`,variant:`solid`,size:`sm`,loading:f(D),disabled:f(L)||f(D)||!f(T).trim()},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Send`)),1)]),_:1},8,[`loading`,`disabled`])])],40,oh)):g(``,!0)],64))),128)),e.prompt.multi&&!f(x)?(_(),v(`button`,{key:0,type:`button`,class:`choices-next`,disabled:f(L),onClick:b},[a(M((`t`in t?t.t:f(Y))(`Continue`)),1),F(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(xr))(`enter`)),1)],8,ch)):g(``,!0)],2)):g(``,!0),f(i).length||f(R)||f(d)?(_(),v(`div`,lh,[f(d)?(_(),v(`button`,{key:0,type:`button`,disabled:f(L),onClick:p},M((`t`in t?t.t:f(Y))(`Dismiss`)),9,uh)):g(``,!0),(_(!0),v(k,null,y(f(i),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(L),onClick:t=>u(e)},[a(M((`screenActionText`in t?t.screenActionText:f(Fr))(e)),1),F(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(xr))(e.key)),1)],8,dh))),128)),f(R)?(_(),v(`span`,fh,[f(S)?(_(),v(`kbd`,ph,`←→`)):g(``,!0),n[2]||=F(`kbd`,null,`↑↓`,-1),F(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(xr))(`enter`)),1),F(`kbd`,null,`1–`+M(Math.min(9,e.prompt.options.length)),1)])):g(``,!0)])):g(``,!0)],2)}}}),{__name:`ChoicesPanel`}),hh={class:`choices choices-menu`},gh={class:`eyebrow choices-eyebrow`},_h={class:`menu-kind`},vh={key:0,class:`choices-q`},yh={key:1,class:`choices-note`},bh={key:2,class:`choices-note`},xh=[`placeholder`,`aria-label`,`disabled`],Sh={key:0,class:`menu-group`},Ch=[`aria-current`,`disabled`,`onClick`],wh={class:`n`,"aria-hidden":`true`},Th={class:`l`},Eh={key:0},Dh={key:0,class:`menu-more`},Oh={key:0,class:`choices-screen-text wrap`},kh={class:`choices-note`},Ah={class:`choices-keys`},jh=[`disabled`,`onClick`],Mh={key:0,class:`card-kbd`,"aria-hidden":`true`},Nh={key:0},Ph=Object.assign(T({__name:`MenuPanel`,props:{paneId:{},menu:{},keys:{type:Boolean}},emits:[`terminal`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=h(null),c=()=>N(()=>s.value?.querySelector(`.cur`)?.scrollIntoView({block:`nearest`}));z(()=>r.menu,()=>{o.value=!1,c()}),w(c);let l=n(()=>o.value||!_n.value||Dn.value),u=n(()=>Ct(r.menu)),d=n(()=>r.menu.actions.filter(e=>!(e.key===`enter`&&r.menu.cursor!==null&&!u.value))),p=n(()=>r.menu.items.length>0);async function m(e,t){o.value=!0,await Pe(r.paneId,{op:`select`,index:e,label:t})||(o.value=!1)}async function b(e){o.value=!0,await Pe(r.paneId,{op:`key`,key:e.key,label:e.label})||(o.value=!1)}let x=h(r.menu.search||``),S=h(!1);z(()=>r.menu.search,e=>{S.value||(x.value=e||``)});let C=null;function T(){S.value=!0,C&&clearTimeout(C),C=setTimeout(D,450)}async function D(){C&&=(clearTimeout(C),null);let e=x.value;e!==(r.menu.search||``)&&await Pe(r.paneId,{op:`search`,text:e}),S.value=!1}U(()=>{C&&clearTimeout(C)});let O=h(null),A=n(()=>r.menu.actions.some(e=>e.key===`esc`)),P=n(()=>r.menu.actions.filter(e=>/^ctrl\+[a-z]$/.test(e.key)).map(e=>e.key)),L=n(()=>!!(r.keys&&Q.value&&p.value&&!l.value));return Jr(()=>!!(r.keys&&Q.value&&!l.value&&(p.value||P.value.length)),()=>({digits:0,enter:!u.value,own:O.value,ctrl:P.value,nav:L.value}),e=>{if(e.kind===`ctrl`){let t=r.menu.actions.find(t=>t.key===e.key);t&&b(t);return}e.kind!==`nav`||e.key===`esc`&&!A.value||q(r.paneId,e.key)}),(t,n)=>{let r=De;return _(),v(`div`,hh,[F(`p`,gh,[n[2]||=F(`i`,null,null,-1),a(M((`t`in t?t.t:f(Y))(`Your turn`)),1),F(`span`,_h,M((`t`in t?t.t:f(Y))(`Interactive menu`)),1)]),e.menu.title?(_(),v(`p`,vh,M(e.menu.title),1)):g(``,!0),f(p)&&e.menu.lines.length?(_(),v(`p`,yh,M(e.menu.lines[0]),1)):g(``,!0),f(p)&&f(u)?(_(),v(`p`,bh,M((`tl`in t?t.tl:f(Z))(`Tap an entry to move the cursor there, then confirm with a button below.`,`Toucher une entrée y place le curseur ; valide ensuite avec un bouton ci-dessous.`)),1)):g(``,!0),e.menu.search===null?g(``,!0):(_(),v(`form`,{key:3,class:`menu-search`,onSubmit:K(D,[`prevent`])},[E(r,{name:`i-lucide-search`,"aria-hidden":`true`}),I(F(`input`,{ref_key:`searchRef`,ref:O,"onUpdate:modelValue":n[0]||=e=>te(x)?x.value=e:null,type:`search`,placeholder:(`t`in t?t.t:f(Y))(`Search…`),"aria-label":(`t`in t?t.t:f(Y))(`Search the menu`),enterkeyhint:`search`,autocomplete:`off`,autocapitalize:`off`,spellcheck:`false`,disabled:!(`eventsOpen`in t?t.eventsOpen:f(_n))||(`offlineView`in t?t.offlineView:f(Dn)),onInput:T},null,40,xh),[[re,f(x)]])],32)),f(p)?(_(),v(`div`,{key:4,ref_key:`listRef`,ref:s,class:`choices-list menu-list`},[(_(!0),v(k,null,y(e.menu.items,(t,n)=>(_(),v(k,{key:n},[t.header?(_(),v(`p`,Sh,M(t.label),1)):(_(),v(`button`,{key:1,type:`button`,class:j({cur:n===e.menu.cursor}),"aria-current":n===e.menu.cursor?`true`:void 0,disabled:f(l),onClick:e=>m(n,t.label)},[F(`span`,wh,M(n===e.menu.cursor?`❯`:``),1),F(`span`,Th,[a(M(t.label),1),t.hint?(_(),v(`small`,Eh,M(t.hint),1)):g(``,!0)])],10,Ch))],64))),128)),e.menu.more?(_(),v(`p`,Dh,M(e.menu.more),1)):g(``,!0)],512)):(_(),v(k,{key:5},[e.menu.lines.length?(_(),v(`pre`,Oh,M(e.menu.lines.join(`
79
- `)),1)):g(``,!0),F(`p`,kh,M((`tl`in t?t.tl:f(Z))(`Interactive menu open: pick its entries in the terminal.`,`Menu interactif en cours : ses entrées se choisissent dans le terminal.`)),1)],64)),F(`div`,Ah,[(_(!0),v(k,null,y(f(d),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(l),onClick:t=>b(e)},[a(M((`screenActionText`in t?t.screenActionText:f(Fr))(e)),1),F(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(xr))(e.key)),1)],8,jh))),128)),f(L)?(_(),v(`span`,Mh,[n[3]||=F(`kbd`,null,`↑↓`,-1),f(u)?g(``,!0):(_(),v(`kbd`,Nh,M((`screenKeyName`in t?t.screenKeyName:f(xr))(`enter`)),1))])):g(``,!0),F(`button`,{type:`button`,class:`menu-term`,onClick:n[1]||=e=>i(`terminal`)},[E(r,{name:`i-lucide-square-terminal`,"aria-hidden":`true`}),a(M((`t`in t?t.t:f(Y))(`View terminal`)),1)])])])}}}),{__name:`MenuPanel`}),Fh={class:`usage-limit-card composer-notice`,role:`status`},Ih={class:`restart-text`},Lh={key:1},Rh=[`disabled`],zh=[`disabled`],Bh={key:2,class:`notice-btn`,href:`https://clau.de/reset`,target:`_blank`,rel:`noopener noreferrer`},Vh=Object.assign(vi(T({__name:`UsageLimitCard`,props:{limit:{},readOnly:{type:Boolean},sendKeys:{type:Function}},emits:[`credits`],setup(e,{emit:t}){let n=e,r=t,i=h(!1);async function o(){if(!(n.readOnly||i.value)){i.value=!0;try{await n.sendKeys([`esc`])}catch(e){$(e.message,!0)}finally{i.value=!1}}}return(t,n)=>(_(),v(`div`,Fh,[F(`span`,Ih,[a(M(f(Z)(`Usage limit reached`,`Limite de quota atteinte`)),1),e.limit.resets?(_(),v(k,{key:0},[a(` · `+M(f(Z)(`Resets`,`Réinitialisation`))+` `+M(e.limit.resets),1)],64)):g(``,!0),e.limit.automatic?(_(),v(`small`,Lh,M(f(Z)(`Will continue automatically`,`Reprise automatique`)),1)):g(``,!0)]),e.limit.automatic?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:o},M(f(Z)(`Cancel wait`,`Annuler l’attente`)),9,Rh)):g(``,!0),e.limit.credits?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:n[0]||=e=>r(`credits`)},`/usage-credits`,8,zh)):g(``,!0),e.limit.resetLink?(_(),v(`a`,Bh,M(f(Z)(`Reset limit ↗`,`Réinitialiser ↗`)),1)):g(``,!0)]))}}),[[`__scopeId`,`data-v-a8935db4`]]),{__name:`UsageLimitCard`}),Hh={key:0,class:`composer-notice restart`,role:`status`},Uh={class:`restart-text`},Wh={key:1,class:`composer-notice failed`,role:`status`},Gh={class:`restart-text`},Kh={key:2,class:`composer-notice`,role:`status`},qh={class:`restart-text`},Jh=[`disabled`,`title`],Yh={key:3,class:`composer-notice codex-update`,role:`status`},Xh=[`title`],Zh={key:0,class:`notice-extra`},Qh=[`href`,`aria-label`,`title`],$h={class:`notice-label`},eg=[`disabled`,`title`],tg={key:2,class:`notice-reason`},ng=[`aria-label`,`title`],rg=[`title`],ig=[`disabled`,`title`],ag=`wherdr.codexUpdate.dismissed`,og=Object.assign(T({__name:`CodexNotices`,props:{pane:{},paneId:{},readOnly:{type:Boolean}},setup(e){let t=e,r=h(``);try{r.value=localStorage.getItem(ag)||``}catch{}let i=n(()=>{let e=t.pane.codexStatus?.update;return!e||e.state===`available`&&!e.job&&e.latest===r.value?null:e}),o=n(()=>t.pane.codexStatus?.weekly||null),s=n(()=>i.value?.job||null),c=n(()=>{let e=Wn(t.pane.id),n=Xn.value.machines?.find(t=>t.key===e);return n&&n.label||Bn.value||Y(`This machine`)}),l=n(()=>{let e=i.value;if(!e)return``;let t=Z(`Codex ${e.latest} available`,`Codex ${e.latest} disponible`);return e.current?`${t} ${Z(`(you have ${e.current})`,`(tu as la ${e.current})`)}`:t}),u=n(()=>{let e=o.value;return e?e.lessThan?Z(`Weekly limit: less than ${e.left}% left`,`Limite hebdo : moins de ${e.left} % restants`):Z(`Weekly limit: ${e.left}% left`,`Limite hebdo : ${e.left} % restants`):``});function d(){let e=i.value?.latest;if(e){r.value=e;try{localStorage.setItem(ag,e)}catch{}}}async function p(){let e=i.value?.command;if(e){X();try{await navigator.clipboard.writeText(e),$(Z(`Command copied: paste it into a terminal on ${c.value}.`,`Commande copiée : colle-la dans un terminal sur ${c.value}.`))}catch{$(Y(`Copy failed`),!0)}}}let m=n(()=>{if(i.value?.method!==`terminal`)return``;let e=t.pane.status;return e===`working`?Z(`Codex is working: update it once it is done`,`Codex travaille : mets-le à jour quand il a fini`):e===`blocked`?Z(`Codex is waiting for an answer: answer it first`,`Codex attend une réponse : réponds-lui d’abord`):``});async function y(){let e=i.value;if(e&&e.runnable&&e.command&&!m.value&&(e.method===`terminal`?await _t([Z(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Z(`wherdr will exit Codex in this pane, type Codex’s official update command in its terminal:`,`wherdr va quitter Codex dans ce panneau et taper dans son terminal la commande de mise à jour officielle de Codex :`),e.command,Z(`then restart Codex on this conversation (codex resume). If the update fails, the pane stays at its shell.`,`puis relancer Codex sur cette conversation (codex resume). Si la mise à jour échoue, le panneau reste sur son shell.`)].join(`
74
+ }`)),this.register((0,i.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0,r.throwIfFalsy)(l.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(p)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p),l.bufferData(l.ELEMENT_ARRAY_BUFFER,f,l.STATIC_DRAW),this._attributesBuffer=(0,r.throwIfFalsy)(l.createBuffer()),this.register((0,i.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,s,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,s,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,s,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r,i,o,s,c,l,u,d,f,p,m,h=1;for(r=0;r<t.rows;r++){for(o=-1,s=0,c=0,l=!1,i=0;i<t.cols;i++)u=(r*t.cols+i)*a.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[u+a.RENDER_MODEL_BG_OFFSET],f=e.cells[u+a.RENDER_MODEL_FG_OFFSET],p=!!(67108864&f),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,i,r)),o=i,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,t.cols,r))}n.count=h}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`)return void(t.count=0);let r,i=0;n.style!==`bar`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.style!==`underline`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=8*i++,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,s){if(67108864&n)switch(50331648&n){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&n].rgba;break;case 50331648:l=(16777215&n)<<8;break;default:l=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:l=(16777215&r)<<8;break;default:l=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=(0,o.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),u=i*this._dimensions.device.cell.width,d=s*this._dimensions.device.cell.height,f=(l>>24&255)/255,p=(l>>16&255)/255,m=(l>>8&255)/255,h=1,this._addRectangle(e.attributes,t,u,d,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,f,p,m,h)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}}t.RectangleRenderer=g},310:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;let r=n(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=(0,r.createSelectionRenderModel)()}resize(e,n){let r=e*n*t.RENDER_MODEL_INDICIES_PER_CELL;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;let r=n(820),i=n(274),a=n(627),o=n(457),s=n(56),c=n(374),l=n(345),u=n(859),d=n(147),f=n(782),p=n(855),m=n(965),h=n(742),g=n(310),_=n(733);class v extends u.Disposable{constructor(e,t,n,o,d,p,m,h,v){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=o,this._coreService=d,this._decorationService=p,this._optionsService=m,this._themeService=h,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new g.RenderModel,this._workCell=new f.CellData,this._workCell2=new f.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new l.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new l.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new l.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new i.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,m,this._themeService)],this.dimensions=(0,c.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(m.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let y={antialias:!1,depth:!1,preserveDrawingBuffer:v};if(this._gl=this._canvas.getContext(`webgl2`,y),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextlost`,(e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)}),3e3)}))),this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextrestored`,(e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,a.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,a.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new h.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new m.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let e=(0,a.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,l.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,l.forwardEvent)(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(e){return-1}deregisterCharacterJoiner(e){return!1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new o.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r,i,a,o,s,c,l,u,d,f,m,h,_,v,x=this._workCell;e=b(e,n.rows-1,0),t=b(t,n.rows-1,0);let S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let D=!1;for(i=e;i<=t;i++)for(a=i+n.buffer.ydisp,o=n.buffer.lines.get(a),this._model.lineLengths[i]=0,s=this._characterJoinerService.getJoinedCharacters(a),_=0;_<n.cols;_++)if(r=this._cellColorResolver.result.bg,o.loadCell(_,x),_===0&&(r=this._cellColorResolver.result.bg),c=!1,l=_,s.length>0&&_===s[0][0]&&(c=!0,u=s.shift(),x=new y(x,o.translateToString(!0,u[0],u[1]),u[1]-u[0]),l=u[1]-1),d=x.getChars(),f=x.getCode(),h=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(x,_,a,this.dimensions.device.cell.width),E&&a===S&&(_===w&&(this._model.cursor={x:w,y:C,width:x.getWidth(),style:this._coreBrowserService.isFocused?n.options.cursorStyle||`block`:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+x.getWidth()-1),_>=w&&_<=T&&(this._coreBrowserService.isFocused&&(n.options.cursorStyle||`block`)===`block`||!1===this._coreBrowserService.isFocused&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),f!==p.NULL_CELL_CODE&&(this._model.lineLengths[i]=_+1),(this._model.cells[h]!==f||this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(D=!0,d.length>1&&(f|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[h]=f,this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,m=x.getWidth(),this._glyphRenderer.value.updateCell(_,i,f,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,m,r),c))for(x=this._workCell,_++;_<l;_++)v=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(_,i,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[v]=p.NULL_CELL_CODE,this._model.cells[v+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[v+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[v+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;D&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}}t.WebglRenderer=v;class y extends d.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function b(e,t,n=0){return Math.max(Math.min(e,t),n)}t.JoinedCellData=y},381:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;let r=n(374);function i(e,t,n){let i=(0,r.throwIfFalsy)(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,n){let a=(0,r.throwIfFalsy)(e.createProgram());if(e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.VERTEX_SHADER,t))),e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.FRAGMENT_SHADER,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)},t.createShader=i,t.expandFloat32Array=function(e,t){let n=Math.min(2*e.length,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1}}},592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(627),i=n(237),a=n(374),o=n(859);class s extends o.Disposable{constructor(e,t,n,r,i,a,s,c){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=s,this._themeService=c,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e)}))),this.register((0,o.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,a.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,r.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=i.TEXT_BASELINE,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){return`${n?`italic`:``} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=s},733:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(592);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===i.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&(0,r.is256Color)(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}}t.LinkRenderLayer=o},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let r=n(855),i=n(160),a=n(374),o,s=0,c=0,l=!1,u=!1,d=!1,f=0;t.CellColorResolver=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,p){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,c=0,s=0,u=!1,l=!1,d=!1,o=this._themeService.colors,f=0,e.getCode()!==r.NULL_CELL_CODE&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));f=t*p%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),d){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:c=(16777215&this.result.fg)<<8|255;break;default:c=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:c=(16777215&this.result.bg)<<8|255}c=i.rgba.blend(c,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else c=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,o.selectionForeground&&(s=o.selectionForeground.rgba>>8&16777215,l=!0),(0,a.treatGlyphAsBackgroundColor)(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))s=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:s=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:s=(16777215&this.result.fg)<<8|255;break;default:s=this._themeService.colors.foreground.rgba}s=i.rgba.blend(s,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}l=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),u&&(c=d?e.bg&-150994944|c|50331648:-16777216&e.bg|c|50331648),l&&(s=e.fg&-83886080|s|50331648),67108864&this.result.fg&&(u&&!l&&(s=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&o.background.rgba>>8|50331648,l=!0),!u&&l&&(c=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&o.foreground.rgba>>8|50331648,u=!0)),o=void 0,this.result.bg=u?c:this.result.bg,this.result.fg=l?s:this.result.fg,this.result.ext&=536870911,this.result.ext|=f<<29&3758096384}}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;let r=n(509),i=n(197),a=[];t.acquireTextureAtlas=function(e,t,n,o,s,c,l,u){let d=(0,i.generateConfig)(o,s,c,l,t,n,u);for(let t=0;t<a.length;t++){let n=a[t],r=n.ownedBy.indexOf(e);if(r>=0){if((0,i.configEquals)(n.config,d))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),a.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<a.length;t++){let n=a[t];if((0,i.configEquals)(n.config,d))return n.ownedBy.push(e),n.atlas}let f=e._core,p={atlas:new r.TextureAtlas(document,d,f.unicodeService),config:d,ownedBy:[e]};return a.push(p),p.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<a.length;t++){let n=a[t].ownedBy.indexOf(e);if(n!==-1){a[t].ownedBy.length===1?(a[t].atlas.dispose(),a.splice(t,1)):a[t].ownedBy.splice(n,1);break}}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;let r=n(160);t.generateConfig=function(e,t,n,i,a,o,s){let c={foreground:o.foreground,background:o.background,cursor:r.NULL_COLOR,cursorAccent:r.NULL_COLOR,selectionForeground:r.NULL_COLOR,selectionBackgroundTransparent:r.NULL_COLOR,selectionBackgroundOpaque:r.NULL_COLOR,selectionInactiveBackgroundTransparent:r.NULL_COLOR,selectionInactiveBackgroundOpaque:r.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:s,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:c}},t.configEquals=function(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba},t.is256Color=function(e){return(50331648&e)==16777216||(50331648&e)==33554432}},237:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;let r=n(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};let i={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}},t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.tryDrawCustomChar=function(e,n,o,l,u,d,f,p){let m=t.blockElementDefinitions[n];if(m)return function(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}(e,m,o,l,u,d),!0;let h=i[n];if(h)return function(e,t,n,i,o,s){let c=a.get(t);c||(c=new Map,a.set(t,c));let l=e.fillStyle;if(typeof l!=`string`)throw Error(`Unexpected fillStyle type "${l}"`);let u=c.get(l);if(!u){let n=t[0].length,i=t.length,a=e.canvas.ownerDocument.createElement(`canvas`);a.width=n,a.height=i;let o=(0,r.throwIfFalsy)(a.getContext(`2d`)),s=new ImageData(n,i),d,f,p,m;if(l.startsWith(`#`))d=parseInt(l.slice(1,3),16),f=parseInt(l.slice(3,5),16),p=parseInt(l.slice(5,7),16),m=l.length>7&&parseInt(l.slice(7,9),16)||1;else{if(!l.startsWith(`rgba`))throw Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,f,p,m]=l.substring(5,l.length-1).split(`,`).map((e=>parseFloat(e)))}for(let e=0;e<i;e++)for(let r=0;r<n;r++)s.data[4*(e*n+r)]=d,s.data[4*(e*n+r)+1]=f,s.data[4*(e*n+r)+2]=p,s.data[4*(e*n+r)+3]=t[e][r]*(255*m);o.putImageData(s,0,0),u=(0,r.throwIfFalsy)(e.createPattern(a,null)),c.set(l,u)}e.fillStyle=u,e.fillRect(n,i,o,s)}(e,h,o,l,u,d),!0;let g=t.boxDrawingDefinitions[n];if(g)return function(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[l,u]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=o*Number.parseInt(l),t=typeof u==`function`?u(.15,.15/a*i):u;for(let l of t.split(` `)){let t=l[0],u=s[t];if(!u){console.error(`Could not find drawing instructions for "${t}"`);continue}let d=l.substring(1).split(`,`);d[0]&&d[1]&&u(e,c(d,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}(e,g,o,l,u,d,p),!0;let _=t.powerlineDefinitions[n];return!!_&&(function(e,t,n,r,i,a,o,l){let u=new Path2D;u.rect(n,r,i,a),e.clip(u),e.beginPath();let d=o/12;e.lineWidth=l*d;for(let o of t.d.split(` `)){let u=o[0],f=s[u];if(!f){console.error(`Could not find drawing instructions for "${u}"`);continue}let p=o.substring(1).split(`,`);p[0]&&p[1]&&f(e,c(p,i,a,n,r,!1,l,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,_,o,l,u,d,f,p),!0)};let a=new Map;function o(e,t,n=0){return Math.max(Math.min(e,t),n)}let s={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function c(e,t,n,r,i,a,s,c=0,l=0){let u=e.map((e=>parseFloat(e)||parseInt(e)));if(u.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<u.length;e+=2)u[e]*=t-c*s-l*s,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,t,0)),u[e]+=r+c*s;for(let e=1;e<u.length;e+=2)u[e]*=n,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,n,0)),u[e]+=i;return u}},56:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;let r=n(859);t.observeDevicePixelDimensions=function(e,t,n){let i=new t.ResizeObserver((t=>{let r=t.find((t=>t.target===e));if(!r)return;if(!(`devicePixelContentBoxSize`in r))return i?.disconnect(),void(i=void 0);let a=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)}));try{i.observe(e,{box:[`device-pixel-content-box`]})}catch{i.disconnect(),i=void 0}return(0,r.toDisposable)((()=>i?.disconnect()))}},374:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},509:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;let r=n(237),i=n(860),a=n(374),o=n(160),s=n(345),c=n(485),l=n(385),u=n(147),d=n(855),f={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},p;class m{get pages(){return this._pages}constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new c.FourKeyMap,this._cacheMapCombined=new c.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new s.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new s.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,a.throwIfFalsy)(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new l.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT)){let e=this._drawToCache(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT);this._cacheMap.set(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT,e)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(m.maxAtlasPages&&this._pages.length>=Math.max(4,m.maxAtlasPages)){let e=this._pages.filter((e=>2*e.canvas.width<=(m.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width)),t=-1,n=0;for(let r=0;r<e.length;r++)if(e[r].canvas.width!==n)t=r,n=e[r].canvas.width;else if(r-t==3)break;let r=e.slice(t,t+4),i=r.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),a=this.pages.length-r.length,o=this._mergePages(r,a);o.version++;for(let e=i.length-1;e>=0;e--)this._deletePage(i[e]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let e=new h(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let n=2*e[0].canvas.width,r=new h(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i)}getRasterizedGlyph(e,t,n,r,i){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i)}_getFromCacheMap(e,t,n,r,i,a=!1){return p=e.get(t,n,r,i),p||(p=this._drawToCache(t,n,r,i,a),e.set(t,n,r,i,p)),p}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return o.NULL_COLOR;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=u.AttributeData.toColorRGB(t);i=o.channels.toColor(e[0],e[1],e[2]);break;default:i=n?o.color.opaque(this._config.colors.foreground):this._config.colors.background}return i}_getForegroundColor(e,t,n,i,a,s,c,l,d,f){let p=this._getMinimumContrastColor(e,t,n,i,a,s,c,d,l,f);if(p)return p;let m;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&s<8&&(s+=8),m=this._getColorFromAnsiIndex(s);break;case 50331648:let e=u.AttributeData.toColorRGB(s);m=o.channels.toColor(e[0],e[1],e[2]);break;default:m=c?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(m=o.color.opaque(m)),l&&(m=o.color.multiplyOpacity(m,r.DIM_OPACITY)),m}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,s,c,l,u){if(this._config.minimumContrastRatio===1||u)return;let d=this._getContrastCache(l),f=d.getColor(e,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(t,n,s),m=this._resolveForegroundRgba(i,a,s,c),h=o.rgba.ensureContrastRatio(p,m,this._config.minimumContrastRatio/(l?2:1));if(!h)return void d.setColor(e,r,null);let g=o.channels.toColor(h>>24&255,h>>16&255,h>>8&255);return d.setColor(e,r,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,n,o,s=!1){let c=typeof e==`number`?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let d=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=o,this._workAttributeData.isInvisible())return f;let p=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(h){let e=S;S=w,w=e;let t=C;C=T,T=t}let E=this._getBackgroundColor(T,w,h,_);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let D=p?this._config.fontWeightBold:this._config.fontWeight,O=v?`italic`:``;this._tmpCtx.font=`${O} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;let k=c.length===1&&(0,a.isPowerlineGlyph)(c.charCodeAt(0)),A=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),j=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=j.css;let M=A?0:4,N=!1;!1!==this._config.customGlyphs&&(N=(0,i.tryDrawCustomChar)(this._tmpCtx,c,M,M,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let P,F=!k;if(P=typeof e==`number`?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())F=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{F=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=M,r=Math.ceil(M+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<P;s++){this._tmpCtx.save();let c=n+s*this._config.deviceCellWidth,u=n+(s+1)*this._config.deviceCellWidth,d=c+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r),this._tmpCtx.moveTo(c,o),this._tmpCtx.lineTo(u,o);break;case 3:let n=e<=1?o:Math.ceil(M+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(M+this._config.deviceCharHeight+e/2)-t,f=new Path2D;f.rect(c,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(f),this._tmpCtx.moveTo(c-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(c-this._config.deviceCellWidth/2,s,c,s,c,i),this._tmpCtx.bezierCurveTo(c,n,d,n,d,i),this._tmpCtx.bezierCurveTo(d,s,u,s,u,i),this._tmpCtx.bezierCurveTo(u,n,u+this._config.deviceCellWidth/2,n,u+this._config.deviceCellWidth/2,i);break;case 4:let p=l===0?0:l>=e?2*e-l:e-l;!(l>=e)==0||p===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c+p,r),this._tmpCtx.lineTo(u,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(c+p,r),this._tmpCtx.moveTo(c+p+e,r),this._tmpCtx.lineTo(u,r)),l=(0,a.computeNextVariantOffset)(u-c,e,l);break;case 5:let m=u-c,h=Math.floor(.6*m),g=Math.floor(.3*m),_=m-h-g;this._tmpCtx.setLineDash([h,g,_]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r);break;default:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!N&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*P,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(c,M,M+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+t),this._tmpCtx.stroke()}if(N||this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F),e);t++);}if(b){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),L;if(L=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(I):g(I,E,j,F),L)return f;let R=this._findGlyphBoundingBox(I,this._workBoundingBox,l,A,N,M),z,B;for(;;){if(this._activePages.length===0){let e=this._createNewPage();z=e,B=e.currentRow,B.height=R.size.y;break}z=this._activePages[this._activePages.length-1],B=z.currentRow;for(let e of this._activePages)R.size.y<=e.currentRow.height&&(z=e,B=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=B.height&&R.size.y<=t.height&&(z=this._activePages[e],B=t);if(B.y+R.size.y>=z.canvas.height||B.height>R.size.y+2){let e=!1;if(z.currentRow.y+z.currentRow.height+R.size.y>=z.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+R.size.y<e.canvas.height){t=e;break}if(t)z=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&B.y+R.size.y<=z.canvas.height&&B.height>=R.size.y&&B.x+R.size.x<=z.canvas.width)e=!0;else{let t=this._createNewPage();z=t,B=t.currentRow,B.height=R.size.y,e=!0}}e||(z.currentRow.height>0&&z.fixedRows.push(z.currentRow),B={x:0,y:z.currentRow.y+z.currentRow.height,height:R.size.y},z.fixedRows.push(B),z.currentRow={x:0,y:B.y+B.height,height:0})}if(B.x+R.size.x<=z.canvas.width)break;B===z.currentRow?(B.x=0,B.y+=B.height,B.height=0):z.fixedRows.splice(z.fixedRows.indexOf(B),1)}return R.texturePage=this._pages.indexOf(z),R.texturePosition.x=B.x,R.texturePosition.y=B.y,R.texturePositionClipSpace.x=B.x/z.canvas.width,R.texturePositionClipSpace.y=B.y/z.canvas.height,R.sizeClipSpace.x/=z.canvas.width,R.sizeClipSpace.y/=z.canvas.height,B.height=Math.max(B.height,R.size.y),B.x+=R.size.x,z.ctx.putImageData(I,R.texturePosition.x-this._workBoundingBox.left,R.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,R.size.x,R.size.y),z.addGlyph(R),z.version++,R}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=m;class h{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=_(e,t,t),this.ctx=(0,a.throwIfFalsy)(this.canvas.getContext(`2d`,{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function _(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(399);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},782:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(133),i=n(855),a=n(147);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},776:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(859),o=n(97),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},97:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(726);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;let t=n(345),i=n(859),a=n(399),o=n(666),s=n(776);class c extends i.Disposable{constructor(e){if(a.isSafari&&(0,a.getSafariVersion)()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(e){let n=e._core;if(!e.element)return void this.register(n.onWillOpen((()=>this.activate(e))));this._terminal=e;let r=n.coreService,a=n.optionsService,c=n,l=c._renderService,u=c._characterJoinerService,d=c._charSizeService,f=c._coreBrowserService,p=c._decorationService,m=c._logService,h=c._themeService;(0,s.setTraceLogger)(m),this._renderer=this.register(new o.WebglRenderer(e,u,d,f,r,p,a,h,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0,i.toDisposable)((()=>{let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.WebglAddon=c})(),r})()))})),mm=dm(),hm=fm(),gm=pm();function _m(e,t,n=!0){return n?t===`normal`?Math.min(Math.max(0,e),760):Math.min(t===`wide`?1100:1/0,Math.max(0,e-48)):Math.max(0,e)}var vm=/https?:\/\/[^\s"'<>`─-▟]+/g,ym=/[─-▟|]/,bm={")":`(`,"]":`[`,"}":`{`};function xm(e){let t;try{t=new URL(e.trim())}catch{return null}return t.protocol===`http:`||t.protocol===`https:`?t.href:null}function Sm(e,t){let n=e[e.length-1],r=t[0];return!!n&&!!r&&n!==` `&&r!==` `&&!ym.test(n)&&!ym.test(r)}function Cm(e){for(;;){let t=e[e.length-1];if(`.,;:!?'"`.includes(t))e=e.slice(0,-1);else if(bm[t]&&e.split(bm[t]).length<=e.split(t).length-1)e=e.slice(0,-1);else return e}}function wm(e){let t=[];for(let n of e.matchAll(vm)){let e=Cm(n[0]);xm(e)&&e.length>8&&t.push({start:n.index,end:n.index+e.length,url:e})}return t}function Tm(e,t,n=()=>!1){if(!e[t])return[];let r=t=>n(t+1)||Sm(e[t],e[t+1]??``),i=t;for(;i>0&&r(i-1);)i--;let a=t;for(;a<e.length-1&&r(a);)a++;let o=[],s=``;for(let t=i;t<=a;t++)o.push(s.length),s+=e[t];let c=e=>{let t=o.length-1;for(;t>0&&o[t]>e;)t--;return{row:i+t,col:e-o[t]}};return wm(s).map(e=>({url:e.url,start:c(e.start),end:c(e.end-1)})).filter(e=>e.start.row<=t&&e.end.row>=t).map(e=>({...e,end:{row:e.end.row,col:e.end.col+1}}))}function Em(e,t){let n=``;for(let r=0;r<t;r++){let t=e?.getCell(r)?.getChars()||` `;n+=t.length===1?t:` `}return n}function Dm(e){let t=e.buffer.active,n=[];for(let r=0;r<t.length;r++)n.push(Em(t.getLine(r),e.cols));return n}var Om=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),km=()=>typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches;function Am(e,t,n){return!t||(n?e.metaKey:e.ctrlKey)}function jm(e){let t=xm(e);return t?(window.open(t,`_blank`,`noopener,noreferrer`),!0):!1}function Mm(e,t){let n=Om(),r=km(),i=e=>`${e}\n${t(n?`⌘+click to open`:`Ctrl+click to open`)}`,a=!1,o=(e,t)=>{Am(e,r,n)&&(a=jm(t)||a)},s=()=>e.element?.querySelector(`.xterm-screen`),c=(e,t)=>{let n=s();n&&r&&xm(t)&&(n.title=i(t))},l=()=>{let e=s();e&&e.removeAttribute(`title`)},u={activate:o,hover:c,leave:l,allowNonHttpProtocols:!1};e.options.linkHandler=u;let d=e.registerLinkProvider({provideLinks(t,n){let r=Dm(e),i=e.buffer.active,a=Tm(r,t-1,e=>!!i.getLine(e)?.isWrapped);n(a.length?a.map(e=>({text:e.url,range:{start:{x:e.start.col+1,y:e.start.row+1},end:{x:e.end.col,y:e.end.row+1}},activate:t=>o(t,e.url),hover:t=>c(t,e.url),leave:l})):void 0)}});return{tap:(t,n)=>{let r=s();if(!r)return!1;a=!1;let i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:n,button:0};for(let e of[`mousemove`,`mousedown`,`mouseup`])r.dispatchEvent(new MouseEvent(e,{...i,buttons:+(e===`mousedown`)}));return e.element?.dispatchEvent(new MouseEvent(`mouseleave`,i)),e.clearSelection(),a},dispose(){d.dispose(),l()}}}function Nm(e){return e.key.toLowerCase()===`c`&&!e.altKey&&(e.metaKey||e.ctrlKey&&e.shiftKey)}function Pm(e,t,n){return e.button!==0||!e.shiftKey||e.altKey?null:n?t?{shiftKey:!1,altKey:!0}:null:{shiftKey:!1,altKey:!1}}function Fm(e){return e.replace(/[ \t]+$/gm,``)}function Im(e,t,n=()=>!1){let r=e.split(`
75
+ `);return r.length===t.length?r.reduce((e,r,i)=>i===0?r:e+(n(i)||Sm(t[i-1],t[i])?``:`
76
+ `)+r,``):e}function Lm(e){let t=e.getSelection(),n=e.getSelectionPosition();if(!n)return Fm(t);let r=Math.min(n.start.y,n.end.y),i=Math.max(n.start.y,n.end.y),a=e.buffer.active;return Fm(Im(t,Dm(e).slice(r,i+1),e=>!!a.getLine(r+e)?.isWrapped))}function Rm(e,t=globalThis.navigator?.clipboard){if(!e||!t?.writeText)return Promise.resolve(!1);try{return t.writeText(e).then(()=>!0,()=>!1)}catch{return Promise.resolve(!1)}}var zm=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent);function Bm(e,t){let n=e.element;if(!n)return()=>{};let r=zm(),i=()=>{e.hasSelection()&&Rm(Lm(e)).then(e=>e&&t?.())},a=t=>{Nm(t)&&e.hasSelection()&&(t.preventDefault(),t.stopPropagation(),i())},o=()=>i(),s=t=>{t.button===0&&window.addEventListener(`mouseup`,o,{capture:!0,once:!0});let n=Pm(t,r,e.modes.mouseTrackingMode!==`none`);n&&(t.preventDefault(),t.stopImmediatePropagation(),t.target?.dispatchEvent(new MouseEvent(`mousedown`,{bubbles:!0,cancelable:!0,composed:!0,view:window,detail:t.detail,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:t.button,buttons:t.buttons,ctrlKey:t.ctrlKey,metaKey:t.metaKey,...n})))};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`mousedown`,s,!0),()=>{window.removeEventListener(`mouseup`,o,{capture:!0}),n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`mousedown`,s,!0)}}function Vm(e,t){e.attachCustomKeyEventHandler(e=>e.key!==`Enter`||!e.shiftKey||e.ctrlKey||e.altKey||e.metaKey||e.isComposing?!0:(e.type===`keydown`&&(e.preventDefault(),t(`shift+enter`)),!1))}function Hm(e){return!e||e.getData(`text/plain`)?[]:[...e.items||[]].filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e)}function Um(e,t){async function n(e){let n=[];for(let r of e)try{n.push(await t.upload(r))}catch(e){t.report(`${Y(`Photo upload failed`)} : ${e.message}`)}n.length&&!t.paste(n.join(` `))&&t.report(Y(`Terminal not connected — image not pasted`))}let r=e=>{let r=Hm(e.clipboardData);!r.length||t.enabled&&!t.enabled()||(e.preventDefault(),e.stopPropagation(),n(r))};return e.addEventListener(`paste`,r,!0),()=>e.removeEventListener(`paste`,r,!0)}async function Wm(e){let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=Math.min(1,2048/Math.max(e.naturalWidth,e.naturalHeight)),r=document.createElement(`canvas`);r.width=Math.round(e.naturalWidth*n),r.height=Math.round(e.naturalHeight*n);let i=r.getContext(`2d`);i.fillStyle=`#fff`,i.fillRect(0,0,r.width,r.height),i.drawImage(e,0,0,r.width,r.height);let a=await new Promise(e=>r.toBlob(e,`image/jpeg`,.86));if(a)return a}catch{}finally{URL.revokeObjectURL(t)}return e}async function Gm(e,t){let n=await Wm(t),r=await fetch(`/api/upload?pane=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":n.type||`image/jpeg`},body:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(Y(i.error||`HTTP ${r.status}`));return{path:i.path,name:i.name}}function Km(e){return e.code===`unreachable`?X(`${e.machine||`Machine`} unreachable`,`${e.machine||`Machine`} injoignable`):e.code===`unknown_machine`?X(`unknown machine`,`machine inconnue`):Y(e.reason||``)}function qm(e){return e?X(`Terminal unavailable: ${e}`,`Terminal indisponible : ${e}`):Y(`Terminal unavailable`)}var Jm=`"Wherdr Symbols", "JetBrains Mono Variable", "JetBrains Mono", "Wherdr Nerd Symbols", ui-monospace, "SF Mono", Menlo, monospace`;function Ym(e){let t=typeof document<`u`?document.fonts:void 0;return t?.addEventListener?(t.addEventListener(`loadingdone`,e),()=>t.removeEventListener(`loadingdone`,e)):()=>{}}function Xm(e,t){let n=null,r=null,i=null,a=null,o=null,s=0,c,l=!1,u={cols:0,rows:0},d=!1,f=h(!1),p=h(!1),m=um(),g=null,_=null,v=null,y=null,b=()=>`${location.protocol===`https:`?`wss`:`ws`}://${location.host}`;function x(i){a=i,d=!1,s=0,n=new mm.Terminal({fontFamily:Jm,fontSize:Gr.value,lineHeight:1,scrollback:0,cursorBlink:!1,allowProposedApi:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:ei.value}),r=new hm.FitAddon,n.loadAddon(r),n.open(i),g=Bm(n,()=>$(Y(`Copied`))),y=Mm(n,Y),_=Um(i,{upload:async t=>(await Gm(e,t)).path,paste:e=>S({type:`paste`,text:e}),report:e=>$(e,!0)}),T(Pr.value);let o=n;Promise.all([document.fonts?.load(`${Gr.value}px "JetBrains Mono Variable"`),document.fonts?.load(`${Gr.value}px "Wherdr Symbols"`,`─▀█⎿⏵⏺✻✳`)]).then(()=>{d||n!==o||(o.options.fontFamily=Jm,w(!0),o.refresh(0,o.rows-1))}).catch(()=>{}),v=Ym(()=>{d||n!==o||(o.clearTextureAtlas(),o.refresh(0,o.rows-1))});let c=n.textarea;c&&(c.setAttribute(`autocorrect`,`off`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`spellcheck`,`false`),c.addEventListener(`blur`,()=>{p.value=!1}),c.addEventListener(`focus`,()=>{p.value=!0})),n.attachCustomWheelEventHandler(()=>!1),Vm(n,e=>C([e])),n.onData(e=>{t.input?.()!==!1&&S({type:`terminal.input`,text:e})}),n.onBinary(e=>{if(t.input?.()===!1)return;let n=Uint8Array.from(e,e=>e.charCodeAt(0)&255);S({type:`terminal.input`,bytes:bn(n)})})}function S(e){return o&&o.readyState===1?(o.send(JSON.stringify(e)),!0):!1}async function C(t){if(!S({type:`keys`,keys:t}))try{await kr(`/api/input`,{pane_id:e,keys:t}),Q()}catch(e){$(e.message,!0)}}function w(e){if(!n||!r||!a||!a.parentElement)return;let i=matchMedia(`(min-width: 900px)`).matches&&!t.fill?.();a.style.width=i?`${_m(a.parentElement.clientWidth,Sr.value)}px`:``;let o=r.proposeDimensions();if(!o||!o.cols||!o.rows)return;let s={cols:o.cols,rows:o.rows};(s.cols!==n.cols||s.rows!==n.rows)&&n.resize(s.cols,s.rows),e&&(s.cols!==u.cols||s.rows!==u.rows)&&S({type:`terminal.resize`,cols:s.cols,rows:s.rows})&&(u={cols:s.cols,rows:s.rows})}B(ei,e=>{n&&(n.options.theme=e)}),B(Sr,()=>P(()=>w(!0)));function T(e){if(n){if(i){let e=i;i=null,e.dispose()}if(e===`webgl`){let e=null;try{e=new gm.WebglAddon;let t=e;e.onContextLoss(()=>{i===t&&(i=null,t.dispose(),xr(`html-fallback`),w(!0))}),n.loadAddon(e),i=e,xr(`webgl`)}catch{try{e?.dispose()}catch{}xr(`html-fallback`)}}else xr(`html`);w(!0)}}B(Pr,T);function E(e){n&&(n.options.fontSize=e,w(!0))}function D(r){if(d||!n)return;if(clearTimeout(c),o){o.onclose=null;try{o.close(1e3)}catch{}}w(!1);let i=new URLSearchParams({pane:e,cols:String(n.cols),rows:String(n.rows)});r&&i.set(`takeover`,`1`),f.value=!0,l=!0;let a=null,p=!1,h=``,g=new WebSocket(`${b()}/ws/term?${i}`);o=g,g.onopen=()=>{n&&(u={cols:n.cols,rows:n.rows}),g.send(JSON.stringify({type:`visibility`,visible:!document.hidden}))},g.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type===`terminal.frame`){if(p||(p=!0,s=0),f.value=!1,!n)return;t.width&&t.height&&(t.width!==n.cols||t.height!==n.rows)&&n.resize(t.width,t.height);let e=n;e.write(Qn(t.bytes||``),()=>m.refresh(e))}else t.type===`terminal.closed`?a=Km(t):t.type===`herdr.stderr`?/^run 'herdr --help'/.test(t.message)||(h=t.message):t.type===`web.error`&&$(t.message,!0)},g.onclose=()=>{if(o===g&&(o=null,f.value=!1,l&&!d)){if(a&&/already has an attached client/.test(a))return t.setBanner({text:Y(`This terminal is already open elsewhere.`),btn:Y(`Take control`),fn:()=>{t.setBanner(null),D(!0)}});if(a&&/taken over/.test(a))return t.setBanner({text:Y(`Another client took control.`),btn:Y(`Take back control`),fn:()=>{t.setBanner(null),D(!0)}});if((Ur.value||!er.value.ok)&&!document.hidden){if(!p&&s>=3){s=0;let e=h||a;return t.setBanner({text:qm(e),btn:Y(`Retry`),fn:()=>{t.setBanner(null),D(!1)}})}c=setTimeout(()=>D(!1),Math.min(6e3,400*2**s++))}}}}function O(){if(l=!1,clearTimeout(c),o){let e=o;o=null;try{e.close(1e3)}catch{}}}let k=()=>!!(o&&o.readyState<=1);function A(){n?.reset()}function j(){n?.focus(),p.value=!0}function M(){n?.textarea?.blur()}let N=(e,t)=>y?.tap(e,t)??!1,F=()=>!!(n&&document.activeElement===n.textarea),I=()=>n&&n.rows&&a?a.clientHeight/n.rows:16,L=()=>n?.rows||24;function R(e){return S({type:`terminal.scroll`,direction:e>0?`up`:`down`,lines:Math.abs(e)})}function z(e){S({type:`visibility`,visible:e}),e&&P(()=>w(!0))}function V(){d=!0,O(),g?.(),_?.(),v?.(),v=null,g=null,_=null,y?.dispose(),y=null,i=null,n?.dispose(),n=null}return{mount:x,connect:D,disconnect:O,isConnected:k,sendTerm:S,sendKeys:C,fitNow:w,setFontSize:E,reset:A,scroll:R,focus:j,blur:M,tapLink:N,hasFocus:F,rowHeight:I,pageRows:L,setVisible:z,dispose:V,loading:f,kbdOn:p,hasBanner:t.hasBanner,selectionHint:m}}var Zm={key:0},Qm={class:`interactive-terminal-note`},$m={key:0,class:`term-banner`},eh=Object.assign(T({__name:`InteractiveTerminal`,props:{paneId:{},active:{type:Boolean},title:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=u(null),o=Xm(n.paneId,{setBanner:e=>{i.value=e},hasBanner:()=>!!i.value,fill:()=>!0,input:()=>n.active});B(cr,e=>o.setVisible(e));let s=!1;function c(){if(!s||!Z.value||o.hasFocus())return;let e=document.activeElement;e instanceof HTMLElement&&e.closest(`.interactive-terminal`)&&e.matches(`button, input, textarea`)||o.focus()}function l(e){e.preventDefault(),s=!0,e.currentTarget?.focus(),setTimeout(c,50)}B(()=>o.loading.value,e=>{e||P(c)});let d={onOpenAutoFocus:l,onEscapeKeyDown:e=>e.preventDefault()},p={overlay:`hw-scrim interactive-terminal-scrim`,content:`interactive-terminal`};return(t,n)=>{let s=Ee,c=yt,l=Vu,u=om,h=Oi;return _(),m(h,{open:``,title:(`tl`in t?t.tl:f(X))(`Interactive terminal`,`Terminal interactif`),content:d,ui:p,"onUpdate:open":n[5]||=e=>e||r(`close`)},{content:H(()=>[I(`header`,{class:`interactive-terminal-head`,onKeydown:n[1]||=q(()=>{},[`stop`])},[I(`span`,null,[E(s,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(X))(`Interactive terminal`,`Terminal interactif`)),1),e.title?(_(),v(`small`,Zm,M(e.title),1)):g(``,!0)]),E(c,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,"aria-label":(`tl`in t?t.tl:f(X))(`Close terminal window`,`Fermer la fenêtre terminal`),onClick:n[0]||=e=>r(`close`)},null,8,[`aria-label`])],32),I(`p`,Qm,M((`tl`in t?t.tl:f(X))(`Live agent screen · closes when the message field returns`,`Écran réel de l’agent · se ferme au retour du champ libre`)),1),f(i)?(_(),v(`div`,$m,[I(`span`,null,M(f(i).text),1),E(c,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[2]||=e=>f(i).fn()},{default:H(()=>[a(M(f(i).btn),1)]),_:1})])):g(``,!0),E(l,{ctl:f(o),onKeydown:n[3]||=q(()=>{},[`stop`])},null,8,[`ctl`]),E(u,{ctl:f(o),"all-digits":``,onKeydown:n[4]||=q(()=>{},[`stop`])},null,8,[`ctl`])]),_:1},8,[`title`])}}}),{__name:`InteractiveTerminal`}),th={class:`prompt-detail-head`},nh={class:`prompt-detail-tool`},rh={key:0,class:`prompt-detail-desc`},ih={key:0,class:`prompt-detail-file`},ah={class:`path`},oh={key:0,class:`prompt-detail-stats`},sh={key:0,class:`add`},ch={key:1,class:`del`},lh={key:2,class:`prompt-detail-note`},uh=Object.assign(T({__name:`PromptDetailBlock`,props:{detail:{}},setup(e){let t=e,r=h(!1);B(()=>t.detail.command,()=>{r.value=!1});let i=n(()=>(t.detail.command||``).split(`
77
+ `)),o=n(()=>i.value.length>8||(t.detail.command||``).length>800),s=n(()=>ki(t.detail));return(t,n)=>{let c=Ee;return _(),v(`div`,{class:j([`prompt-detail`,{file:e.detail.file}])},[I(`p`,th,[I(`span`,nh,M(e.detail.tool),1),e.detail.description?(_(),v(`span`,rh,M(e.detail.description),1)):g(``,!0)]),e.detail.file?(_(),v(`p`,ih,[E(c,{name:`i-lucide-file-pen`}),I(`span`,ah,M(e.detail.file),1),f(s)?(_(),v(`span`,oh,[e.detail.added?(_(),v(`span`,sh,`+`+M(e.detail.added),1)):g(``,!0),e.detail.removed?(_(),v(`span`,ch,`−`+M(e.detail.removed),1)):g(``,!0)])):g(``,!0)])):g(``,!0),e.detail.command?(_(),v(`pre`,{key:1,class:j([`prompt-detail-code`,{collapsed:f(o)&&!f(r)}])},[I(`code`,null,[(_(!0),v(k,null,y(f(i),(n,r)=>(_(),v(`span`,{key:r,class:j((`diffKind`in t?t.diffKind:f(wi))(n,!!e.detail.file))},M(n),3))),128))])],2)):g(``,!0),e.detail.truncated?(_(),v(`p`,lh,M((`t`in t?t.t:f(Y))(`Too long: only the beginning is shown. The terminal shows the rest.`)),1)):g(``,!0),f(o)?(_(),v(`button`,{key:3,type:`button`,class:`prompt-detail-more`,onClick:n[0]||=e=>r.value=!f(r)},[E(c,{name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),a(` `+M(f(r)?(`t`in t?t.t:f(Y))(`Collapse`):(`tl`in t?t.tl:f(X))(`Show all (${f(i).length} lines)`,`Tout afficher (${f(i).length} lignes)`)),1)])):g(``,!0)],2)}}}),{__name:`PromptDetailBlock`}),dh={class:`eyebrow choices-eyebrow`},fh=[`aria-label`],ph=[`aria-current`,`disabled`,`onClick`],mh={key:2,class:`choices-q`},hh={key:3,class:`choices-note`,role:`status`},gh={key:4,class:`choices-note`},_h=[`aria-pressed`,`aria-expanded`,`disabled`,`onClick`],vh={key:0,class:`n`},yh={key:1,class:`n`},bh={class:`l`},xh={key:0},Sh=[`onSubmit`],Ch={class:`choices-free-actions`},wh=[`disabled`],Th={key:7,class:`choices-keys`},Eh=[`disabled`],Dh=[`disabled`,`onClick`],Oh={key:1,class:`card-kbd`,"aria-hidden":`true`},kh={key:0},Ah=Object.assign(T({__name:`ChoicesPanel`,props:{paneId:{},prompt:{},screen:{},keys:{type:Boolean}},setup(e){let t=e,r=h(!1),i=h(t.prompt?.cursor);B(()=>t.prompt,e=>{i.value=e?.cursor}),B(()=>[t.prompt,t.screen],()=>{r.value=!1});let o=n(()=>t.screen?t.screen.actions.filter(e=>!(t.prompt&&e.key===`enter`)):[]),s=n(()=>t.screen?vr(t.screen.kind):null),c=n(()=>!!(t.screen&&t.screen.lines.some(e=>/\S {3,}\S/.test(e)))),l=n(()=>t.prompt?.kind===`self-update`?Y(t.prompt.question||``):t.screen&&t.screen.title||t.prompt&&t.prompt.question);async function u(e,n){r.value=!0,await He(t.paneId,e,n,t.prompt?.identity)||(r.value=!1)}async function d(e){r.value=!0,await qt(t.paneId,e,t.screen?.identity)||(r.value=!1)}let p=n(()=>t.prompt?.kind===`self-update`);async function b(){r.value=!0,await ke(t.paneId)||(r.value=!1)}async function x(){r.value=!0,await it(t.paneId,`enter`,t.prompt?.identity)||(r.value=!1)}let S=n(()=>!!(t.prompt&&t.prompt.options.some(e=>e.checked===void 0))),C=n(()=>t.prompt&&t.prompt.tabs&&t.prompt.tab!==void 0&&!t.prompt.typing?t.prompt.tabs:null);async function w(e){let n=t.prompt;n&&n.tabs&&e!==n.tab&&!R.value&&(r.value=!0,await zt(t.paneId,e,n.tabs[e])?D.value=``:r.value=!1)}let T=h(null),D=h(``),O=h(!1),A=n(()=>t.prompt?.typing?t.prompt.options.findIndex(e=>e.free):T.value);B(()=>t.prompt?.question,()=>{T.value=null});let N=n(()=>Z.value&&!Tr&&!Rn);async function P(e,n){let i=D.value.trim();if(!(!i||R.value||O.value)){r.value=!0,O.value=!0;try{await He(t.paneId,e,n,t.prompt?.identity,{text:i,question:t.prompt?.question??null})?(D.value=``,T.value=null):r.value=!1}finally{O.value=!1}}}function F(){t.prompt?.typing?it(t.paneId,`esc`):T.value=null}function L(e,t,n){e.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),F()):e.key===`Enter`&&!e.shiftKey&&N.value&&(e.preventDefault(),P(t,n)))}let R=n(()=>r.value||t.prompt?.unavailable||t.screen?.unavailable||!yn.value||jn.value),z=n(()=>!!(t.keys&&Z.value&&t.prompt&&!t.prompt.kind&&t.prompt.options.length&&A.value===null&&!R.value));return Zr(()=>z.value,()=>({digits:Math.min(9,t.prompt?.options.length||0),enter:!0,tabs:!!C.value}),e=>{let n=t.prompt;if(n){if(e.kind===`digit`){let t=n.options[e.n-1];t.free?T.value=e.n-1:u(e.n-1,t.label);return}if(e.kind===`tab`)return it(t.paneId,e.dir>0?`right`:`left`);e.kind===`nav`&&((e.key===`up`||e.key===`down`)&&i.value!==null&&i.value!==void 0&&(i.value=Math.max(0,Math.min(n.options.length-1,i.value+(e.key===`down`?1:-1)))),it(t.paneId,e.key,n.identity).then(e=>{e||(i.value=t.prompt?.cursor)}))}}),(t,n)=>{let r=uh,h=Ee,N=Bi,B=yt;return _(),v(`div`,{class:j([`choices`,{"choices-screen":e.screen}])},[I(`p`,dh,[n[1]||=I(`i`,null,null,-1),a(M((`t`in t?t.t:f(Y))(`Your turn`)),1)]),f(C)?(_(),v(`div`,{key:0,class:`choices-tabs`,role:`group`,"aria-label":(`t`in t?t.t:f(Y))(`Questions`)},[(_(!0),v(k,null,y(f(C),(t,n)=>(_(),v(`button`,{key:n,type:`button`,class:j({on:n===e.prompt.tab}),"aria-current":n===e.prompt.tab?`step`:void 0,disabled:f(R),onClick:e=>w(n)},M(t),11,ph))),128))],8,fh)):g(``,!0),e.prompt?.detail?(_(),m(r,{key:1,detail:e.prompt.detail},null,8,[`detail`])):g(``,!0),f(l)?(_(),v(`p`,mh,M(f(l)),1)):g(``,!0),e.prompt?.unavailable||e.screen?.unavailable?(_(),v(`p`,hh,M((`tl`in t?t.tl:f(X))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),f(s)?(_(),v(`p`,gh,M(f(s)),1)):g(``,!0),e.screen&&e.screen.lines.length&&!e.prompt?.detail?(_(),v(`pre`,{key:5,class:j([`choices-screen-text`,{wrap:!f(c)}])},M(e.screen.lines.join(`
78
+ `)),3)):g(``,!0),e.prompt?(_(),v(`div`,{key:6,class:j([`choices-list`,{multi:e.prompt.multi}])},[(_(!0),v(k,null,y(e.prompt.options,(r,o)=>(_(),v(k,{key:o},[I(`button`,{type:`button`,class:j({cur:o===f(i),on:r.checked}),"aria-pressed":e.prompt.multi&&!r.free?!!r.checked:void 0,"aria-expanded":r.free?f(A)===o:void 0,disabled:f(R),onClick:t=>r.free?T.value=e.prompt.typing||f(T)===o?null:o:u(o,r.label)},[e.prompt.multi&&r.checked!==void 0?(_(),v(`span`,vh,[E(h,{name:r.checked?`i-lucide-square-check`:`i-lucide-square`},null,8,[`name`])])):(_(),v(`span`,yh,M(o+1),1)),I(`span`,bh,[a(M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Y))(r.label):r.label),1),r.hint?(_(),v(`small`,xh,M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Y))(r.hint):r.hint),1)):g(``,!0)]),r.free?(_(),m(h,{key:2,name:`i-lucide-pencil-line`,class:`choices-free-icon`})):g(``,!0)],10,_h),r.free&&f(A)===o?(_(),v(`form`,{key:0,class:`choices-free`,onSubmit:q(e=>P(o,r.label),[`prevent`])},[E(N,{modelValue:f(D),"onUpdate:modelValue":n[0]||=e=>W(D)?D.value=e:null,rows:1,maxrows:6,autoresize:``,autofocus:!e.prompt.typing,size:`lg`,class:`w-full`,placeholder:(`t`in t?t.t:f(Y))(`Your answer…`),disabled:f(R)||f(O),onKeydown:e=>L(e,o,r.label)},null,8,[`modelValue`,`autofocus`,`placeholder`,`disabled`,`onKeydown`]),I(`div`,Ch,[E(B,{type:`button`,color:`neutral`,variant:`ghost`,size:`sm`,disabled:f(R)||f(O),onClick:F},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Cancel`)),1)]),_:1},8,[`disabled`]),E(B,{type:`submit`,color:`primary`,variant:`solid`,size:`sm`,loading:f(O),disabled:f(R)||f(O)||!f(D).trim()},{default:H(()=>[a(M((`t`in t?t.t:f(Y))(`Send`)),1)]),_:1},8,[`loading`,`disabled`])])],40,Sh)):g(``,!0)],64))),128)),e.prompt.multi&&!f(S)?(_(),v(`button`,{key:0,type:`button`,class:`choices-next`,disabled:f(R),onClick:x},[a(M((`t`in t?t.t:f(Y))(`Continue`)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Br))(`enter`)),1)],8,wh)):g(``,!0)],2)):g(``,!0),f(o).length||f(z)||f(p)?(_(),v(`div`,Th,[f(p)?(_(),v(`button`,{key:0,type:`button`,disabled:f(R),onClick:b},M((`t`in t?t.t:f(Y))(`Dismiss`)),9,Eh)):g(``,!0),(_(!0),v(k,null,y(f(o),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(R),onClick:t=>d(e)},[a(M((`screenActionText`in t?t.screenActionText:f(Mr))(e)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Br))(e.key)),1)],8,Dh))),128)),f(z)?(_(),v(`span`,Oh,[f(C)?(_(),v(`kbd`,kh,`←→`)):g(``,!0),n[2]||=I(`kbd`,null,`↑↓`,-1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Br))(`enter`)),1),I(`kbd`,null,`1–`+M(Math.min(9,e.prompt.options.length)),1)])):g(``,!0)])):g(``,!0)],2)}}}),{__name:`ChoicesPanel`}),jh={class:`choices choices-menu`},Mh={class:`eyebrow choices-eyebrow`},Nh={class:`menu-kind`},Ph={key:0,class:`choices-note`,role:`status`},Fh={key:1,class:`choices-q`},Ih={key:2,class:`choices-note`},Lh={key:3,class:`choices-note`},Rh=[`placeholder`,`aria-label`,`disabled`],zh={key:0,class:`menu-group`},Bh=[`aria-current`,`disabled`,`onClick`],Vh={class:`n`,"aria-hidden":`true`},Hh={class:`l`},Uh={key:0},Wh={key:0,class:`menu-more`},Gh={key:0,class:`choices-screen-text wrap`},Kh={class:`choices-note`},qh={class:`choices-keys`},Jh=[`disabled`,`onClick`],Yh={key:0,class:`card-kbd`,"aria-hidden":`true`},Xh={key:0},Zh=Object.assign(T({__name:`MenuPanel`,props:{paneId:{},menu:{},keys:{type:Boolean}},emits:[`terminal`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=h(r.menu.cursor),c=n(()=>s.value===null?r.menu.identity:r.menu.items[s.value]?.identity),l=h(null),u=()=>P(()=>l.value?.querySelector(`.cur`)?.scrollIntoView({block:`nearest`}));B(()=>r.menu,()=>{o.value=!1,s.value=r.menu.cursor,u()}),w(u);let d=n(()=>o.value||r.menu.unavailable||!yn.value||jn.value),p=n(()=>Te(r.menu)),m=n(()=>r.menu.actions.filter(e=>!(e.key===`enter`&&r.menu.cursor!==null&&!p.value))),b=n(()=>r.menu.items.length>0);async function x(e,t){o.value=!0,await re(r.paneId,{op:`select`,index:e,label:t},r.menu.items[e]?.identity)||(o.value=!1)}async function S(e){o.value=!0,await re(r.paneId,{op:`key`,key:e.key,label:e.label},c.value)||(o.value=!1)}let C=h(r.menu.search||``),T=h(!1);B(()=>r.menu.search,e=>{T.value||(C.value=e||``)});let D=null;function O(){T.value=!0,D&&clearTimeout(D),D=setTimeout(A,450)}async function A(){D&&=(clearTimeout(D),null);let e=C.value;e!==(r.menu.search||``)&&await re(r.paneId,{op:`search`,text:e},r.menu.identity),T.value=!1}U(()=>{D&&clearTimeout(D)});let N=h(null),F=n(()=>r.menu.actions.some(e=>e.key===`esc`)),R=n(()=>r.menu.actions.filter(e=>/^ctrl\+[a-z]$/.test(e.key)).map(e=>e.key)),z=n(()=>!!(r.keys&&Z.value&&b.value&&!d.value));return Zr(()=>!!(r.keys&&Z.value&&!d.value&&(b.value||R.value.length)),()=>({digits:0,enter:!p.value,own:N.value,ctrl:R.value,nav:z.value}),e=>{if(e.kind===`ctrl`){let t=r.menu.actions.find(t=>t.key===e.key);t&&S(t);return}if(!(e.kind!==`nav`||e.key===`esc`&&!F.value)){if(e.key===`up`||e.key===`down`){let t=r.menu.items.map((e,t)=>e.header?-1:t).filter(e=>e>=0),n=t.indexOf(s.value??-1);s.value=t[n+(e.key===`down`?1:-1)]??s.value,u()}it(r.paneId,e.key,c.value).then(e=>{e||(s.value=r.menu.cursor,u())})}}),(t,n)=>{let r=Ee;return _(),v(`div`,jh,[I(`p`,Mh,[n[2]||=I(`i`,null,null,-1),a(M((`t`in t?t.t:f(Y))(`Your turn`)),1),I(`span`,Nh,M((`t`in t?t.t:f(Y))(`Interactive menu`)),1)]),e.menu.unavailable?(_(),v(`p`,Ph,M((`tl`in t?t.tl:f(X))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),e.menu.title?(_(),v(`p`,Fh,M(e.menu.title),1)):g(``,!0),f(b)&&e.menu.lines.length?(_(),v(`p`,Ih,M(e.menu.lines[0]),1)):g(``,!0),f(b)&&f(p)?(_(),v(`p`,Lh,M((`tl`in t?t.tl:f(X))(`Tap an entry to move the cursor there, then confirm with a button below.`,`Toucher une entrée y place le curseur ; valide ensuite avec un bouton ci-dessous.`)),1)):g(``,!0),e.menu.search===null?g(``,!0):(_(),v(`form`,{key:4,class:`menu-search`,onSubmit:q(A,[`prevent`])},[E(r,{name:`i-lucide-search`,"aria-hidden":`true`}),L(I(`input`,{ref_key:`searchRef`,ref:N,"onUpdate:modelValue":n[0]||=e=>W(C)?C.value=e:null,type:`search`,placeholder:(`t`in t?t.t:f(Y))(`Search…`),"aria-label":(`t`in t?t.t:f(Y))(`Search the menu`),enterkeyhint:`search`,autocomplete:`off`,autocapitalize:`off`,spellcheck:`false`,disabled:f(d),onInput:O},null,40,Rh),[[ne,f(C)]])],32)),f(b)?(_(),v(`div`,{key:5,ref_key:`listRef`,ref:l,class:`choices-list menu-list`},[(_(!0),v(k,null,y(e.menu.items,(e,t)=>(_(),v(k,{key:t},[e.header?(_(),v(`p`,zh,M(e.label),1)):(_(),v(`button`,{key:1,type:`button`,class:j({cur:t===f(s)}),"aria-current":t===f(s)?`true`:void 0,disabled:f(d),onClick:n=>x(t,e.label)},[I(`span`,Vh,M(t===f(s)?`❯`:``),1),I(`span`,Hh,[a(M(e.label),1),e.hint?(_(),v(`small`,Uh,M(e.hint),1)):g(``,!0)])],10,Bh))],64))),128)),e.menu.more?(_(),v(`p`,Wh,M(e.menu.more),1)):g(``,!0)],512)):(_(),v(k,{key:6},[e.menu.lines.length?(_(),v(`pre`,Gh,M(e.menu.lines.join(`
79
+ `)),1)):g(``,!0),I(`p`,Kh,M((`tl`in t?t.tl:f(X))(`Interactive menu open: pick its entries in the terminal.`,`Menu interactif en cours : ses entrées se choisissent dans le terminal.`)),1)],64)),I(`div`,qh,[(_(!0),v(k,null,y(f(m),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(d),onClick:t=>S(e)},[a(M((`screenActionText`in t?t.screenActionText:f(Mr))(e)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Br))(e.key)),1)],8,Jh))),128)),f(z)?(_(),v(`span`,Yh,[n[3]||=I(`kbd`,null,`↑↓`,-1),f(p)?g(``,!0):(_(),v(`kbd`,Xh,M((`screenKeyName`in t?t.screenKeyName:f(Br))(`enter`)),1))])):g(``,!0),I(`button`,{type:`button`,class:`menu-term`,onClick:n[1]||=e=>i(`terminal`)},[E(r,{name:`i-lucide-square-terminal`,"aria-hidden":`true`}),a(M((`t`in t?t.t:f(Y))(`View terminal`)),1)])])])}}}),{__name:`MenuPanel`}),Qh={class:`usage-limit-card composer-notice`,role:`status`},$h={class:`restart-text`},eg={key:1},tg=[`disabled`],ng=[`disabled`],rg={key:2,class:`notice-btn`,href:`https://clau.de/reset`,target:`_blank`,rel:`noopener noreferrer`},ig=Object.assign(xi(T({__name:`UsageLimitCard`,props:{limit:{},readOnly:{type:Boolean},sendKeys:{type:Function}},emits:[`credits`],setup(e,{emit:t}){let n=e,r=t,i=h(!1);async function o(){if(!(n.readOnly||i.value)){i.value=!0;try{await n.sendKeys([`esc`])}catch(e){$(e.message,!0)}finally{i.value=!1}}}return(t,n)=>(_(),v(`div`,Qh,[I(`span`,$h,[a(M(f(X)(`Usage limit reached`,`Limite de quota atteinte`)),1),e.limit.resets?(_(),v(k,{key:0},[a(` · `+M(f(X)(`Resets`,`Réinitialisation`))+` `+M(e.limit.resets),1)],64)):g(``,!0),e.limit.automatic?(_(),v(`small`,eg,M(f(X)(`Will continue automatically`,`Reprise automatique`)),1)):g(``,!0)]),e.limit.automatic?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:o},M(f(X)(`Cancel wait`,`Annuler l’attente`)),9,tg)):g(``,!0),e.limit.credits?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:n[0]||=e=>r(`credits`)},`/usage-credits`,8,ng)):g(``,!0),e.limit.resetLink?(_(),v(`a`,rg,M(f(X)(`Reset limit ↗`,`Réinitialiser ↗`)),1)):g(``,!0)]))}}),[[`__scopeId`,`data-v-a8935db4`]]),{__name:`UsageLimitCard`}),ag={key:0,class:`composer-notice restart`,role:`status`},og={class:`restart-text`},sg={key:1,class:`composer-notice failed`,role:`status`},cg={class:`restart-text`},lg={key:2,class:`composer-notice`,role:`status`},ug={class:`restart-text`},dg=[`disabled`,`title`],fg={key:3,class:`composer-notice codex-update`,role:`status`},pg=[`title`],mg={key:0,class:`notice-extra`},hg=[`href`,`aria-label`,`title`],gg={class:`notice-label`},_g=[`disabled`,`title`],vg={key:2,class:`notice-reason`},yg=[`aria-label`,`title`],bg=[`title`],xg=[`disabled`,`title`],Sg=`wherdr.codexUpdate.dismissed`,Cg=Object.assign(T({__name:`CodexNotices`,props:{pane:{},paneId:{},readOnly:{type:Boolean}},setup(e){let t=e,r=h(``);try{r.value=localStorage.getItem(Sg)||``}catch{}let i=n(()=>{let e=t.pane.codexStatus?.update;return!e||e.state===`available`&&!e.job&&e.latest===r.value?null:e}),o=n(()=>t.pane.codexStatus?.weekly||null),s=n(()=>i.value?.job||null),c=n(()=>{let e=Hr(t.pane.id),n=er.value.machines?.find(t=>t.key===e);return n&&n.label||Un.value||Y(`This machine`)}),l=n(()=>{let e=i.value;if(!e)return``;let t=X(`Codex ${e.latest} available`,`Codex ${e.latest} disponible`);return e.current?`${t} ${X(`(you have ${e.current})`,`(tu as la ${e.current})`)}`:t}),u=n(()=>{let e=o.value;return e?e.lessThan?X(`Weekly limit: less than ${e.left}% left`,`Limite hebdo : moins de ${e.left} % restants`):X(`Weekly limit: ${e.left}% left`,`Limite hebdo : ${e.left} % restants`):``});function d(){let e=i.value?.latest;if(e){r.value=e;try{localStorage.setItem(Sg,e)}catch{}}}async function p(){let e=i.value?.command;if(e){Q();try{await navigator.clipboard.writeText(e),$(X(`Command copied: paste it into a terminal on ${c.value}.`,`Commande copiée : colle-la dans un terminal sur ${c.value}.`))}catch{$(Y(`Copy failed`),!0)}}}let m=n(()=>{if(i.value?.method!==`terminal`)return``;let e=t.pane.status;return e===`working`?X(`Codex is working: update it once it is done`,`Codex travaille : mets-le à jour quand il a fini`):e===`blocked`?X(`Codex is waiting for an answer: answer it first`,`Codex attend une réponse : réponds-lui d’abord`):``});async function y(){let e=i.value;if(e&&e.runnable&&e.command&&!m.value&&(e.method===`terminal`?await lt([X(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),X(`wherdr will exit Codex in this pane, type Codex’s official update command in its terminal:`,`wherdr va quitter Codex dans ce panneau et taper dans son terminal la commande de mise à jour officielle de Codex :`),e.command,X(`then restart Codex on this conversation (codex resume). If the update fails, the pane stays at its shell.`,`puis relancer Codex sur cette conversation (codex resume). Si la mise à jour échoue, le panneau reste sur son shell.`)].join(`
80
80
 
81
- `),Y(`Update`),`primary`):await _t([Z(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Z(`wherdr will run Codex’s official update command there:`,`wherdr y lancera la commande de mise à jour officielle de Codex :`),e.command,Z(`Running Codex agents keep their version until they are restarted; you can then restart this one on the same conversation.`,`Les Codex en cours gardent leur version jusqu’à leur redémarrage ; tu pourras ensuite redémarrer celui-ci sur la même conversation.`)].join(`
81
+ `),Y(`Update`),`primary`):await lt([X(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),X(`wherdr will run Codex’s official update command there:`,`wherdr y lancera la commande de mise à jour officielle de Codex :`),e.command,X(`Running Codex agents keep their version until they are restarted; you can then restart this one on the same conversation.`,`Les Codex en cours gardent leur version jusqu’à leur redémarrage ; tu pourras ensuite redémarrer celui-ci sur la même conversation.`)].join(`
82
82
 
83
- `),Y(`Update`),`primary`))){X();try{await Dr(`/api/codex-update`,{pane_id:t.paneId})}catch(e){$(e.message,!0)}}}async function b(){try{await Dr(`/api/codex-update`,{pane_id:t.paneId,dismiss:!0})}catch(e){$(e.message,!0)}}async function x(){try{await Dr(`/api/prompt`,{pane_id:t.paneId,text:`/status`}),X()}catch(e){return $(e.message,!0)}fe(t.paneId,`/status`)}return(t,n)=>{let r=De;return _(),v(k,null,[f(i)&&f(s)?.phase===`running`?(_(),v(`div`,Hh,[n[1]||=F(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),F(`span`,Uh,M((`tl`in t?t.tl:f(Z))(`Updating Codex on ${f(c)}…`,`Mise à jour de Codex sur ${f(c)}…`)),1)])):f(i)&&f(s)?.phase===`failed`?(_(),v(`div`,Wh,[F(`span`,Gh,M((`t`in t?t.t:f(Y))(`Codex update failed`))+M((`tl`in t?t.tl:f(Z))(`: `,` : `))+M((`t`in t?t.t:f(Y))(f(s).error)),1),f(i).command?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Y))(`Copy command`)),1)])):g(``,!0),F(`button`,{type:`button`,class:`notice-btn`,onClick:b},M((`t`in t?t.t:f(Y))(`Hide`)),1)])):f(i)&&f(i).state===`installed`?(_(),v(`div`,Kh,[F(`span`,qh,M((`tl`in t?t.tl:f(Z))(`Codex ${f(i).latest} installed`,`Codex ${f(i).latest} installé`))+` ·`,1),F(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly||!(`canRestart`in t?t.canRestart:f(Vt))(e.pane),title:(`tl`in t?t.tl:f(Z))(`Restarts Codex in this pane on the same conversation (codex resume)`,`Relance Codex dans ce panneau sur la même conversation (codex resume)`),onClick:n[0]||=n=>(`restartAgent`in t?t.restartAgent:f(Zt))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Y))(`Restart to update`)),1)],8,Jh)])):f(i)?(_(),v(`div`,Yh,[F(`span`,{class:`restart-text`,title:f(l)},[a(M((`tl`in t?t.tl:f(Z))(`Codex ${f(i).latest} available`,`Codex ${f(i).latest} disponible`)),1),f(i).current?(_(),v(`span`,Zh,M(` `)+M((`tl`in t?t.tl:f(Z))(`(you have ${f(i).current})`,`(tu as la ${f(i).current})`)),1)):g(``,!0),n[2]||=a(` ·`,-1)],8,Xh),F(`a`,{class:`notice-btn`,href:f(i).notes,target:`_blank`,rel:`noopener noreferrer`,"aria-label":(`t`in t?t.t:f(Y))(`Release notes`),title:(`t`in t?t.t:f(Y))(`Release notes`)},[E(r,{name:`i-lucide-external-link`}),F(`span`,$h,M((`t`in t?t.t:f(Y))(`Release notes`)),1)],8,Qh),f(i).runnable?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||!!f(m),title:f(m)||(f(i).method===`terminal`?(`tl`in t?t.tl:f(Z))(`Exits Codex, updates it in this pane’s terminal, then resumes this conversation`,`Quitte Codex, le met à jour dans le terminal de ce panneau, puis reprend cette conversation`):void 0),onClick:y},[E(r,{name:`i-lucide-circle-arrow-up`}),a(M((`t`in t?t.t:f(Y))(`Update`)),1)],8,eg)):f(i).command?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Y))(`Copy command`)),1)])):g(``,!0),f(m)?(_(),v(`span`,tg,M(e.pane.status===`blocked`?(`tl`in t?t.tl:f(Z))(`answer first`,`réponds d’abord`):(`tl`in t?t.tl:f(Z))(`after this turn`,`après ce tour`)),1)):g(``,!0),F(`button`,{type:`button`,class:`notice-btn notice-x`,"aria-label":(`t`in t?t.t:f(Y))(`Hide until the next version`),title:(`t`in t?t.t:f(Y))(`Hide until the next version`),onClick:d},[E(r,{name:`i-lucide-x`})],8,ng)])):g(``,!0),f(o)?(_(),v(`div`,{key:4,class:j([`composer-notice codex-weekly`,{low:f(o).left<=10}]),role:`status`},[E(r,{name:`i-lucide-triangle-alert`,class:`notice-icon`}),F(`span`,{class:`restart-text`,title:f(u)},M(f(u)),9,rg),F(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly,title:(`t`in t?t.t:f(Y))(`Show Codex’s usage breakdown`),onClick:x},`/status`,8,ig)],2)):g(``,!0)],64)}}}),{__name:`CodexNotices`}),sg=e=>e.toLowerCase().replace(/\bwith 1m context\b/g,`(1m)`).replace(/\b1m context\b/g,`1m`).replace(/\s*\((?:default|current)\)/g,``).replace(/\s+/g,` `).trim();function cg(e,t){if(!t)return!1;if(t.id&&e.label.includes(`/`))return e.label===t.id;let n=sg(t.label);if(sg(e.label)===n)return!0;let r=e.hint?.split(`·`)[0]?.trim()||``;return!!r&&sg(r)===n}function lg(e,t){let n=e.findIndex(e=>!/^default\b/i.test(e.label)&&cg(e,t));return n>=0?n:e.findIndex(e=>cg(e,t))}var ug={class:`model-pick-wrap`},dg={class:`model-name`},fg={class:`model-pick-wrap`},pg=Object.assign(T({__name:`ModelPicker`,props:{pane:{}},setup(e){let t=e,r=h(!1),i=h(!1),o=h(!1),s=h(!1),c=h(!1),l=h(null),u=h(null),d=h(null),p=e=>String(e||``).trim().toLowerCase(),y=(e,t)=>!!(e&&t)&&p(e)===p(t),b=n(()=>{let e=d.value;if(e&&Date.now()-e.at<2e4&&(!y(t.pane.model?.label,e.info.label)||t.pane.model?.effort!==e.info.effort))return e.info;let n=t.pane.model;return n?{...n,effort:n.effort||u.value?.current||null}:null});z(()=>[t.pane.model?.label,t.pane.model?.effort],()=>{d.value&&y(t.pane.model?.label,d.value.info.label)&&t.pane.model?.effort===d.value.info.effort&&(d.value=null)});let x=n(()=>{if(!_n.value||Dn.value||Tn(t.pane))return Y(`Changes unavailable offline`);let e=t.pane.status;return e===`working`?Y(`The agent is working — change the model once it’s done.`):e===`blocked`?Y(`The agent is waiting for an answer — reply first.`):null}),S=n(()=>!!x.value||c.value);async function C(e=!1){if(!o.value){o.value=!0;try{l.value=await Dr(`/api/models?pane=${encodeURIComponent(t.pane.id)}${e?`&refresh=1`:``}`)}catch(e){r.value=!1,$(e.message,!0)}finally{o.value=!1}}}async function w(){if(!s.value){s.value=!0;try{u.value=await Dr(`/api/efforts?pane=${encodeURIComponent(t.pane.id)}`)}catch(e){i.value=!1,$(e.message,!0)}finally{s.value=!1}}}z(r,e=>{e&&(!l.value||l.value.agent!==t.pane.agent)&&C()}),z(i,e=>{e&&!u.value&&w()}),z(()=>[_n.value,t.pane.status,t.pane.model?.label,t.pane.model?.effort],()=>{[`claude`,`codex`,`omp`].includes(t.pane.agent||``)&&[`idle`,`done`].includes(t.pane.status||``)&&!t.pane.model?.effort&&t.pane.model&&!u.value&&!x.value&&w()},{immediate:!0}),z(()=>t.pane.id,()=>{l.value=null,u.value=null,d.value=null});let T=n(()=>lg(l.value?.options||[],b.value)),D=e=>l.value?.options.indexOf(e)===T.value,O=e=>/^default \(recommended\)$/i.test(e.label)?Y(`Default (recommended)`):e.label;async function A(e){if(!(D(e)||S.value)){c.value=!0,X();try{let n=await Dr(`/api/model`,{pane_id:t.pane.id,label:e.label});d.value={info:n.model,at:Date.now()},u.value=null,$(Z(`Model: ${n.model.label} (this session)`,`Modèle : ${n.model.label} (cette session)`))}catch(e){$(e.message,!0)}finally{c.value=!1}x.value||await w()}}async function N(e){if(!(S.value||b.value?.effort===e)){c.value=!0,X();try{let n=await Dr(`/api/effort`,{pane_id:t.pane.id,level:e});d.value={info:n.model,at:Date.now()},u.value&&(u.value.current=e),$(Z(`Effort: ${e} (this session)`,`Effort : ${e} (cette session)`))}catch(e){$(e.message,!0)}finally{c.value=!1}t.pane.agent===`omp`&&!x.value&&await w()}}let P=n(()=>{let e=[{type:`label`,label:Y(`For this session only`)}];return o.value||!l.value?[e,[{label:Y(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,l.value.options.map(e=>({type:`checkbox`,label:O(e),description:e.hint||void 0,checked:D(e),onSelect:()=>A(e)})),[{label:Y(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),C(!0)}}]]}),I=n(()=>{let e=[{type:`label`,label:Y(`For this session only`)}];return s.value||!u.value?[e,[{label:Y(`Reading effort levels…`),icon:`i-lucide-loader-circle`,disabled:!0}]]:[e,u.value.levels.map(e=>({type:`checkbox`,label:e,checked:b.value?.effort===e,description:e===`auto`?b.value?.effort===`auto`&&b.value.effortResolved?Z(`This turn: ${b.value.effortResolved}`,`Ce tour : ${b.value.effortResolved}`):t.pane.agent===`omp`?Y(`Picks the level each turn`):void 0:void 0,onSelect:()=>N(e)}))]}),L=n(()=>{let e=b.value;return e?.effort?e.effort===`auto`&&e.effortResolved?`auto · ${e.effortResolved}`:e.effort:null}),R=n(()=>[`claude`,`codex`,`omp`].includes(t.pane.agent||``)&&!!(u.value?.levels.length||b.value?.effort&&!u.value));function B(e,t){if(t&&S.value){x.value&&$(x.value,!0);return}e===`model`?(r.value=t,t&&(i.value=!1)):(i.value=t,t&&(r.value=!1))}return z(S,e=>{e&&(r.value=!1,i.value=!1)}),(e,t)=>{let n=Oe,o=oi,s=Qr;return _(),v(k,null,[E(s,{text:f(x)||(`t`in e?e.t:f(Y))(`Change model`),disabled:!(`desk`in e?e.desk:f(Q))||!f(x)&&f(r),content:{side:`top`}},{default:H(()=>[F(`span`,ug,[E(o,{open:f(r),items:f(P),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":t[0]||=e=>B(`model`,e)},{default:H(()=>[E(n,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick`,{off:f(S)}]),"aria-disabled":f(S),"aria-label":`${(`t`in e?e.t:f(Y))(`Model`)} : ${f(b)?f(b).label:(`t`in e?e.t:f(Y))(`Unknown model`)}`,"trailing-icon":f(c)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(c)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[F(`span`,dg,M(f(b)?f(b).label:(`t`in e?e.t:f(Y))(`Model`)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`])])]),_:1},8,[`text`,`disabled`]),f(R)?(_(),m(s,{key:0,text:f(x)||(`t`in e?e.t:f(Y))(`Change effort`),disabled:!(`desk`in e?e.desk:f(Q))||!f(x)&&f(i),content:{side:`top`}},{default:H(()=>[F(`span`,fg,[E(o,{open:f(i),items:f(I),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu effort-menu`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":t[1]||=e=>B(`effort`,e)},{default:H(()=>[E(n,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick effort-pick`,{off:f(S)}]),"aria-disabled":f(S),"aria-label":`${(`t`in e?e.t:f(Y))(`Effort`)} : ${f(L)||(`t`in e?e.t:f(Y))(`Unknown effort`)}`,"trailing-icon":f(c)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(c)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[a(M(f(L)||(`t`in e?e.t:f(Y))(`Effort`)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`])])]),_:1},8,[`text`,`disabled`])):g(``,!0)],64)}}}),{__name:`ModelPicker`}),mg={slots:{base:``}},hg=Object.assign({inheritAttrs:!1},{__name:`UChatPromptSubmit`,props:{status:{type:String,required:!1,default:`ready`},icon:{type:[String,Boolean],required:!1,skipCheck:!0},color:{type:null,required:!1},variant:{type:null,required:!1},streamingIcon:{type:null,required:!1},streamingColor:{type:null,required:!1,default:`neutral`},streamingVariant:{type:null,required:!1,default:`subtle`},submittedIcon:{type:null,required:!1},submittedColor:{type:null,required:!1,default:`neutral`},submittedVariant:{type:null,required:!1,default:`subtle`},errorIcon:{type:null,required:!1},errorColor:{type:null,required:!1,default:`error`},errorVariant:{type:null,required:!1,default:`soft`},ui:{type:Object,required:!1},class:{type:null,required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},emits:[`stop`,`reload`],setup(e,{emit:r}){let i=e,a=r,o=O(),s=se(`chatPromptSubmit`,i),{t:c}=ri(),l=J(),u=on(Ne(s,`icon`,`color`,`variant`,`status`,`disabled`,`streamingIcon`,`streamingColor`,`streamingVariant`,`submittedIcon`,`submittedColor`,`submittedVariant`,`errorIcon`,`errorColor`,`errorVariant`,`class`,`ui`)),p=n(()=>s.status===`ready`&&s.disabled),h=n(()=>({ready:{icon:s.icon===!1?void 0:s.icon??l.ui.icons.arrowUp,color:s.color,variant:s.variant,type:`submit`},submitted:{icon:s.submittedIcon||l.ui.icons.stop,color:s.submittedColor,variant:s.submittedVariant,onClick(e){a(`stop`,e)}},streaming:{icon:s.streamingIcon||l.ui.icons.stop,color:s.streamingColor,variant:s.streamingVariant,onClick(e){a(`stop`,e)}},error:{icon:s.errorIcon||l.ui.icons.reload,color:s.errorColor,variant:s.errorVariant,onClick(e){a(`reload`,e)}}})[s.status]),g=n(()=>Ae({extend:mg,...l.ui?.chatPromptSubmit||{}})());return(e,n)=>(_(),m(Oe,R({...f(u),...h.value,disabled:p.value,"aria-label":f(c)(`chatPromptSubmit.label`),...e.$attrs},{class:g.value.base({class:[f(s).ui?.base,f(s).class]}),ui:f(xe)(g.value,f(s).ui)}),x({_:2},[y(o,(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,B(t(n)))])}))]),1040,[`class`,`ui`]))}});function gg(e){let t=!1;function n(e){return e.isComposing||e.keyCode===229}function r(r){t||n(r)||(r.preventDefault(),e(r))}let i;function a(){clearTimeout(i),t=!0,i=setTimeout(()=>{t=!1},50)}return{onKeydown:r,onCompositionEnd:a}}var _g={slots:{root:`relative flex flex-col items-stretch gap-2 px-2.5 py-2 w-full rounded-lg backdrop-blur-sm`,header:`flex items-center gap-1.5`,body:`items-start gap-1.5`,footer:`flex items-center justify-between gap-1.5`,base:`px-0`},variants:{color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{outline:{root:`bg-default/75 ring ring-default`},soft:{root:`bg-elevated/50`},subtle:{root:`bg-elevated/50 ring ring-default`},naked:{root:``}}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-primary has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-primary`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-neutral has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-neutral`}},{color:`success`,variant:[`outline`,`subtle`],class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-success has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-success`}},{color:`warning`,variant:[`outline`,`subtle`],class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-warning has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-warning`}},{color:`error`,variant:[`outline`,`subtle`],class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-error has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-error`}},{color:`info`,variant:[`outline`,`subtle`],class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-info has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-info`}},{color:`primary`,variant:`soft`,class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:`soft`,class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`success`,variant:`soft`,class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`warning`,variant:`soft`,class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`error`,variant:`soft`,class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`info`,variant:`soft`,class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-inverted has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-inverted`}},{color:`neutral`,variant:`soft`,class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}}],defaultVariants:{color:`primary`,variant:`outline`}},vg=Object.assign({inheritAttrs:!1},{__name:`UChatPrompt`,props:V({as:{type:null,required:!1,default:`form`},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},submitOnEnter:{type:Boolean,required:!1,default:!0},error:{type:Error,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},rows:{type:Number,required:!1,default:1},autofocus:{type:Boolean,required:!1,default:!0},autofocusDelay:{type:Number,required:!1},autoresize:{type:Boolean,required:!1,default:!0},autoresizeDelay:{type:Number,required:!1},maxrows:{type:Number,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},disabled:{type:Boolean,required:!1}},{modelValue:{type:String,default:``},modelModifiers:{}}),emits:V([`submit`,`close`],[`update:modelValue`]),setup(e,{expose:r,emit:i}){let a=e,o=i,s=O(),c=se(`chatPrompt`,a),l=D(e,`modelValue`,{type:String,default:``}),{t:u}=ri(),p=J(),h=on(ge(c,`rows`,`autofocus`,`autofocusDelay`,`autoresize`,`autoresizeDelay`,`maxrows`,`icon`,`avatar`,`loading`,`loadingIcon`)),C=()=>_e(s,[`header`,`footer`,`body`]),w=n(()=>Ae({extend:_g,...p.ui?.chatPrompt||{}})({color:c.color,variant:c.variant})),T=b(`textareaRef`);function k(e){l.value.trim()!==``&&o(`submit`,e??new Event(`submit`))}function A(e){T.value?.textareaRef?.blur(),o(`close`,e??new Event(`close`))}let{onKeydown:M,onCompositionEnd:N}=gg(e=>{k(e)});function P(e){if(c.submitOnEnter){if(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)return}else if(!e.ctrlKey&&!e.metaKey)return;M(e)}function F(e){e.key===`Enter`?P(e):e.key===`Escape`&&A(e)}return r({textareaRef:S(()=>T.value?.textareaRef)}),(e,n)=>(_(),m(f(Jt),{as:f(c).as,"data-slot":e.$attrs[`data-slot`]??`root`,class:j(w.value.root({class:[f(c).ui?.root,f(c).class]})),onSubmit:K(k,[`prevent`])},{default:H(()=>[s.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(w.value.header({class:f(c).ui?.header}))},[d(e.$slots,`header`)],2)):g(``,!0),d(e.$slots,`body`,{submit:k,close:A,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,ui:w.value},()=>[E(Li,R({ref_key:`textareaRef`,ref:T,modelValue:l.value,"onUpdate:modelValue":n[0]||=e=>l.value=e,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,variant:`none`,fixed:``},{...f(h),...e.$attrs},{ui:f(xe)(f(_e)(w.value,[`root`,`body`,`header`,`footer`]),f(c).ui),"data-slot":`body`,class:w.value.body({class:f(c).ui?.body}),onKeydown:F,onCompositionend:f(N)}),x({_:2},[y(C(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,B(t(n)))])}))]),1040,[`modelValue`,`placeholder`,`disabled`,`ui`,`class`,`onCompositionend`])]),s.footer?(_(),v(`div`,{key:1,"data-slot":`footer`,class:j(w.value.footer({class:f(c).ui?.footer}))},[d(e.$slots,`footer`)],2)):g(``,!0)]),_:3},8,[`as`,`data-slot`,`class`]))}});function yg(e){return e.split(`
84
- `).map(e=>{let t=e.startsWith(`↳`)?Pr(e):null;return t?{ref:!0,head:t.head,text:t.ref.excerpt,tail:t.tail}:{ref:!1,head:``,text:e,tail:``}})}var bg=`fontFamily.fontSize.fontWeight.fontStyle.fontStretch.fontVariant.fontKerning.fontFeatureSettings.fontVariationSettings.fontVariantLigatures.fontOpticalSizing.lineHeight.letterSpacing.wordSpacing.textTransform.textIndent.textRendering.tabSize.whiteSpace.overflowWrap.wordBreak.hyphens.direction.paddingTop.paddingRight.paddingBottom.paddingLeft.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.boxSizing`.split(`.`);function xg(e){let t=e.parentElement,n=document.createElement(`div`);n.className=`qm-mirror`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`div`);n.append(r),t.insertBefore(n,e),t.classList.add(`qm-host`),e.classList.add(`qm-on`);let i=!0;function a(){r.style.transform=`translateY(${-e.scrollTop}px)`}function o(){if(!i)return;let t=getComputedStyle(e);for(let e of bg)n.style[e]=t[e];n.style.borderStyle=`solid`,n.style.borderColor=`transparent`;let r=e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth);n.style.paddingRight=`${parseFloat(t.paddingRight)+Math.max(0,r)}px`,n.style.top=`${e.offsetTop}px`,n.style.left=`${e.offsetLeft}px`,n.style.width=`${e.offsetWidth}px`,n.style.height=`${e.offsetHeight}px`,n.style.setProperty(`--qm-pl`,t.paddingLeft),n.style.setProperty(`--qm-pr`,n.style.paddingRight),a()}function s(){r.textContent=``;for(let t of yg(e.value)){let e=document.createElement(`div`);if(t.ref){e.className=`qm-q`;let n=document.createElement(`span`);n.className=`qm-a`,n.textContent=t.head.slice(0,1);let r=document.createElement(`span`);r.className=`qm-h`,r.textContent=t.head.slice(1);let i=document.createElement(`span`);i.className=`qm-h`,i.textContent=t.tail,e.append(n,r,t.text,i)}else e.append(t.text||`​`);r.append(e)}o()}e.addEventListener(`input`,s),e.addEventListener(`scroll`,a,{passive:!0});let c=new ResizeObserver(o);return c.observe(e),document.fonts?.ready.then(o),s(),{render:s,destroy(){i=!1,c.disconnect(),e.removeEventListener(`input`,s),e.removeEventListener(`scroll`,a),e.classList.remove(`qm-on`),t.classList.remove(`qm-host`),n.remove()}}}var Sg=[`data-agent`],Cg={class:`restart-text`},wg={class:`restart-text`},Tg={class:`restart-text`},Eg={class:`restart-text`},Dg={class:`restart-text`},Og=[`disabled`],kg=[`aria-label`],Ag=[`aria-selected`,`onMousemove`,`onClick`],jg={class:`slash-name`},Mg={key:0},Ng={class:`slash-desc`},Pg={key:7,class:`composer-ask-anchor`},Fg=[`aria-label`],Ig={class:`composer-quotes-label`},Lg={class:`composer-quote-text`},Rg=[`aria-label`,`onClick`],zg={class:`attachments`},Bg=[`aria-label`,`onClick`,`onKeydown`],Vg=[`src`],Hg={key:0,class:`spinner`},Ug=[`aria-label`,`onClick`],Wg={key:1,class:`prompt-hint`},Gg={key:2,class:`prompt-hint`},Kg={key:3,class:`prompt-hint`},qg=[`title`],Jg={class:`composer-status-line`},Yg={key:0,class:`composer-status-meters`},Xg=Object.assign(T({__name:`Composer`,props:{pane:{},paneId:{},sendKeys:{type:Function},conversation:{type:Boolean},escStops:{type:Boolean},takeBack:{type:Boolean},unanswered:{}},emits:[`sent`,`showTerminal`,`showUnanswered`],setup(e,{expose:t,emit:i}){let o=e,s=i,c=n(()=>/\b(failed|error)\b/i.test(o.pane?.claudeNotice||``)),l=n(()=>!!(o.pane?.claudeNotice&&/Restart to update/i.test(o.pane.claudeNotice)&&Vt(o.pane))),u=n(()=>{let e=o.pane?.restart;if(!e)return``;let t=Tr(e.agent);return e.update&&e.phase===`stopping`?Z(`Exiting ${t}…`,`Fermeture de ${t}…`):e.phase===`updating`?Z(`Updating ${t} in its terminal…`,`Mise à jour de ${t} dans son terminal…`):e.phase===`stopping`?Z(`Stopping ${t}…`,`Arrêt de ${t}…`):Z(`Restarting ${t} on the same conversation…`,`Relance de ${t} sur la même conversation…`)});async function d(){let e=o.pane?.restart?.update;if(e)try{await navigator.clipboard.writeText(e),$(Z(`Command copied: paste it into the terminal of this pane.`,`Commande copiée : colle-la dans le terminal de ce panneau.`))}catch{$(Y(`Copy failed`),!0)}}let p=Bi(o.paneId),b=S(p,`text`),C=h(null),w=n(()=>C.value?.textareaRef||null),T=h(null),D=h(null),O=h(!1),A=n(()=>Q.value&&!Vn&&!Un),P=S(p,`atts`),I=n(()=>Yn(b.value)),L=null;z([()=>or.value===`native`&&I.value.length>0,w],([e,t])=>{L&&(!e||!t)&&(L.destroy(),L=null),e&&t&&!L&&(L=xg(t))},{immediate:!0,flush:`post`}),z(b,()=>N(()=>L?.render()),{flush:`post`}),U(()=>{L?.destroy(),L=null});let R=n(()=>!!(b.value.trim()||P.value.length)),B=n(()=>!!o.pane?.stopped||!_n.value||Dn.value||Tn(o.pane)),V=n(()=>!!(o.pane&&o.pane.agent===`omp`&&o.pane.ompShell&&o.pane.status!==`working`)),ee=n(()=>!(B.value||!o.pane||!o.pane.agent||o.pane.status!==`working`&&!V.value||R.value)),W=n(()=>!B.value&&!R.value&&o.pane?.claudeSuggestion||null);function ne(){let e=W.value;e&&(b.value=e,He())}let re=n(()=>{let e=o.pane;return e?e.status===`blocked`?Y(`Type a reply…`):W.value?W.value:e.agent?Z(`Message to ${Tr(e.agent)}…`,`Message à ${Tr(e.agent)}…`):Y(`Command…`):Y(`Message to agent…`)});function ie(e){if(Pe.value&&!e.isComposing){let t=Ne.value.length;if(e.key===`ArrowDown`){e.preventDefault(),Fe=`kb`,Ee.value=(Ee.value+1)%t;return}if(e.key===`ArrowUp`){e.preventDefault(),Fe=`kb`,Ee.value=(Ee.value-1+t)%t;return}if(e.key===`Escape`){e.preventDefault(),ke.value=!0;return}if(e.key===`Tab`||A.value&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),Le(Ne.value[Ee.value]||Ne.value[0]);return}}if(e.key===`Tab`&&!e.shiftKey&&!e.isComposing&&W.value&&!b.value){e.preventDefault(),ne();return}A.value&&e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&!b.value.trim()&&(e.preventDefault(),se())}function q(e){e.preventDefault(),se()}let oe=n(()=>Q.value&&!ee.value);async function se(){if(B.value)return $(Y(`Sending unavailable offline`),!0);if(ee.value)return ue();if(P.value.some(e=>!e.paste&&!e.path))return $(Y(P.value.some(e=>!e.path&&e.file)?`File is uploading…`:`Photo is uploading…`));let e=P.value.flatMap(e=>e.paste?[e.paste]:[]),t=P.value.flatMap(e=>e.paste?[]:[e.ref||e.path]),n=$t(b.value,e,t);if(!n||O.value)return;let r=o.pane,i=r&&r.status===`blocked`?r.prompt:null,a=i?i.options.findIndex(e=>e.free):-1;if(a<0&&dt(r)&&!lc(n)){b.value=``,pe(),Qe(e),X(),s(`sent`,null),na(r,o.paneId,n).then(()=>s(`sent`,null),e=>$(e.message,!0));return}O.value=!0,Qe(e);try{let e=null;if(i&&a>=0){if(!await be(o.paneId,a,i.options[a].label,{text:n,question:i.question}))return}else e=await Pt(r,o.paneId,n);b.value=``,pe(),X(),s(`sent`,e);let c=n.split(/\s/)[0],l=we.get(o.paneId)?.list||Te.value;a<0&&r&&r.agent&&!t.length&&/^\/\S+$/.test(c)&&!n.includes(`
85
- `)&&!ae(c,l)&&fe(o.paneId,c,l.some(e=>e.source===`builtin`&&`/${e.name}`===c))}catch(e){$(e.message,!0)}finally{O.value=!1}}let ce=h(null),le=h(!1);async function ue(){if(ce.value!==`running`){X(),ce.value=`running`,le.value=V.value;try{let e=await Dr(`/api/interrupt`,{pane_id:o.paneId,restore:!!o.takeBack});if(ce.value=e.stopped?null:`failed`,le.value=!!e.shell,e.shell){e.stopped&&$(Z(`Command cancelled`,`Commande annulée`));return}if(e.restored!==void 0){ji(p,e.restored),He();let t=Z(`Stopped: your message is back in the field`,`Arrêté : ton message est revenu dans le champ`);e.lost?$(t,!0,Mi(e.lost)):$(t)}else e.stopped&&$(e.background?Z(`Agent stopped (${e.background} background task${e.background>1?`s`:``} stopped)`,`Agent arrêté (${e.background} tâche${e.background>1?`s`:``} de fond arrêtée${e.background>1?`s`:``})`):Y(`Agent stopped`))}catch(e){ce.value=null,$(e.message,!0)}}}z(()=>o.pane?.status,e=>{ce.value===`failed`&&!le.value&&e!==`working`&&(ce.value=null)}),z(V,e=>{ce.value===`failed`&&le.value&&!e&&(ce.value=null)});function de(){return!o.escStops||!ee.value||O.value||ce.value===`running`?!1:(ue(),w.value?.focus(),!0)}function pe(){for(let e of P.value)e.url&&URL.revokeObjectURL(e.url);P.value=[]}function me(e){tt.value=e.url}function he(e){let[t]=P.value.splice(e,1);t&&t.url&&URL.revokeObjectURL(t.url)}z(()=>P.value.length,()=>N(Yi)),z(b,()=>N(()=>{let e=w.value;!e||e.scrollHeight<=e.clientHeight||document.activeElement!==e||e.selectionEnd>=e.value.length-1&&(e.scrollTop=e.scrollHeight)}));async function ge(e){for(let t of e){let e=r({url:URL.createObjectURL(t),path:null});P.value.push(e);try{let n=await Am(o.paneId,t);e.path=n.path,e.name=n.name}catch(t){$(`${Y(`Photo upload failed`)} : ${t.message}`,!0),P.value=P.value.filter(t=>t!==e),URL.revokeObjectURL(e.url)}}}async function _e(e){let t=o.pane,{images:n,files:r,refused:i}=await qi(e,t?.agent);if(i.length){let e=Tr(t?.agent),n=i.map(e=>e.file.name).join(`, `),r=[...new Set(i.map(t=>Ri(t.reason,e,t.kind)))];$(Z(`Not attached: ${n}`,`Non joint : ${n}`),!0,r.join(` · `))}n.length&&ge(n);for(let e of r)ve(e.file,e.kind);return n.length+r.length}async function ve(e,t){let n=r({url:``,path:null,file:{label:e.name,size:e.size,kind:t}});P.value.push(n);try{let t=await fetch(`/api/attach?pane=${encodeURIComponent(o.paneId)}&name=${encodeURIComponent(e.name)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:e}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(Y(r.error||`HTTP ${t.status}`));n.path=r.path,n.name=r.name,n.ref=r.ref}catch(t){$(`${e.name} : ${Y(`File upload failed`)} — ${t.message}`,!0),P.value=P.value.filter(e=>e!==n)}}function ye(e){let t=e.target,n=[...t.files||[]];t.value=``,_e(n)}function xe(e){let t=[...e.clipboardData&&e.clipboardData.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e);if(!t.length){let t=(e.clipboardData?.getData(`text/plain`)||``).replace(/\r\n?/g,`
86
- `);if(Kt(t)){e.preventDefault(),Se(t);return}let n=ur(t);if(n===t)return;e.preventDefault();let r=e.target,i=r.value;if(!(typeof document.execCommand==`function`&&document.execCommand(`insertText`,!1,n))||r.value===i){let e=r.selectionStart??i.length;r.value=i.slice(0,e)+n+i.slice(r.selectionEnd??e),r.setSelectionRange(e+n.length,e+n.length),r.dispatchEvent(new Event(`input`,{bubbles:!0}))}return}e.preventDefault(),_e(t),X()}function Se(e){P.value.push({url:``,path:null,paste:e}),X()}async function Ce(){if(!navigator.clipboard||!navigator.clipboard.read)return $(Y(`Clipboard unavailable here — paste into the message field.`),!0);try{let e=[];for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));n&&e.push(new File([await t.getType(n)],`presse-papiers.${n.split(`/`)[1]}`,{type:n}))}if(!e.length)return $(Y(`No image in the clipboard`),!0);ge(e)}catch(e){let t=e;$(t.name===`NotAllowedError`?Y(`Paste denied`):`${Y(`Paste failed`)} : ${t.message}`,!0)}}let we=new Map,Te=h([]),Ee=h(0),ke=h(!1),Ae=h(null),je=n(()=>{let e=/^\/(\S*)$/.exec(b.value);return o.pane&&o.pane.agent&&e?e[1].toLowerCase():null});async function Me(){let e=o.paneId,t=we.get(e);if(t&&Date.now()-t.at<6e4){Te.value=t.list;return}try{let t=await Dr(`/api/commands?pane=${encodeURIComponent(e)}`);t.partial||we.set(e,{at:Date.now(),list:t.commands}),e===o.paneId&&(Te.value=t.commands)}catch{}}z(je,(e,t)=>{if(e===null){ke.value=!1;return}t??Me(),Ee.value=0}),z(()=>o.paneId,()=>{Te.value=[]});let Ne=n(()=>{let e=je.value;if(e===null)return[];let t=[],n=[],r=[];for(let i of Te.value){let a=i.name.toLowerCase();a.startsWith(e)?t.push(i):a.includes(e)?n.push(i):e.length>1&&i.desc.toLowerCase().includes(e)&&r.push(i)}return[...t,...n,...r]}),Pe=n(()=>je.value!==null&&!ke.value&&Ne.value.length>0&&(Ne.value.length!==1||Ne.value[0].name.toLowerCase()!==je.value)),Fe=``;function Ie(e,t){let n=`${e.screenX},${e.screenY}`,r=Fe===`kb`;n!==Fe&&(Fe=n,!r&&(Ee.value=t))}function Le(e){b.value=`/${e.name} `,X(),N(()=>w.value?.focus())}z(Ee,e=>N(()=>{(Ae.value?.children[e])?.scrollIntoView({block:`nearest`})}));let ze={claude:[[`/compact`,`Summarize context`],[`/clear`,`New conversation`],[`/context`,`Context usage`],[`/usage`,`Plan usage`],[`/model`,`Change model`],[`/review`,`Code review`]],codex:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/status`,`Session status`],[`/model`,`Change model`],[`/review`,`Code review`],[`/diff`,`View diff`]],omp:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/plan`,`Plan mode`],[`/model`,`Change model`],[`/fast`,`Priority service tier`]]};function Be(){let e=o.pane;if(!e)return;let t=[{label:Y(`Photo or screenshot`),icon:`i-lucide-image`,run:()=>T.value?.click()},{label:e.agent===`claude`?Y(`File (PDF, text, code)`):Y(`File (text, code)`),icon:`i-lucide-paperclip`,run:()=>D.value?.click()},{label:Y(`Paste copied image`),icon:`i-lucide-clipboard-paste`,run:Ce}];if(e.agent){t.push({kind:`separator`}),t.push({kind:`command`,cmd:`esc`,desc:Y(`Interrupt agent`),run:()=>o.sendKeys([`esc`])});for(let[n,r]of ze[e.agent]||[])t.push({kind:`command`,cmd:n,desc:Y(r),run:()=>Ve(n)});t.push({kind:`note`,label:Y(`Commands that open a menu (model…) can then be controlled in the Terminal tab.`)})}nn(t)}async function Ve(e,t=!0){try{await Dr(`/api/prompt`,{pane_id:o.paneId,text:e}),X()}catch(e){return $(e.message,!0)}t&&fe(o.paneId,e)}function He(){w.value?.focus(),N(()=>{let e=w.value;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight)})}return t({focus:()=>w.value?.focus(),focusEnd:He,blur:()=>w.value?.blur(),addImages:ge,addFiles:_e,stop:de}),(t,n)=>{let r=De,i=Vh,o=og,p=bo,h=co,S=Oe,w=pg,N=Re,L=hg,z=vg;return _(),v(`div`,{class:`composer`,"data-agent":e.pane?.agent||void 0},[f(ce)?(_(),v(`div`,{key:0,class:j([`composer-notice restart`,{failed:f(ce)===`failed`}]),role:`status`},[f(ce)===`failed`?(_(),v(k,{key:0},[F(`span`,Cg,M(f(le)?(`tl`in t?t.tl:f(Z))(`The command is still running.`,`La commande tourne encore.`):(`t`in t?t.t:f(Y))(`The agent is still working.`)),1),F(`button`,{type:`button`,class:`notice-btn`,onClick:n[0]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Y))(`View terminal`)),1),F(`button`,{type:`button`,class:`notice-btn`,onClick:n[1]||=e=>ce.value=null},M((`t`in t?t.t:f(Y))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[13]||=F(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),F(`span`,wg,M(f(le)?(`tl`in t?t.tl:f(Z))(`Cancelling the command…`,`Annulation de la commande…`):(`t`in t?t.t:f(Y))(`Stopping…`)),1)],64))],2)):e.pane?.restart?(_(),v(`div`,{key:1,class:j([`composer-notice restart`,e.pane.restart.phase]),role:`status`},[e.pane.restart.phase===`failed`?(_(),v(k,{key:0},[F(`span`,Tg,M(e.pane.restart.update?(`t`in t?t.t:f(Y))(`Codex update failed`):(`t`in t?t.t:f(Y))(`Restart failed`))+M((`tl`in t?t.tl:f(Z))(`: `,` : `))+M((`t`in t?t.t:f(Y))(e.pane.restart.error||``)),1),F(`button`,{type:`button`,class:`notice-btn`,onClick:n[2]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Y))(`View terminal`)),1),e.pane.restart.update?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:d},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Y))(`Copy command`)),1)])):g(``,!0),F(`button`,{type:`button`,class:`notice-btn`,onClick:n[3]||=n=>(`dismissRestart`in t?t.dismissRestart:f(We))(e.paneId)},M((`t`in t?t.t:f(Y))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[14]||=F(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),F(`span`,Eg,M(f(u)),1)],64))],2)):e.conversation&&e.pane?.usageLimit?(_(),m(i,{key:2,limit:e.pane.usageLimit,"read-only":f(B),"send-keys":e.sendKeys,onCredits:n[4]||=e=>Ve(`/usage-credits`,!1)},null,8,[`limit`,`read-only`,`send-keys`])):e.pane?.claudeNotice?(_(),v(`div`,{key:3,class:j([`composer-notice`,{error:f(c)}]),role:`status`},[f(l)?(_(),v(k,{key:0},[F(`span`,Dg,M(e.pane.claudeNotice.replace(/\s*·\s*Restart to update\b.*$/,``))+` ·`,1),F(`button`,{type:`button`,class:`notice-btn`,disabled:f(B),onClick:n[5]||=n=>(`restartAgent`in t?t.restartAgent:f(Zt))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Y))(`Restart to update`)),1)],8,Og)],64)):(_(),v(k,{key:1},[a(M(f(c)&&!/^[✗✘]/.test(e.pane.claudeNotice)?`✘ ${e.pane.claudeNotice}`:e.pane.claudeNotice),1)],64))],2)):e.pane?.codexStatus?(_(),m(o,{key:4,pane:e.pane,"pane-id":e.paneId,"read-only":f(B)},null,8,[`pane`,`pane-id`,`read-only`])):g(``,!0),f(W)&&!f(A)?(_(),v(`button`,{key:5,type:`button`,class:`composer-suggest`,onMousedown:n[6]||=K(()=>{},[`prevent`]),onClick:ne},[E(r,{name:`i-lucide-corner-down-left`}),a(` `+M((`t`in t?t.t:f(Y))(`Use suggestion`)),1)],32)):g(``,!0),f(Pe)?(_(),v(`div`,{key:6,class:`slash-menu`,role:`listbox`,"aria-label":(`t`in t?t.t:f(Y))(`Commands`)},[F(`div`,{ref_key:`slashListEl`,ref:Ae,class:`slash-list`},[(_(!0),v(k,null,y(f(Ne),(e,t)=>(_(),v(`button`,{key:e.name,type:`button`,role:`option`,class:j([`slash-item`,{on:t===f(Ee)}]),"aria-selected":t===f(Ee),onMousedown:n[7]||=K(()=>{},[`prevent`]),onMousemove:e=>Ie(e,t),onClick:t=>Le(e)},[F(`span`,jg,[a(`/`+M(e.name),1),e.hint?(_(),v(`small`,Mg,M(e.hint),1)):g(``,!0)]),F(`span`,Ng,M(e.desc),1)],42,Ag))),128))],512)],8,kg)):g(``,!0),e.unanswered&&!f(B)?(_(),v(`div`,Pg,[F(`button`,{type:`button`,class:`composer-ask`,onMousedown:n[8]||=K(()=>{},[`prevent`]),onClick:n[9]||=e=>s(`showUnanswered`)},[E(r,{name:`i-lucide-arrow-up`}),F(`span`,null,M(e.unanswered>1?(`tl`in t?t.tl:f(Z))(`${e.unanswered} questions unanswered`,`${e.unanswered} questions sans réponse`):(`tl`in t?t.tl:f(Z))(`1 question unanswered`,`1 question sans réponse`)),1)],32)])):g(``,!0),f(I).length?(_(),v(`div`,{key:8,class:`composer-quotes`,role:`list`,"aria-label":(`t`in t?t.t:f(Y))(`Quoted questions`)},[F(`span`,Ig,`↳ `+M(f(I).length),1),(_(!0),v(k,null,y(f(I),e=>(_(),v(`span`,{key:e.start,class:`composer-quote`,role:`listitem`},[F(`span`,Lg,M(e.excerpt),1),F(`button`,{type:`button`,class:`composer-quote-x`,"aria-label":(`t`in t?t.t:f(Y))(`Remove quote`),onMousedown:n[10]||=K(()=>{},[`prevent`]),onClick:t=>b.value=f(yn)(f(b),e)},[E(r,{name:`i-lucide-x`})],40,Rg)]))),128))],8,Fg)):g(``,!0),E(z,{ref_key:`promptRef`,ref:C,modelValue:f(b),"onUpdate:modelValue":n[12]||=e=>te(b)?b.value=e:null,disabled:!!e.pane?.stopped,placeholder:e.pane?.stopped?(`t`in t?t.t:f(Y))(`Restart Codex before sending a message`):f(B)?(`t`in t?t.t:f(Y))(`Draft saved — sending unavailable offline`):f(re),variant:`outline`,color:`neutral`,rows:1,maxrows:7,autofocus:!1,"submit-on-enter":f(A)&&!f(Pe),enterkeyhint:f(A)?`send`:`enter`,autocapitalize:`sentences`,class:`prompt`,ui:{header:`prompt-head`,body:`prompt-body`,base:`prompt-input`,footer:`prompt-foot`},onSubmit:se,onKeydown:ie,onPaste:xe},x({footer:H(()=>[E(S,{icon:`i-lucide-plus`,color:`neutral`,variant:`outline`,size:`sm`,class:`prompt-plus`,disabled:f(B),"aria-label":(`t`in t?t.t:f(Y))(`Photo, file, paste, commands`),onClick:Be},null,8,[`disabled`,`aria-label`]),F(`input`,{ref_key:`fileInput`,ref:T,type:`file`,accept:`image/*`,multiple:``,hidden:``,onChange:ye},null,544),F(`input`,{ref_key:`anyFileInput`,ref:D,type:`file`,multiple:``,hidden:``,"data-testid":`attach-any`,onChange:ye},null,544),e.pane&&(e.pane.agent===`claude`||e.pane.agent===`codex`||e.pane.agent===`omp`)?(_(),m(w,{key:0,pane:e.pane},null,8,[`pane`])):g(``,!0),f(oe)&&f(W)?(_(),v(`span`,Wg,[E(N,{value:`tab`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Y))(`suggestion`))+` `,1),n[15]||=F(`span`,{class:`sep`},`·`,-1),n[16]||=a(),E(N,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Y))(`send`)),1)])):f(oe)?(_(),v(`span`,Gg,[E(N,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Y))(`send`))+` `,1),n[17]||=F(`span`,{class:`sep`},`·`,-1),n[18]||=a(),E(N,{value:`shift`,size:`sm`}),E(N,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Y))(`new line`)),1)])):(`desk`in t?t.desk:f(Q))&&e.escStops&&f(ee)&&f(ce)!==`running`?(_(),v(`span`,Kg,[E(N,{value:`escape`,size:`sm`}),a(` `+M((`tl`in t?t.tl:f(Z))(`stop`,`arrêter`)),1)])):g(``,!0),E(L,{status:f(ee)?`streaming`:`ready`,disabled:f(B)||!f(R)&&!f(ee)||f(O)||f(ce)===`running`,color:`primary`,variant:`solid`,"streaming-color":`neutral`,"streaming-variant":`solid`,"streaming-icon":`i-herdr-stop`,size:`sm`,class:j([`prompt-send`,{stop:f(ee)}]),"aria-label":f(ee)&&f(V)?(`tl`in t?t.tl:f(Z))(`Cancel the command`,`Annuler la commande`):(`t`in t?t.t:f(Y))(f(ee)?`Stop the agent`:`Send`),onMousedown:n[11]||=K(()=>{},[`prevent`]),onClick:q,onStop:ue},null,8,[`status`,`disabled`,`class`,`aria-label`])]),_:2},[f(P).length?{name:`header`,fn:H(()=>[F(`div`,zg,[(_(!0),v(k,null,y(f(P),(e,n)=>(_(),v(k,{key:e.url||e.path||e.file?.label||`paste:${n}`},[e.paste?(_(),m(p,{key:0,text:e.paste,removable:``,onRemove:e=>he(n)},null,8,[`text`,`onRemove`])):e.file?(_(),m(h,{key:1,name:e.file.label,size:e.file.size,kind:e.file.kind,uploading:!e.path,removable:``,onRemove:e=>he(n)},null,8,[`name`,`size`,`kind`,`uploading`,`onRemove`])):(_(),v(`div`,{key:2,class:j([`att`,{up:!e.path}]),role:`button`,tabindex:`0`,"aria-label":(`t`in t?t.t:f(Y))(`View image`),onClick:t=>me(e),onKeydown:G(K(t=>me(e),[`self`]),[`enter`])},[F(`img`,{src:e.url,alt:``},null,8,Vg),e.path?g(``,!0):(_(),v(`span`,Hg)),F(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Y))(`Remove`),onClick:K(e=>he(n),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Ug)],42,Bg))],64))),128))])]),key:`0`}:void 0]),1032,[`modelValue`,`disabled`,`placeholder`,`submit-on-enter`,`enterkeyhint`]),e.pane?.ompStatus?(_(),v(`div`,{key:9,class:`composer-status`,title:[e.pane.ompStatus.line,e.pane.ompStatus.meters].filter(Boolean).join(`
87
- `)},[F(`span`,Jg,M(e.pane.ompStatus.line),1),e.pane.ompStatus.meters?(_(),v(`span`,Yg,M(e.pane.ompStatus.meters),1)):g(``,!0)],8,qg)):g(``,!0)],8,Sg)}}}),{__name:`Composer`}),Zg=[`aria-label`],Qg={class:`review-note-head`},$g={class:`review-range`},e_={key:0,class:`review-path`},t_={key:0,class:`review-warning`,role:`status`},n_=[`id`,`value`,`placeholder`,`aria-label`],r_={class:`review-note-actions`},i_={class:`review-keys`,"aria-hidden":`true`},a_=[`disabled`],o_={class:`review-body`},s_={class:`review-note-actions`},c_=[`aria-label`],l_=[`aria-label`],u_=Object.assign(T({__name:`ReviewNote`,props:{comment:{},label:{},missing:{type:Boolean},changed:{type:Boolean}},emits:[`act`,`hover`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>r.comment.draft!==void 0),o=n(()=>r.comment.draft??``),s=n(()=>o.value.trim()!==r.comment.body.trim()),c=h(``);z(a,()=>{c.value=``});let l=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``)?`⌘↵`:`Ctrl+↵`;function u(e){c.value=``,i(`act`,`draft`,r.comment.id,e.target.value)}function d(){o.value.trim()&&i(`act`,`save`,r.comment.id)}function p(){if(s.value&&c.value!==`cancel`){c.value=`cancel`;return}i(`act`,`cancel`,r.comment.id)}function m(){if(c.value!==`remove`){c.value=`remove`;return}i(`act`,`remove`,r.comment.id)}function y(e){if(!e.isComposing){if(e.key===`Escape`&&(a.value||c.value))e.preventDefault(),e.stopPropagation(),a.value?p():c.value=``;else if(a.value)e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d());else return}}return(t,n)=>(_(),v(`div`,{class:j([`review-note`,{missing:e.missing,editing:f(a)}]),role:`group`,"aria-label":`${e.label}: ${(`t`in t?t.t:f(Y))(`review comment`)}`,onKeydown:y,onMouseenter:n[3]||=t=>i(`hover`,e.comment.id),onMouseleave:n[4]||=e=>i(`hover`,null),onFocusin:n[5]||=t=>i(`hover`,e.comment.id),onFocusout:n[6]||=e=>i(`hover`,null)},[F(`div`,Qg,[F(`span`,$g,M(e.label),1),e.missing?(_(),v(`span`,e_,M(e.comment.path),1)):g(``,!0)]),e.missing?(_(),v(`p`,t_,M(e.changed?(`t`in t?t.t:f(Y))(`The code of this block changed. Check this comment before sending.`):(`t`in t?t.t:f(Y))(`No longer in the diff. Check this comment before sending.`)),1)):g(``,!0),f(a)?(_(),v(k,{key:1},[F(`textarea`,{id:`review-${e.comment.id}`,value:f(o),placeholder:(`t`in t?t.t:f(Y))(`Write a review comment…`),"aria-label":`${e.label}: ${(`t`in t?t.t:f(Y))(`review comment`)}`,rows:`3`,onInput:u,onFocus:n[0]||=e=>e.target.scrollIntoView({block:`nearest`})},null,40,n_),F(`div`,r_,[F(`span`,i_,M(f(l))+` `+M((`t`in t?t.t:f(Y))(`to save`))+` · Esc `+M((`t`in t?t.t:f(Y))(`to cancel`)),1),F(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`cancel`}]),onClick:p},M(f(c)===`cancel`?(`t`in t?t.t:f(Y))(`Discard this text?`):(`t`in t?t.t:f(Y))(`Cancel`)),3),F(`button`,{type:`button`,class:`review-btn primary`,disabled:!f(o).trim(),onClick:d},M(e.comment.body?(`t`in t?t.t:f(Y))(`Save`):(`t`in t?t.t:f(Y))(`Comment`)),9,a_)])],64)):(_(),v(k,{key:2},[F(`p`,o_,M(e.comment.body),1),F(`div`,s_,[F(`button`,{type:`button`,class:`review-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Edit comment`),onClick:n[1]||=t=>i(`act`,`edit`,e.comment.id)},M((`tl`in t?t.tl:f(Z))(`Edit`,`Modifier`)),9,c_),F(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`remove`}]),"aria-label":f(c)===`remove`?(`t`in t?t.t:f(Y))(`Confirm delete`):(`t`in t?t.t:f(Y))(`Delete comment`),onClick:m,onBlur:n[2]||=e=>c.value=``},M(f(c)===`remove`?(`t`in t?t.t:f(Y))(`Confirm delete`):(`t`in t?t.t:f(Y))(`Delete`)),43,l_)])],64))],42,Zg))}}),{__name:`ReviewNote`});function d_(e){let t=null,n=null;return e.map(e=>{let r=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e.text);e.kind===`hunk`&&(t=r?Number(r[1]):null,n=r?Number(r[2]):null);let i=e.kind===`del`?`old`:`new`,a=[`add`,`del`,`context`].includes(e.kind)?i===`old`?t:n:null;return(e.kind===`del`||e.kind===`context`)&&t!==null&&t++,(e.kind===`add`||e.kind===`context`)&&n!==null&&n++,{...e,number:a,side:i}})}function f_(e,t){let n=t,r=t;for(;n>0&&e[n-1].kind!==`hunk`;)n--;for(;r<e.length-1&&e[r+1].kind!==`hunk`;)r++;for(;n<t&&e[n].number===null;)n++;for(;r>t&&e[r].number===null;)r--;return[n,r]}function p_(e,t,n){let[r,i]=f_(e,t),a=Math.min(Math.max(n,r),i);for(;a!==t&&e[a].number===null;)a+=a<t?1:-1;return t<=a?[t,a]:[a,t]}var m_=e=>e.filter(e=>e.number!==null);function h_(e){let t={};for(let n of m_(e)){let e=t[n.side];t[n.side]=e?[Math.min(e[0],n.number),Math.max(e[1],n.number)]:[n.number,n.number]}return t}var g_=100;function __(e){let t=m_(e).map(e=>e.text.trimEnd()).filter(e=>e.length>1);return(t.length>3?[t[0],`…`,t.at(-1)]:t).map(e=>e.length>g_?`${e.slice(0,99)}…`:e)}function v_(e){let t=2166136261;for(let n of m_(e).map(e=>e.text).join(`
88
- `))t=Math.imul(t^n.codePointAt(0),16777619);return(t>>>0).toString(16)}function y_(e){let t=m_(e),n=t[0],r=t.at(-1);return{number:n.number,side:n.side,text:n.text,end:t.length>1?{number:r.number,side:r.side,text:r.text}:void 0,span:h_(t),excerpt:__(t),hash:v_(t)}}var b_=(e,t)=>e.number===t.number&&e.side===t.side&&e.text===t.text;function x_(e,t){return b_(e,t)&&!!e.end==!!t.end&&(!e.end||b_(e.end,t.end))}function S_(e,t){for(let n=0;n<t.length;n++)if(b_(e,t[n])){if(!e.end)return[n,n];for(let r=n+1;r<t.length&&t[r].kind!==`hunk`;r++)if(b_(e.end,t[r]))return[n,r]}return null}function C_(e,t){let n=S_(e,t);return n&&(!e.hash||e.hash===v_(t.slice(n[0],n[1]+1)))?n:null}function w_(e,t){let n=t[e.scope]?.files.find(t=>t.path===e.path);return n?d_(n.lines):null}function T_(e,t,n=!1){if(t.git&&e.scope===`committed`&&!t.committed&&!n)return null;let r=w_(e,t);return r&&C_(e,r)?null:r&&S_(e,r)?`changed`:`gone`}function E_(e,t,n=!1){return e.filter(e=>T_(e,t,n))}function D_(e,t){return e.map(e=>{let n=w_(e,t),r=n&&C_(e,n);return r?{...e,...y_(n.slice(r[0],r[1]+1)),end:e.end}:e})}function O_(e){return(e.draft?.trim()?e.draft:e.body).trim()}function k_(e){let t=[e.number,e.number];return e.span??(e.side===`old`?{old:t}:{new:t})}var A_=(e,t)=>e[0]===e[1]?`${e[0]}`:`${e[0]}${t}${e[1]}`,j_=e=>e[0]!==e[1];function M_(e,t){let n=e.old&&(j_(e.old)?t.oldLines:t.oldLine);if(!e.new)return e.old?`${j_(e.old)?t.lines:t.line} ${A_(e.old,`–`)} (${n})`:``;let r=`${j_(e.new)?t.lines:t.line} ${A_(e.new,`–`)}`;return e.old?`${r} + ${n} ${A_(e.old,`–`)}`:r}function N_(e,t,n={}){let r=new Map;for(let i of e){let e=O_(i).replace(/\s*\n\s*/g,` `);if(!e)continue;let a=k_(i),o=a.old&&(j_(a.old)?t.oldLines:t.oldLine),s=[a.old?a.new?`${o} ${A_(a.old,`-`)}`:o:``,n[i.id]===`changed`?t.changed??t.missing:n[i.id]?t.missing:``].filter(Boolean),c=`${i.path}:${A_(a.new??a.old,`-`)}${s.length?` (${s.join(`, `)})`:``} — ${e}`,l=(i.excerpt??[i.text.trimEnd()]).filter(Boolean).map(e=>` ${e}`);r.has(i.path)||r.set(i.path,[]),r.get(i.path).push([c,...l].join(`
83
+ `),Y(`Update`),`primary`))){Q();try{await kr(`/api/codex-update`,{pane_id:t.paneId})}catch(e){$(e.message,!0)}}}async function b(){try{await kr(`/api/codex-update`,{pane_id:t.paneId,dismiss:!0})}catch(e){$(e.message,!0)}}async function x(){try{await kr(`/api/prompt`,{pane_id:t.paneId,text:`/status`}),Q()}catch(e){return $(e.message,!0)}De(t.paneId,`/status`)}return(t,n)=>{let r=Ee;return _(),v(k,null,[f(i)&&f(s)?.phase===`running`?(_(),v(`div`,ag,[n[1]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,og,M((`tl`in t?t.tl:f(X))(`Updating Codex on ${f(c)}…`,`Mise à jour de Codex sur ${f(c)}…`)),1)])):f(i)&&f(s)?.phase===`failed`?(_(),v(`div`,sg,[I(`span`,cg,M((`t`in t?t.t:f(Y))(`Codex update failed`))+M((`tl`in t?t.tl:f(X))(`: `,` : `))+M((`t`in t?t.t:f(Y))(f(s).error)),1),f(i).command?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Y))(`Copy command`)),1)])):g(``,!0),I(`button`,{type:`button`,class:`notice-btn`,onClick:b},M((`t`in t?t.t:f(Y))(`Hide`)),1)])):f(i)&&f(i).state===`installed`?(_(),v(`div`,lg,[I(`span`,ug,M((`tl`in t?t.tl:f(X))(`Codex ${f(i).latest} installed`,`Codex ${f(i).latest} installé`))+` ·`,1),I(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly||!(`canRestart`in t?t.canRestart:f(xe))(e.pane),title:(`tl`in t?t.tl:f(X))(`Restarts Codex in this pane on the same conversation (codex resume)`,`Relance Codex dans ce panneau sur la même conversation (codex resume)`),onClick:n[0]||=n=>(`restartAgent`in t?t.restartAgent:f(kt))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Y))(`Restart to update`)),1)],8,dg)])):f(i)?(_(),v(`div`,fg,[I(`span`,{class:`restart-text`,title:f(l)},[a(M((`tl`in t?t.tl:f(X))(`Codex ${f(i).latest} available`,`Codex ${f(i).latest} disponible`)),1),f(i).current?(_(),v(`span`,mg,M(` `)+M((`tl`in t?t.tl:f(X))(`(you have ${f(i).current})`,`(tu as la ${f(i).current})`)),1)):g(``,!0),n[2]||=a(` ·`,-1)],8,pg),I(`a`,{class:`notice-btn`,href:f(i).notes,target:`_blank`,rel:`noopener noreferrer`,"aria-label":(`t`in t?t.t:f(Y))(`Release notes`),title:(`t`in t?t.t:f(Y))(`Release notes`)},[E(r,{name:`i-lucide-external-link`}),I(`span`,gg,M((`t`in t?t.t:f(Y))(`Release notes`)),1)],8,hg),f(i).runnable?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||!!f(m),title:f(m)||(f(i).method===`terminal`?(`tl`in t?t.tl:f(X))(`Exits Codex, updates it in this pane’s terminal, then resumes this conversation`,`Quitte Codex, le met à jour dans le terminal de ce panneau, puis reprend cette conversation`):void 0),onClick:y},[E(r,{name:`i-lucide-circle-arrow-up`}),a(M((`t`in t?t.t:f(Y))(`Update`)),1)],8,_g)):f(i).command?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Y))(`Copy command`)),1)])):g(``,!0),f(m)?(_(),v(`span`,vg,M(e.pane.status===`blocked`?(`tl`in t?t.tl:f(X))(`answer first`,`réponds d’abord`):(`tl`in t?t.tl:f(X))(`after this turn`,`après ce tour`)),1)):g(``,!0),I(`button`,{type:`button`,class:`notice-btn notice-x`,"aria-label":(`t`in t?t.t:f(Y))(`Hide until the next version`),title:(`t`in t?t.t:f(Y))(`Hide until the next version`),onClick:d},[E(r,{name:`i-lucide-x`})],8,yg)])):g(``,!0),f(o)?(_(),v(`div`,{key:4,class:j([`composer-notice codex-weekly`,{low:f(o).left<=10}]),role:`status`},[E(r,{name:`i-lucide-triangle-alert`,class:`notice-icon`}),I(`span`,{class:`restart-text`,title:f(u)},M(f(u)),9,bg),I(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly,title:(`t`in t?t.t:f(Y))(`Show Codex’s usage breakdown`),onClick:x},`/status`,8,xg)],2)):g(``,!0)],64)}}}),{__name:`CodexNotices`}),wg=e=>e.toLowerCase().replace(/\bwith 1m context\b/g,`(1m)`).replace(/\b1m context\b/g,`1m`).replace(/\s*\((?:default|current)\)/g,``).replace(/\s+/g,` `).trim();function Tg(e,t){if(!t)return!1;if(t.id&&e.label.includes(`/`))return e.label===t.id;let n=wg(t.label);if(wg(e.label)===n)return!0;let r=e.hint?.split(`·`)[0]?.trim()||``;return!!r&&wg(r)===n}function Eg(e,t){let n=e.findIndex(e=>!/^default\b/i.test(e.label)&&Tg(e,t));return n>=0?n:e.findIndex(e=>Tg(e,t))}var Dg={class:`model-pick-wrap`},Og={class:`model-name`},kg={class:`model-pick-wrap`},Ag=Object.assign(T({__name:`ModelPicker`,props:{pane:{}},setup(e){let t=e,r=h(!1),i=h(!1),o=h(!1),s=h(!1),c=h(!1),l=h(null),u=h(null),d=h(null),p=e=>String(e||``).trim().toLowerCase(),y=(e,t)=>!!(e&&t)&&p(e)===p(t),b=n(()=>{let e=d.value;if(e&&Date.now()-e.at<2e4&&(!y(t.pane.model?.label,e.info.label)||t.pane.model?.effort!==e.info.effort))return e.info;let n=t.pane.model;return n?{...n,effort:n.effort||u.value?.current||null}:null});B(()=>[t.pane.model?.label,t.pane.model?.effort],()=>{d.value&&y(t.pane.model?.label,d.value.info.label)&&t.pane.model?.effort===d.value.info.effort&&(d.value=null)});let x=n(()=>{if(!yn.value||jn.value||On(t.pane))return Y(`Changes unavailable offline`);let e=t.pane.status;return e===`working`?Y(`The agent is working — change the model once it’s done.`):e===`blocked`?Y(`The agent is waiting for an answer — reply first.`):null}),S=n(()=>!!x.value||c.value);async function C(e=!1){if(!o.value){o.value=!0;try{l.value=await kr(`/api/models?pane=${encodeURIComponent(t.pane.id)}${e?`&refresh=1`:``}`)}catch(e){r.value=!1,$(e.message,!0)}finally{o.value=!1}}}async function w(){if(!s.value){s.value=!0;try{u.value=await kr(`/api/efforts?pane=${encodeURIComponent(t.pane.id)}`)}catch(e){i.value=!1,$(e.message,!0)}finally{s.value=!1}}}B(r,e=>{e&&(!l.value||l.value.agent!==t.pane.agent)&&C()}),B(i,e=>{e&&!u.value&&w()}),B(()=>[yn.value,t.pane.status,t.pane.model?.label,t.pane.model?.effort],()=>{[`claude`,`codex`,`omp`].includes(t.pane.agent||``)&&[`idle`,`done`].includes(t.pane.status||``)&&!t.pane.model?.effort&&t.pane.model&&!u.value&&!x.value&&w()},{immediate:!0}),B(()=>t.pane.id,()=>{l.value=null,u.value=null,d.value=null});let T=n(()=>Eg(l.value?.options||[],b.value)),D=e=>l.value?.options.indexOf(e)===T.value,O=e=>/^default \(recommended\)$/i.test(e.label)?Y(`Default (recommended)`):e.label;async function A(e){if(!(D(e)||S.value)){c.value=!0,Q();try{let n=await kr(`/api/model`,{pane_id:t.pane.id,label:e.label});d.value={info:n.model,at:Date.now()},u.value=null,$(X(`Model: ${n.model.label} (this session)`,`Modèle : ${n.model.label} (cette session)`))}catch(e){$(e.message,!0)}finally{c.value=!1}x.value||await w()}}async function N(e){if(!(S.value||b.value?.effort===e)){c.value=!0,Q();try{let n=await kr(`/api/effort`,{pane_id:t.pane.id,level:e});d.value={info:n.model,at:Date.now()},u.value&&(u.value.current=e),$(X(`Effort: ${e} (this session)`,`Effort : ${e} (cette session)`))}catch(e){$(e.message,!0)}finally{c.value=!1}t.pane.agent===`omp`&&!x.value&&await w()}}let P=n(()=>{let e=[{type:`label`,label:Y(`For this session only`)}];return o.value||!l.value?[e,[{label:Y(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,l.value.options.map(e=>({type:`checkbox`,label:O(e),description:e.hint||void 0,checked:D(e),onSelect:()=>A(e)})),[{label:Y(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),C(!0)}}]]}),F=n(()=>{let e=[{type:`label`,label:Y(`For this session only`)}];return s.value||!u.value?[e,[{label:Y(`Reading effort levels…`),icon:`i-lucide-loader-circle`,disabled:!0}]]:[e,u.value.levels.map(e=>({type:`checkbox`,label:e,checked:b.value?.effort===e,description:e===`auto`?b.value?.effort===`auto`&&b.value.effortResolved?X(`This turn: ${b.value.effortResolved}`,`Ce tour : ${b.value.effortResolved}`):t.pane.agent===`omp`?Y(`Picks the level each turn`):void 0:void 0,onSelect:()=>N(e)}))]}),L=n(()=>{let e=b.value;return e?.effort?e.effort===`auto`&&e.effortResolved?`auto · ${e.effortResolved}`:e.effort:null}),R=n(()=>[`claude`,`codex`,`omp`].includes(t.pane.agent||``)&&!!(u.value?.levels.length||b.value?.effort&&!u.value));function z(e,t){if(t&&S.value){x.value&&$(x.value,!0);return}e===`model`?(r.value=t,t&&(i.value=!1)):(i.value=t,t&&(r.value=!1))}return B(S,e=>{e&&(r.value=!1,i.value=!1)}),(e,t)=>{let n=yt,o=oi,s=ti;return _(),v(k,null,[E(s,{text:f(x)||(`t`in e?e.t:f(Y))(`Change model`),disabled:!(`desk`in e?e.desk:f(Z))||!f(x)&&f(r),content:{side:`top`}},{default:H(()=>[I(`span`,Dg,[E(o,{open:f(r),items:f(P),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":t[0]||=e=>z(`model`,e)},{default:H(()=>[E(n,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick`,{off:f(S)}]),"aria-disabled":f(S),"aria-label":`${(`t`in e?e.t:f(Y))(`Model`)} : ${f(b)?f(b).label:(`t`in e?e.t:f(Y))(`Unknown model`)}`,"trailing-icon":f(c)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(c)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[I(`span`,Og,M(f(b)?f(b).label:(`t`in e?e.t:f(Y))(`Model`)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`])])]),_:1},8,[`text`,`disabled`]),f(R)?(_(),m(s,{key:0,text:f(x)||(`t`in e?e.t:f(Y))(`Change effort`),disabled:!(`desk`in e?e.desk:f(Z))||!f(x)&&f(i),content:{side:`top`}},{default:H(()=>[I(`span`,kg,[E(o,{open:f(i),items:f(F),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu effort-menu`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":t[1]||=e=>z(`effort`,e)},{default:H(()=>[E(n,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick effort-pick`,{off:f(S)}]),"aria-disabled":f(S),"aria-label":`${(`t`in e?e.t:f(Y))(`Effort`)} : ${f(L)||(`t`in e?e.t:f(Y))(`Unknown effort`)}`,"trailing-icon":f(c)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(c)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[a(M(f(L)||(`t`in e?e.t:f(Y))(`Effort`)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`])])]),_:1},8,[`text`,`disabled`])):g(``,!0)],64)}}}),{__name:`ModelPicker`}),jg={slots:{base:``}},Mg=Object.assign({inheritAttrs:!1},{__name:`UChatPromptSubmit`,props:{status:{type:String,required:!1,default:`ready`},icon:{type:[String,Boolean],required:!1,skipCheck:!0},color:{type:null,required:!1},variant:{type:null,required:!1},streamingIcon:{type:null,required:!1},streamingColor:{type:null,required:!1,default:`neutral`},streamingVariant:{type:null,required:!1,default:`subtle`},submittedIcon:{type:null,required:!1},submittedColor:{type:null,required:!1,default:`neutral`},submittedVariant:{type:null,required:!1,default:`subtle`},errorIcon:{type:null,required:!1},errorColor:{type:null,required:!1,default:`error`},errorVariant:{type:null,required:!1,default:`soft`},ui:{type:Object,required:!1},class:{type:null,required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},emits:[`stop`,`reload`],setup(e,{emit:r}){let i=e,a=r,o=O(),s=Le(`chatPromptSubmit`,i),{t:c}=mi(),l=pn(),u=ae(he(s,`icon`,`color`,`variant`,`status`,`disabled`,`streamingIcon`,`streamingColor`,`streamingVariant`,`submittedIcon`,`submittedColor`,`submittedVariant`,`errorIcon`,`errorColor`,`errorVariant`,`class`,`ui`)),p=n(()=>s.status===`ready`&&s.disabled),h=n(()=>({ready:{icon:s.icon===!1?void 0:s.icon??l.ui.icons.arrowUp,color:s.color,variant:s.variant,type:`submit`},submitted:{icon:s.submittedIcon||l.ui.icons.stop,color:s.submittedColor,variant:s.submittedVariant,onClick(e){a(`stop`,e)}},streaming:{icon:s.streamingIcon||l.ui.icons.stop,color:s.streamingColor,variant:s.streamingVariant,onClick(e){a(`stop`,e)}},error:{icon:s.errorIcon||l.ui.icons.reload,color:s.errorColor,variant:s.errorVariant,onClick(e){a(`reload`,e)}}})[s.status]),g=n(()=>fe({extend:jg,...l.ui?.chatPromptSubmit||{}})());return(e,n)=>(_(),m(yt,z({...f(u),...h.value,disabled:p.value,"aria-label":f(c)(`chatPromptSubmit.label`),...e.$attrs},{class:g.value.base({class:[f(s).ui?.base,f(s).class]}),ui:f(Lt)(g.value,f(s).ui)}),x({_:2},[y(o,(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R(t(n)))])}))]),1040,[`class`,`ui`]))}});function Ng(e){let t=!1;function n(e){return e.isComposing||e.keyCode===229}function r(r){t||n(r)||(r.preventDefault(),e(r))}let i;function a(){clearTimeout(i),t=!0,i=setTimeout(()=>{t=!1},50)}return{onKeydown:r,onCompositionEnd:a}}var Pg={slots:{root:`relative flex flex-col items-stretch gap-2 px-2.5 py-2 w-full rounded-lg backdrop-blur-sm`,header:`flex items-center gap-1.5`,body:`items-start gap-1.5`,footer:`flex items-center justify-between gap-1.5`,base:`px-0`},variants:{color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{outline:{root:`bg-default/75 ring ring-default`},soft:{root:`bg-elevated/50`},subtle:{root:`bg-elevated/50 ring ring-default`},naked:{root:``}}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-primary has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-primary`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-neutral has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-neutral`}},{color:`success`,variant:[`outline`,`subtle`],class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-success has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-success`}},{color:`warning`,variant:[`outline`,`subtle`],class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-warning has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-warning`}},{color:`error`,variant:[`outline`,`subtle`],class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-error has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-error`}},{color:`info`,variant:[`outline`,`subtle`],class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-info has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-info`}},{color:`primary`,variant:`soft`,class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:`soft`,class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`success`,variant:`soft`,class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`warning`,variant:`soft`,class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`error`,variant:`soft`,class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`info`,variant:`soft`,class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-inverted has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-inverted`}},{color:`neutral`,variant:`soft`,class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}}],defaultVariants:{color:`primary`,variant:`outline`}},Fg=Object.assign({inheritAttrs:!1},{__name:`UChatPrompt`,props:V({as:{type:null,required:!1,default:`form`},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},submitOnEnter:{type:Boolean,required:!1,default:!0},error:{type:Error,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},rows:{type:Number,required:!1,default:1},autofocus:{type:Boolean,required:!1,default:!0},autofocusDelay:{type:Number,required:!1},autoresize:{type:Boolean,required:!1,default:!0},autoresizeDelay:{type:Number,required:!1},maxrows:{type:Number,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},disabled:{type:Boolean,required:!1}},{modelValue:{type:String,default:``},modelModifiers:{}}),emits:V([`submit`,`close`],[`update:modelValue`]),setup(e,{expose:r,emit:i}){let a=e,o=i,s=O(),c=Le(`chatPrompt`,a),l=D(e,`modelValue`,{type:String,default:``}),{t:u}=mi(),p=pn(),h=ae(ye(c,`rows`,`autofocus`,`autofocusDelay`,`autoresize`,`autoresizeDelay`,`maxrows`,`icon`,`avatar`,`loading`,`loadingIcon`)),C=()=>Se(s,[`header`,`footer`,`body`]),w=n(()=>fe({extend:Pg,...p.ui?.chatPrompt||{}})({color:c.color,variant:c.variant})),T=b(`textareaRef`);function k(e){l.value.trim()!==``&&o(`submit`,e??new Event(`submit`))}function A(e){T.value?.textareaRef?.blur(),o(`close`,e??new Event(`close`))}let{onKeydown:M,onCompositionEnd:N}=Ng(e=>{k(e)});function P(e){if(c.submitOnEnter){if(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)return}else if(!e.ctrlKey&&!e.metaKey)return;M(e)}function F(e){e.key===`Enter`?P(e):e.key===`Escape`&&A(e)}return r({textareaRef:S(()=>T.value?.textareaRef)}),(e,n)=>(_(),m(f(et),{as:f(c).as,"data-slot":e.$attrs[`data-slot`]??`root`,class:j(w.value.root({class:[f(c).ui?.root,f(c).class]})),onSubmit:q(k,[`prevent`])},{default:H(()=>[s.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(w.value.header({class:f(c).ui?.header}))},[d(e.$slots,`header`)],2)):g(``,!0),d(e.$slots,`body`,{submit:k,close:A,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,ui:w.value},()=>[E(Bi,z({ref_key:`textareaRef`,ref:T,modelValue:l.value,"onUpdate:modelValue":n[0]||=e=>l.value=e,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,variant:`none`,fixed:``},{...f(h),...e.$attrs},{ui:f(Lt)(f(Se)(w.value,[`root`,`body`,`header`,`footer`]),f(c).ui),"data-slot":`body`,class:w.value.body({class:f(c).ui?.body}),onKeydown:F,onCompositionend:f(N)}),x({_:2},[y(C(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R(t(n)))])}))]),1040,[`modelValue`,`placeholder`,`disabled`,`ui`,`class`,`onCompositionend`])]),s.footer?(_(),v(`div`,{key:1,"data-slot":`footer`,class:j(w.value.footer({class:f(c).ui?.footer}))},[d(e.$slots,`footer`)],2)):g(``,!0)]),_:3},8,[`as`,`data-slot`,`class`]))}}),Ig=e=>e.split(`
84
+ `).filter(e=>!An(e)).join(`
85
+ `).trim();function Lg(e,t){let n=Ig(t);return!n||e.at(-1)===n?e:[...e,n].slice(-100)}function Rg(e,t){return e.defaultPrevented||e.isComposing||e.keyCode===229||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||t.start!==t.end?null:e.key===`ArrowUp`&&!t.text.slice(0,t.start).includes(`
86
+ `)?-1:e.key===`ArrowDown`&&!t.text.slice(t.end).includes(`
87
+ `)?1:null}var zg=class{snapshot=[];index=0;draft=null;reset(){this.draft=null,this.snapshot=[],this.index=0}move(e,t,n){if(!this.draft){if(e===1||!n.length)return null;this.draft={...t},this.snapshot=[...n],this.index=n.length}let r=Math.max(0,this.index+e);if(r===this.index)return null;if(r>=this.snapshot.length){let e=this.draft;return this.reset(),e}this.index=r;let i=this.snapshot[r];return{text:i,start:i.length,end:i.length}}},Bg=new Map,Vg=e=>`prompt-history:${e}`;function Hg(e){let t=Bg.get(e);if(!t){t=[];try{let n=JSON.parse(localStorage.getItem(Vg(e))||`[]`);Array.isArray(n)&&(t=n.filter(e=>typeof e==`string`&&!!e.trim()).slice(-100))}catch{}Bg.set(e,t)}return t}function Ug(e,t){let n=Lg(Hg(e),t);Bg.set(e,n);try{localStorage.setItem(Vg(e),JSON.stringify(n))}catch{}}function Wg(e){return e.split(`
88
+ `).map(e=>{let t=e.startsWith(`↳`)?mr(e):null;return t?{ref:!0,head:t.head,text:t.ref.excerpt,tail:t.tail}:{ref:!1,head:``,text:e,tail:``}})}var Gg=`fontFamily.fontSize.fontWeight.fontStyle.fontStretch.fontVariant.fontKerning.fontFeatureSettings.fontVariationSettings.fontVariantLigatures.fontOpticalSizing.lineHeight.letterSpacing.wordSpacing.textTransform.textIndent.textRendering.tabSize.whiteSpace.overflowWrap.wordBreak.hyphens.direction.paddingTop.paddingRight.paddingBottom.paddingLeft.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.boxSizing`.split(`.`);function Kg(e){let t=e.parentElement,n=document.createElement(`div`);n.className=`qm-mirror`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`div`);n.append(r),t.insertBefore(n,e),t.classList.add(`qm-host`),e.classList.add(`qm-on`);let i=!0;function a(){r.style.transform=`translateY(${-e.scrollTop}px)`}function o(){if(!i)return;let t=getComputedStyle(e);for(let e of Gg)n.style[e]=t[e];n.style.borderStyle=`solid`,n.style.borderColor=`transparent`;let r=e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth);n.style.paddingRight=`${parseFloat(t.paddingRight)+Math.max(0,r)}px`,n.style.top=`${e.offsetTop}px`,n.style.left=`${e.offsetLeft}px`,n.style.width=`${e.offsetWidth}px`,n.style.height=`${e.offsetHeight}px`,n.style.setProperty(`--qm-pl`,t.paddingLeft),n.style.setProperty(`--qm-pr`,n.style.paddingRight),a()}function s(){r.textContent=``;for(let t of Wg(e.value)){let e=document.createElement(`div`);if(t.ref){e.className=`qm-q`;let n=document.createElement(`span`);n.className=`qm-a`,n.textContent=t.head.slice(0,1);let r=document.createElement(`span`);r.className=`qm-h`,r.textContent=t.head.slice(1);let i=document.createElement(`span`);i.className=`qm-h`,i.textContent=t.tail,e.append(n,r,t.text,i)}else e.append(t.text||`​`);r.append(e)}o()}e.addEventListener(`input`,s),e.addEventListener(`scroll`,a,{passive:!0});let c=new ResizeObserver(o);return c.observe(e),document.fonts?.ready.then(o),s(),{render:s,destroy(){i=!1,c.disconnect(),e.removeEventListener(`input`,s),e.removeEventListener(`scroll`,a),e.classList.remove(`qm-on`),t.classList.remove(`qm-host`),n.remove()}}}var qg=[`data-agent`],Jg={class:`restart-text`},Yg={class:`restart-text`},Xg={class:`restart-text`},Zg={class:`restart-text`},Qg={class:`restart-text`},$g=[`disabled`],e_={key:5,class:`composer-notice codex-field`,role:`status`},t_=[`title`],n_=[`disabled`,`title`],r_={class:`notice-label`},i_=[`aria-label`],a_=[`aria-selected`,`onMousemove`,`onClick`],o_={class:`slash-name`},s_={key:0},c_={class:`slash-desc`},l_={key:1,class:`slash-denied`,role:`status`},u_={class:`slash-denied-label`},d_={class:`dir-denied-path`},f_={key:8,class:`composer-ask-anchor`},p_=[`aria-label`],m_={class:`composer-quotes-label`},h_={class:`composer-quote-text`},g_=[`aria-label`,`onClick`],__={class:`attachments`},v_=[`aria-label`,`onClick`,`onKeydown`],y_=[`src`],b_={key:0,class:`spinner`},x_=[`aria-label`,`onClick`],S_={key:1,class:`prompt-hint`},C_={key:2,class:`prompt-hint`},w_={key:3,class:`prompt-hint`},T_=[`title`],E_={class:`composer-status-line`},D_={key:0,class:`composer-status-meters`},O_=Object.assign(T({__name:`Composer`,props:{pane:{},paneId:{},sendKeys:{type:Function},conversation:{type:Boolean},escStops:{type:Boolean},takeBack:{type:Boolean},unanswered:{}},emits:[`sent`,`showTerminal`,`showUnanswered`],setup(e,{expose:t,emit:i}){let o=e,s=i,c=n(()=>X(`Text typed in Codex’s terminal, or arrived there by mistake: your next message would be sent after it.`,`Texte tapé dans le terminal de Codex, ou arrivé là par erreur : ton prochain message serait envoyé à sa suite.`)),l=h(!1);async function u(){l.value=!0;try{await o.sendKeys(Array.from({length:10},()=>[`ctrl+u`,`backspace`]).flat())}finally{l.value=!1}}let d=n(()=>/\b(failed|error)\b/i.test(o.pane?.claudeNotice||``)),p=n(()=>!!(o.pane?.claudeNotice&&/Restart to update/i.test(o.pane.claudeNotice)&&xe(o.pane))),b=n(()=>{let e=o.pane?.restart;if(!e)return``;let t=zn(e.agent);return e.update&&e.phase===`stopping`?X(`Exiting ${t}…`,`Fermeture de ${t}…`):e.phase===`updating`?X(`Updating ${t} in its terminal…`,`Mise à jour de ${t} dans son terminal…`):e.phase===`stopping`?X(`Stopping ${t}…`,`Arrêt de ${t}…`):X(`Restarting ${t} on the same conversation…`,`Relance de ${t} sur la même conversation…`)});async function C(){let e=o.pane?.restart?.update;if(e)try{await navigator.clipboard.writeText(e),$(X(`Command copied: paste it into the terminal of this pane.`,`Commande copiée : colle-la dans le terminal de ce panneau.`))}catch{$(Y(`Copy failed`),!0)}}let T=Ui(o.paneId),D=S(T,`text`),O=h(null),A=n(()=>O.value?.textareaRef||null),N=h(null),F=h(null),L=h(!1),R=n(()=>Z.value&&!Tr&&!Rn),z=S(T,`atts`),V=n(()=>xn(D.value)),ee=null;B([()=>ur.value===`native`&&V.value.length>0,A],([e,t])=>{ee&&(!e||!t)&&(ee.destroy(),ee=null),e&&t&&!ee&&(ee=Kg(t))},{immediate:!0,flush:`post`}),B(D,()=>P(()=>ee?.render()),{flush:`post`}),U(()=>{ee?.destroy(),ee=null});let te=n(()=>!!(D.value.trim()||z.value.length)),K=n(()=>!!(o.pane?.stopped||o.pane?.prompt?.unavailable)||!yn.value||jn.value||On(o.pane)),ne=n(()=>!!(o.pane&&o.pane.agent===`omp`&&o.pane.ompShell&&o.pane.status!==`working`)),re=n(()=>!(K.value||!o.pane||!o.pane.agent||o.pane.status!==`working`&&!ne.value||te.value)),ie=n(()=>!K.value&&!te.value&&o.pane?.claudeSuggestion||null);function ae(){let e=ie.value;e&&(D.value=e,Ze())}let oe=n(()=>{let e=o.pane;return e?e.status===`blocked`?Y(`Type a reply…`):ie.value?ie.value:e.agent?X(`Message to ${zn(e.agent)}…`,`Message à ${zn(e.agent)}…`):Y(`Command…`):Y(`Message to agent…`)});function se(e){if(Ue.value&&!e.isComposing){let t=Ve.value.length;if(e.key===`ArrowDown`){e.preventDefault(),Ge=`kb`,Ie.value=(Ie.value+1)%t;return}if(e.key===`ArrowUp`){e.preventDefault(),Ge=`kb`,Ie.value=(Ie.value-1+t)%t;return}if(e.key===`Escape`){e.preventDefault(),Le.value=!0;return}if(e.key===`Tab`||R.value&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),qe(Ve.value[Ie.value]||Ve.value[0]);return}}if(e.key===`Tab`&&!e.shiftKey&&!e.isComposing&&ie.value&&!D.value){e.preventDefault(),ae();return}R.value&&e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&!D.value.trim()&&(e.preventDefault(),me())}let ce=new zg;function le(e){let t=A.value;if(!t||e.target!==t||Ue.value||L.value)return;let n={text:t.value,start:t.selectionStart,end:t.selectionEnd},r=Rg(e,n);if(r===null)return;let i=ce.move(r,n,Hg(o.paneId));i&&(e.preventDefault(),D.value=i.text,Le.value=!0,P(()=>{Le.value=!0,t.setSelectionRange(i.start,i.end)}))}w(()=>window.addEventListener(`keydown`,le)),U(()=>{window.removeEventListener(`keydown`,le),ce.draft&&(D.value=ce.draft.text)});function de(e){Ug(o.paneId,e),ce.reset()}function fe(e){e.preventDefault(),me()}let pe=n(()=>Z.value&&!re.value);async function me(){if(K.value)return $(Y(`Sending unavailable offline`),!0);if(re.value)return _e();if(z.value.some(e=>!e.paste&&!e.path))return $(Y(z.value.some(e=>!e.path&&e.file)?`File is uploading…`:`Photo is uploading…`));let e=z.value.flatMap(e=>e.paste?[e.paste]:[]),t=z.value.flatMap(e=>e.paste?[]:[e.ref||e.path]),n=D.value,r=nt(n,e,t);if(!r||L.value)return;let i=o.pane,a=i&&i.status===`blocked`?i.prompt:null,c=a?a.options.findIndex(e=>e.free):-1;if(c<0&&Ft(i)&&!wc(r)){de(n),D.value=``,ye(),Mt(e),Q(),s(`sent`,null),oa(i,o.paneId,r).then(()=>s(`sent`,null),e=>$(e.message,!0));return}L.value=!0,Mt(e);try{let e=null;if(a&&c>=0){if(!await He(o.paneId,c,a.options[c].label,a.identity,{text:r,question:a.question}))return}else e=await Ht(i,o.paneId,r);de(n),D.value=``,ye(),Q(),s(`sent`,e);let l=r.split(/\s/)[0],u=Me.get(o.paneId)?.list||Ne.value;c<0&&i&&i.agent&&!t.length&&/^\/\S+$/.test(l)&&!r.includes(`
89
+ `)&&!_t(l,u)&&De(o.paneId,l,u.some(e=>e.source===`builtin`&&`/${e.name}`===l))}catch(e){$(e.message,!0)}finally{L.value=!1}}let he=h(null),ge=h(!1);async function _e(){if(he.value!==`running`){Q(),he.value=`running`,ge.value=ne.value;try{let e=await kr(`/api/interrupt`,{pane_id:o.paneId,restore:!!o.takeBack});if(he.value=e.stopped?null:`failed`,ge.value=!!e.shell,e.shell){e.stopped&&$(X(`Command cancelled`,`Commande annulée`));return}if(e.restored!==void 0){Pi(T,e.restored),Ze();let t=X(`Stopped: your message is back in the field`,`Arrêté : ton message est revenu dans le champ`);e.lost?$(t,!0,Fi(e.lost)):$(t)}else e.stopped&&$(e.background?X(`Agent stopped (${e.background} background task${e.background>1?`s`:``} stopped)`,`Agent arrêté (${e.background} tâche${e.background>1?`s`:``} de fond arrêtée${e.background>1?`s`:``})`):Y(`Agent stopped`))}catch(e){he.value=null,$(e.message,!0)}}}B(()=>o.pane?.status,e=>{he.value===`failed`&&!ge.value&&e!==`working`&&(he.value=null)}),B(ne,e=>{he.value===`failed`&&ge.value&&!e&&(he.value=null)});function ve(){return!o.escStops||!re.value||L.value||he.value===`running`?!1:(_e(),A.value?.focus(),!0)}function ye(){for(let e of z.value)e.url&&URL.revokeObjectURL(e.url);z.value=[]}function be(e){an.value=e.url}function Se(e){let[t]=z.value.splice(e,1);t&&t.url&&URL.revokeObjectURL(t.url)}B(()=>z.value.length,()=>P(Qi)),B(D,()=>P(()=>{let e=A.value;!e||e.scrollHeight<=e.clientHeight||document.activeElement!==e||e.selectionEnd>=e.value.length-1&&(e.scrollTop=e.scrollHeight)}));async function Ce(e){for(let t of e){let e=r({url:URL.createObjectURL(t),path:null});z.value.push(e);try{let n=await Gm(o.paneId,t);e.path=n.path,e.name=n.name}catch(t){$(`${Y(`Photo upload failed`)} : ${t.message}`,!0),z.value=z.value.filter(t=>t!==e),URL.revokeObjectURL(e.url)}}}async function we(e){let t=o.pane,{images:n,files:r,refused:i}=await Xi(e,t?.agent);if(i.length){let e=zn(t?.agent),n=i.map(e=>e.file.name).join(`, `),r=[...new Set(i.map(t=>Vi(t.reason,e,t.kind)))];$(X(`Not attached: ${n}`,`Non joint : ${n}`),!0,r.join(` · `))}n.length&&Ce(n);for(let e of r)Te(e.file,e.kind);return n.length+r.length}async function Te(e,t){let n=r({url:``,path:null,file:{label:e.name,size:e.size,kind:t}});z.value.push(n);try{let t=await fetch(`/api/attach?pane=${encodeURIComponent(o.paneId)}&name=${encodeURIComponent(e.name)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:e}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(Y(r.error||`HTTP ${t.status}`));n.path=r.path,n.name=r.name,n.ref=r.ref}catch(t){$(`${e.name} : ${Y(`File upload failed`)} — ${t.message}`,!0),z.value=z.value.filter(e=>e!==n)}}function Oe(e){let t=e.target,n=[...t.files||[]];t.value=``,we(n)}function ke(e){let t=[...e.clipboardData&&e.clipboardData.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e);if(!t.length){let t=(e.clipboardData?.getData(`text/plain`)||``).replace(/\r\n?/g,`
90
+ `);if(Qe(t)){e.preventDefault(),Ae(t);return}let n=Vr(t);if(n===t)return;e.preventDefault();let r=e.target,i=r.value;if(!(typeof document.execCommand==`function`&&document.execCommand(`insertText`,!1,n))||r.value===i){let e=r.selectionStart??i.length;r.value=i.slice(0,e)+n+i.slice(r.selectionEnd??e),r.setSelectionRange(e+n.length,e+n.length),r.dispatchEvent(new Event(`input`,{bubbles:!0}))}return}e.preventDefault(),we(t),Q()}function Ae(e){z.value.push({url:``,path:null,paste:e}),Q()}async function je(){if(!navigator.clipboard||!navigator.clipboard.read)return $(Y(`Clipboard unavailable here — paste into the message field.`),!0);try{let e=[];for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));n&&e.push(new File([await t.getType(n)],`presse-papiers.${n.split(`/`)[1]}`,{type:n}))}if(!e.length)return $(Y(`No image in the clipboard`),!0);Ce(e)}catch(e){let t=e;$(t.name===`NotAllowedError`?Y(`Paste denied`):`${Y(`Paste failed`)} : ${t.message}`,!0)}}let Me=new Map,Ne=h([]),Pe=h(null),Ie=h(0),Le=h(!1),Re=h(null),ze=n(()=>{let e=/^\/(\S*)$/.exec(D.value);return o.pane&&o.pane.agent&&e?e[1].toLowerCase():null});async function Be(){let e=o.paneId,t=Me.get(e);if(!(t&&(Ne.value=t.list,Pe.value=t.denied,Date.now()-t.at<15e3)))try{let n=await kr(`/api/commands?pane=${encodeURIComponent(e)}`);if(n.partial&&t)return;let r=n.denied?{remote:!!n.remote}:null;n.partial||Me.set(e,{at:Date.now(),list:n.commands,denied:r}),e===o.paneId&&(Ne.value=n.commands,Pe.value=r)}catch{}}B(ze,(e,t)=>{if(e===null){Le.value=!1;return}t??Be(),Ie.value=0}),B(()=>o.paneId,()=>{Ne.value=[],Pe.value=null});let Ve=n(()=>{let e=ze.value;if(e===null)return[];let t=[],n=[],r=[];for(let i of Ne.value){let a=i.name.toLowerCase();a.startsWith(e)?t.push(i):a.includes(e)?n.push(i):e.length>1&&i.desc.toLowerCase().includes(e)&&r.push(i)}return[...t,...n,...r]}),Ue=n(()=>ze.value!==null&&!Le.value&&(Ve.value.length>0||!!Pe.value)&&(Ve.value.length!==1||Ve.value[0].name.toLowerCase()!==ze.value)),Ge=``;function Ke(e,t){let n=`${e.screenX},${e.screenY}`,r=Ge===`kb`;n!==Ge&&(Ge=n,!r&&(Ie.value=t))}function qe(e){D.value=`/${e.name} `,Q(),P(()=>A.value?.focus())}B(Ie,e=>P(()=>{(Re.value?.children[e])?.scrollIntoView({block:`nearest`})}));let Je={claude:[[`/compact`,`Summarize context`],[`/clear`,`New conversation`],[`/context`,`Context usage`],[`/usage`,`Plan usage`],[`/model`,`Change model`],[`/review`,`Code review`]],codex:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/status`,`Session status`],[`/model`,`Change model`],[`/review`,`Code review`],[`/diff`,`View diff`]],omp:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/plan`,`Plan mode`],[`/model`,`Change model`],[`/fast`,`Priority service tier`]]};function Ye(){let e=o.pane;if(!e)return;let t=[{label:Y(`Photo or screenshot`),icon:`i-lucide-image`,run:()=>N.value?.click()},{label:e.agent===`claude`?Y(`File (PDF, text, code)`):Y(`File (text, code)`),icon:`i-lucide-paperclip`,run:()=>F.value?.click()},{label:Y(`Paste copied image`),icon:`i-lucide-clipboard-paste`,run:je}];if(e.agent){t.push({kind:`separator`}),t.push({kind:`command`,cmd:`esc`,desc:Y(`Interrupt agent`),run:()=>o.sendKeys([`esc`])});for(let[n,r]of Je[e.agent]||[])t.push({kind:`command`,cmd:n,desc:Y(r),run:()=>Xe(n)});t.push({kind:`note`,label:Y(`Commands that open a menu (model…) can then be controlled in the Terminal tab.`)})}Fe(t)}async function Xe(e,t=!0){try{await kr(`/api/prompt`,{pane_id:o.paneId,text:e}),Ug(o.paneId,e),Q()}catch(e){return $(e.message,!0)}t&&De(o.paneId,e)}function Ze(){A.value?.focus(),P(()=>{let e=A.value;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight)})}return t({focus:()=>A.value?.focus(),focusEnd:Ze,blur:()=>A.value?.blur(),addImages:Ce,addFiles:we,stop:ve}),(t,n)=>{let r=Ee,i=ig,o=Cg,h=wo,S=po,w=yt,T=Ag,A=ue,P=Mg,B=Fg;return _(),v(`div`,{class:`composer`,"data-agent":e.pane?.agent||void 0},[f(he)?(_(),v(`div`,{key:0,class:j([`composer-notice restart`,{failed:f(he)===`failed`}]),role:`status`},[f(he)===`failed`?(_(),v(k,{key:0},[I(`span`,Jg,M(f(ge)?(`tl`in t?t.tl:f(X))(`The command is still running.`,`La commande tourne encore.`):(`t`in t?t.t:f(Y))(`The agent is still working.`)),1),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[0]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Y))(`View terminal`)),1),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[1]||=e=>he.value=null},M((`t`in t?t.t:f(Y))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[14]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,Yg,M(f(ge)?(`tl`in t?t.tl:f(X))(`Cancelling the command…`,`Annulation de la commande…`):(`t`in t?t.t:f(Y))(`Stopping…`)),1)],64))],2)):e.pane?.restart?(_(),v(`div`,{key:1,class:j([`composer-notice restart`,e.pane.restart.phase]),role:`status`},[e.pane.restart.phase===`failed`?(_(),v(k,{key:0},[I(`span`,Xg,M(e.pane.restart.update?(`t`in t?t.t:f(Y))(`Codex update failed`):(`t`in t?t.t:f(Y))(`Restart failed`))+M((`tl`in t?t.tl:f(X))(`: `,` : `))+M((`t`in t?t.t:f(Y))(e.pane.restart.error||``)),1),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[2]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Y))(`View terminal`)),1),e.pane.restart.update?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:C},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Y))(`Copy command`)),1)])):g(``,!0),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[3]||=n=>(`dismissRestart`in t?t.dismissRestart:f(We))(e.paneId)},M((`t`in t?t.t:f(Y))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[15]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,Zg,M(f(b)),1)],64))],2)):e.conversation&&e.pane?.usageLimit?(_(),m(i,{key:2,limit:e.pane.usageLimit,"read-only":f(K),"send-keys":e.sendKeys,onCredits:n[4]||=e=>Xe(`/usage-credits`,!1)},null,8,[`limit`,`read-only`,`send-keys`])):e.pane?.claudeNotice?(_(),v(`div`,{key:3,class:j([`composer-notice`,{error:f(d)}]),role:`status`},[f(p)?(_(),v(k,{key:0},[I(`span`,Qg,M(e.pane.claudeNotice.replace(/\s*·\s*Restart to update\b.*$/,``))+` ·`,1),I(`button`,{type:`button`,class:`notice-btn`,disabled:f(K),onClick:n[5]||=n=>(`restartAgent`in t?t.restartAgent:f(kt))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Y))(`Restart to update`)),1)],8,$g)],64)):(_(),v(k,{key:1},[a(M(f(d)&&!/^[✗✘]/.test(e.pane.claudeNotice)?`✘ ${e.pane.claudeNotice}`:e.pane.claudeNotice),1)],64))],2)):e.pane?.codexStatus?(_(),m(o,{key:4,pane:e.pane,"pane-id":e.paneId,"read-only":f(K)},null,8,[`pane`,`pane-id`,`read-only`])):g(``,!0),e.pane?.agent===`codex`&&e.pane.codexField&&!f(he)?(_(),v(`div`,e_,[E(r,{name:`i-lucide-text-cursor-input`,class:`notice-icon`}),I(`span`,{class:`restart-text`,title:f(c)},[a(M((`tl`in t?t.tl:f(X))(`In Codex’s field:`,`Dans le champ de Codex :`))+` `,1),I(`code`,null,M(e.pane.codexField),1)],8,t_),I(`button`,{type:`button`,class:`notice-btn`,disabled:f(K)||f(l),title:f(c),onClick:u},M((`tl`in t?t.tl:f(X))(`Clear`,`Vider`)),9,n_),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[6]||=e=>s(`showTerminal`)},[E(r,{name:`i-lucide-terminal`}),I(`span`,r_,M((`t`in t?t.t:f(Y))(`View terminal`)),1)])])):g(``,!0),f(ie)&&!f(R)?(_(),v(`button`,{key:6,type:`button`,class:`composer-suggest`,onMousedown:n[7]||=q(()=>{},[`prevent`]),onClick:ae},[E(r,{name:`i-lucide-corner-down-left`}),a(` `+M((`t`in t?t.t:f(Y))(`Use suggestion`)),1)],32)):g(``,!0),f(Ue)?(_(),v(`div`,{key:7,class:`slash-menu`,role:`listbox`,"aria-label":(`t`in t?t.t:f(Y))(`Commands`)},[f(Ve).length?(_(),v(`div`,{key:0,ref_key:`slashListEl`,ref:Re,class:`slash-list`},[(_(!0),v(k,null,y(f(Ve),(e,t)=>(_(),v(`button`,{key:e.name,type:`button`,role:`option`,class:j([`slash-item`,{on:t===f(Ie)}]),"aria-selected":t===f(Ie),onMousedown:n[8]||=q(()=>{},[`prevent`]),onMousemove:e=>Ke(e,t),onClick:t=>qe(e)},[I(`span`,o_,[a(`/`+M(e.name),1),e.hint?(_(),v(`small`,s_,M(e.hint),1)):g(``,!0)]),I(`span`,c_,M(e.desc),1)],42,a_))),128))],512)):g(``,!0),f(Pe)?(_(),v(`div`,l_,[I(`p`,u_,[E(r,{name:`i-lucide-shield-alert`}),a(M((`tl`in t?t.tl:f(X))(`macOS hides this project’s commands`,`macOS masque les commandes de ce projet`)),1)]),I(`p`,null,[a(M((`tl`in t?t.tl:f(X))(`Typed in full, they still work. To list them, on the Mac:`,`Tapées en entier, elles marchent quand même. Pour les lister, sur le Mac :`))+` `,1),I(`span`,d_,M(f(Pe).remote?(`tl`in t?t.tl:f(X))(`System Settings › General › Sharing › Remote Login ⓘ › “Allow full disk access for remote users”`,`Réglages Système › Général › Partage › Session à distance ⓘ › « Autoriser l’accès complet au disque pour les utilisateurs distants »`):(`tl`in t?t.tl:f(X))(`System Settings › Privacy & Security › Full Disk Access`,`Réglages Système › Confidentialité et sécurité › Accès complet au disque`)),1)])])):g(``,!0)],8,i_)):g(``,!0),e.unanswered&&!f(K)?(_(),v(`div`,f_,[I(`button`,{type:`button`,class:`composer-ask`,onMousedown:n[9]||=q(()=>{},[`prevent`]),onClick:n[10]||=e=>s(`showUnanswered`)},[E(r,{name:`i-lucide-arrow-up`}),I(`span`,null,M(e.unanswered>1?(`tl`in t?t.tl:f(X))(`${e.unanswered} questions unanswered`,`${e.unanswered} questions sans réponse`):(`tl`in t?t.tl:f(X))(`1 question unanswered`,`1 question sans réponse`)),1)],32)])):g(``,!0),f(V).length?(_(),v(`div`,{key:9,class:`composer-quotes`,role:`list`,"aria-label":(`t`in t?t.t:f(Y))(`Quoted questions`)},[I(`span`,m_,`↳ `+M(f(V).length),1),(_(!0),v(k,null,y(f(V),e=>(_(),v(`span`,{key:e.start,class:`composer-quote`,role:`listitem`},[I(`span`,h_,M(e.excerpt),1),I(`button`,{type:`button`,class:`composer-quote-x`,"aria-label":(`t`in t?t.t:f(Y))(`Remove quote`),onMousedown:n[11]||=q(()=>{},[`prevent`]),onClick:t=>D.value=f(qr)(f(D),e)},[E(r,{name:`i-lucide-x`})],40,g_)]))),128))],8,p_)):g(``,!0),E(B,{ref_key:`promptRef`,ref:O,modelValue:f(D),"onUpdate:modelValue":n[13]||=e=>W(D)?D.value=e:null,disabled:!!e.pane?.stopped,placeholder:e.pane?.stopped?(`t`in t?t.t:f(Y))(`Restart Codex before sending a message`):f(K)?(`t`in t?t.t:f(Y))(`Draft saved — sending unavailable offline`):f(oe),variant:`outline`,color:`neutral`,rows:1,maxrows:7,autofocus:!1,"submit-on-enter":f(R)&&!f(Ue),enterkeyhint:f(R)?`send`:`enter`,autocapitalize:`sentences`,class:`prompt`,ui:{header:`prompt-head`,body:`prompt-body`,base:`prompt-input`,footer:`prompt-foot`},onSubmit:me,onKeydown:se,onPaste:ke},x({footer:H(()=>[E(w,{icon:`i-lucide-plus`,color:`neutral`,variant:`outline`,size:`sm`,class:`prompt-plus`,disabled:f(K),"aria-label":(`t`in t?t.t:f(Y))(`Photo, file, paste, commands`),onClick:Ye},null,8,[`disabled`,`aria-label`]),I(`input`,{ref_key:`fileInput`,ref:N,type:`file`,accept:`image/*`,multiple:``,hidden:``,onChange:Oe},null,544),I(`input`,{ref_key:`anyFileInput`,ref:F,type:`file`,multiple:``,hidden:``,"data-testid":`attach-any`,onChange:Oe},null,544),e.pane&&(e.pane.agent===`claude`||e.pane.agent===`codex`||e.pane.agent===`omp`)?(_(),m(T,{key:0,pane:e.pane},null,8,[`pane`])):g(``,!0),f(pe)&&f(ie)?(_(),v(`span`,S_,[E(A,{value:`tab`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Y))(`suggestion`))+` `,1),n[16]||=I(`span`,{class:`sep`},`·`,-1),n[17]||=a(),E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Y))(`send`)),1)])):f(pe)?(_(),v(`span`,C_,[E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Y))(`send`))+` `,1),n[18]||=I(`span`,{class:`sep`},`·`,-1),n[19]||=a(),E(A,{value:`shift`,size:`sm`}),E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Y))(`new line`)),1)])):(`desk`in t?t.desk:f(Z))&&e.escStops&&f(re)&&f(he)!==`running`?(_(),v(`span`,w_,[E(A,{value:`escape`,size:`sm`}),a(` `+M((`tl`in t?t.tl:f(X))(`stop`,`arrêter`)),1)])):g(``,!0),E(P,{status:f(re)?`streaming`:`ready`,disabled:f(K)||!f(te)&&!f(re)||f(L)||f(he)===`running`,color:`primary`,variant:`solid`,"streaming-color":`neutral`,"streaming-variant":`solid`,"streaming-icon":`i-herdr-stop`,size:`sm`,class:j([`prompt-send`,{stop:f(re)}]),"aria-label":f(re)&&f(ne)?(`tl`in t?t.tl:f(X))(`Cancel the command`,`Annuler la commande`):(`t`in t?t.t:f(Y))(f(re)?`Stop the agent`:`Send`),onMousedown:n[12]||=q(()=>{},[`prevent`]),onClick:fe,onStop:_e},null,8,[`status`,`disabled`,`class`,`aria-label`])]),_:2},[f(z).length?{name:`header`,fn:H(()=>[I(`div`,__,[(_(!0),v(k,null,y(f(z),(e,n)=>(_(),v(k,{key:e.url||e.path||e.file?.label||`paste:${n}`},[e.paste?(_(),m(h,{key:0,text:e.paste,removable:``,onRemove:e=>Se(n)},null,8,[`text`,`onRemove`])):e.file?(_(),m(S,{key:1,name:e.file.label,size:e.file.size,kind:e.file.kind,uploading:!e.path,removable:``,onRemove:e=>Se(n)},null,8,[`name`,`size`,`kind`,`uploading`,`onRemove`])):(_(),v(`div`,{key:2,class:j([`att`,{up:!e.path}]),role:`button`,tabindex:`0`,"aria-label":(`t`in t?t.t:f(Y))(`View image`),onClick:t=>be(e),onKeydown:G(q(t=>be(e),[`self`]),[`enter`])},[I(`img`,{src:e.url,alt:``},null,8,y_),e.path?g(``,!0):(_(),v(`span`,b_)),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Y))(`Remove`),onClick:q(e=>Se(n),[`stop`])},[E(r,{name:`i-lucide-x`})],8,x_)],42,v_))],64))),128))])]),key:`0`}:void 0]),1032,[`modelValue`,`disabled`,`placeholder`,`submit-on-enter`,`enterkeyhint`]),e.pane?.ompStatus?(_(),v(`div`,{key:10,class:`composer-status`,title:[e.pane.ompStatus.line,e.pane.ompStatus.meters].filter(Boolean).join(`
91
+ `)},[I(`span`,E_,M(e.pane.ompStatus.line),1),e.pane.ompStatus.meters?(_(),v(`span`,D_,M(e.pane.ompStatus.meters),1)):g(``,!0)],8,T_)):g(``,!0)],8,qg)}}}),{__name:`Composer`}),k_=[`aria-label`],A_={class:`review-note-head`},j_={class:`review-range`},M_={key:0,class:`review-path`},N_={key:0,class:`review-warning`,role:`status`},P_=[`id`,`value`,`placeholder`,`aria-label`],F_={class:`review-note-actions`},I_={class:`review-keys`,"aria-hidden":`true`},L_=[`disabled`],R_={class:`review-body`},z_={class:`review-note-actions`},B_=[`aria-label`],V_=[`aria-label`],H_=Object.assign(T({__name:`ReviewNote`,props:{comment:{},label:{},missing:{type:Boolean},changed:{type:Boolean}},emits:[`act`,`hover`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>r.comment.draft!==void 0),o=n(()=>r.comment.draft??``),s=n(()=>o.value.trim()!==r.comment.body.trim()),c=h(``);B(a,()=>{c.value=``});let l=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``)?`⌘↵`:`Ctrl+↵`;function u(e){c.value=``,i(`act`,`draft`,r.comment.id,e.target.value)}function d(){o.value.trim()&&i(`act`,`save`,r.comment.id)}function p(){if(s.value&&c.value!==`cancel`){c.value=`cancel`;return}i(`act`,`cancel`,r.comment.id)}function m(){if(c.value!==`remove`){c.value=`remove`;return}i(`act`,`remove`,r.comment.id)}function y(e){if(!e.isComposing){if(e.key===`Escape`&&(a.value||c.value))e.preventDefault(),e.stopPropagation(),a.value?p():c.value=``;else if(a.value)e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d());else return}}return(t,n)=>(_(),v(`div`,{class:j([`review-note`,{missing:e.missing,editing:f(a)}]),role:`group`,"aria-label":`${e.label}: ${(`t`in t?t.t:f(Y))(`review comment`)}`,onKeydown:y,onMouseenter:n[3]||=t=>i(`hover`,e.comment.id),onMouseleave:n[4]||=e=>i(`hover`,null),onFocusin:n[5]||=t=>i(`hover`,e.comment.id),onFocusout:n[6]||=e=>i(`hover`,null)},[I(`div`,A_,[I(`span`,j_,M(e.label),1),e.missing?(_(),v(`span`,M_,M(e.comment.path),1)):g(``,!0)]),e.missing?(_(),v(`p`,N_,M(e.changed?(`t`in t?t.t:f(Y))(`The code of this block changed. Check this comment before sending.`):(`t`in t?t.t:f(Y))(`No longer in the diff. Check this comment before sending.`)),1)):g(``,!0),f(a)?(_(),v(k,{key:1},[I(`textarea`,{id:`review-${e.comment.id}`,value:f(o),placeholder:(`t`in t?t.t:f(Y))(`Write a review comment…`),"aria-label":`${e.label}: ${(`t`in t?t.t:f(Y))(`review comment`)}`,rows:`3`,onInput:u,onFocus:n[0]||=e=>e.target.scrollIntoView({block:`nearest`})},null,40,P_),I(`div`,F_,[I(`span`,I_,M(f(l))+` `+M((`t`in t?t.t:f(Y))(`to save`))+` · Esc `+M((`t`in t?t.t:f(Y))(`to cancel`)),1),I(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`cancel`}]),onClick:p},M(f(c)===`cancel`?(`t`in t?t.t:f(Y))(`Discard this text?`):(`t`in t?t.t:f(Y))(`Cancel`)),3),I(`button`,{type:`button`,class:`review-btn primary`,disabled:!f(o).trim(),onClick:d},M(e.comment.body?(`t`in t?t.t:f(Y))(`Save`):(`t`in t?t.t:f(Y))(`Comment`)),9,L_)])],64)):(_(),v(k,{key:2},[I(`p`,R_,M(e.comment.body),1),I(`div`,z_,[I(`button`,{type:`button`,class:`review-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Edit comment`),onClick:n[1]||=t=>i(`act`,`edit`,e.comment.id)},M((`tl`in t?t.tl:f(X))(`Edit`,`Modifier`)),9,B_),I(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`remove`}]),"aria-label":f(c)===`remove`?(`t`in t?t.t:f(Y))(`Confirm delete`):(`t`in t?t.t:f(Y))(`Delete comment`),onClick:m,onBlur:n[2]||=e=>c.value=``},M(f(c)===`remove`?(`t`in t?t.t:f(Y))(`Confirm delete`):(`t`in t?t.t:f(Y))(`Delete`)),43,V_)])],64))],42,k_))}}),{__name:`ReviewNote`});function U_(e){let t=null,n=null;return e.map(e=>{let r=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e.text);e.kind===`hunk`&&(t=r?Number(r[1]):null,n=r?Number(r[2]):null);let i=e.kind===`del`?`old`:`new`,a=[`add`,`del`,`context`].includes(e.kind)?i===`old`?t:n:null;return(e.kind===`del`||e.kind===`context`)&&t!==null&&t++,(e.kind===`add`||e.kind===`context`)&&n!==null&&n++,{...e,number:a,side:i}})}function W_(e,t){let n=t,r=t;for(;n>0&&e[n-1].kind!==`hunk`;)n--;for(;r<e.length-1&&e[r+1].kind!==`hunk`;)r++;for(;n<t&&e[n].number===null;)n++;for(;r>t&&e[r].number===null;)r--;return[n,r]}function G_(e,t,n){let[r,i]=W_(e,t),a=Math.min(Math.max(n,r),i);for(;a!==t&&e[a].number===null;)a+=a<t?1:-1;return t<=a?[t,a]:[a,t]}var K_=e=>e.filter(e=>e.number!==null);function q_(e){let t={};for(let n of K_(e)){let e=t[n.side];t[n.side]=e?[Math.min(e[0],n.number),Math.max(e[1],n.number)]:[n.number,n.number]}return t}var J_=100;function Y_(e){let t=K_(e).map(e=>e.text.trimEnd()).filter(e=>e.length>1);return(t.length>3?[t[0],`…`,t.at(-1)]:t).map(e=>e.length>J_?`${e.slice(0,99)}…`:e)}function X_(e){let t=2166136261;for(let n of K_(e).map(e=>e.text).join(`
92
+ `))t=Math.imul(t^n.codePointAt(0),16777619);return(t>>>0).toString(16)}function Z_(e){let t=K_(e),n=t[0],r=t.at(-1);return{number:n.number,side:n.side,text:n.text,end:t.length>1?{number:r.number,side:r.side,text:r.text}:void 0,span:q_(t),excerpt:Y_(t),hash:X_(t)}}var Q_=(e,t)=>e.number===t.number&&e.side===t.side&&e.text===t.text;function $_(e,t){return Q_(e,t)&&!!e.end==!!t.end&&(!e.end||Q_(e.end,t.end))}function ev(e,t){for(let n=0;n<t.length;n++)if(Q_(e,t[n])){if(!e.end)return[n,n];for(let r=n+1;r<t.length&&t[r].kind!==`hunk`;r++)if(Q_(e.end,t[r]))return[n,r]}return null}function tv(e,t){let n=ev(e,t);return n&&(!e.hash||e.hash===X_(t.slice(n[0],n[1]+1)))?n:null}function nv(e,t){let n=t[e.scope]?.files.find(t=>t.path===e.path);return n?U_(n.lines):null}function rv(e,t,n=!1){if(t.git&&e.scope===`committed`&&!t.committed&&!n)return null;let r=nv(e,t);return r&&tv(e,r)?null:r&&ev(e,r)?`changed`:`gone`}function iv(e,t,n=!1){return e.filter(e=>rv(e,t,n))}function av(e,t){return e.map(e=>{let n=nv(e,t),r=n&&tv(e,n);return r?{...e,...Z_(n.slice(r[0],r[1]+1)),end:e.end}:e})}function ov(e){return(e.draft?.trim()?e.draft:e.body).trim()}function sv(e){let t=[e.number,e.number];return e.span??(e.side===`old`?{old:t}:{new:t})}var cv=(e,t)=>e[0]===e[1]?`${e[0]}`:`${e[0]}${t}${e[1]}`,lv=e=>e[0]!==e[1];function uv(e,t){let n=e.old&&(lv(e.old)?t.oldLines:t.oldLine);if(!e.new)return e.old?`${lv(e.old)?t.lines:t.line} ${cv(e.old,`–`)} (${n})`:``;let r=`${lv(e.new)?t.lines:t.line} ${cv(e.new,`–`)}`;return e.old?`${r} + ${n} ${cv(e.old,`–`)}`:r}function dv(e,t,n={}){let r=new Map;for(let i of e){let e=ov(i).replace(/\s*\n\s*/g,` `);if(!e)continue;let a=sv(i),o=a.old&&(lv(a.old)?t.oldLines:t.oldLine),s=[a.old?a.new?`${o} ${cv(a.old,`-`)}`:o:``,n[i.id]===`changed`?t.changed??t.missing:n[i.id]?t.missing:``].filter(Boolean),c=`${i.path}:${cv(a.new??a.old,`-`)}${s.length?` (${s.join(`, `)})`:``} — ${e}`,l=(i.excerpt??[i.text.trimEnd()]).filter(Boolean).map(e=>` ${e}`);r.has(i.path)||r.set(i.path,[]),r.get(i.path).push([c,...l].join(`
89
93
  `))}return r.size?`${t.intro}\n\n${[...r.values()].map(e=>e.join(`
90
94
  `)).join(`
91
95
 
92
- `)}`:``}var P_=[`aria-label`,`aria-describedby`],F_=[`id`],I_=[`data-row`,`onClick`],L_=[`tabindex`,`aria-label`,`aria-pressed`,`onPointerdown`,`onClick`,`onKeydown`,`onFocus`],R_={class:`review-number`},z_={class:`review-source`},B_=Object.assign(T({__name:`ReviewDiff`,props:{file:{},scope:{},comments:{},selection:{}},emits:[`add`,`select`,`act`],setup(e,{emit:t}){let r=e,i=t,a=h(null),o=p(),s=n(()=>d_(r.file.lines)),c=n(()=>({line:Y(`Line`),lines:Y(`Lines`),oldLine:Y(`old line`),oldLines:Y(`old lines`)})),u=h(null),d=n(()=>r.comments.flatMap(e=>{let t=e.scope===r.scope&&e.path===r.file.path?C_(e,s.value):null;return t?[{c:e,at:t}]:[]})),b=n(()=>{let e=new Map,t=new Set,n=new Set;for(let{c:r,at:i}of d.value){e.set(i[1],[...e.get(i[1])??[],r]);let a=r.draft!==void 0||r.id===u.value?t:n;for(let e=i[0];e<=i[1];e++)a.add(e)}return{notes:e,open:t,noted:n}});function x(e){let t=d.value.find(t=>t.c.id===e.id)?.at;return M_(t?h_(s.value.slice(t[0],t[1]+1)):k_(e),c.value)}let S=n(()=>r.selection&&r.selection.scope===r.scope&&r.selection.path===r.file.path?r.selection:null),C=n(()=>S.value?[Math.min(S.value.anchor,S.value.head),Math.max(S.value.anchor,S.value.head)]:null),w=n(()=>S.value?f_(s.value,S.value.anchor):null);function T(e,t,n){let a=p_(s.value,e,t);return i(`select`,{scope:r.scope,path:r.file.path,anchor:e,head:a[0]===e?a[1]:a[0],via:n,block:s.value.slice(a[0],a[1]+1)}),a}function E(e,t,n){let a=s.value.slice(e,t+1);a.some(e=>e.number!==null)&&i(`add`,r.scope,r.file.path,a,n),i(`select`,null)}let D=``;function O(e){D=e.pointerType}let A=null;function P(e){let t=a.value?.getBoundingClientRect(),n=t&&document.elementFromPoint(t.left+4,e)?.closest(`[data-row]`);return n&&a.value.contains(n)?Number(n.dataset.row):null}function I(e){let t=P(e.clientY);A&&t!==null&&s.value[t]?.number!=null&&(A.at=T(A.anchor,t,`drag`))}function L(){A=null,window.removeEventListener(`pointermove`,I),window.removeEventListener(`pointerup`,R),window.removeEventListener(`pointercancel`,B),window.removeEventListener(`keydown`,V,!0)}function R(){let e=A;L(),e&&E(e.at[0],e.at[1],e.extend)}function B(){L(),i(`select`,null)}function V(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),B())}function H(e,t){if(e.pointerType!==`mouse`||e.button!==0)return;e.preventDefault(),e.currentTarget.focus();let[n,r]=f_(s.value,t),i=e.shiftKey?d.value.findLast(e=>e.c.draft!==void 0&&e.at[0]>=n&&e.at[1]<=r):void 0,a=i?t>=i.at[0]?i.at[0]:i.at[1]:t;A={anchor:a,at:T(a,t,`drag`),extend:i?.c.id},window.addEventListener(`pointermove`,I),window.addEventListener(`pointerup`,R),window.addEventListener(`pointercancel`,B),window.addEventListener(`keydown`,V,!0)}l(L),z(()=>r.file,()=>{A&&B()});function U(e){let t=S.value,n=w.value;!t||!n||t.via===`drag`||e<n[0]||e>n[1]?T(e,e,`touch`):e===t.anchor&&t.head===t.anchor?i(`select`,null):T(t.anchor,e,`touch`)}function ee(e,t){if(!e.detail){let e=S.value?.via===`keys`?C.value:null;return E(e?e[0]:t,e?e[1]:t)}D!==`mouse`&&U(t)}function te(e,t){D===`mouse`||S.value?.via!==`touch`||e.number===null||window.getSelection()?.toString()||U(t)}let W=h(-1),G=n(()=>W.value>=0&&s.value[W.value]?.number!=null?W.value:s.value.findIndex(e=>e.number!==null));function ne(e){a.value?.querySelector(`[data-row="${e}"] .review-gutter`)?.focus()}function re(e,t,[n,r]){for(let i=e+t;i>=n&&i<=r;i+=t)if(s.value[i].number!==null)return i;return e}function ie(e,t){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let n=e.key===`ArrowDown`?1:-1;if(e.shiftKey){let e=S.value?.via===`keys`?S.value.anchor:t,r=re(t,n,f_(s.value,e));T(e,r,`keys`),ne(r)}else S.value&&i(`select`,null),ne(re(t,n,[0,s.value.length-1]))}else e.key===`Escape`&&S.value&&(e.preventDefault(),e.stopPropagation(),i(`select`,null))}function q(e,t,n){let r=d.value.find(e=>e.c.id===t)?.at[1];i(`act`,e,t,n),e!==`draft`&&e!==`edit`&&(u.value=null,r!==void 0&&a.value?.contains(document.activeElement)&&N(()=>ne(r)))}function ae(e){return`${Y(`Comment on line`)} ${e.number}${e.side===`old`?` (${Y(`old line`)})`:``}`}return(t,n)=>{let r=u_;return _(),v(`div`,{ref_key:`root`,ref:a,class:j([`change-code`,{picking:f(S),dragging:f(S)?.via===`drag`}]),role:`region`,"aria-label":e.file.path,"aria-describedby":f(o)},[F(`p`,{id:f(o),class:`sr-only`},M((`t`in t?t.t:f(Y))(`Arrow keys move between lines. Shift+Arrow selects a block of lines. Enter writes a comment.`)),9,F_),(_(!0),v(k,null,y(f(s),(e,t)=>(_(),v(k,{key:t},[F(`div`,{class:j([`change-line review-line`,[e.kind,{picked:f(C)&&t>=f(C)[0]&&t<=f(C)[1],open:f(b).open.has(t),noted:f(b).noted.has(t),out:f(w)&&(t<f(w)[0]-1||t>f(w)[1])}]]),"data-row":t,onPointerdown:O,onClick:n=>te(e,t)},[e.number===null?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`review-gutter`,tabindex:t===f(G)?0:-1,"aria-label":ae(e),"aria-pressed":f(C)?t>=f(C)[0]&&t<=f(C)[1]:void 0,onPointerdown:e=>H(e,t),onClick:K(e=>ee(e,t),[`stop`]),onKeydown:e=>ie(e,t),onFocus:e=>W.value=t},[n[1]||=F(`span`,{class:`review-plus`,"aria-hidden":`true`},`+`,-1),F(`span`,R_,M(e.number),1)],40,L_)),F(`span`,z_,M(e.text),1)],42,I_),(_(!0),v(k,null,y(f(b).notes.get(t),e=>(_(),m(r,{key:e.id,comment:e,label:x(e),onAct:q,onHover:n[0]||=e=>u.value=e},null,8,[`comment`,`label`]))),128))],64))),128))],10,P_)}}}),{__name:`ReviewDiff`}),V_=e=>e===`old`||e===`new`,H_=e=>Number.isInteger(e)&&e>0,U_=e=>!!e&&H_(e.number)&&V_(e.side)&&typeof e.text==`string`,W_=e=>e===void 0||Array.isArray(e)&&e.length===2&&e.every(H_);function G_(e){return e&&typeof e.id==`string`&&[`working`,`committed`].includes(e.scope)&&typeof e.path==`string`&&U_(e)&&typeof e.body==`string`&&(e.end===void 0||U_(e.end))&&(e.span===void 0||typeof e.span==`object`&&e.span!==null&&W_(e.span.new)&&W_(e.span.old)&&!!(e.span.new||e.span.old))&&(e.excerpt===void 0||Array.isArray(e.excerpt)&&e.excerpt.every(e=>typeof e==`string`))&&(e.draft===void 0||typeof e.draft==`string`)&&(e.hash===void 0||typeof e.hash==`string`)}function K_(e){try{let t=JSON.parse(e||`[]`);return Array.isArray(t)?t.filter(e=>G_(e)&&(e.body.trim()||e.draft?.trim())):[]}catch{return[]}}function q_(e){let t=`review:${e}`,n=h([]);try{n.value=K_(localStorage.getItem(t))}catch{}z(n,e=>{try{let n=e.length?JSON.stringify(e):null;if(n===localStorage.getItem(t))return;n?localStorage.setItem(t,n):localStorage.removeItem(t)}catch{}},{deep:!0,flush:`sync`});function r(e){if(e.key!==t&&e.key!==null)return;let r=new Map(n.value.filter(e=>e.draft!==void 0).map(e=>[e.id,e]));n.value=K_(e.key===null?null:e.newValue).map(e=>r.get(e.id)??e)}return typeof window<`u`&&(window.addEventListener(`storage`,r),s(()=>window.removeEventListener(`storage`,r))),n}var J_={class:`changes-view`},Y_={class:`changes-inner`},X_={class:`changes-toolbar`},Z_={key:0,class:`changes-location`},Q_={key:0,class:`review-hint`},$_={class:`by-mouse`},ev={class:`by-touch`},tv={key:1,class:`review-toolbar`},nv={role:`status`},rv={key:2,class:`changes-notice error`,role:`alert`},iv={key:3,class:`changes-notice`},av={key:4,class:`changes-notice`},ov={class:`changes-section`},sv={key:0,class:`changes-notice`},cv={key:0,class:`changes-limit`},lv={class:`change-path`},uv={key:0,class:`change-binary`},dv={key:1,class:`change-totals`},fv={class:`change-status`},pv={key:0,class:`change-note`},mv={key:1,class:`change-note`},hv={class:`changes-section`},gv={class:`changes-toggle`},_v={class:`changes-location`},vv={key:0,class:`changes-limit`},yv={key:1,class:`changes-notice`},bv={class:`change-path`},xv={key:0,class:`change-binary`},Sv={key:1,class:`change-totals`},Cv={key:0,class:`change-note`},wv={key:1,class:`changes-notice`},Tv={class:`sr-only`,role:`status`},Ev={key:6,class:`review-pick`},Dv=Object.assign(T({__name:`ChangesView`,props:{paneId:{}},emits:[`review`],setup(e,{emit:t}){let r=e,i=t,o=q_(r.paneId),s=n(()=>O.value?E_(o.value,O.value,P.value):[]),c=n(()=>Object.fromEntries(s.value.map(e=>[e.id,T_(e,O.value,P.value)??void 0]))),u=n(()=>o.value.filter(O_).length),d=n(()=>({line:Y(`Line`),lines:Y(`Lines`),oldLine:Y(`old line`),oldLines:Y(`old lines`)})),p=h(null),b=n(()=>p.value?M_(h_(p.value.block),d.value):``);function x(e){N(()=>document.getElementById(`review-${e}`)?.focus())}function S(e){o.value=o.value.filter(t=>t.id!==e)}function C(e,t,n){let r=o.value.find(e=>e.id===t);r&&(e===`draft`?r.draft=n??``:e===`edit`?(r.draft=r.body,x(t)):e===`save`&&O_(r)?(r.body=O_(r),delete r.draft):e===`cancel`&&r.body?delete r.draft:S(t))}function T(e,t,n,r){if(!n.some(e=>e.number!==null))return;let i=y_(n),a=o.value.find(n=>r?n.id===r:n.scope===e&&n.path===t&&x_(n,i));a&&r?Object.assign(a,i):a?a.draft??=a.body:(a={id:crypto.randomUUID(),scope:e,path:t,...i,body:``,draft:``},o.value.push(a)),p.value=null,x(a.id)}function D(){let e=N_(O.value?D_(o.value,O.value):o.value,{intro:Y(`Please review these points:`),oldLine:Y(`old line`),oldLines:Y(`old lines`),missing:Y(`no longer in diff`),changed:Y(`code changed since this comment`)},c.value);e&&(i(`review`,e),o.value=[])}let O=h(null),A=h(!1),j=h(``),P=h(o.value.some(e=>e.scope===`committed`)),L=0;async function R(){let e=++L;A.value=!0,j.value=``;try{let t=await Dr(`/api/changes?pane=${encodeURIComponent(r.paneId)}&commits=${P.value?`1`:`0`}`);e===L&&(O.value=t)}catch(t){e===L&&(j.value=t.message)}finally{e===L&&(A.value=!1)}}w(R),z(P,R),z(O,()=>{p.value=null}),l(()=>{L++});function B(e){return e.status===`??`?Y(`Untracked`):e.status===`commit`?Y(`Commit`):e.status.includes(`R`)?Y(`Renamed`):e.status.includes(`D`)?Y(`Deleted`):e.status.includes(`A`)?Y(`Added`):Y(`Modified`)}function V(e,t){return e===null?`${t}—`:`${t}${e}`}return(e,t)=>{let n=Oe,r=u_,i=B_;return _(),v(`div`,J_,[F(`div`,Y_,[F(`div`,X_,[F(`div`,null,[f(O)?.git?(_(),v(`p`,Z_,M(f(O).branch||`HEAD`)+` · `+M(f(O).root),1)):g(``,!0)]),E(n,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(A),"aria-label":(`t`in e?e.t:f(Y))(`Refresh changes`),onClick:R},{default:H(()=>[a(M((`t`in e?e.t:f(Y))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])]),f(O)?.git&&!f(o).length?(_(),v(`p`,Q_,[F(`span`,$_,M((`t`in e?e.t:f(Y))(`To comment, hover a line and click +. Drag from the + to comment a block of lines.`)),1),F(`span`,ev,M((`t`in e?e.t:f(Y))(`To comment, tap a line number, then another line for a block.`)),1)])):g(``,!0),f(o).length?(_(),v(`div`,tv,[F(`span`,nv,M(f(u))+` `+M((`t`in e?e.t:f(Y))(f(u)===1?`review comment`:`review comments`)),1),E(n,{color:`neutral`,variant:`outline`,onClick:t[0]||=e=>o.value=[]},{default:H(()=>[a(M((`t`in e?e.t:f(Y))(`Discard`)),1)]),_:1}),E(n,{disabled:!f(u),onClick:D},{default:H(()=>[a(M((`t`in e?e.t:f(Y))(`Send review`)),1)]),_:1},8,[`disabled`]),F(`p`,null,M((`t`in e?e.t:f(Y))(`Adds to your message draft. You send it yourself.`)),1)])):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),m(r,{key:e.id,comment:e,label:f(M_)(f(k_)(e),f(d)),missing:``,changed:f(c)[e.id]===`changed`,onAct:C},null,8,[`comment`,`label`,`changed`]))),128)),f(j)?(_(),v(`p`,rv,M(f(j)),1)):g(``,!0),f(A)&&!f(O)?(_(),v(`p`,iv,[t[6]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in e?e.t:f(Y))(`Reading changes…`)),1)])):f(O)&&!f(O).git?(_(),v(`p`,av,M((`t`in e?e.t:f(Y))(`This folder is not a Git repository.`)),1)):f(O)?.git?(_(),v(k,{key:5},[F(`section`,ov,[F(`h3`,null,[a(M((`t`in e?e.t:f(Y))(`Working tree`))+` `,1),F(`span`,null,M(f(O).working?.count||0),1)]),f(O).working?.count?(_(),v(k,{key:1},[f(O).working?.truncated?(_(),v(`p`,cv,M((`t`in e?e.t:f(Y))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(O).working?.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[F(`summary`,null,[F(`span`,lv,M(n.path),1),n.binary?(_(),v(`span`,uv,M((`t`in e?e.t:f(Y))(`Binary`)),1)):(_(),v(`span`,dv,[F(`b`,null,M(V(n.added,`+`)),1),F(`i`,null,M(V(n.deleted,`−`)),1)])),F(`span`,fv,M(B(n)),1)]),n.previousPath?(_(),v(`p`,pv,M((`t`in e?e.t:f(Y))(`From`))+` `+M(n.previousPath),1)):g(``,!0),n.summary?(_(),v(`p`,mv,M((`t`in e?e.t:f(Y))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:2,file:n,scope:`working`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[1]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):(_(),v(`p`,sv,M((`t`in e?e.t:f(Y))(`No working tree changes.`)),1))]),F(`section`,hv,[F(`label`,gv,[I(F(`input`,{"onUpdate:modelValue":t[2]||=e=>te(P)?P.value=e:null,type:`checkbox`},null,512),[[ne,f(P)]]),t[7]||=a(),F(`span`,null,M((`t`in e?e.t:f(Y))(`Also show unpushed commits`)),1)]),f(P)&&f(O).committed?(_(),v(k,{key:0},[F(`h3`,null,[a(M((`t`in e?e.t:f(Y))(`Commits`))+` `,1),F(`span`,null,M(f(O).commits??0),1)]),F(`p`,_v,M(f(O).comparison)+` → HEAD`,1),f(O).committed.truncated?(_(),v(`p`,vv,M((`t`in e?e.t:f(Y))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(O).committed.count?g(``,!0):(_(),v(`p`,yv,M((`t`in e?e.t:f(Y))(`No committed changes to show.`)),1)),(_(!0),v(k,null,y(f(O).committed.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[F(`summary`,null,[F(`span`,bv,M(n.path),1),n.binary?(_(),v(`span`,xv,M((`t`in e?e.t:f(Y))(`Binary`)),1)):(_(),v(`span`,Sv,[F(`b`,null,M(V(n.added,`+`)),1),F(`i`,null,M(V(n.deleted,`−`)),1)]))]),n.summary?(_(),v(`p`,Cv,M((`t`in e?e.t:f(Y))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:1,file:n,scope:`committed`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[3]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):f(P)&&!f(A)&&!f(O).comparison?(_(),v(`p`,wv,M((`t`in e?e.t:f(Y))(`No upstream or base branch available for comparison.`)),1)):g(``,!0)])],64)):g(``,!0),F(`p`,Tv,M(f(b)&&`${(`t`in e?e.t:f(Y))(`Selection:`)} ${f(b)}`),1),f(p)&&f(p).via!==`drag`?(_(),v(`div`,Ev,[F(`div`,null,[F(`b`,null,M(f(b)),1),F(`p`,null,M(f(p).via===`touch`?(`t`in e?e.t:f(Y))(`Tap another line of this hunk to extend the block.`):(`t`in e?e.t:f(Y))(`Shift+Arrow extends the block within this hunk.`)),1)]),F(`button`,{type:`button`,class:`review-btn`,onClick:t[4]||=e=>p.value=null},M((`t`in e?e.t:f(Y))(`Cancel`)),1),F(`button`,{type:`button`,class:`review-btn primary`,onClick:t[5]||=e=>T(f(p).scope,f(p).path,f(p).block)},M((`t`in e?e.t:f(Y))(`Comment`)),1)])):g(``,!0)])])}}}),{__name:`ChangesView`}),Ov=[`id`,`data-pane`],kv={key:0,class:`file-drop`,"aria-hidden":`true`},Av={class:`file-drop-label`},jv={class:`top bar agent-top`},Mv=[`aria-label`,`title`],Nv={class:`agent-head`},Pv={class:`agent-title`},Fv={class:`agent-meta`},Iv={key:0,class:`agent-subtitle`},Lv={key:1,class:`agent-subtitle agent-command`},Rv={key:2,class:`agent-subtitle`},zv=[`title`],Bv={class:`machine-inline-name`},Vv={key:4,class:`where`},Hv={class:`agent-actions`},Uv=[`aria-label`],Wv={class:`agent-body`},Gv={class:`agent-main hw-backdrop-host`},Kv={key:1,class:`term-banner machine-banner`},qv={key:0},Jv={key:2,class:`term-banner`},Yv={key:4,class:`chat-empty offline-terminal`},Xv={key:7,class:`chat`},Zv={key:8,class:`terminal-transcript-note`},Qv=[`aria-label`,`title`],$v=null,ey=Object.assign(T({__name:`AgentView`,props:{paneId:{},cell:{type:Boolean},active:{type:Boolean},grip:{type:Boolean}},emits:[`activate`],setup(e,{emit:t}){let r=e,i=t,o=sn(),s=ln(),c=n(()=>!r.cell||!!r.active),d=Symbol(`vue agent`);z(c,e=>{e&&(dr.value=r.paneId,$v=d)},{immediate:!0}),l(()=>{$v===d&&(dr.value=null)});let p=n(()=>Xn.value.panes.find(e=>e.id===r.paneId)),y=n(()=>Xn.value.workspaces.find(e=>e.id===p.value?.workspace)),b=n(()=>!!(r.cell||xt.value&&xt.value.panes.length>1)),x=n(()=>p.value?b.value?Cr(p.value):aa(p.value,y.value):`—`),S=n(()=>{let e=p.value?Ji(p.value,y.value):``;return e&&e!==x.value?e:``}),C=n(()=>p.value?.command&&p.value.command!==x.value&&p.value.command!==S.value?p.value.command:``),T=n(()=>p.value&&Xn.value.tabs?.filter(e=>e.workspace===p.value?.workspace).length>1?p.value.tabLabel:``),D=n({get:()=>Nn(r.paneId),set:e=>Sr(r.paneId,e)}),O=n(()=>{let e=p.value;return e?r.cell?wn({chat:bn(e),viewMode:D.value,active:r.active}):D.value===`project`?U.value?`project`:bn(e)?`chat`:`term`:bn(e)?D.value:`term`:null}),k=h(Ai()),A=h(!1),P=n(()=>k.value?{width:`${k.value}px`}:void 0);function I(e){if(e.button!==0)return;let t=e.currentTarget,n=t.nextElementSibling,r=t.parentElement?.getBoundingClientRect().width||0;if(!n||!r)return;e.preventDefault();let i=e.clientX,a=n.getBoundingClientRect().width;t.setPointerCapture(e.pointerId),A.value=!0;let o=e=>{k.value=sa(a+i-e.clientX,r)},s=()=>{t.removeEventListener(`pointermove`,o),t.removeEventListener(`pointerup`,s),t.removeEventListener(`pointercancel`,s),A.value=!1,bi(k.value)};t.addEventListener(`pointermove`,o),t.addEventListener(`pointerup`,s),t.addEventListener(`pointercancel`,s)}function R(){k.value=null,bi(null)}let B=ht(()=>r.paneId,()=>!r.cell&&(Q.value?zt.value:D.value===`project`)),V=n(()=>!r.cell&&B.coordinator.value&&B.available.value===!0),U=n(()=>V.value&&!Q.value),ee=n(()=>V.value&&Q.value),W=u(null),G=Fm(r.paneId,{setBanner:e=>{W.value=e},hasBanner:()=>!!W.value,fill:()=>!!r.cell,input:()=>c.value}),ne=h(null),re=h(0),K=h(null),q=h(typeof o.query.q==`string`&&typeof o.query.hit==`string`),ae=h(!!p.value),se=h(!1),le=setTimeout(()=>{se.value=!0},4e3);l(()=>clearTimeout(le));let ue={text:Y(`This pane has been closed.`),btn:Y(`Back`),fn:()=>un(`/`)},de=n(()=>!p.value&&Xn.value.ok&&(ae.value||se.value)&&!Ge(r.paneId));z(p,e=>{e&&(ae.value=!0,W.value===ue&&(W.value=null,O.value===`term`&&!G.isConnected()&&N(()=>G.connect(!1))))}),z(de,e=>{e&&(W.value=ue)},{immediate:!0}),z(O,(e,t)=>{e===`chat`&&t===`term`&&(W.value=de.value?W.value:null)},{immediate:!0});function fe(e){r.cell&&i(`activate`),D.value=e,Q.value&&e===`term`&&N(()=>G.focus()),X()}function pe(e){fe(qr(O.value,e))}function he(){q.value?q.value=!1:(q.value=!0,O.value!==`chat`&&(D.value=`chat`))}$r(()=>r.paneId,()=>c.value,{searchChat(){return!p.value||!bn(p.value)||O.value!==`chat`?!1:(q.value?ne.value?.focusSearch():q.value=!0,!0)},toggleTerm(){if(!p.value||!bn(p.value)||!O.value)return!1;let e=O.value!==`chat`;return fe(e?`chat`:`term`),e&&N(()=>K.value?.focus()),!0},stop:()=>O.value===`chat`&&!!K.value?.stop()});let ge=Bi(r.paneId);function _e(e){ge.text=Rt(ge.text,e),!Q.value&&D.value===`project`&&(D.value=bn(p.value)?`chat`:`term`),K.value?.focusEnd()}let ve=n(()=>Wi(r.paneId));function be(e){e&&Xi(r.paneId,e),ne.value?.scrollToEnd(!0),ne.value?.reload()}z(p,e=>Ii(r.paneId,e?.queued||[]));let xe=n(()=>p.value&&p.value.status===`blocked`&&p.value.prompt&&p.value.prompt.options?p.value.prompt:null),Ce=n(()=>gr(p.value)),we=n(()=>p.value&&p.value.menu&&p.value.status!==`working`&&!xe.value&&!Ce.value?p.value.menu:null);z(()=>JSON.stringify([xe.value,Ce.value,we.value]),()=>N(()=>ne.value?.scrollToEnd(!1)));let ke=n(()=>{let e=p.value;return e?In(e.cwd):``}),Ae=n(()=>hn.value&&p.value?Cn(p.value.machine):void 0),Ne=n(()=>!!(Ae.value&&Ae.value.status!==`online`));function Pe(e){ge.text=ge.text?`${ge.text}\n\n${e}`:e,Fe.value=!1,fe(`chat`),N(()=>K.value?.focusEnd())}let Fe=h(!1),Ie=h(!1),Le=h(null),Re=n(()=>O.value===`term`),Be=Gi(r.paneId),Ve=h(Be.resume(p.value?.interaction||`unknown`)),He=n(()=>O.value===`chat`&&_n.value&&!Dn.value&&!Ne.value&&!Tn(p.value)),Ue=n(()=>p.value?.interaction===`terminal`);function We(){Ve.value=Be.update(p.value?.interaction||`unknown`,Date.now()),(Ue.value||Ve.value)&&Ye.pane===r.paneId&&mt(!1)}z(()=>p.value?.interaction,We,{immediate:!0});let qe=Lr(We,100);l(()=>clearInterval(qe));function Je(){Be.dismiss(),Ve.value=!1}function Xe(){r.cell&&i(`activate`),Be.reopen(),Ve.value=!0}let Qe=n(()=>Ve.value&&He.value&&c.value&&!Rn.value),$e=n(()=>jn({desk:Q.value,live:c.value,mode:O.value,cell:!!r.cell})&&!(we.value&&O.value!==`term`)&&!(O.value===`chat`&&Ve.value)),et=n(()=>qn({desk:Q.value,live:c.value,mode:O.value,available:!(!p.value||!_n.value||Dn.value||Ne.value||Tn(p.value))}));function tt(e){let t=e.target,n=[...t.files||[]];t.value=``,nt(n)}async function nt(e){if(et.value&&p.value)for(let t of e)try{let e=t.name.includes(`.`)&&t.name.split(`.`).pop()||``,n=await fetch(`/api/file?pane=${encodeURIComponent(r.paneId)}&ext=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:t}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(Y(i.error||`HTTP ${n.status}`));be(await Pt(p.value,r.paneId,i.path)),X()}catch(e){$(`${Y(`File upload failed`)} : ${e.message}`,!0)}}let rt=n(()=>et.value?`term`:$e.value&&O.value!==`project`&&!Dn.value?`chat`:null),it=h(0);function at(e){Zi(e.dataTransfer)&&rt.value&&(e.preventDefault(),e.type===`dragover`&&e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),it.value=ta(it.value,e.type))}function ot(e){if(it.value=0,!Zi(e.dataTransfer)||!rt.value)return;e.preventDefault();let t=[...e.dataTransfer?.files||[]];if(t.length){if(rt.value===`term`)return nt(t);K.value?.addFiles(t).then(e=>{e&&(K.value?.focus(),X())})}}let st=n(()=>p.value?.agent===`claude`?Y(`Images, PDFs, text and code files`):Y(`Images, text and code files`)),ct=n(()=>{let e=p.value,t=[];et.value&&t.push({label:Y(`Attach a file…`),icon:`i-lucide-paperclip`,run:()=>Le.value?.click()}),e&&t.push({label:Y(`View changes`),icon:`i-lucide-file-diff`,run:()=>{Fe.value=!0}}),e&&t.push({label:Y(`Browse files`),icon:`i-lucide-folder-tree`,run:()=>{Ie.value=!0}}),e&&Ir(e)&&t.push({label:Y(`Open in editor`),icon:`i-lucide-external-link`,kbds:c.value?Ft(`open-editor`):void 0,run:()=>$n(e)}),e&&t.push({label:Y(`Rename pane`),icon:`i-lucide-pencil`,run:()=>{ze.value=e.id}}),e&&t.push(...Ee(e)),e&&t.push(oe(e));let n=e?Se(e,c.value):[];if(n.length&&t.push(...n,{kind:`separator`}),e&&je(e.machine).length&&t.push({label:Y(`Plugin actions`),icon:`i-lucide-puzzle`,run:()=>ce({pane:e})}),t.push({label:Y(`Take control of this terminal`),icon:`i-lucide-arrow-left-right`,run:()=>{W.value=null,D.value=`term`,N(()=>G.connect(!0))}}),e&&Vt(e)&&!e.restart&&t.push({label:Y(`Restart agent`),icon:`i-lucide-rotate-cw`,run:()=>Zt(e)}),t.push({label:Y(`Reconnect`),icon:`i-lucide-refresh-cw`,run:()=>{W.value=null,D.value=`term`,N(()=>{G.reset(),G.connect(!1)})}}),r.cell||t.push(...me()),e){t.push({kind:`separator`}),t.push({label:e.agent?Z(`Close this pane (stops ${Tr(e.agent)})`,`Fermer ce pane (arrête ${Tr(e.agent)})`):Y(`Close this terminal`),icon:`i-lucide-trash-2`,danger:!0,kbds:c.value?Ft(`close-pane`):void 0,run:()=>Ke(e)});let n=Xn.value.workspaces.find(t=>t.id===e.workspace);n&&n.worktree&&t.push({label:Y(`Delete this worktree`),icon:`i-lucide-git-branch`,danger:!0,run:()=>lt(e.workspace)})}return t});async function lt(e){await gi();let t=(fi.value||[]).find(t=>t.workspace===e);if(!t)return $(Y(`Worktree not found`),!0);await pi(t)&&un(`/`)}let ut=n(()=>wt(ct.value));function dt(){nn(ct.value)}z(()=>p.value&&(p.value.machine||``),e=>{e!==void 0&&Te(e)},{immediate:!0});let ft=n(()=>[{label:Y(`Conversation`),value:`chat`,icon:`i-lucide-message-square`},{label:Y(`Terminal`),value:`term`,icon:`i-lucide-square-terminal`}]),pt={list:`hw-tabs`,trigger:`hw-tab`,indicator:`hw-tab-ind`,leadingIcon:`hw-tab-icon`,label:`hw-tab-label`},gt=n({get:()=>O.value===`term`?`term`:`chat`,set:e=>fe(e===`term`?`term`:`chat`)}),_t=n(()=>gn({desk:Q.value,cell:!!r.cell,chat:bn(p.value),live:c.value,project:U.value})),yt=n(()=>!r.cell&&p.value&&Fn(Xt(p.value.workspace).length).headerAdd);z(Br,e=>G.setFontSize(e)),z(rr,e=>{G.setVisible(e),e&&O.value===`term`&&!G.isConnected()&&!W.value&&G.connect(!1)});let xt=n(()=>p.value?bt(p.value.tab):null),St=n(()=>!!(xt.value&&xt.value.panes.length>1));function Ct(){xt.value&&(Q.value?un({path:Ze(xt.value.tab.id),query:{pane:r.paneId}}):ye(xt.value.tab.id))}function Tt(){let e=history.state?.back;e===`/board`||xt.value&&e===Ze(xt.value.tab.id)?s.back():un(`/`)}let Et=Nt.value;Nt.value=0;let Dt=h(0),Ot=h(!1),kt=0,At=0,jt=0,Mt=`off`,It=e=>xt.value?An(xt.value.layout,r.paneId,e):null;function Lt(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.scrollWidth>n.clientWidth+1&&/(auto|scroll)/.test(getComputedStyle(n).overflowX))return!0;return!1}function Bt(e){if(Mt=`off`,Q.value||!St.value||e.touches.length!==1)return;let t=e.target?.closest?.(`.swipe-area, .choices, #termWrap`);t&&!Lt(e.target,t)&&(kt=e.touches[0].clientX,At=e.touches[0].clientY,jt=Date.now(),Mt=null)}function Ht(e){if(Mt===`off`||Mt===`y`)return;let t=e.touches[0].clientX-kt,n=e.touches[0].clientY-At;Mt===null&&(Mt=Hi(t,n)),Mt===`x`&&(e.preventDefault(),Ot.value=!0,Dt.value=Pi(t,!!It(t<0?1:-1)))}function Ut(e){if(Mt===`x`){let t=(e.changedTouches[0]?.clientX??kt)-kt,n=oa(t,Date.now()-jt,window.innerWidth),r=n?It(n):null;r&&(X(),Nt.value=n,s.replace(ie(r)))}Mt=`off`,Ot.value=!1,Dt.value=0}let Wt=n(()=>St.value&&!Q.value?{transform:Dt.value?`translateX(${Dt.value}px)`:void 0,transition:Ot.value?`none`:`transform .18s ease`}:{});w(()=>{Q.value&&c.value&&setTimeout(()=>(O.value===`term`?G:K.value)?.focus(),50)}),z(()=>r.active,(e,t)=>{e&&!t&&r.cell&&setTimeout(()=>{document.activeElement?.closest(`.cell-view.active`)||(O.value===`term`?G:K.value)?.focus()},50)});function Gt(e){let t=e.target;r.cell&&Q.value&&t?.closest?.(`.agent-top`)&&!t.closest(`button, a, input, [role="tab"], .cell-grip`)&&(document.activeElement&&document.activeElement!==document.body||(O.value===`term`?G:K.value)?.focus())}let Kt=n(()=>ra.value?{height:`${Ui.value}px`,top:`${Fi.value}px`}:{});return(t,n)=>{let r=De,o=za,s=Oe,l=ai,u=Ki,d=Ua,h=Qr,y=Ci,b=oi,w=Ja,D=Ya,k=hu,N=xu,z=Vp,V=zm,U=mh,ae=Ph,oe=Gp,se=Xg,ce=Dv,le=yi,ue=Qs;return _(),v(`section`,{id:e.cell?void 0:`agent`,class:j(e.cell?[`cell-view`,{active:e.active,gripped:e.grip}]:`view`),style:L(e.cell?void 0:f(Kt)),"data-pane":e.cell?e.paneId:void 0,onTouchstart:Bt,onTouchmove:Ht,onTouchend:Ut,onTouchcancel:Ut,onPointerdownCapture:n[20]||=t=>e.cell&&i(`activate`),onFocusin:n[21]||=t=>e.cell&&i(`activate`),onClick:Gt,onDragenter:at,onDragover:at,onDragleave:at,onDrop:ot},[f(it)&&f(rt)?(_(),v(`div`,kv,[E(r,{name:f(rt)===`term`?`i-lucide-paperclip`:`i-lucide-file-plus`,class:`file-drop-icon`},null,8,[`name`]),F(`span`,Av,M((`t`in t?t.t:f(Y))(`Drop to attach`)),1),F(`small`,null,M(f(rt)===`term`?(`t`in t?t.t:f(Y))(`The file path is sent to the terminal`):f(st)),1)])):g(``,!0),!e.cell&&f(p)?(_(),m(o,{key:1,workspace:f(p).workspace,current:f(p).tab},null,8,[`workspace`,`current`])):g(``,!0),E(w,{items:()=>f(ct),disabled:!f(p)},{default:H(()=>[F(`header`,jv,[e.cell&&e.grip?(_(),v(`span`,{key:0,class:`cell-grip`,role:`button`,"aria-label":(`t`in t?t.t:f(Y))(`Drag to move the pane`),title:(`t`in t?t.t:f(Y))(`Drag to move the pane`)},[E(r,{name:`i-lucide-grip-vertical`})],8,Mv)):g(``,!0),e.cell?g(``,!0):(_(),m(s,{key:1,id:`btnBack`,icon:`i-lucide-chevron-left`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn back`,"aria-label":(`t`in t?t.t:f(Y))(`Back`),onClick:Tt},null,8,[`aria-label`])),F(`div`,Nv,[F(`div`,Pv,M(f(x)),1),F(`div`,Fv,[E(l,{pane:f(p),kind:``},null,8,[`pane`]),f(S)?(_(),v(`span`,Iv,M(f(S)),1)):g(``,!0),f(C)?(_(),v(`span`,Lv,M(f(C)),1)):g(``,!0),f(T)?(_(),v(`span`,Rv,M(f(T)),1)):g(``,!0),f(Ae)?(_(),v(`span`,{key:3,class:j([`agent-machine`,f(Ae).status]),title:f(Ae).target?`ssh ${f(Ae).target}`:void 0},[E(r,{name:f(Ae).local?`i-lucide-server`:`i-lucide-laptop`},null,8,[`name`]),F(`span`,Bv,M((`machineName`in t?t.machineName:f(kn))(f(Ae).key)),1),f(Ae).local?(_(),m(u,{key:0})):g(``,!0)],10,zv)):g(``,!0),f(ke)?(_(),v(`span`,Vv,M(f(ke)),1)):g(``,!0)])]),f(_t).selector===`cell`?(_(),m(d,{key:2,modelValue:f(gt),"onUpdate:modelValue":n[0]||=e=>te(gt)?gt.value=e:null,items:f(ft),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:pt},null,8,[`modelValue`,`items`])):g(``,!0),F(`div`,Hv,[f(_t).selector===`header`?(_(),m(d,{key:0,modelValue:f(gt),"onUpdate:modelValue":n[1]||=e=>te(gt)?gt.value=e:null,items:f(ft),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:pt},null,8,[`modelValue`,`items`])):g(``,!0),f(yt)&&f(p)?(_(),m(s,{key:1,icon:`i-lucide-plus`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Y))(`New tab`),title:(`t`in t?t.t:f(Y))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(Dn),onClick:n[2]||=e=>(`newTab`in t?t.newTab:f(Me))(f(p).workspace)},null,8,[`aria-label`,`title`,`disabled`])):g(``,!0),e.cell?(_(),m(h,{key:2,text:(`t`in t?t.t:f(Y))(`Open alone`)},{default:H(()=>[E(s,{icon:`i-lucide-maximize-2`,color:`neutral`,variant:`ghost`,size:`md`,class:`icon-btn cell-extra`,"aria-label":(`t`in t?t.t:f(Y))(`Open alone`),to:(`panePath`in t?t.panePath:f(ie))(e.paneId)},null,8,[`aria-label`,`to`])]),_:1},8,[`text`])):f(St)&&f(xt)?(_(),m(h,{key:3,text:(`t`in t?t.t:f(Y))(`Side by side`),disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[F(`button`,{type:`button`,class:`map-btn`,"aria-label":(`desk`in t?t.desk:f(Q))?(`t`in t?t.t:f(Y))(`Side by side`):(`t`in t?t.t:f(Y))(`Tab overview`),onClick:Ct},[E(y,{layout:f(xt).layout,panes:f(xt).panes,current:e.paneId},null,8,[`layout`,`panes`,`current`])],8,Uv)]),_:1},8,[`text`,`disabled`])):g(``,!0),f(ee)&&!(`projectSideOpen`in t?t.projectSideOpen:f(zt))?(_(),m(h,{key:4,text:(`t`in t?t.t:f(Y))(`Show the Project panel`),kbds:f(c)?(`shortcutKbds`in t?t.shortcutKbds:f(Ft))(`project-panel`):void 0},{default:H(()=>[E(s,{icon:`i-lucide-panel-right-open`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Show the Project panel`),onClick:n[3]||=e=>(`setProjectSideOpen`in t?t.setProjectSideOpen:f(vt))(!0)},null,8,[`aria-label`])]),_:1},8,[`text`,`kbds`])):g(``,!0),f(_t).project?(_(),m(s,{key:5,icon:`i-lucide-folder-kanban`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn mode-btn`,{on:f(O)===`project`}]),"aria-label":(`t`in t?t.t:f(Y))(`Project`),"aria-pressed":f(O)===`project`,onClick:n[4]||=e=>pe(`project`)},null,8,[`class`,`aria-label`,`aria-pressed`])):g(``,!0),f(_t).term?(_(),m(s,{key:6,icon:`i-lucide-square-terminal`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn mode-btn`,{on:f(O)===`term`}]),"aria-label":(`t`in t?t.t:f(Y))(`Terminal`),"aria-pressed":f(O)===`term`,onClick:n[5]||=e=>pe(`term`)},null,8,[`class`,`aria-label`,`aria-pressed`])):g(``,!0),(`hasChat`in t?t.hasChat:f(bn))(f(p))&&(f(c)||e.cell)?(_(),m(h,{key:7,text:(`t`in t?t.t:f(Y))(`Search`),kbds:f(O)===`chat`?(`shortcutKbds`in t?t.shortcutKbds:f(Ft))(`search-chat`):void 0,disabled:!(`desk`in t?t.desk:f(Q))},{default:H(()=>[E(s,{icon:`i-lucide-search`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn cell-extra`,{on:f(q)}]),"aria-label":(`t`in t?t.t:f(Y))(`Search`),onClick:he},null,8,[`class`,`aria-label`])]),_:1},8,[`text`,`kbds`,`disabled`])):g(``,!0),(`sheetMenus`in t?t.sheetMenus:f(Ar))?(_(),m(s,{key:9,icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Options`),onClick:dt},null,8,[`aria-label`])):(_(),m(b,{key:8,items:f(ut),content:{align:`end`,sideOffset:6},ui:{content:`hw-dropdown`}},{default:H(()=>[E(s,{icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Options`)},null,8,[`aria-label`])]),_:1},8,[`items`]))])])]),_:1},8,[`items`,`disabled`]),F(`div`,Wv,[F(`div`,Gv,[(`desk`in t?t.desk:f(Q))&&!e.cell&&(`backdrop`in t?t.backdrop:f(Yr))===`wherdr`&&f(O)===`chat`?(_(),m(D,{key:0})):g(``,!0),f(Ne)&&f(Ae)?(_(),v(`div`,Kv,[E(r,{name:`i-lucide-unplug`,class:`term-banner-icon`}),F(`span`,null,[a(M(f(Ae).status===`connecting`?(`tl`in t?t.tl:f(Z))(`${(`machineName`in t?t.machineName:f(kn))(f(Ae).key)} unreachable — reconnecting…`,`${(`machineName`in t?t.machineName:f(kn))(f(Ae).key)} injoignable — reconnexion…`):(`tl`in t?t.tl:f(Z))(`${(`machineName`in t?t.machineName:f(kn))(f(Ae).key)} offline`,`${(`machineName`in t?t.machineName:f(kn))(f(Ae).key)} hors ligne`)),1),f(Ae).error?(_(),v(`small`,qv,M((`t`in t?t.t:f(Y))(f(Ae).error)),1)):g(``,!0)])])):g(``,!0),f(W)?(_(),v(`div`,Jv,[E(r,{name:`i-lucide-triangle-alert`,class:`term-banner-icon`}),F(`span`,null,M(f(W).text),1),E(s,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[6]||=e=>f(W).fn()},{default:H(()=>[a(M(f(W).btn),1)]),_:1})])):g(``,!0),f(p)&&f(O)===`chat`?(_(),v(`div`,{key:3,class:j([`swipe-area`,f(Et)?f(Et)>0?`enter-next`:`enter-prev`:void 0]),style:L(f(Wt))},[E(k,{ref_key:`chatRef`,ref:ne,search:f(q),"onUpdate:search":n[7]||=e=>te(q)?q.value=e:null,pane:f(p),"local-queued":f(ve),onGotoTerm:n[8]||=e=>fe(`term`),onRestored:n[9]||=e=>f(K)?.focus(),onQuote:n[10]||=e=>f(K)?.focusEnd(),onUnanswered:n[11]||=e=>re.value=e,onSent:be},null,8,[`search`,`pane`,`local-queued`])],6)):f(O)===`term`&&(!(`eventsOpen`in t?t.eventsOpen:f(_n))||(`offlineView`in t?t.offlineView:f(Dn))||f(Ne))?(_(),v(`div`,Yv,[E(r,{name:`i-lucide-wifi-off`,class:`chat-empty-icon`}),F(`p`,null,M((`t`in t?t.t:f(Y))(`Terminal unavailable offline`)),1)])):f(O)===`term`?(_(),m(N,{key:5,ctl:f(G),class:j(f(Et)?f(Et)>0?`enter-next`:`enter-prev`:void 0),style:L(f(Wt))},null,8,[`ctl`,`class`,`style`])):f(O)===`project`?(_(),m(z,{key:6,"pane-id":e.paneId,board:f(B).board.value,loading:f(B).loading.value,error:f(B).error.value,onReload:n[12]||=e=>f(B).reload(),onSent:be,onPrefill:_e},null,8,[`pane-id`,`board`,`loading`,`error`])):(_(),v(`div`,Xv)),f(p)?.agent&&!(`hasChat`in t?t.hasChat:f(bn))(f(p))&&f(O)===`term`&&!e.cell?(_(),v(`p`,Zv,M((`tl`in t?t.tl:f(Z))(`Conversation unavailable for this agent · follow it in the terminal`,`Conversation non disponible pour cet agent · suivi dans le terminal`)),1)):g(``,!0),f(Qe)?(_(),m(V,{key:9,"pane-id":e.paneId,active:f(c),title:f(x),onClose:Je},null,8,[`pane-id`,`active`,`title`])):(f(Ue)||f(Ve))&&f(He)?(_(),v(`button`,{key:10,type:`button`,class:`interactive-terminal-reopen`,onClick:Xe},[E(r,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Z))(`Open interactive terminal`,`Ouvrir le terminal interactif`)),1)])):g(``,!0),(f(xe)||f(Ce))&&!f(Ve)&&!f(Ue)&&!f(Re)&&(`eventsOpen`in t?t.eventsOpen:f(_n))&&!(`offlineView`in t?t.offlineView:f(Dn))&&!f(Ne)?(_(),m(U,{key:11,"pane-id":e.paneId,prompt:f(xe),screen:f(Ce),keys:f(c)},null,8,[`pane-id`,`prompt`,`screen`,`keys`])):f(we)&&!f(Ve)&&!f(Ue)&&!f(Re)&&(`eventsOpen`in t?t.eventsOpen:f(_n))&&!(`offlineView`in t?t.offlineView:f(Dn))&&!f(Ne)?(_(),m(ae,{key:12,"pane-id":e.paneId,menu:f(we),keys:f(c),onTerminal:n[13]||=e=>fe(`term`)},null,8,[`pane-id`,`menu`,`keys`])):g(``,!0),f(O)===`term`&&!e.cell&&(`eventsOpen`in t?t.eventsOpen:f(_n))&&!(`offlineView`in t?t.offlineView:f(Dn))&&!f(Ne)?(_(),m(oe,{key:13,ctl:f(G)},null,8,[`ctl`])):g(``,!0),f($e)?(_(),m(se,{key:14,ref_key:`composer`,ref:K,pane:f(p),"pane-id":e.paneId,"send-keys":f(G).sendKeys,conversation:f(O)===`chat`,"esc-stops":!f(q),"take-back":f(O)===`chat`,unanswered:f(O)===`chat`?f(re):0,onSent:be,onShowTerminal:n[14]||=e=>fe(`term`),onShowUnanswered:n[15]||=e=>f(ne)?.gotoUnanswered()},null,8,[`pane`,`pane-id`,`send-keys`,`conversation`,`esc-stops`,`take-back`,`unanswered`])):g(``,!0)]),f(ee)&&(`projectSideOpen`in t?t.projectSideOpen:f(zt))?(_(),v(`div`,{key:0,class:j([`side-handle`,{dragging:f(A)}]),role:`separator`,"aria-orientation":`vertical`,"aria-label":(`t`in t?t.t:f(Y))(`Project panel width`),title:(`t`in t?t.t:f(Y))(`Drag to resize · double-click: default width`),onPointerdown:I,onDblclick:R},null,42,Qv)):g(``,!0),f(ee)&&(`projectSideOpen`in t?t.projectSideOpen:f(zt))?(_(),m(z,{key:1,side:``,style:L(f(P)),class:j({resizing:f(A)}),"pane-id":e.paneId,board:f(B).board.value,loading:f(B).loading.value,error:f(B).error.value,onReload:n[16]||=e=>f(B).reload(),onCollapse:n[17]||=e=>(`setProjectSideOpen`in t?t.setProjectSideOpen:f(vt))(!1),onSent:be,onPrefill:_e},null,8,[`style`,`class`,`pane-id`,`board`,`loading`,`error`])):g(``,!0)]),E(le,{open:f(Fe),"onUpdate:open":n[18]||=e=>te(Fe)?Fe.value=e:null,title:(`t`in t?t.t:f(Y))(`Changes`),wide:``,full:``,screen:``},{default:H(()=>[f(Fe)&&f(p)?(_(),m(ce,{key:0,"pane-id":e.paneId,onReview:Pe},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),E(le,{open:f(Ie),"onUpdate:open":n[19]||=e=>te(Ie)?Ie.value=e:null,title:(`t`in t?t.t:f(Y))(`Files`),wide:``,full:``,screen:``},{default:H(()=>[f(Ie)&&f(p)?(_(),m(ue,{key:0,"pane-id":e.paneId},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),F(`input`,{ref_key:`attachInput`,ref:Le,type:`file`,multiple:``,hidden:``,onChange:tt},null,544)],46,Ov)}}}),{__name:`AgentView`});export{za as i,Ja as n,qa as r,ey as t};
96
+ `)}`:``}var fv=[`aria-label`,`aria-describedby`],pv=[`id`],mv=[`data-row`,`onClick`],hv=[`tabindex`,`aria-label`,`aria-pressed`,`onPointerdown`,`onClick`,`onKeydown`,`onFocus`],gv={class:`review-number`},_v={class:`review-source`},vv=Object.assign(T({__name:`ReviewDiff`,props:{file:{},scope:{},comments:{},selection:{}},emits:[`add`,`select`,`act`],setup(e,{emit:t}){let r=e,i=t,a=h(null),o=p(),s=n(()=>U_(r.file.lines)),c=n(()=>({line:Y(`Line`),lines:Y(`Lines`),oldLine:Y(`old line`),oldLines:Y(`old lines`)})),u=h(null),d=n(()=>r.comments.flatMap(e=>{let t=e.scope===r.scope&&e.path===r.file.path?tv(e,s.value):null;return t?[{c:e,at:t}]:[]})),b=n(()=>{let e=new Map,t=new Set,n=new Set;for(let{c:r,at:i}of d.value){e.set(i[1],[...e.get(i[1])??[],r]);let a=r.draft!==void 0||r.id===u.value?t:n;for(let e=i[0];e<=i[1];e++)a.add(e)}return{notes:e,open:t,noted:n}});function x(e){let t=d.value.find(t=>t.c.id===e.id)?.at;return uv(t?q_(s.value.slice(t[0],t[1]+1)):sv(e),c.value)}let S=n(()=>r.selection&&r.selection.scope===r.scope&&r.selection.path===r.file.path?r.selection:null),C=n(()=>S.value?[Math.min(S.value.anchor,S.value.head),Math.max(S.value.anchor,S.value.head)]:null),w=n(()=>S.value?W_(s.value,S.value.anchor):null);function T(e,t,n){let a=G_(s.value,e,t);return i(`select`,{scope:r.scope,path:r.file.path,anchor:e,head:a[0]===e?a[1]:a[0],via:n,block:s.value.slice(a[0],a[1]+1)}),a}function E(e,t,n){let a=s.value.slice(e,t+1);a.some(e=>e.number!==null)&&i(`add`,r.scope,r.file.path,a,n),i(`select`,null)}let D=``;function O(e){D=e.pointerType}let A=null;function N(e){let t=a.value?.getBoundingClientRect(),n=t&&document.elementFromPoint(t.left+4,e)?.closest(`[data-row]`);return n&&a.value.contains(n)?Number(n.dataset.row):null}function F(e){let t=N(e.clientY);A&&t!==null&&s.value[t]?.number!=null&&(A.at=T(A.anchor,t,`drag`))}function L(){A=null,window.removeEventListener(`pointermove`,F),window.removeEventListener(`pointerup`,R),window.removeEventListener(`pointercancel`,z),window.removeEventListener(`keydown`,V,!0)}function R(){let e=A;L(),e&&E(e.at[0],e.at[1],e.extend)}function z(){L(),i(`select`,null)}function V(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),z())}function H(e,t){if(e.pointerType!==`mouse`||e.button!==0)return;e.preventDefault(),e.currentTarget.focus();let[n,r]=W_(s.value,t),i=e.shiftKey?d.value.findLast(e=>e.c.draft!==void 0&&e.at[0]>=n&&e.at[1]<=r):void 0,a=i?t>=i.at[0]?i.at[0]:i.at[1]:t;A={anchor:a,at:T(a,t,`drag`),extend:i?.c.id},window.addEventListener(`pointermove`,F),window.addEventListener(`pointerup`,R),window.addEventListener(`pointercancel`,z),window.addEventListener(`keydown`,V,!0)}l(L),B(()=>r.file,()=>{A&&z()});function U(e){let t=S.value,n=w.value;!t||!n||t.via===`drag`||e<n[0]||e>n[1]?T(e,e,`touch`):e===t.anchor&&t.head===t.anchor?i(`select`,null):T(t.anchor,e,`touch`)}function ee(e,t){if(!e.detail){let e=S.value?.via===`keys`?C.value:null;return E(e?e[0]:t,e?e[1]:t)}D!==`mouse`&&U(t)}function W(e,t){D===`mouse`||S.value?.via!==`touch`||e.number===null||window.getSelection()?.toString()||U(t)}let te=h(-1),G=n(()=>te.value>=0&&s.value[te.value]?.number!=null?te.value:s.value.findIndex(e=>e.number!==null));function K(e){a.value?.querySelector(`[data-row="${e}"] .review-gutter`)?.focus()}function ne(e,t,[n,r]){for(let i=e+t;i>=n&&i<=r;i+=t)if(s.value[i].number!==null)return i;return e}function re(e,t){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let n=e.key===`ArrowDown`?1:-1;if(e.shiftKey){let e=S.value?.via===`keys`?S.value.anchor:t,r=ne(t,n,W_(s.value,e));T(e,r,`keys`),K(r)}else S.value&&i(`select`,null),K(ne(t,n,[0,s.value.length-1]))}else e.key===`Escape`&&S.value&&(e.preventDefault(),e.stopPropagation(),i(`select`,null))}function ie(e,t,n){let r=d.value.find(e=>e.c.id===t)?.at[1];i(`act`,e,t,n),e!==`draft`&&e!==`edit`&&(u.value=null,r!==void 0&&a.value?.contains(document.activeElement)&&P(()=>K(r)))}function ae(e){return`${Y(`Comment on line`)} ${e.number}${e.side===`old`?` (${Y(`old line`)})`:``}`}return(t,n)=>{let r=H_;return _(),v(`div`,{ref_key:`root`,ref:a,class:j([`change-code`,{picking:f(S),dragging:f(S)?.via===`drag`}]),role:`region`,"aria-label":e.file.path,"aria-describedby":f(o)},[I(`p`,{id:f(o),class:`sr-only`},M((`t`in t?t.t:f(Y))(`Arrow keys move between lines. Shift+Arrow selects a block of lines. Enter writes a comment.`)),9,pv),(_(!0),v(k,null,y(f(s),(e,t)=>(_(),v(k,{key:t},[I(`div`,{class:j([`change-line review-line`,[e.kind,{picked:f(C)&&t>=f(C)[0]&&t<=f(C)[1],open:f(b).open.has(t),noted:f(b).noted.has(t),out:f(w)&&(t<f(w)[0]-1||t>f(w)[1])}]]),"data-row":t,onPointerdown:O,onClick:n=>W(e,t)},[e.number===null?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`review-gutter`,tabindex:t===f(G)?0:-1,"aria-label":ae(e),"aria-pressed":f(C)?t>=f(C)[0]&&t<=f(C)[1]:void 0,onPointerdown:e=>H(e,t),onClick:q(e=>ee(e,t),[`stop`]),onKeydown:e=>re(e,t),onFocus:e=>te.value=t},[n[1]||=I(`span`,{class:`review-plus`,"aria-hidden":`true`},`+`,-1),I(`span`,gv,M(e.number),1)],40,hv)),I(`span`,_v,M(e.text),1)],42,mv),(_(!0),v(k,null,y(f(b).notes.get(t),e=>(_(),m(r,{key:e.id,comment:e,label:x(e),onAct:ie,onHover:n[0]||=e=>u.value=e},null,8,[`comment`,`label`]))),128))],64))),128))],10,fv)}}}),{__name:`ReviewDiff`}),yv=e=>e===`old`||e===`new`,bv=e=>Number.isInteger(e)&&e>0,xv=e=>!!e&&bv(e.number)&&yv(e.side)&&typeof e.text==`string`,Sv=e=>e===void 0||Array.isArray(e)&&e.length===2&&e.every(bv);function Cv(e){return e&&typeof e.id==`string`&&[`working`,`committed`].includes(e.scope)&&typeof e.path==`string`&&xv(e)&&typeof e.body==`string`&&(e.end===void 0||xv(e.end))&&(e.span===void 0||typeof e.span==`object`&&e.span!==null&&Sv(e.span.new)&&Sv(e.span.old)&&!!(e.span.new||e.span.old))&&(e.excerpt===void 0||Array.isArray(e.excerpt)&&e.excerpt.every(e=>typeof e==`string`))&&(e.draft===void 0||typeof e.draft==`string`)&&(e.hash===void 0||typeof e.hash==`string`)}function wv(e){try{let t=JSON.parse(e||`[]`);return Array.isArray(t)?t.filter(e=>Cv(e)&&(e.body.trim()||e.draft?.trim())):[]}catch{return[]}}function Tv(e){let t=`review:${e}`,n=h([]);try{n.value=wv(localStorage.getItem(t))}catch{}B(n,e=>{try{let n=e.length?JSON.stringify(e):null;if(n===localStorage.getItem(t))return;n?localStorage.setItem(t,n):localStorage.removeItem(t)}catch{}},{deep:!0,flush:`sync`});function r(e){if(e.key!==t&&e.key!==null)return;let r=new Map(n.value.filter(e=>e.draft!==void 0).map(e=>[e.id,e]));n.value=wv(e.key===null?null:e.newValue).map(e=>r.get(e.id)??e)}return typeof window<`u`&&(window.addEventListener(`storage`,r),s(()=>window.removeEventListener(`storage`,r))),n}var Ev={class:`changes-view`},Dv={class:`changes-inner`},Ov={class:`changes-toolbar`},kv={key:0,class:`changes-location`},Av={key:0,class:`review-hint`},jv={class:`by-mouse`},Mv={class:`by-touch`},Nv={key:1,class:`review-toolbar`},Pv={role:`status`},Fv={key:2,class:`changes-notice error`,role:`alert`},Iv={key:3,class:`changes-notice`},Lv={key:4,class:`changes-notice`},Rv={class:`changes-section`},zv={key:0,class:`changes-notice`},Bv={key:0,class:`changes-limit`},Vv={class:`change-path`},Hv={key:0,class:`change-binary`},Uv={key:1,class:`change-totals`},Wv={class:`change-status`},Gv={key:0,class:`change-note`},Kv={key:1,class:`change-note`},qv={class:`changes-section`},Jv={class:`changes-toggle`},Yv={class:`changes-location`},Xv={key:0,class:`changes-limit`},Zv={key:1,class:`changes-notice`},Qv={class:`change-path`},$v={key:0,class:`change-binary`},ey={key:1,class:`change-totals`},ty={key:0,class:`change-note`},ny={key:1,class:`changes-notice`},ry={class:`sr-only`,role:`status`},iy={key:6,class:`review-pick`},ay=Object.assign(T({__name:`ChangesView`,props:{paneId:{}},emits:[`review`],setup(e,{emit:t}){let r=e,i=t,o=Tv(r.paneId),s=n(()=>O.value?iv(o.value,O.value,N.value):[]),c=n(()=>Object.fromEntries(s.value.map(e=>[e.id,rv(e,O.value,N.value)??void 0]))),u=n(()=>o.value.filter(ov).length),d=n(()=>({line:Y(`Line`),lines:Y(`Lines`),oldLine:Y(`old line`),oldLines:Y(`old lines`)})),p=h(null),b=n(()=>p.value?uv(q_(p.value.block),d.value):``);function x(e){P(()=>document.getElementById(`review-${e}`)?.focus())}function S(e){o.value=o.value.filter(t=>t.id!==e)}function C(e,t,n){let r=o.value.find(e=>e.id===t);r&&(e===`draft`?r.draft=n??``:e===`edit`?(r.draft=r.body,x(t)):e===`save`&&ov(r)?(r.body=ov(r),delete r.draft):e===`cancel`&&r.body?delete r.draft:S(t))}function T(e,t,n,r){if(!n.some(e=>e.number!==null))return;let i=Z_(n),a=o.value.find(n=>r?n.id===r:n.scope===e&&n.path===t&&$_(n,i));a&&r?Object.assign(a,i):a?a.draft??=a.body:(a={id:crypto.randomUUID(),scope:e,path:t,...i,body:``,draft:``},o.value.push(a)),p.value=null,x(a.id)}function D(){let e=dv(O.value?av(o.value,O.value):o.value,{intro:Y(`Please review these points:`),oldLine:Y(`old line`),oldLines:Y(`old lines`),missing:Y(`no longer in diff`),changed:Y(`code changed since this comment`)},c.value);e&&(i(`review`,e),o.value=[])}let O=h(null),A=h(!1),j=h(``),N=h(o.value.some(e=>e.scope===`committed`)),F=0;async function R(){let e=++F;A.value=!0,j.value=``;try{let t=await kr(`/api/changes?pane=${encodeURIComponent(r.paneId)}&commits=${N.value?`1`:`0`}`);e===F&&(O.value=t)}catch(t){e===F&&(j.value=t.message)}finally{e===F&&(A.value=!1)}}w(R),B(N,R),B(O,()=>{p.value=null}),l(()=>{F++});function z(e){return e.status===`??`?Y(`Untracked`):e.status===`commit`?Y(`Commit`):e.status.includes(`R`)?Y(`Renamed`):e.status.includes(`D`)?Y(`Deleted`):e.status.includes(`A`)?Y(`Added`):Y(`Modified`)}function V(e,t){return e===null?`${t}—`:`${t}${e}`}return(e,t)=>{let n=yt,r=H_,i=vv;return _(),v(`div`,Ev,[I(`div`,Dv,[I(`div`,Ov,[I(`div`,null,[f(O)?.git?(_(),v(`p`,kv,M(f(O).branch||`HEAD`)+` · `+M(f(O).root),1)):g(``,!0)]),E(n,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(A),"aria-label":(`t`in e?e.t:f(Y))(`Refresh changes`),onClick:R},{default:H(()=>[a(M((`t`in e?e.t:f(Y))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])]),f(O)?.git&&!f(o).length?(_(),v(`p`,Av,[I(`span`,jv,M((`t`in e?e.t:f(Y))(`To comment, hover a line and click +. Drag from the + to comment a block of lines.`)),1),I(`span`,Mv,M((`t`in e?e.t:f(Y))(`To comment, tap a line number, then another line for a block.`)),1)])):g(``,!0),f(o).length?(_(),v(`div`,Nv,[I(`span`,Pv,M(f(u))+` `+M((`t`in e?e.t:f(Y))(f(u)===1?`review comment`:`review comments`)),1),E(n,{color:`neutral`,variant:`outline`,onClick:t[0]||=e=>o.value=[]},{default:H(()=>[a(M((`t`in e?e.t:f(Y))(`Discard`)),1)]),_:1}),E(n,{disabled:!f(u),onClick:D},{default:H(()=>[a(M((`t`in e?e.t:f(Y))(`Send review`)),1)]),_:1},8,[`disabled`]),I(`p`,null,M((`t`in e?e.t:f(Y))(`Adds to your message draft. You send it yourself.`)),1)])):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),m(r,{key:e.id,comment:e,label:f(uv)(f(sv)(e),f(d)),missing:``,changed:f(c)[e.id]===`changed`,onAct:C},null,8,[`comment`,`label`,`changed`]))),128)),f(j)?(_(),v(`p`,Fv,M(f(j)),1)):g(``,!0),f(A)&&!f(O)?(_(),v(`p`,Iv,[t[6]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in e?e.t:f(Y))(`Reading changes…`)),1)])):f(O)&&!f(O).git?(_(),v(`p`,Lv,M((`t`in e?e.t:f(Y))(`This folder is not a Git repository.`)),1)):f(O)?.git?(_(),v(k,{key:5},[I(`section`,Rv,[I(`h3`,null,[a(M((`t`in e?e.t:f(Y))(`Working tree`))+` `,1),I(`span`,null,M(f(O).working?.count||0),1)]),f(O).working?.count?(_(),v(k,{key:1},[f(O).working?.truncated?(_(),v(`p`,Bv,M((`t`in e?e.t:f(Y))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(O).working?.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[I(`summary`,null,[I(`span`,Vv,M(n.path),1),n.binary?(_(),v(`span`,Hv,M((`t`in e?e.t:f(Y))(`Binary`)),1)):(_(),v(`span`,Uv,[I(`b`,null,M(V(n.added,`+`)),1),I(`i`,null,M(V(n.deleted,`−`)),1)])),I(`span`,Wv,M(z(n)),1)]),n.previousPath?(_(),v(`p`,Gv,M((`t`in e?e.t:f(Y))(`From`))+` `+M(n.previousPath),1)):g(``,!0),n.summary?(_(),v(`p`,Kv,M((`t`in e?e.t:f(Y))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:2,file:n,scope:`working`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[1]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):(_(),v(`p`,zv,M((`t`in e?e.t:f(Y))(`No working tree changes.`)),1))]),I(`section`,qv,[I(`label`,Jv,[L(I(`input`,{"onUpdate:modelValue":t[2]||=e=>W(N)?N.value=e:null,type:`checkbox`},null,512),[[K,f(N)]]),t[7]||=a(),I(`span`,null,M((`t`in e?e.t:f(Y))(`Also show unpushed commits`)),1)]),f(N)&&f(O).committed?(_(),v(k,{key:0},[I(`h3`,null,[a(M((`t`in e?e.t:f(Y))(`Commits`))+` `,1),I(`span`,null,M(f(O).commits??0),1)]),I(`p`,Yv,M(f(O).comparison)+` → HEAD`,1),f(O).committed.truncated?(_(),v(`p`,Xv,M((`t`in e?e.t:f(Y))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(O).committed.count?g(``,!0):(_(),v(`p`,Zv,M((`t`in e?e.t:f(Y))(`No committed changes to show.`)),1)),(_(!0),v(k,null,y(f(O).committed.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[I(`summary`,null,[I(`span`,Qv,M(n.path),1),n.binary?(_(),v(`span`,$v,M((`t`in e?e.t:f(Y))(`Binary`)),1)):(_(),v(`span`,ey,[I(`b`,null,M(V(n.added,`+`)),1),I(`i`,null,M(V(n.deleted,`−`)),1)]))]),n.summary?(_(),v(`p`,ty,M((`t`in e?e.t:f(Y))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:1,file:n,scope:`committed`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[3]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):f(N)&&!f(A)&&!f(O).comparison?(_(),v(`p`,ny,M((`t`in e?e.t:f(Y))(`No upstream or base branch available for comparison.`)),1)):g(``,!0)])],64)):g(``,!0),I(`p`,ry,M(f(b)&&`${(`t`in e?e.t:f(Y))(`Selection:`)} ${f(b)}`),1),f(p)&&f(p).via!==`drag`?(_(),v(`div`,iy,[I(`div`,null,[I(`b`,null,M(f(b)),1),I(`p`,null,M(f(p).via===`touch`?(`t`in e?e.t:f(Y))(`Tap another line of this hunk to extend the block.`):(`t`in e?e.t:f(Y))(`Shift+Arrow extends the block within this hunk.`)),1)]),I(`button`,{type:`button`,class:`review-btn`,onClick:t[4]||=e=>p.value=null},M((`t`in e?e.t:f(Y))(`Cancel`)),1),I(`button`,{type:`button`,class:`review-btn primary`,onClick:t[5]||=e=>T(f(p).scope,f(p).path,f(p).block)},M((`t`in e?e.t:f(Y))(`Comment`)),1)])):g(``,!0)])])}}}),{__name:`ChangesView`}),oy=[`id`,`data-pane`],sy={key:0,class:`file-drop`,"aria-hidden":`true`},cy={class:`file-drop-label`},ly={class:`top bar agent-top`},uy=[`aria-label`,`title`],dy={class:`agent-head`},fy={class:`agent-title`},py={class:`agent-meta`},my={key:0,class:`agent-subtitle`},hy={key:1,class:`agent-subtitle agent-command`},gy={key:2,class:`agent-subtitle`},_y=[`title`],vy={class:`machine-inline-name`},yy={key:4,class:`where`},by={class:`agent-actions`},xy=[`aria-label`],Sy={class:`agent-body`},Cy={class:`agent-main hw-backdrop-host`},wy={key:1,class:`term-banner machine-banner`},Ty={key:0},Ey={key:2,class:`term-banner`},Dy={key:4,class:`chat-empty offline-terminal`},Oy={key:7,class:`chat`},ky={key:8,class:`terminal-transcript-note`},Ay=[`aria-label`,`title`],jy=null,My=Object.assign(T({__name:`AgentView`,props:{paneId:{},cell:{type:Boolean},active:{type:Boolean},grip:{type:Boolean}},emits:[`activate`],setup(e,{emit:t}){let r=e,i=t,o=cn(),s=un(),c=n(()=>!r.cell||!!r.active),d=Symbol(`vue agent`);B(c,e=>{e&&(hr.value=r.paneId,jy=d)},{immediate:!0}),l(()=>{jy===d&&(hr.value=null)});let p=n(()=>er.value.panes.find(e=>e.id===r.paneId)),y=n(()=>er.value.workspaces.find(e=>e.id===p.value?.workspace)),b=n(()=>!!(r.cell||St.value&&St.value.panes.length>1)),x=n(()=>p.value?b.value?Kn(p.value):la(p.value,y.value):`—`),S=n(()=>{let e=p.value?Zi(p.value,y.value):``;return e&&e!==x.value?e:``}),C=n(()=>p.value?.command&&p.value.command!==x.value&&p.value.command!==S.value?p.value.command:``),T=n(()=>p.value&&er.value.tabs?.filter(e=>e.workspace===p.value?.workspace).length>1?p.value.tabLabel:``),D=n({get:()=>Fn(r.paneId),set:e=>wr(r.paneId,e)}),O=n(()=>{let e=p.value;return e?r.cell?Zn({chat:gn(e),viewMode:D.value,active:r.active}):D.value===`project`?U.value?`project`:gn(e)?`chat`:`term`:gn(e)?D.value:`term`:null}),k=h(Ni()),A=h(!1),F=n(()=>k.value?{width:`${k.value}px`}:void 0);function L(e){if(e.button!==0)return;let t=e.currentTarget,n=t.nextElementSibling,r=t.parentElement?.getBoundingClientRect().width||0;if(!n||!r)return;e.preventDefault();let i=e.clientX,a=n.getBoundingClientRect().width;t.setPointerCapture(e.pointerId),A.value=!0;let o=e=>{k.value=da(a+i-e.clientX,r)},s=()=>{t.removeEventListener(`pointermove`,o),t.removeEventListener(`pointerup`,s),t.removeEventListener(`pointercancel`,s),A.value=!1,Ci(k.value)};t.addEventListener(`pointermove`,o),t.addEventListener(`pointerup`,s),t.addEventListener(`pointercancel`,s)}function R(){k.value=null,Ci(null)}let z=qe(()=>r.paneId,()=>!r.cell&&(Z.value?Et.value:D.value===`project`)),V=n(()=>!r.cell&&z.coordinator.value&&z.available.value===!0),U=n(()=>V.value&&!Z.value),ee=n(()=>V.value&&Z.value),te=u(null),G=Xm(r.paneId,{setBanner:e=>{te.value=e},hasBanner:()=>!!te.value,fill:()=>!!r.cell,input:()=>c.value}),K=h(null),ne=h(0),q=h(null),re=h(typeof o.query.q==`string`&&typeof o.query.hit==`string`),ae=h(!!p.value),oe=h(!1),se=setTimeout(()=>{oe.value=!0},4e3);l(()=>clearTimeout(se));let le={text:Y(`This pane has been closed.`),btn:Y(`Back`),fn:()=>dn(`/`)},ue=n(()=>!p.value&&er.value.ok&&(ae.value||oe.value)&&!ze(r.paneId));B(p,e=>{e&&(ae.value=!0,te.value===le&&(te.value=null,O.value===`term`&&!G.isConnected()&&P(()=>G.connect(!1))))}),B(ue,e=>{e&&(te.value=le)},{immediate:!0}),B(O,(e,t)=>{e===`chat`&&t===`term`&&(te.value=ue.value?te.value:null)},{immediate:!0});function fe(e){r.cell&&i(`activate`),D.value=e,Z.value&&e===`term`&&P(()=>G.focus()),Q()}function he(e){fe(Mn(O.value,e))}function ge(){re.value?re.value=!1:(re.value=!0,O.value!==`chat`&&(D.value=`chat`))}ni(()=>r.paneId,()=>c.value,{searchChat(){return!p.value||!gn(p.value)||O.value!==`chat`?!1:(re.value?K.value?.focusSearch():re.value=!0,!0)},toggleTerm(){if(!p.value||!gn(p.value)||!O.value)return!1;let e=O.value!==`chat`;return fe(e?`chat`:`term`),e&&P(()=>q.value?.focus()),!0},stop:()=>O.value===`chat`&&!!q.value?.stop()});let _e=Ui(r.paneId);function ve(e){_e.text=Tt(_e.text,e),!Z.value&&D.value===`project`&&(D.value=gn(p.value)?`chat`:`term`),q.value?.focusEnd()}let ye=n(()=>qi(r.paneId));function be(e){e&&$i(r.paneId,e),K.value?.scrollToEnd(!0),K.value?.reload()}B(p,e=>zi(r.paneId,e?.queued||[]));let Se=n(()=>p.value&&p.value.status===`blocked`&&p.value.prompt&&p.value.prompt.options?p.value.prompt:null),Ce=n(()=>Rr(p.value)),we=n(()=>p.value&&p.value.menu&&p.value.status!==`working`&&!Se.value&&!Ce.value?p.value.menu:null);B(()=>JSON.stringify([Se.value,Ce.value,we.value]),()=>P(()=>K.value?.scrollToEnd(!1)));let Te=n(()=>{let e=p.value;return e?Dn(e.cwd):``}),De=n(()=>vn.value&&p.value?En(p.value.machine):void 0),Oe=n(()=>!!(De.value&&De.value.status!==`online`));function ke(e){_e.text=_e.text?`${_e.text}\n\n${e}`:e,Ae.value=!1,fe(`chat`),P(()=>q.value?.focusEnd())}let Ae=h(!1),Ne=h(!1),Pe=h(null),Ie=n(()=>O.value===`term`),Le=Ji(r.paneId),He=h(Le.resume(p.value?.interaction||`unknown`)),Ue=n(()=>O.value===`chat`&&yn.value&&!jn.value&&!Oe.value&&!On(p.value)),We=n(()=>p.value?.interaction===`terminal`),Ge;function Je(){clearTimeout(Ge),Ge=void 0;let e=Date.now();He.value=Le.update(p.value?.interaction||`unknown`,e);let t=Le.deadline();t!==null&&cr.value&&(Ge=setTimeout(Je,Math.max(0,t-e))),(We.value||He.value||Se.value||we.value||Ce.value)&&$t.open&&$t.pane===r.paneId&&Ke(!1)}B([()=>p.value?.interaction,Se,we,Ce,()=>$t.open,()=>$t.pane,cr],Je,{immediate:!0});let Xe=Le.subscribe(Je);l(()=>{clearTimeout(Ge),Xe()});function Ze(){Le.dismiss(),He.value=!1}function Qe(){r.cell&&i(`activate`),Le.reopen(),He.value=!0}let $e=n(()=>He.value&&Ue.value&&c.value&&!Vn.value),et=n(()=>Xr({desk:Z.value,live:c.value,mode:O.value,cell:!!r.cell})&&!(we.value&&O.value!==`term`)&&!(O.value===`chat`&&He.value)),tt=n(()=>sr({desk:Z.value,live:c.value,mode:O.value,available:!(!p.value||!yn.value||jn.value||Oe.value||On(p.value))}));function nt(e){let t=e.target,n=[...t.files||[]];t.value=``,it(n)}async function it(e){if(tt.value&&p.value)for(let t of e)try{let e=t.name.includes(`.`)&&t.name.split(`.`).pop()||``,n=await fetch(`/api/file?pane=${encodeURIComponent(r.paneId)}&ext=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:t}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(Y(i.error||`HTTP ${n.status}`));be(await Ht(p.value,r.paneId,i.path)),Q()}catch(e){$(`${Y(`File upload failed`)} : ${e.message}`,!0)}}let at=n(()=>tt.value?`term`:et.value&&O.value!==`project`&&!jn.value?`chat`:null),ot=h(0);function st(e){ea(e.dataTransfer)&&at.value&&(e.preventDefault(),e.type===`dragover`&&e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),ot.value=aa(ot.value,e.type))}function ct(e){if(ot.value=0,!ea(e.dataTransfer)||!at.value)return;e.preventDefault();let t=[...e.dataTransfer?.files||[]];if(t.length){if(at.value===`term`)return it(t);q.value?.addFiles(t).then(e=>{e&&(q.value?.focus(),Q())})}}let lt=n(()=>p.value?.agent===`claude`?Y(`Images, PDFs, text and code files`):Y(`Images, text and code files`)),dt=n(()=>{let e=p.value,t=[];tt.value&&t.push({label:Y(`Attach a file…`),icon:`i-lucide-paperclip`,run:()=>Pe.value?.click()}),e&&t.push({label:Y(`View changes`),icon:`i-lucide-file-diff`,run:()=>{Ae.value=!0}}),e&&t.push({label:Y(`Browse files`),icon:`i-lucide-folder-tree`,run:()=>{Ne.value=!0}}),e&&zr(e)&&t.push({label:Y(`Open in editor`),icon:`i-lucide-external-link`,kbds:c.value?Ut(`open-editor`):void 0,run:()=>rr(e)}),e&&t.push({label:Y(`Rename pane`),icon:`i-lucide-pencil`,run:()=>{de.value=e.id}}),e&&t.push(...Me(e)),e&&t.push(vt(e));let n=e?Rt(e,c.value):[];if(n.length&&t.push(...n,{kind:`separator`}),e&&pe(e.machine).length&&t.push({label:Y(`Plugin actions`),icon:`i-lucide-puzzle`,run:()=>Re({pane:e})}),t.push({label:Y(`Take control of this terminal`),icon:`i-lucide-arrow-left-right`,run:()=>{te.value=null,D.value=`term`,P(()=>G.connect(!0))}}),e&&xe(e)&&!e.restart&&t.push({label:Y(`Restart agent`),icon:`i-lucide-rotate-cw`,run:()=>kt(e)}),t.push({label:Y(`Reconnect`),icon:`i-lucide-refresh-cw`,run:()=>{te.value=null,D.value=`term`,P(()=>{G.reset(),G.connect(!1)})}}),r.cell||t.push(...ce()),e){t.push({kind:`separator`}),t.push({label:e.agent?X(`Close this pane (stops ${zn(e.agent)})`,`Fermer ce pane (arrête ${zn(e.agent)})`):Y(`Close this terminal`),icon:`i-lucide-trash-2`,danger:!0,kbds:c.value?Ut(`close-pane`):void 0,run:()=>Be(e)});let n=er.value.workspaces.find(t=>t.id===e.workspace);n&&n.worktree&&t.push({label:Y(`Delete this worktree`),icon:`i-lucide-git-branch`,danger:!0,run:()=>ft(e.workspace)})}return t});async function ft(e){await yi();let t=(hi.value||[]).find(t=>t.workspace===e);if(!t)return $(Y(`Worktree not found`),!0);await gi(t)&&dn(`/`)}let pt=n(()=>ie(dt.value));function mt(){Fe(dt.value)}B(()=>p.value&&(p.value.machine||``),e=>{e!==void 0&&je(e)},{immediate:!0});let ht=n(()=>[{label:Y(`Conversation`),value:`chat`,icon:`i-lucide-message-square`},{label:Y(`Terminal`),value:`term`,icon:`i-lucide-square-terminal`}]),gt={list:`hw-tabs`,trigger:`hw-tab`,indicator:`hw-tab-ind`,leadingIcon:`hw-tab-icon`,label:`hw-tab-label`},_t=n({get:()=>O.value===`term`?`term`:`chat`,set:e=>fe(e===`term`?`term`:`chat`)}),bt=n(()=>ir({desk:Z.value,cell:!!r.cell,chat:gn(p.value),live:c.value,project:U.value})),xt=n(()=>!r.cell&&p.value&&J(Ot(p.value.workspace).length).headerAdd);B(Gr,e=>G.setFontSize(e)),B(cr,e=>{G.setVisible(e),e&&O.value===`term`&&!G.isConnected()&&!te.value&&G.connect(!1)});let St=n(()=>p.value?Ye(p.value.tab):null),Ct=n(()=>!!(St.value&&St.value.panes.length>1));function wt(){St.value&&(Z.value?dn({path:jt(St.value.tab.id),query:{pane:r.paneId}}):Ve(St.value.tab.id))}function Dt(){let e=history.state?.back;e===`/board`||St.value&&e===jt(St.value.tab.id)?s.back():dn(`/`)}let At=Vt.value;Vt.value=0;let Mt=h(0),Nt=h(!1),Pt=0,Ft=0,It=0,Lt=`off`,zt=e=>St.value?Xn(St.value.layout,r.paneId,e):null;function Bt(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.scrollWidth>n.clientWidth+1&&/(auto|scroll)/.test(getComputedStyle(n).overflowX))return!0;return!1}function Wt(e){if(Lt=`off`,Z.value||!Ct.value||e.touches.length!==1)return;let t=e.target?.closest?.(`.swipe-area, .choices, #termWrap`);t&&!Bt(e.target,t)&&(Pt=e.touches[0].clientX,Ft=e.touches[0].clientY,It=Date.now(),Lt=null)}function Gt(e){if(Lt===`off`||Lt===`y`)return;let t=e.touches[0].clientX-Pt,n=e.touches[0].clientY-Ft;Lt===null&&(Lt=Gi(t,n)),Lt===`x`&&(e.preventDefault(),Nt.value=!0,Mt.value=Li(t,!!zt(t<0?1:-1)))}function Kt(e){if(Lt===`x`){let t=(e.changedTouches[0]?.clientX??Pt)-Pt,n=ua(t,Date.now()-It,window.innerWidth),r=n?zt(n):null;r&&(Q(),Vt.value=n,s.replace(rt(r)))}Lt=`off`,Nt.value=!1,Mt.value=0}let qt=n(()=>Ct.value&&!Z.value?{transform:Mt.value?`translateX(${Mt.value}px)`:void 0,transition:Nt.value?`none`:`transform .18s ease`}:{});w(()=>{Z.value&&c.value&&setTimeout(()=>(O.value===`term`?G:q.value)?.focus(),50)}),B(()=>r.active,(e,t)=>{e&&!t&&r.cell&&setTimeout(()=>{document.activeElement?.closest(`.cell-view.active`)||(O.value===`term`?G:q.value)?.focus()},50)});function Jt(e){let t=e.target;r.cell&&Z.value&&t?.closest?.(`.agent-top`)&&!t.closest(`button, a, input, [role="tab"], .cell-grip`)&&(document.activeElement&&document.activeElement!==document.body||(O.value===`term`?G:q.value)?.focus())}let Yt=n(()=>sa.value?{height:`${Ki.value}px`,top:`${Ri.value}px`}:{});return(t,n)=>{let r=Ee,o=Ua,s=yt,l=ui,u=Yi,d=qa,h=ti,y=Ei,b=oi,w=Qa,D=$a,k=Fu,P=Vu,B=nm,V=eh,U=Ah,ie=Zh,ae=om,oe=O_,se=ay,ce=Si,le=pc;return _(),v(`section`,{id:e.cell?void 0:`agent`,class:j(e.cell?[`cell-view`,{active:e.active,gripped:e.grip}]:`view`),style:N(e.cell?void 0:f(Yt)),"data-pane":e.cell?e.paneId:void 0,onTouchstart:Wt,onTouchmove:Gt,onTouchend:Kt,onTouchcancel:Kt,onPointerdownCapture:n[20]||=t=>e.cell&&i(`activate`),onFocusin:n[21]||=t=>e.cell&&i(`activate`),onClick:Jt,onDragenter:st,onDragover:st,onDragleave:st,onDrop:ct},[f(ot)&&f(at)?(_(),v(`div`,sy,[E(r,{name:f(at)===`term`?`i-lucide-paperclip`:`i-lucide-file-plus`,class:`file-drop-icon`},null,8,[`name`]),I(`span`,cy,M((`t`in t?t.t:f(Y))(`Drop to attach`)),1),I(`small`,null,M(f(at)===`term`?(`t`in t?t.t:f(Y))(`The file path is sent to the terminal`):f(lt)),1)])):g(``,!0),!e.cell&&f(p)?(_(),m(o,{key:1,workspace:f(p).workspace,current:f(p).tab},null,8,[`workspace`,`current`])):g(``,!0),E(w,{items:()=>f(dt),disabled:!f(p)},{default:H(()=>[I(`header`,ly,[e.cell&&e.grip?(_(),v(`span`,{key:0,class:`cell-grip`,role:`button`,"aria-label":(`t`in t?t.t:f(Y))(`Drag to move the pane`),title:(`t`in t?t.t:f(Y))(`Drag to move the pane`)},[E(r,{name:`i-lucide-grip-vertical`})],8,uy)):g(``,!0),e.cell?g(``,!0):(_(),m(s,{key:1,id:`btnBack`,icon:`i-lucide-chevron-left`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn back`,"aria-label":(`t`in t?t.t:f(Y))(`Back`),onClick:Dt},null,8,[`aria-label`])),I(`div`,dy,[I(`div`,fy,M(f(x)),1),I(`div`,py,[E(l,{pane:f(p),kind:``},null,8,[`pane`]),f(S)?(_(),v(`span`,my,M(f(S)),1)):g(``,!0),f(C)?(_(),v(`span`,hy,M(f(C)),1)):g(``,!0),f(T)?(_(),v(`span`,gy,M(f(T)),1)):g(``,!0),f(De)?(_(),v(`span`,{key:3,class:j([`agent-machine`,f(De).status]),title:f(De).target?`ssh ${f(De).target}`:void 0},[E(r,{name:f(De).local?`i-lucide-server`:`i-lucide-laptop`},null,8,[`name`]),I(`span`,vy,M((`machineName`in t?t.machineName:f(Nn))(f(De).key)),1),f(De).local?(_(),m(u,{key:0})):g(``,!0)],10,_y)):g(``,!0),f(Te)?(_(),v(`span`,yy,M(f(Te)),1)):g(``,!0)])]),f(bt).selector===`cell`?(_(),m(d,{key:2,modelValue:f(_t),"onUpdate:modelValue":n[0]||=e=>W(_t)?_t.value=e:null,items:f(ht),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:gt},null,8,[`modelValue`,`items`])):g(``,!0),I(`div`,by,[f(bt).selector===`header`?(_(),m(d,{key:0,modelValue:f(_t),"onUpdate:modelValue":n[1]||=e=>W(_t)?_t.value=e:null,items:f(ht),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:gt},null,8,[`modelValue`,`items`])):g(``,!0),f(xt)&&f(p)?(_(),m(s,{key:1,icon:`i-lucide-plus`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Y))(`New tab`),title:(`t`in t?t.t:f(Y))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(jn),onClick:n[2]||=e=>(`newTab`in t?t.newTab:f(me))(f(p).workspace)},null,8,[`aria-label`,`title`,`disabled`])):g(``,!0),e.cell?(_(),m(h,{key:2,text:(`t`in t?t.t:f(Y))(`Open alone`)},{default:H(()=>[E(s,{icon:`i-lucide-maximize-2`,color:`neutral`,variant:`ghost`,size:`md`,class:`icon-btn cell-extra`,"aria-label":(`t`in t?t.t:f(Y))(`Open alone`),to:(`panePath`in t?t.panePath:f(rt))(e.paneId)},null,8,[`aria-label`,`to`])]),_:1},8,[`text`])):f(Ct)&&f(St)?(_(),m(h,{key:3,text:(`t`in t?t.t:f(Y))(`Side by side`),disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[I(`button`,{type:`button`,class:`map-btn`,"aria-label":(`desk`in t?t.desk:f(Z))?(`t`in t?t.t:f(Y))(`Side by side`):(`t`in t?t.t:f(Y))(`Tab overview`),onClick:wt},[E(y,{layout:f(St).layout,panes:f(St).panes,current:e.paneId},null,8,[`layout`,`panes`,`current`])],8,xy)]),_:1},8,[`text`,`disabled`])):g(``,!0),f(ee)&&!(`projectSideOpen`in t?t.projectSideOpen:f(Et))?(_(),m(h,{key:4,text:(`t`in t?t.t:f(Y))(`Show the Project panel`),kbds:f(c)?(`shortcutKbds`in t?t.shortcutKbds:f(Ut))(`project-panel`):void 0},{default:H(()=>[E(s,{icon:`i-lucide-panel-right-open`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Show the Project panel`),onClick:n[3]||=e=>(`setProjectSideOpen`in t?t.setProjectSideOpen:f(ut))(!0)},null,8,[`aria-label`])]),_:1},8,[`text`,`kbds`])):g(``,!0),f(bt).project?(_(),m(s,{key:5,icon:`i-lucide-folder-kanban`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn mode-btn`,{on:f(O)===`project`}]),"aria-label":(`t`in t?t.t:f(Y))(`Project`),"aria-pressed":f(O)===`project`,onClick:n[4]||=e=>he(`project`)},null,8,[`class`,`aria-label`,`aria-pressed`])):g(``,!0),f(bt).term?(_(),m(s,{key:6,icon:`i-lucide-square-terminal`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn mode-btn`,{on:f(O)===`term`}]),"aria-label":(`t`in t?t.t:f(Y))(`Terminal`),"aria-pressed":f(O)===`term`,onClick:n[5]||=e=>he(`term`)},null,8,[`class`,`aria-label`,`aria-pressed`])):g(``,!0),(`hasChat`in t?t.hasChat:f(gn))(f(p))&&(f(c)||e.cell)?(_(),m(h,{key:7,text:(`t`in t?t.t:f(Y))(`Search`),kbds:f(O)===`chat`?(`shortcutKbds`in t?t.shortcutKbds:f(Ut))(`search-chat`):void 0,disabled:!(`desk`in t?t.desk:f(Z))},{default:H(()=>[E(s,{icon:`i-lucide-search`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn cell-extra`,{on:f(re)}]),"aria-label":(`t`in t?t.t:f(Y))(`Search`),onClick:ge},null,8,[`class`,`aria-label`])]),_:1},8,[`text`,`kbds`,`disabled`])):g(``,!0),(`sheetMenus`in t?t.sheetMenus:f(Nr))?(_(),m(s,{key:9,icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Options`),onClick:mt},null,8,[`aria-label`])):(_(),m(b,{key:8,items:f(pt),content:{align:`end`,sideOffset:6},ui:{content:`hw-dropdown`}},{default:H(()=>[E(s,{icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Y))(`Options`)},null,8,[`aria-label`])]),_:1},8,[`items`]))])])]),_:1},8,[`items`,`disabled`]),I(`div`,Sy,[I(`div`,Cy,[(`desk`in t?t.desk:f(Z))&&!e.cell&&(`backdrop`in t?t.backdrop:f(Qr))===`wherdr`&&f(O)===`chat`?(_(),m(D,{key:0})):g(``,!0),f(Oe)&&f(De)?(_(),v(`div`,wy,[E(r,{name:`i-lucide-unplug`,class:`term-banner-icon`}),I(`span`,null,[a(M(f(De).status===`connecting`?(`tl`in t?t.tl:f(X))(`${(`machineName`in t?t.machineName:f(Nn))(f(De).key)} unreachable — reconnecting…`,`${(`machineName`in t?t.machineName:f(Nn))(f(De).key)} injoignable — reconnexion…`):(`tl`in t?t.tl:f(X))(`${(`machineName`in t?t.machineName:f(Nn))(f(De).key)} offline`,`${(`machineName`in t?t.machineName:f(Nn))(f(De).key)} hors ligne`)),1),f(De).error?(_(),v(`small`,Ty,M((`t`in t?t.t:f(Y))(f(De).error)),1)):g(``,!0)])])):g(``,!0),f(te)?(_(),v(`div`,Ey,[E(r,{name:`i-lucide-triangle-alert`,class:`term-banner-icon`}),I(`span`,null,M(f(te).text),1),E(s,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[6]||=e=>f(te).fn()},{default:H(()=>[a(M(f(te).btn),1)]),_:1})])):g(``,!0),f(p)&&f(O)===`chat`?(_(),v(`div`,{key:3,class:j([`swipe-area`,f(At)?f(At)>0?`enter-next`:`enter-prev`:void 0]),style:N(f(qt))},[E(k,{ref_key:`chatRef`,ref:K,search:f(re),"onUpdate:search":n[7]||=e=>W(re)?re.value=e:null,pane:f(p),"local-queued":f(ye),onGotoTerm:n[8]||=e=>fe(`term`),onRestored:n[9]||=e=>f(q)?.focus(),onQuote:n[10]||=e=>f(q)?.focusEnd(),onUnanswered:n[11]||=e=>ne.value=e,onSent:be},null,8,[`search`,`pane`,`local-queued`])],6)):f(O)===`term`&&(!(`eventsOpen`in t?t.eventsOpen:f(yn))||(`offlineView`in t?t.offlineView:f(jn))||f(Oe))?(_(),v(`div`,Dy,[E(r,{name:`i-lucide-wifi-off`,class:`chat-empty-icon`}),I(`p`,null,M((`t`in t?t.t:f(Y))(`Terminal unavailable offline`)),1)])):f(O)===`term`?(_(),m(P,{key:5,ctl:f(G),class:j(f(At)?f(At)>0?`enter-next`:`enter-prev`:void 0),style:N(f(qt))},null,8,[`ctl`,`class`,`style`])):f(O)===`project`?(_(),m(B,{key:6,"pane-id":e.paneId,board:f(z).board.value,loading:f(z).loading.value,error:f(z).error.value,onReload:n[12]||=e=>f(z).reload(),onSent:be,onPrefill:ve},null,8,[`pane-id`,`board`,`loading`,`error`])):(_(),v(`div`,Oy)),f(p)?.agent&&!(`hasChat`in t?t.hasChat:f(gn))(f(p))&&f(O)===`term`&&!e.cell?(_(),v(`p`,ky,M((`tl`in t?t.tl:f(X))(`Conversation unavailable for this agent · follow it in the terminal`,`Conversation non disponible pour cet agent · suivi dans le terminal`)),1)):g(``,!0),f($e)?(_(),m(V,{key:9,"pane-id":e.paneId,active:f(c),title:f(x),onClose:Ze},null,8,[`pane-id`,`active`,`title`])):(f(We)||f(He))&&f(Ue)?(_(),v(`button`,{key:10,type:`button`,class:`interactive-terminal-reopen`,onClick:Qe},[E(r,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(X))(`Open interactive terminal`,`Ouvrir le terminal interactif`)),1)])):g(``,!0),(f(Se)||f(Ce))&&!f(He)&&!f(We)&&!f(Ie)&&(`eventsOpen`in t?t.eventsOpen:f(yn))&&!(`offlineView`in t?t.offlineView:f(jn))&&!f(Oe)?(_(),m(U,{key:11,"pane-id":e.paneId,prompt:f(Se),screen:f(Ce),keys:f(c)},null,8,[`pane-id`,`prompt`,`screen`,`keys`])):f(we)&&!f(He)&&!f(We)&&!f(Ie)&&(`eventsOpen`in t?t.eventsOpen:f(yn))&&!(`offlineView`in t?t.offlineView:f(jn))&&!f(Oe)?(_(),m(ie,{key:12,"pane-id":e.paneId,menu:f(we),keys:f(c),onTerminal:n[13]||=e=>fe(`term`)},null,8,[`pane-id`,`menu`,`keys`])):g(``,!0),f(O)===`term`&&!e.cell&&(`eventsOpen`in t?t.eventsOpen:f(yn))&&!(`offlineView`in t?t.offlineView:f(jn))&&!f(Oe)?(_(),m(ae,{key:13,ctl:f(G)},null,8,[`ctl`])):g(``,!0),f(et)?(_(),m(oe,{key:14,ref_key:`composer`,ref:q,pane:f(p),"pane-id":e.paneId,"send-keys":f(G).sendKeys,conversation:f(O)===`chat`,"esc-stops":!f(re),"take-back":f(O)===`chat`,unanswered:f(O)===`chat`?f(ne):0,onSent:be,onShowTerminal:n[14]||=e=>fe(`term`),onShowUnanswered:n[15]||=e=>f(K)?.gotoUnanswered()},null,8,[`pane`,`pane-id`,`send-keys`,`conversation`,`esc-stops`,`take-back`,`unanswered`])):g(``,!0)]),f(ee)&&(`projectSideOpen`in t?t.projectSideOpen:f(Et))?(_(),v(`div`,{key:0,class:j([`side-handle`,{dragging:f(A)}]),role:`separator`,"aria-orientation":`vertical`,"aria-label":(`t`in t?t.t:f(Y))(`Project panel width`),title:(`t`in t?t.t:f(Y))(`Drag to resize · double-click: default width`),onPointerdown:L,onDblclick:R},null,42,Ay)):g(``,!0),f(ee)&&(`projectSideOpen`in t?t.projectSideOpen:f(Et))?(_(),m(B,{key:1,side:``,style:N(f(F)),class:j({resizing:f(A)}),"pane-id":e.paneId,board:f(z).board.value,loading:f(z).loading.value,error:f(z).error.value,onReload:n[16]||=e=>f(z).reload(),onCollapse:n[17]||=e=>(`setProjectSideOpen`in t?t.setProjectSideOpen:f(ut))(!1),onSent:be,onPrefill:ve},null,8,[`style`,`class`,`pane-id`,`board`,`loading`,`error`])):g(``,!0)]),E(ce,{open:f(Ae),"onUpdate:open":n[18]||=e=>W(Ae)?Ae.value=e:null,title:(`t`in t?t.t:f(Y))(`Changes`),wide:``,full:``,screen:``},{default:H(()=>[f(Ae)&&f(p)?(_(),m(se,{key:0,"pane-id":e.paneId,onReview:ke},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),E(ce,{open:f(Ne),"onUpdate:open":n[19]||=e=>W(Ne)?Ne.value=e:null,title:(`t`in t?t.t:f(Y))(`Files`),wide:``,full:``,screen:``},{default:H(()=>[f(Ne)&&f(p)?(_(),m(le,{key:0,"pane-id":e.paneId},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),I(`input`,{ref_key:`attachInput`,ref:Pe,type:`file`,multiple:``,hidden:``,onChange:nt},null,544)],46,oy)}}}),{__name:`AgentView`});export{Ua as i,Qa as n,Za as r,My as t};